@nylas/react 1.3.3 → 1.3.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.
- package/dist/add-circle-icon.entry-321c1dd1.js +15 -0
- package/dist/{add-circle-icon.entry-89060fe6.cjs → add-circle-icon.entry-dcc45961.cjs} +1 -1
- package/dist/archive-icon.entry-715e139b.js +15 -0
- package/dist/archive-icon.entry-c4da9f4f.cjs +1 -0
- package/dist/{arrow-icon.entry-7c38f4ad.js → arrow-icon.entry-9311463c.js} +2 -2
- package/dist/{arrow-icon.entry-e8dbe365.cjs → arrow-icon.entry-bdccce8a.cjs} +1 -1
- package/dist/{bold-icon.entry-665901ce.cjs → bold-icon.entry-06fa4738.cjs} +1 -1
- package/dist/{bold-icon.entry-4ce7cfee.js → bold-icon.entry-c531dff1.js} +4 -4
- package/dist/{button-component_2.entry-89ea010b.js → button-component_2.entry-5aad0ec4.js} +9 -9
- package/dist/{button-component_2.entry-ca263036.cjs → button-component_2.entry-db911efe.cjs} +1 -1
- package/dist/{calendar-agenda-fill-icon_53.entry-347662f3.js → calendar-agenda-fill-icon_53.entry-6f1aa42c.js} +1846 -1433
- package/dist/calendar-agenda-fill-icon_53.entry-affead77.cjs +6 -0
- package/dist/{calendar-cancel-icon.entry-6b7836c9.cjs → calendar-cancel-icon.entry-3bd1c8e9.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-c1d33f90.js → calendar-cancel-icon.entry-59375bc4.js} +4 -4
- package/dist/{calendar-check-icon_2.entry-222e3c0b.js → calendar-check-icon_2.entry-1ca369b6.js} +7 -7
- package/dist/{calendar-check-icon_2.entry-67024cd6.cjs → calendar-check-icon_2.entry-540dde9d.cjs} +1 -1
- package/dist/{calendar-icon.entry-380048b0.cjs → calendar-icon.entry-1d9773d5.cjs} +1 -1
- package/dist/{calendar-icon.entry-c08a8f21.js → calendar-icon.entry-66517be4.js} +5 -5
- package/dist/{checkbox-component_3.entry-52b27cb9.cjs → checkbox-component_3.entry-3918885e.cjs} +1 -1
- package/dist/{checkbox-component_3.entry-dab3c3c8.js → checkbox-component_3.entry-cf9507ac.js} +5 -5
- package/dist/{chevron-icon_3.entry-17bb7d23.cjs → chevron-icon_3.entry-27b71bd6.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-7be40d99.js → chevron-icon_3.entry-afc62aa5.js} +13 -13
- package/dist/{clock-icon_4.entry-89e0dd55.js → clock-icon_4.entry-ab2c2eaf.js} +18 -18
- package/dist/{clock-icon_4.entry-875db481.cjs → clock-icon_4.entry-f46a42fc.cjs} +1 -1
- package/dist/close-icon.entry-791cb99c.js +15 -0
- package/dist/close-icon.entry-be2b5f87.cjs +1 -0
- package/dist/{constants-54af2051-a3596673.cjs → constants-91d76d21-0f7c85cc.cjs} +1 -1
- package/dist/{constants-54af2051-767e8462.js → constants-91d76d21-1638ead6.js} +23 -11
- package/dist/copy-icon.entry-16835c5d.cjs +1 -0
- package/dist/{copy-icon.entry-eecc7301.js → copy-icon.entry-c009a659.js} +6 -6
- package/dist/{delete-icon.entry-1e6c99ee.cjs → delete-icon.entry-3c295200.cjs} +1 -1
- package/dist/{delete-icon.entry-4b341b41.js → delete-icon.entry-e8815e15.js} +2 -2
- package/dist/document-refresh-icon.entry-1628d0dd.js +15 -0
- package/dist/{document-refresh-icon.entry-612c5d4f.cjs → document-refresh-icon.entry-7d84ace4.cjs} +1 -1
- package/dist/{feedbackSync-e5cb0245-013ce5ec.cjs → feedbackSync-b5d35a5b-1343e33b.cjs} +1 -1
- package/dist/{feedbackSync-e5cb0245-f8e4575c.js → feedbackSync-b5d35a5b-20032e5d.js} +1 -1
- package/dist/{folder-icon.entry-5bc752d4.cjs → folder-icon.entry-1837e7eb.cjs} +1 -1
- package/dist/{folder-icon.entry-8d91bc75.js → folder-icon.entry-1a70f499.js} +2 -2
- package/dist/forward-icon.entry-7a9952fe.cjs +1 -0
- package/dist/forward-icon.entry-92fa4f95.js +15 -0
- package/dist/{globe-icon.entry-c2ddabb6.js → globe-icon.entry-2886c103.js} +4 -4
- package/dist/{globe-icon.entry-13f5dd98.cjs → globe-icon.entry-5ea64e36.cjs} +1 -1
- package/dist/{google-logo-icon_4.entry-b58af39b.js → google-logo-icon_4.entry-c0413818.js} +168 -148
- package/dist/google-logo-icon_4.entry-ff5ebfd9.cjs +1 -0
- package/dist/inbox-icon.entry-893a70b6.js +15 -0
- package/dist/inbox-icon.entry-ad864253.cjs +1 -0
- package/dist/index-94416062.cjs +81 -0
- package/dist/index-cd93b584.js +16202 -0
- package/dist/{index.es-e9d66a9b-fa36c085.cjs → index.es-ef72cd61-0860521c.cjs} +1 -1
- package/dist/{index.es-e9d66a9b-a07a895d.js → index.es-ef72cd61-3075f564.js} +1 -1
- package/dist/{info-icon_2.entry-14cad09c.js → info-icon_2.entry-891619f7.js} +5 -5
- package/dist/{info-icon_2.entry-fce3a1ce.cjs → info-icon_2.entry-cfa2954a.cjs} +1 -1
- package/dist/{input-color-picker.entry-2079f40e.js → input-color-picker.entry-58c5f4d3.js} +4 -4
- package/dist/{input-color-picker.entry-785e80b1.cjs → input-color-picker.entry-5c3e8407.cjs} +1 -1
- package/dist/{input-component.entry-cee3fa04.js → input-component.entry-a45cff7f.js} +3 -3
- package/dist/{input-component.entry-0edf62cf.cjs → input-component.entry-f6f257b9.cjs} +1 -1
- package/dist/input-dropdown_2.entry-0518caac.js +228 -0
- package/dist/input-dropdown_2.entry-85077fff.cjs +1 -0
- package/dist/italic-icon.entry-7f971c72.cjs +1 -0
- package/dist/italic-icon.entry-a9a0be67.js +15 -0
- package/dist/multi-select-dropdown.entry-0b7e26c0.js +116 -0
- package/dist/multi-select-dropdown.entry-2c5b3f8d.cjs +1 -0
- package/dist/{nylas-booked-event-card_12.entry-56068565.js → nylas-booked-event-card_12.entry-8eed168c.js} +211 -190
- package/dist/nylas-booked-event-card_12.entry-d416f896.cjs +1 -0
- package/dist/{nylas-form-card.entry-77485e1d.cjs → nylas-form-card.entry-2c336c14.cjs} +1 -1
- package/dist/{nylas-form-card.entry-df1c70ff.js → nylas-form-card.entry-8842785d.js} +8 -8
- package/dist/{nylas-if-state.entry-0271bf92.cjs → nylas-if-state.entry-e6c90919.cjs} +1 -1
- package/dist/{nylas-if-state.entry-74c342ef.js → nylas-if-state.entry-fdc20d01.js} +3 -3
- package/dist/{nylas-login.entry-6a308ac9.js → nylas-login.entry-16f39c90.js} +3 -3
- package/dist/{nylas-login.entry-2483aa51.cjs → nylas-login.entry-dcdc4d06.cjs} +1 -1
- package/dist/{nylas-provider.entry-df790de3.cjs → nylas-provider.entry-0cc093e4.cjs} +1 -1
- package/dist/{nylas-provider.entry-5cbbd312.js → nylas-provider.entry-d51de210.js} +5 -5
- package/dist/nylas-scheduler-editor.entry-af211f07.cjs +2 -0
- package/dist/{nylas-scheduler-editor.entry-b6793c45.js → nylas-scheduler-editor.entry-d0214565.js} +48 -30
- package/dist/{nylas-scheduling.entry-fea8dca0.js → nylas-scheduling.entry-3d3a4eb4.js} +7 -7
- package/dist/{nylas-scheduling.entry-2a9aed18.cjs → nylas-scheduling.entry-ce1ef505.cjs} +1 -1
- package/dist/{nylas-time-window-picker_2.entry-fc5aa4be.js → nylas-time-window-picker_2.entry-24672606.js} +30 -30
- package/dist/{nylas-time-window-picker_2.entry-32f657a2.cjs → nylas-time-window-picker_2.entry-52a54abb.cjs} +1 -1
- package/dist/{person-icon.entry-c853f6b5.cjs → person-icon.entry-954d4c10.cjs} +1 -1
- package/dist/{person-icon.entry-fae1d972.js → person-icon.entry-dcdc2118.js} +4 -4
- package/dist/{play-icon.entry-b07a4311.cjs → play-icon.entry-7e17d583.cjs} +1 -1
- package/dist/{play-icon.entry-6ccd7cb6.js → play-icon.entry-e727a1d6.js} +4 -4
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/{refresh-icon.entry-b717e4fe.js → refresh-icon.entry-d5e50180.js} +4 -4
- package/dist/{refresh-icon.entry-a218275f.cjs → refresh-icon.entry-f735be78.cjs} +1 -1
- package/dist/{register-component-5d7bcc15-bb9405d1.cjs → register-component-a169494c-3d95c4fd.cjs} +1 -1
- package/dist/{register-component-5d7bcc15-43981253.js → register-component-a169494c-62768a00.js} +1 -1
- package/dist/{reply-all-icon.entry-f20c4a10.js → reply-all-icon.entry-848cd16f.js} +5 -5
- package/dist/{reply-all-icon.entry-cd2bafd1.cjs → reply-all-icon.entry-c847636d.cjs} +1 -1
- package/dist/reply-icon.entry-028435a1.cjs +1 -0
- package/dist/reply-icon.entry-9e3e5122.js +15 -0
- package/dist/{scheduler-config-store-ed4a8dfd-96520080.cjs → scheduler-config-store-ed4a8dfd-0e3f540f.cjs} +1 -1
- package/dist/{scheduler-config-store-ed4a8dfd-2619e757.js → scheduler-config-store-ed4a8dfd-622802c7.js} +1 -1
- package/dist/{scheduler-store-3acf4d70-53282ac4.cjs → scheduler-store-8e74959b-c8514d9a.cjs} +1 -1
- package/dist/{scheduler-store-3acf4d70-68aacbea.js → scheduler-store-8e74959b-ffa0b3c6.js} +2 -2
- package/dist/sent-icon.entry-eef67c1a.cjs +1 -0
- package/dist/sent-icon.entry-f8fda6ff.js +15 -0
- package/dist/spam-icon.entry-22437325.cjs +1 -0
- package/dist/spam-icon.entry-ec4f3144.js +15 -0
- package/dist/{star-icon.entry-6fc95071.js → star-icon.entry-d7cd7608.js} +5 -5
- package/dist/{star-icon.entry-a6e85c82.cjs → star-icon.entry-f275321a.cjs} +1 -1
- package/dist/{stop-icon.entry-8b041eda.js → stop-icon.entry-55779283.js} +2 -2
- package/dist/{stop-icon.entry-eee61c96.cjs → stop-icon.entry-89c2bae7.cjs} +1 -1
- package/dist/{textarea-component.entry-dc92a53f.js → textarea-component.entry-02360e34.js} +2 -2
- package/dist/{textarea-component.entry-cbe424d4.cjs → textarea-component.entry-5e8cb080.cjs} +1 -1
- package/dist/{translate-icon.entry-7307d3f1.cjs → translate-icon.entry-a7915e82.cjs} +1 -1
- package/dist/{translate-icon.entry-447f1502.js → translate-icon.entry-b0b36e4c.js} +4 -4
- package/dist/trash-fill-icon.entry-1fd28f47.js +15 -0
- package/dist/trash-fill-icon.entry-e933f219.cjs +1 -0
- package/dist/{underline-icon.entry-6acfca57.js → underline-icon.entry-1636f401.js} +2 -2
- package/dist/{underline-icon.entry-c636ca0e.cjs → underline-icon.entry-8bf17177.cjs} +1 -1
- package/dist/{warning-icon.entry-03615141.cjs → warning-icon.entry-27c0cdd6.cjs} +1 -1
- package/dist/{warning-icon.entry-290eb052.js → warning-icon.entry-cef2e7c1.js} +7 -7
- package/package.json +3 -3
- package/dist/add-circle-icon.entry-8b883ae4.js +0 -15
- package/dist/archive-icon.entry-62c7e06e.js +0 -15
- package/dist/archive-icon.entry-e9038aeb.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_53.entry-da0fac2a.cjs +0 -9
- package/dist/close-icon.entry-4b2a2974.js +0 -15
- package/dist/close-icon.entry-e52d8440.cjs +0 -1
- package/dist/copy-icon.entry-f3370220.cjs +0 -1
- package/dist/document-refresh-icon.entry-653dc173.js +0 -15
- package/dist/forward-icon.entry-1d14a631.js +0 -15
- package/dist/forward-icon.entry-fe0f2a3a.cjs +0 -1
- package/dist/google-logo-icon_4.entry-59423b91.cjs +0 -1
- package/dist/inbox-icon.entry-2e8c1cf5.cjs +0 -1
- package/dist/inbox-icon.entry-5a452db1.js +0 -15
- package/dist/index-5611d3d5.cjs +0 -81
- package/dist/index-589f8eee.js +0 -13086
- package/dist/input-dropdown.entry-63cf88c1.cjs +0 -1
- package/dist/input-dropdown.entry-a1bac5bf.js +0 -134
- package/dist/italic-icon.entry-85a90ace.js +0 -15
- package/dist/italic-icon.entry-9ced8045.cjs +0 -1
- package/dist/multi-select-dropdown.entry-dd699cdf.js +0 -112
- package/dist/multi-select-dropdown.entry-f6ac5ae9.cjs +0 -1
- package/dist/nylas-booked-event-card_12.entry-89bcf205.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-c23fd4d8.cjs +0 -2
- package/dist/reply-icon.entry-30b5222b.cjs +0 -1
- package/dist/reply-icon.entry-abfbde42.js +0 -15
- package/dist/sent-icon.entry-2b183210.cjs +0 -1
- package/dist/sent-icon.entry-77bb678e.js +0 -15
- package/dist/spam-icon.entry-42f9c9e7.js +0 -15
- package/dist/spam-icon.entry-cbeaca0c.cjs +0 -1
- package/dist/time-period-selector.entry-45ca7b1a.js +0 -99
- package/dist/time-period-selector.entry-60718809.cjs +0 -1
- package/dist/trash-fill-icon.entry-1138f73e.cjs +0 -1
- package/dist/trash-fill-icon.entry-7d11144b.js +0 -15
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var I=Object.defineProperty;var O=(r,t,n)=>t in r?I(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var m=(r,t,n)=>(O(r,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const index=require("./index-94416062.cjs"),index_esEf72cd61=require("./index.es-ef72cd61-0860521c.cjs"),schedulerConfigStoreEd4a8dfd=require("./scheduler-config-store-ed4a8dfd-0e3f540f.cjs"),constants91d76d21=require("./constants-91d76d21-0f7c85cc.cjs");require("react");require("react-dom");class NylasSchedulerConfigAPIConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:n}){this.nylasApiRequest=t,this.nylasSchedulerConfigStore=n}async currentUser(){return this.nylasApiRequest?this.nylasApiRequest.currentUser():(console.warn("Nylas API Request is not initialized"),null)}async getCalendars(){var s;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching calendars: Nylas API Request is not initialized"});const[t,n]=await this.nylasApiRequest.request({method:"GET",path:"calendars"});return n?index.dataResponse(null,{message:"Error fetching calendars: "+n.message}):index_esEf72cd61.Xr(t)?index.dataResponse(null,{message:"Error fetching calendars: "+((s=t.error)==null?void 0:s.message)}):(this.nylasSchedulerConfigStore.state.calendars=t.data,index.dataResponse(t.data))}async getConfigurationById(t,n=!1){var a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching configuration: Nylas API Request is not initialized"});if(!n){const l=this.nylasSchedulerConfigStore.state.configurations.find(c=>c.id===t);if(l)return this.nylasSchedulerConfigStore.state.selectedConfiguration=l,index.dataResponse(l)}const[s,d]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${t}`});return d?index.dataResponse(null,{message:"Error fetching configuration: "+d.message}):index_esEf72cd61.Xr(s)?index.dataResponse(null,{message:"Error fetching configuration: "+((a=s.error)==null?void 0:a.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=s.data,this.nylasSchedulerConfigStore.state.configurations.find(l=>l.id===t)?this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map(l=>l.id===t?s.data:l):this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,s.data],index.dataResponse(s.data))}async getConfigurations(t){var a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error fetching configurations: Nylas API Request is not initialized"});const n=50,[s,d]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations?limit=${n}${t?`&page_token=${t}`:""}`});return d?index.dataResponse(null,{message:"Error fetching configurations: "+d.message}):index_esEf72cd61.Xr(s)?index.dataResponse(null,{message:"Error fetching configurations: "+((a=s.error)==null?void 0:a.message)}):(this.nylasSchedulerConfigStore.state.configurations=s.data,this.nylasSchedulerConfigStore.state.listConfigurationsNextCursor=s.next_cursor||null,index.dataResponse(s.data))}async createConfiguration(t){var d;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error creating configuration: Nylas API Request is not initialized"});const[n,s]=await this.nylasApiRequest.request({method:"POST",path:"scheduling/configurations",body:t});return s?index.dataResponse(null,{message:"Error creating configuration: "+s.message}):index_esEf72cd61.Xr(n)?index.dataResponse(null,{message:"Error creating configuration: "+((d=n.error)==null?void 0:d.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data,this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data],index.dataResponse(n.data))}async updateConfiguration(t){var d;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error updating configuration: Nylas API Request is not initialized"});const[n,s]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${t.id}`,body:t});return s?index.dataResponse(null,{message:"Error updating configuration: "+s.message}):index_esEf72cd61.Xr(n)?index.dataResponse(null,{message:"Error updating configuration: "+((d=n.error)==null?void 0:d.message)}):(this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data,this.nylasSchedulerConfigStore.state.configurations.find(a=>a.id===t.id)?this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map(a=>a.id===t.id?n.data:a):this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data],index.dataResponse(n.data))}async deleteConfiguration(t){var d,a;if(!this.nylasApiRequest)return console.warn("Nylas API Request is not initialized"),index.dataResponse(null,{message:"Error deleting configuration: Nylas API Request is not initialized"});const[n,s]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${t}`});return s?index.dataResponse(null,{message:"Error deleting configuration: "+s.message}):index_esEf72cd61.Xr(n)?index.dataResponse(null,{message:"Error deleting configuration: "+((d=n.error)==null?void 0:d.message)}):(this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter(l=>l.id!==t),((a=this.nylasSchedulerConfigStore.state.selectedConfiguration)==null?void 0:a.id)===t&&this.nylasSchedulerConfigStore.resetSelectedConfiguration(),index.dataResponse(n.data))}}class NylasSchedulerConfigConnector{constructor({nylasApiRequest:t,nylasSchedulerConfigStore:n}){this.nylasApiRequest=t,this.nylasSchedulerConfigStore=n}init(){index.debug("NylasSchedulerConfigConnector init")}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){return this._schedulerConfigConnector?this._schedulerConfigConnector:(this._schedulerConfigConnector=new NylasSchedulerConfigAPIConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore}),this._schedulerConfigConnector)}resetStores(){index.debug("NylasSchedulerConfigConnector resetStores"),this.nylasSchedulerConfigStore.reset()}async logout(){index.debug("NylasSchedulerConfigConnector logout"),this.resetStores()}}class LocalStorage{get(t){return new Promise(n=>{const s=window.localStorage.getItem(t);n(s?JSON.parse(s):null)})}async remove(t){return window.localStorage.removeItem(t),new Promise(n=>{n(null)})}set(t,n){return window.localStorage.setItem(t,JSON.stringify(n)),new Promise(s=>{s(null)})}}const PKCE_KEY="pkce",GRANT_KEY="grant",USER_KEY="user";class Storage{constructor(t){m(this,"Storage",new LocalStorage);if(t){this.Storage=t;return}}setPKCE(t){const n=index.Buffer.from(t);this.Storage.set(PKCE_KEY,n.toString("base64"))}async getPKCE(){try{const t=await this.Storage.get(PKCE_KEY);if(t)return index.Buffer.from(t,"base64").toString("utf8")}catch{return null}return null}removePKCE(){this.Storage.remove(PKCE_KEY)}setGrant(t,n=!1){const{grant_id:s}=t;this.Storage.set(`${GRANT_KEY}${n?"-"+s:""}`,t)}removeGrant(t,n=!1){this.Storage.remove(`${GRANT_KEY}${n?"-"+t:""}`)}async getGrant(t,n=!1){const s=await this.Storage.get(`${GRANT_KEY}${n?"-"+t:""}`);return s||null}async setUserToken(t){const n=await this.getUserTokens();if(n)if(n.find(d=>d.sub===t.sub)){const d=n.map(a=>(a.sub===t.sub&&(a=t),a));this.Storage.set(USER_KEY,d)}else{const d=[...n,t];this.Storage.set(USER_KEY,d)}else this.Storage.set(USER_KEY,[t])}async getUserToken(t=""){const n=await this.Storage.get(USER_KEY);return n?t===""?n[0]:n.find(d=>d.sub===t):null}async getUserTokens(){const t=await this.Storage.get(USER_KEY);return t||null}removeUserTokens(){this.Storage.remove(USER_KEY)}async removeUserToken(t){const n=await this.getUserTokens(),s=n==null?void 0:n.filter(d=>d.sub!==t);this.Storage.set(USER_KEY,s)}async clearSession(){const t=await this.getUserTokens();t==null||t.forEach(n=>{this.removeGrant(n.sub)}),this.removePKCE(),this.removeUserTokens()}}class IndexedDBStorage{constructor(){m(this,"databaseName","identity-db");m(this,"storeName","identity")}get(t){const n=this;return new Promise((s,d)=>{n.openDatabase().then(function(a){const l=a.transaction(n.storeName,"readwrite"),h=l.objectStore(n.storeName).get(t);h.onsuccess=()=>{s(h.result)},h.onerror=()=>{d(h.error)},l.oncomplete=()=>{a.close()}})})}async remove(t){const n=this;return new Promise((s,d)=>{const a=indexedDB.open(this.databaseName);a.onupgradeneeded=function(l){l.target.result.createObjectStore(n.storeName)},a.onerror=()=>{d(a.error)},a.onsuccess=l=>{const c=l.target.result,h=c.transaction(this.storeName,"readwrite"),p=h.objectStore(this.storeName).delete(t);p.onsuccess=()=>{s(null)},p.onerror=()=>{d(p.error)},h.oncomplete=()=>{c.close()}}})}set(t,n){return new Promise((s,d)=>{const a=indexedDB.open(this.databaseName);a.onerror=()=>{d(a.error)},a.onupgradeneeded=l=>{l.target.result.createObjectStore(this.storeName)},a.onsuccess=l=>{const c=l.target.result,h=c.transaction(this.storeName,"readwrite"),p=h.objectStore(this.storeName).put(n,t);p.onsuccess=()=>{s(n)},p.onerror=()=>{d(p.error)},h.oncomplete=()=>{c.close()}}})}openDatabase(){const t=this;return new Promise(function(n,s){const d=indexedDB.open(t.databaseName,2);d.onupgradeneeded=function(a){a.target.result.createObjectStore(t.storeName)},d.onsuccess=function(a){n(a.target.result)},d.onerror=function(a){s(a.error)}})}}var sha256={exports:{}};(function(module){(function(){var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof index.process=="object"&&index.process.versions&&index.process.versions.node;NODE_JS?root=index.commonjsGlobal:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&!0&&module.exports,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(r){return Object.prototype.toString.call(r)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(r){return typeof r=="object"&&r.buffer&&r.buffer.constructor===ArrayBuffer});var createOutputMethod=function(r,t){return function(n){return new Sha256(t,!0).update(n)[r]()}},createMethod=function(r){var t=createOutputMethod("hex",r);NODE_JS&&(t=nodeWrap(t,r)),t.create=function(){return new Sha256(r)},t.update=function(d){return t.create().update(d)};for(var n=0;n<OUTPUT_TYPES.length;++n){var s=OUTPUT_TYPES[n];t[s]=createOutputMethod(s,r)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(r){if(typeof r=="string")return crypto.createHash(algorithm).update(r,"utf8").digest("hex");if(r==null)throw new Error(ERROR);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(r)).digest("hex"):method(r)};return nodeMethod},createHmacOutputMethod=function(r,t){return function(n,s){return new HmacSha256(n,t,!0).update(s)[r]()}},createHmacMethod=function(r){var t=createHmacOutputMethod("hex",r);t.create=function(d){return new HmacSha256(d,r)},t.update=function(d,a){return t.create(d).update(a)};for(var n=0;n<OUTPUT_TYPES.length;++n){var s=OUTPUT_TYPES[n];t[s]=createHmacOutputMethod(s,r)}return t};function Sha256(r,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=r}Sha256.prototype.update=function(r){if(!this.finalized){var t,n=typeof r;if(n!=="string"){if(n==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var s,d=0,a,l=r.length,c=this.blocks;d<l;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),t)for(a=this.start;d<l&&a<64;++d)c[a>>2]|=r[d]<<SHIFT[a++&3];else for(a=this.start;d<l&&a<64;++d)s=r.charCodeAt(d),s<128?c[a>>2]|=s<<SHIFT[a++&3]:s<2048?(c[a>>2]|=(192|s>>6)<<SHIFT[a++&3],c[a>>2]|=(128|s&63)<<SHIFT[a++&3]):s<55296||s>=57344?(c[a>>2]|=(224|s>>12)<<SHIFT[a++&3],c[a>>2]|=(128|s>>6&63)<<SHIFT[a++&3],c[a>>2]|=(128|s&63)<<SHIFT[a++&3]):(s=65536+((s&1023)<<10|r.charCodeAt(++d)&1023),c[a>>2]|=(240|s>>18)<<SHIFT[a++&3],c[a>>2]|=(128|s>>12&63)<<SHIFT[a++&3],c[a>>2]|=(128|s>>6&63)<<SHIFT[a++&3],c[a>>2]|=(128|s&63)<<SHIFT[a++&3]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=c[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,t=this.lastByteIndex;r[16]=this.block,r[t>>2]|=EXTRA[t&3],this.block=r[16],t>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var r=this.h0,t=this.h1,n=this.h2,s=this.h3,d=this.h4,a=this.h5,l=this.h6,c=this.h7,h=this.blocks,u,p,f,y,g,x,w,S,b,v,R;for(u=16;u<64;++u)g=h[u-15],p=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,g=h[u-2],f=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,h[u]=h[u-16]+p+h[u-7]+f<<0;for(R=t&n,u=0;u<64;u+=4)this.first?(this.is224?(S=300032,g=h[0]-1413257819,c=g-150054599<<0,s=g+24177077<<0):(S=704751109,g=h[0]-210244248,c=g-1521486534<<0,s=g+143694565<<0),this.first=!1):(p=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),S=r&t,y=S^r&n^R,w=d&a^~d&l,g=c+f+w+K[u]+h[u],x=p+y,c=s+g<<0,s=g+x<<0),p=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),f=(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7),b=s&r,y=b^s&t^S,w=c&d^~c&a,g=l+f+w+K[u+1]+h[u+1],x=p+y,l=n+g<<0,n=g+x<<0,p=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),v=n&s,y=v^n&r^b,w=l&c^~l&d,g=a+f+w+K[u+2]+h[u+2],x=p+y,a=t+g<<0,t=g+x<<0,p=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),R=t&n,y=R^t&s^v,w=a&l^~a&c,g=d+f+w+K[u+3]+h[u+3],x=p+y,d=r+g<<0,r=g+x<<0;this.h0=this.h0+r<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+s<<0,this.h4=this.h4+d<<0,this.h5=this.h5+a<<0,this.h6=this.h6+l<<0,this.h7=this.h7+c<<0},Sha256.prototype.hex=function(){this.finalize();var r=this.h0,t=this.h1,n=this.h2,s=this.h3,d=this.h4,a=this.h5,l=this.h6,c=this.h7,h=HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>4&15]+HEX_CHARS[d&15]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]+HEX_CHARS[l>>28&15]+HEX_CHARS[l>>24&15]+HEX_CHARS[l>>20&15]+HEX_CHARS[l>>16&15]+HEX_CHARS[l>>12&15]+HEX_CHARS[l>>8&15]+HEX_CHARS[l>>4&15]+HEX_CHARS[l&15];return this.is224||(h+=HEX_CHARS[c>>28&15]+HEX_CHARS[c>>24&15]+HEX_CHARS[c>>20&15]+HEX_CHARS[c>>16&15]+HEX_CHARS[c>>12&15]+HEX_CHARS[c>>8&15]+HEX_CHARS[c>>4&15]+HEX_CHARS[c&15]),h},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var r=this.h0,t=this.h1,n=this.h2,s=this.h3,d=this.h4,a=this.h5,l=this.h6,c=this.h7,h=[r>>24&255,r>>16&255,r>>8&255,r&255,t>>24&255,t>>16&255,t>>8&255,t&255,n>>24&255,n>>16&255,n>>8&255,n&255,s>>24&255,s>>16&255,s>>8&255,s&255,d>>24&255,d>>16&255,d>>8&255,d&255,a>>24&255,a>>16&255,a>>8&255,a&255,l>>24&255,l>>16&255,l>>8&255,l&255];return this.is224||h.push(c>>24&255,c>>16&255,c>>8&255,c&255),h},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),t=new DataView(r);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),r};function HmacSha256(r,t,n){var s,d=typeof r;if(d==="string"){var a=[],l=r.length,c=0,h;for(s=0;s<l;++s)h=r.charCodeAt(s),h<128?a[c++]=h:h<2048?(a[c++]=192|h>>6,a[c++]=128|h&63):h<55296||h>=57344?(a[c++]=224|h>>12,a[c++]=128|h>>6&63,a[c++]=128|h&63):(h=65536+((h&1023)<<10|r.charCodeAt(++s)&1023),a[c++]=240|h>>18,a[c++]=128|h>>12&63,a[c++]=128|h>>6&63,a[c++]=128|h&63);r=a}else if(d==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);r.length>64&&(r=new Sha256(t,!0).update(r).array());var u=[],p=[];for(s=0;s<64;++s){var f=r[s]||0;u[s]=92^f,p[s]=54^f}Sha256.call(this,t,n),this.update(p),this.oKeyPad=u,this.inner=!0,this.sharedMemory=n}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224)})()})(sha256);var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(r){return typeof r=="string"&®EX.test(r)}var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).substr(1));function stringify(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(byteToHex[r[t+0]]+byteToHex[r[t+1]]+byteToHex[r[t+2]]+byteToHex[r[t+3]]+"-"+byteToHex[r[t+4]]+byteToHex[r[t+5]]+"-"+byteToHex[r[t+6]]+byteToHex[r[t+7]]+"-"+byteToHex[r[t+8]]+byteToHex[r[t+9]]+"-"+byteToHex[r[t+10]]+byteToHex[r[t+11]]+byteToHex[r[t+12]]+byteToHex[r[t+13]]+byteToHex[r[t+14]]+byteToHex[r[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}function v4(r,t,n){r=r||{};var s=r.random||(r.rng||rng)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,t){n=n||0;for(var d=0;d<16;++d)t[n+d]=s[d];return t}return stringify(s)}async function getBytes(r,t){const n=r.getReader();let s;for(;!(s=await n.read()).done;)t(s.value)}function getLines(r){let t,n,s,d=!1;return function(l){t===void 0?(t=l,n=0,s=-1):t=concat(t,l);const c=t.length;let h=0;for(;n<c;){d&&(t[n]===10&&(h=++n),d=!1);let u=-1;for(;n<c&&u===-1;++n)switch(t[n]){case 58:s===-1&&(s=n-h);break;case 13:d=!0;case 10:u=n;break}if(u===-1)break;r(t.subarray(h,u),s),h=n,s=-1}h===c?t=void 0:h!==0&&(t=t.subarray(h),n-=h)}}function getMessages(r,t,n){let s=newMessage();const d=new TextDecoder;return function(l,c){if(l.length===0)n==null||n(s),s=newMessage();else if(c>0){const h=d.decode(l.subarray(0,c)),u=c+(l[c+1]===32?2:1),p=d.decode(l.subarray(u));switch(h){case"data":s.data=s.data?s.data+`
|
|
2
|
+
`+p:p;break;case"event":s.event=p;break;case"id":r(s.id=p);break;case"retry":const f=parseInt(p,10);isNaN(f)||t(s.retry=f);break}}}}function concat(r,t){const n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),n}function newMessage(){return{data:"",event:"",id:"",retry:void 0}}var __rest=function(r,t){var n={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&t.indexOf(s)<0&&(n[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,s=Object.getOwnPropertySymbols(r);d<s.length;d++)t.indexOf(s[d])<0&&Object.prototype.propertyIsEnumerable.call(r,s[d])&&(n[s[d]]=r[s[d]]);return n};const EventStreamContentType="text/event-stream",DefaultRetryInterval=1e3,LastEventId="last-event-id";function fetchEventSource(r,t){var{signal:n,headers:s,onopen:d,onmessage:a,onclose:l,onerror:c,openWhenHidden:h,fetch:u}=t,p=__rest(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((f,y)=>{const g=Object.assign({},s);g.accept||(g.accept=EventStreamContentType);let x;function w(){x.abort(),document.hidden||k()}h||document.addEventListener("visibilitychange",w);let S=DefaultRetryInterval,b=0;function v(){document.removeEventListener("visibilitychange",w),window.clearTimeout(b),x.abort()}n==null||n.addEventListener("abort",()=>{v(),f()});const R=u??window.fetch,T=d??defaultOnOpen;async function k(){var _;x=new AbortController;try{const U=await R(r,Object.assign(Object.assign({},p),{headers:g,signal:x.signal}));await T(U),await getBytes(U.body,getLines(getMessages(A=>{A?g[LastEventId]=A:delete g[LastEventId]},A=>{S=A},a))),l==null||l(),v(),f()}catch(U){if(!x.signal.aborted)try{const A=(_=c==null?void 0:c(U))!==null&&_!==void 0?_:S;window.clearTimeout(b),b=window.setTimeout(k,A)}catch(A){v(),y(A)}}}k()})}function defaultOnOpen(r){const t=r.headers.get("content-type");if(!(t!=null&&t.startsWith(EventStreamContentType)))throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${t}`)}function Base64EncodeUrl(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function getTimestamp(){return Math.floor(Date.now()/1e3)}function e(r){this.message=r}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r$1=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,s,d=0,a=0,l="";s=t.charAt(a++);~s&&(n=d%4?64*n+s:s,d++%4)?l+=String.fromCharCode(255&n>>(-2*d&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);return l};function t$1(r){var t=r.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(n){return decodeURIComponent(r$1(n).replace(/(.)/g,function(s,d){var a=d.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}(t)}catch{return r$1(t)}}function n$1(r){this.message=r}function o(r,t){if(typeof r!="string")throw new n$1("Invalid token specified");var n=(t=t||{}).header===!0?0:1;try{return JSON.parse(t$1(r.split(".")[n]))}catch(s){throw new n$1("Invalid token specified: "+s.message)}}n$1.prototype=new Error,n$1.prototype.name="InvalidTokenError";class NylasSessions{constructor(t){m(this,"clientId");m(this,"redirectUri");m(this,"accessType","online");m(this,"domain","http://api.nylas.com");m(this,"versioned",!1);m(this,"Storage");m(this,"hosted",!1);m(this,"multiAccount",!1);m(this,"loginId","");if(this.clientId=t.clientId,this.redirectUri=t.redirectUri,t.domain&&(this.domain=t.domain,this.domain.substring(this.domain.length-3).includes("/v")&&(this.versioned=!0)),t.multiAccount&&(this.multiAccount=t.multiAccount),t.sw){const n=new IndexedDBStorage;this.Storage=new Storage(n)}else this.Storage=new Storage;t.accessType&&(this.accessType=t.accessType),t.loginId&&(this.loginId=t.loginId),t.hosted&&(this.hosted=t.hosted),t.disableInitCodeExchange!==!0&&this.codeExchange(null)}async validateAccessToken(t=""){const n=await this.Storage.getGrant(t,this.multiAccount);if(!n)return!1;const{access_token:s}=n;try{return!!(await(await fetch(`${this.domain}/connect/tokeninfo?access_token=${s}`,{method:"GET"})).json()).data}catch{return!1}}async validateIDToken(t=""){const n=await this.Storage.getGrant(t,this.multiAccount);if(!n)return!1;const{id_token:s}=n;try{const d=await fetch(`${this.domain}/connect/tokeninfo?id_token=${s}`,{method:"GET"});return!(d.status!==200||!(await d.json()).data)}catch{return!1}}getDomain(){return this.domain}async auth(t){this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))&&await this.hostedSetCodeChallenge();const n=await this.generateAuthURL(t);if(t.popup){this.popUp(n);return}return n}async generateAuthURL(t){const n=await this.getCodeChallege();let s=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;return n&&(s+=`&code_challenge=${n}&code_challenge_method=S256&options=rotate_refresh_token`),t.provider&&(s+=`&provider=${t.provider}`),t.loginHint&&(s+=`&login_hint=${t.loginHint}`,t.includeGrantScopes&&(s+=`&include_grant_scopes=${t.includeGrantScopes}`)),t.scope&&(s+=`&scope=${t.scope.join(" ")}`),t.prompt&&(s+=`&prompt=${t.prompt}`),t.metadata&&(s+=`&metadata=${t.metadata}`),(t.state||this.loginId)&&(s+=`&state=${this.loginId?this.loginId:t.state}`),s}async generateReauthURL(t,n){if(!t)throw new Error("Grant ID is required");const s=await this.Storage.getUserToken(t),d=await this.getCodeChallege();let a=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;return d&&(a+=`&code_challenge=${d}&code_challenge_method=S256&options=rotate_refresh_token`),s!=null&&s.provider&&(a+=`&provider=${s.provider}`),s!=null&&s.email&&(a+=`&login_hint=${s.email}`),n&&(a+=`&scope=${n.join(" ")}`),a}async generateCodeChallenge(){if(await this.Storage.getPKCE())return;const n=v4();this.Storage.setPKCE(n)}async hostedSetCodeChallenge(){if(!this.hosted)throw console.error("Method only used with hosted flag enabled");const n=new URLSearchParams(window.location.search).get("code_challenge");if(!n){if(await this.Storage.getPKCE())return;console.warn("Code challenge is recomended");return}this.Storage.setPKCE(n)}async getCodeChallege(){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin))){const s=new URLSearchParams(window.location.search).get("code_challenge");return s||(console.warn("Code challenge is recomended"),"")}const t=await this.Storage.getPKCE();if(t){const n=sha256.exports.sha256(t);let s=index.Buffer.from(n).toString("base64");return s=Base64EncodeUrl(s),s}return""}async isLoggedIn(){if(this.hosted&&(this.domain===window.location.origin||this.versioned&&this.domain.includes(window.location.origin)))return!1;const t=await this.Storage.getUserTokens();return t&&t.length>0?(this.multiAccount&&await this.generateCodeChallenge(),!0):(await this.generateCodeChallenge(),!1)}isMultiAccount(){return this.multiAccount}async logout(){const t=await this.getProfile();await this.Storage.clearSession();const n={detail:t};window.dispatchEvent(new CustomEvent("onLogoutSuccess",n))}async getProfile(t=""){let n;return t?n=await this.Storage.getUserToken(t):n=await this.Storage.getUserToken(),n||null}async getProfiles(){const t=await this.Storage.getUserTokens();return t||null}async removeProfile(t){return await this.Storage.removeUserToken(t),await this.Storage.removeGrant(t),null}async authIMAP(t){const n=await this.getCodeChallege(),s={imap_username:t.imap_username,imap_password:t.imap_password,imap_host:t.imap_host,imap_port:t.imap_port,type:t.type,smtp_host:t.smtp_host,smtp_port:t.smtp_port,provider:t.provider,redirect_uri:this.redirectUri,state:t.state,public_application_id:this.clientId,access_type:this.accessType};return this.loginId&&(s.id=this.loginId),t.smtp_username&&t.smtp_password&&(s.smtp_username=t.smtp_username,s.smtp_password=t.smtp_password),n!=""&&(s.code_challenge=n,s.code_challenge_method="S256"),await(await fetch(`${this.domain}/connect/login/imap`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(s)})).json()}async authEWS(t){const n=await this.getCodeChallege(),s={...t,provider:"ews",redirect_uri:this.redirectUri,public_application_id:this.clientId,access_type:this.accessType};return this.loginId&&(s.id=this.loginId),n!=""&&(s.code_challenge=n,s.code_challenge_method="S256"),await(await fetch(`${this.domain}/connect/login/ews`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(s)})).json()}async detectEmail(t){return await(await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/providers/detect?client_id=${this.clientId}&email=${t}`,{method:"POST",headers:new Headers({"content-type":"application/json"})})).json()}async applicationInfo(){return(await(await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/applications?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})})).json()).data}async getAvailableProviders(){const t=await fetch(`${this.domain}/connect/providers/find?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});return t?(await t.json()).data:null}onLoginSuccess(t){window.addEventListener("onLoginSuccess",n=>t(n))}onLogoutSuccess(t){window.addEventListener("onLogoutSuccess",n=>t(n))}onLoginFail(t){window.addEventListener("onLoginFail",n=>t(n))}onTokenRefreshSuccess(t){window.addEventListener("onTokenRefreshSuccess",n=>t(n))}onTokenRefreshFail(t){window.addEventListener("onTokenRefreshFail",n=>t(n))}onSessionExpired(t){window.addEventListener("onSessionExpired",n=>t(n))}async codeExchange(t){let n=new URLSearchParams(window.location.search);t&&(n=new URLSearchParams(t));const s=n.get("code"),d=n.get("state"),a=n.get("error"),l=n.get("error_description"),c=n.get("error_code");if(a&&l&&c){const u={detail:{error:a,error_description:l,error_code:c}};return window.dispatchEvent(new CustomEvent("onLoginFail",u)),window.history.pushState({},document.title,window.location.pathname),!1}if(!s)return console.warn("No code found"),!1;if(window.opener&&window.name==="uas-popup")return console.warn("Popup window detected"),!1;const h=await this.Storage.getPKCE();if(!h)return console.warn("No code verifier found"),!1;try{const u={client_id:this.clientId,redirect_uri:this.redirectUri,code:s,grant_type:"authorization_code",code_verifier:h},f=await(await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(u)})).json();if(f){if(f.error){const g={detail:f};return window.dispatchEvent(new CustomEvent("onLoginFail",g)),!0}const y=await this.handleCodeExchangeResponse(f);if(y.valid){d&&(y.data.state=d);const g={detail:y.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",g)),window.history.pushState({},document.title,window.location.pathname)}else{const g={detail:y.data};return window.dispatchEvent(new CustomEvent("onLoginFail",g)),!0}}return this.Storage.removePKCE(),!0}catch(u){const p={detail:u};return window.dispatchEvent(new CustomEvent("onLoginFail",p)),window.history.pushState({},document.title,window.location.pathname),!1}}async tokenExchange(t=""){const n=await this.Storage.getGrant(t,this.multiAccount);if(!n)return!1;const s=n.refresh_token;try{const d={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:s,grant_type:"refresh_token"},l=await(await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(d)})).json();if(l){if(l.error){const p={detail:l};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",p)),!0}const c=getTimestamp();if(l.expires_in=c+l.expires_in,this.Storage.setGrant(l,this.multiAccount),!await this.validateIDToken(t)){const p={detail:l};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",p)),!0}const u={detail:l};return window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",u)),!0}this.Storage.removePKCE()}catch(d){const a={detail:d};return window.dispatchEvent(new CustomEvent("onTokenRefreshFail",a)),!1}}async handleCodeExchangeResponse(t){if(t.error)return{data:t,valid:!1};const s=getTimestamp();t.expires_in=s+t.expires_in,this.Storage.setGrant(t,this.multiAccount);const d=o(t.id_token);return d.status="authenticated",this.Storage.setUserToken(d),await this.validateIDToken(d.sub)?{data:t,valid:!0}:{data:t,valid:!1}}async popUp(t){const d=window.screenX+(window.outerWidth-500)/2,a=window.screenY+(window.outerHeight-600)/2.5,l="uas-popup",c=t,h=window.open(c,l,`width=500,height=600,left=${d},top=${a}`);if(!h)return;const u=setInterval(async()=>{if(h.closed){const p={detail:{error_description:"OAuth provider window closed"}};window.dispatchEvent(new CustomEvent("onLoginFail",p)),u&&clearInterval(u);return}try{const p=h.location.href.split("?");if(!p[0])return;const f=h.location.search;if(h.history.pushState({},document.title,window.location.pathname),p[0]===this.redirectUri&&p.length>1){const y=await this.codeExchange(f);h.close(),y&&location.reload(),u&&clearInterval(u);return}}catch{return}},1e3)}async getAccessToken(t=""){const n=getTimestamp(),s=await this.Storage.getGrant(t,this.multiAccount);if(!s)return null;const{access_token:d,expires_in:a}=s,l=d;return l&&a&&a>getTimestamp()&&a-n>30?l:(await this.tokenExchange(t),(await this.Storage.getGrant(t,this.multiAccount)).access_token)}async sse(t,n){const s=n.headers||{},d=s["Grant-ID"];let a="";if(this.multiAccount){if(!d)throw this.logout(),new Error("Grant ID is required for multi account calls");a=await this.getAccessToken(d)}else a=await this.getAccessToken();return delete s["Grant-ID"],s.Authorization=`Bearer ${a}`,s["content-type"]||(s["content-type"]="application/json"),fetchEventSource(`${this.domain}/${t}`,{...n,headers:s})}async fetch(t,n,s=!0,d){let a="",l=1;if(this.multiAccount){if(!n.grant_id)throw this.logout(),new Error("Grant ID is required for multi account calls");const h=await this.getProfiles();l=h?h.length:1,a=await this.getAccessToken(n.grant_id)}else a=await this.getAccessToken();if(!a)throw new Error("Access token not found");let c=n.headers;Headers.prototype.isPrototypeOf(c)?(c.append("Authorization",`Bearer ${a}`),c.has("content-type")||c.append("content-type","application/json")):c=new Headers({Authorization:`Bearer ${a}`,"content-type":"application/json"});try{n!=null&&n.body&&(n.body=JSON.stringify(n==null?void 0:n.body));const h=await fetch(`${d||this.domain}/${t}`,{...n,headers:c});if(!s)return h;const u=await(h==null?void 0:h.json());if(!await this.isAuthenticatedResponse(h.status,u)){if(l>1){const f=await this.getProfile(n.grant_id);if(f){f.status="unauthorized",await this.Storage.setUserToken(f);const y={detail:{user:f}};window.dispatchEvent(new CustomEvent("onSessionExpired",y))}}else{const y={detail:{user:await this.Storage.getUserToken()}};window.dispatchEvent(new CustomEvent("onSessionExpired",y))}this.logout();return}return u}catch(h){throw h}}async fetchRequest(t,n,s,d=!0,a,l){const c=await this.isLoggedIn(),h=new URL(t,a??this.domain),u=new Headers;if(u.append("Accept","application/json"),u.append("Content-Type","application/json"),u.append("User-Agent","nylas-identity"),c){const y=await this.getAccessToken();u.append("Authorization",`Bearer ${y}`)}const p=await fetch(h.toString(),{method:n||"GET",headers:u,mode:"cors",referrer:location.origin,body:s?JSON.stringify(s):void 0,...l||{}});return d?await p.json():p.body}async isAuthenticatedResponse(t,n){var s;return!(t==401&&((s=n==null?void 0:n.error)==null?void 0:s.type)=="token.unauthorized_access")}addAPIKey(t,n,s){this.Storage.setUserToken({aud:"https://api-staging.us.nylas.com/",exp:2e9,email_verified:!0,iat:getTimestamp(),iss:"",email:n,provider:"virtual-calendar",status:"authenticated",name:n,sub:t}),this.Storage.setGrant({grant_id:t,access_token:s,expires_in:2e9},this.multiAccount)}}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(r,t,n){this.props=r,this.context=t,this.refs=D,this.updater=n||B}E.prototype.isReactComponent={};E.prototype.setState=function(r,t){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,t,"setState")};E.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(r,t,n){this.props=r,this.context=t,this.refs=D,this.updater=n||B}var H=G.prototype=new F;H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;const LoginRequired=({authenticationUrl:r})=>index.h("div",{class:"login-required",part:"nse__login-required login-component"},index.h("div",{class:"card",part:"nse__login-required-card"},index.h("p",{part:"nse__login-required-text"},"Log into your account to use the Scheduler Editor."),index.h("button",{class:"google-button",part:"nse__login-required-google-button",onClick:async t=>{t.preventDefault();const n=await r("google");n?window.location.href=n:console.error("[nylas-scheduler-editor] Unable to get authentication URL.")}},index.h("span",{class:"icon"},index.h("google-logo-icon",{width:"15",height:"15"})),"Continue with Google"),index.h("button",{class:"microsoft-button",part:"nse__login-required-microsoft-button",onClick:async t=>{t.preventDefault();const n=await r("microsoft");n?window.location.href=n:console.error("[nylas-scheduler-editor] Unable to get authentication URL.")}},index.h("span",{class:"icon"},index.h("microsoft-logo-icon",{width:"15",height:"15"})),"Continue with Microsoft"),index.h("button",{class:"other-provider-button",part:"nse__login-required-other-provider-button",onClick:async t=>{t.preventDefault();const n=await r();n?window.location.href=n:console.error("[nylas-scheduler-editor] Unable to get authentication URL.")}},"View all providers ",index.h("chevron-icon",{width:"17",height:"17"})),index.h("small",{class:"disclaimer-text",part:"nse__login-required-disclaimer-text"},"* You will be redirected to authenticate your account.")));function ExpressFlow({currentUser:r,calendars:t}){const n=(t==null?void 0:t.find(s=>s.is_primary))||(t==null?void 0:t[0]);return index.h(index.Fragment,null,index.h("nylas-event-info",null,index.h("div",{slot:"inputs"},index.h("nylas-event-title",null),index.h("nylas-event-duration",null),index.h("nylas-event-location",{userProvider:r.provider}))),index.h("nylas-booking-calendar-picker",{expressFlow:!0,calendars:t,currentUser:r,defaultBookingCalendar:n==null?void 0:n.id}),index.h("nylas-scheduling-method",{exportparts:"nsm, nsm__header, nsm__input-label, nsm__dropdown, nsm__dropdown-button, nsm__dropdown-content"}),index.h("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}))}const nylasSchedulerEditorCss=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}@media screen and (max-width: 768px){:host{width:-moz-available;width:-webkit-fill-available;width:fill-available;min-width:325px}}div.scheduler-editor-content{height:610px}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-header{display:grid;grid-template-columns:1fr auto auto;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900);width:924px}@media screen and (max-width: 768px){div.scheduler-editor-header{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;margin:0;font-size:18px;line-height:24px;font-weight:600}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button){border:none;padding:4px;margin-right:8px}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button):hover{outline:none;color:var(--nylas-primary)}@media screen and (max-width: 768px){div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){width:-webkit-fill-available;width:fill-available;width:-moz-available}}nylas-editor-tabs{width:auto;height:inherit}nylas-editor-tabs .composable{height:inherit;overflow:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;max-width:fit-content;align-self:center}.login-required{height:inherit;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.login-required{height:auto}}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}.list-configurations{padding:2rem;height:inherit;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.list-configurations{height:auto;padding:2rem 1rem}}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}',NylasSchedulerEditorStyle0=nylasSchedulerEditorCss,NylasSchedulerEditor=class{constructor(r){index.registerInstance(this,r),this.init=index.createEvent(this,"init",7),this.loggedIn=index.createEvent(this,"loggedIn",7),this.loggedOut=index.createEvent(this,"loggedOut",7),this.schedulerConfigCloseClicked=index.createEvent(this,"schedulerConfigCloseClicked",7),this.handleSchedulerConfigCloseClicked=t=>{const n=this.schedulerConfigCloseClicked.emit(this.host);"schedulerConfigCloseClicked"in this.eventOverrides&&this.eventOverrides.schedulerConfigCloseClicked(n,this.nylasSchedulerConfigConnector),n.defaultPrevented||(localStorage.removeItem("grant"),localStorage.removeItem("user"),window.location.reload())},this.authenticationUrl=async t=>this.nylasApiRequest?await this.nylasApiRequest.authenticationUrl({provider:t})||"":(console.error("[nylas-scheduler-editor] Nylas API Request is not initialized."),""),this.configurationId=void 0,this.nylasApiRequest=void 0,this.nylasSessionsConfig=void 0,this.defaultAuthArgs=void 0,this.eventOverrides={},this.schedulerPreviewLink="",this.defaultSchedulerConfigState=void 0,this.mode="app",this.additionalParticipants=void 0,this.hideEditorTabs=[],this.conferenceProviders=void 0,this.requiresSlug=!1,this.enableUserFeedback=!0,this.defaultLanguage=void 0,this.localization=void 0,this.automaticComponentRegistration=!0,this.selectedLanguage=this.defaultLanguage||constants91d76d21.LANGUAGE_CODE.en}connectedCallback(){index.debug("[nylas-scheduler-editor] connectedCallback")}async componentWillLoad(){var s,d,a,l,c,h,u,p;index.debug("[nylas-scheduler-editor] componentWillLoad");const r=(s=this.additionalParticipants)==null?void 0:s.filter(f=>{var g;const y=((g=f.calendars)==null?void 0:g.length)>0?f.calendars.filter(x=>x.id&&x.name):[];if(f.name&&f.email&&y.length>0)return{name:f.name,email:f.email,calendars:y}});if(this.stores={schedulerConfig:schedulerConfigStoreEd4a8dfd.CreateNylasSchedulerConfigStore({...this.defaultSchedulerConfigState,additionalParticipants:r,conferenceProviders:this.conferenceProviders,requiresSlug:this.requiresSlug,selectedLanguage:this.defaultLanguage||constants91d76d21.LANGUAGE_CODE.en})},!this.nylasApiRequest&&this.nylasSessionsConfig){const f=new NylasSessions(this.nylasSessionsConfig);await f.isLoggedIn(),f.onLoginSuccess(async()=>{var g,x;const y=await((x=(g=this.nylasSchedulerConfigConnector)==null?void 0:g.schedulerConfig)==null?void 0:x.currentUser());if(y){const w=this.loggedIn.emit(this.host);"loggedIn"in this.eventOverrides&&await this.eventOverrides.loggedIn(w,this.nylasSchedulerConfigConnector),w.defaultPrevented||await this.loggedInHandler(y)}}),f.onLoginFail(async()=>{var g,x;(x=(g=this.stores)==null?void 0:g.schedulerConfig)==null||x.set("currentUser",null);const y=this.loggedOut.emit(this.host);"loggedOut"in this.eventOverrides&&(await this.eventOverrides.loggedOut(y,this.nylasSchedulerConfigConnector),y.defaultPrevented)}),this.nylasApiRequest=new index.NylasIdentityRequestWrapper(f)}this.nylasApiRequest&&this.defaultAuthArgs&&this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs),this.baseProvider=new index_esEf72cd61.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=this.baseProvider.getStore("schedulerConfig");this.nylasSchedulerConfigConnector=new NylasSchedulerConfigConnector({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:t});const n=this.init.emit(this.host);if("init"in this.eventOverrides&&await this.eventOverrides.init(n,this.nylasSchedulerConfigConnector),!n.defaultPrevented){const f=await((a=(d=this.nylasSchedulerConfigConnector)==null?void 0:d.schedulerConfig)==null?void 0:a.currentUser());if(f){const y=this.loggedIn.emit(this.host);"loggedIn"in this.eventOverrides&&await this.eventOverrides.loggedIn(y,this.nylasSchedulerConfigConnector),y.defaultPrevented||await this.loggedInHandler(f)}else{(c=(l=this.stores)==null?void 0:l.schedulerConfig)==null||c.set("currentUser",null);const y=this.loggedOut.emit(this.host);if("loggedOut"in this.eventOverrides&&(await this.eventOverrides.loggedOut(y,this.nylasSchedulerConfigConnector),y.defaultPrevented))return}}(u=(h=this.stores)==null?void 0:h.schedulerConfig)==null||u.onChange("selectedConfiguration",async f=>{f&&f.id&&(this.configurationId=f.id)}),(p=this.baseProvider)==null||p.componentWillLoad(this.nylasSchedulerConfigConnector)}async componentDidLoad(){var r;index.debug("[nylas-scheduler-editor] componentDidLoad"),await((r=this.baseProvider)==null?void 0:r.componentDidLoad()),this.updateLocalization(this.localization)}async componentDisconnected(){var r;await((r=this.baseProvider)==null?void 0:r.componentDisconnected())}async configurationIdChanged(r){var t,n,s,d,a,l,c,h;r?(await((n=(t=this.nylasSchedulerConfigConnector)==null?void 0:t.schedulerConfig)==null?void 0:n.getConfigurationById(r)),(d=(s=this.stores)==null?void 0:s.schedulerConfig)==null||d.set("action","edit")):((l=(a=this.stores)==null?void 0:a.schedulerConfig)==null||l.set("selectedConfiguration",{}),(h=(c=this.stores)==null?void 0:c.schedulerConfig)==null||h.set("action",null))}updateLocalization(r){r&&Object.keys(r).forEach(t=>{t in constants91d76d21.LANGUAGE_CODE&&index.instance.addResourceBundle(t,"translation",r[t],!1,!0)})}async store(){var r;return(r=this.stores)==null?void 0:r.schedulerConfig}async schedulerConnector(){return this.nylasSchedulerConfigConnector}async registerComponentHandler(r){var t;(t=this.baseProvider)==null||t.registerComponent(r.detail)}async unregisterComponentHandler(r){var t;(t=this.baseProvider)==null||t.unregisterComponent(r.detail)}nylasFormDropdownChangedHandler(r){var s,d;const{name:t,value:n}=r.detail;t==="language"&&(this.selectedLanguage=constants91d76d21.LANGUAGE_CODE[n],index.instance.changeLanguage(this.selectedLanguage),(d=(s=this.stores)==null?void 0:s.schedulerConfig)==null||d.set("selectedLanguage",this.selectedLanguage))}async loggedInHandler(r){var t,n,s,d,a,l,c;if((n=(t=this.stores)==null?void 0:t.schedulerConfig)==null||n.set("currentUser",r),!!this.nylasSchedulerConfigConnector&&(await((s=this.nylasSchedulerConfigConnector.schedulerConfig)==null?void 0:s.getCalendars()),this.configurationId)){const h=await((d=this.nylasSchedulerConfigConnector.schedulerConfig)==null?void 0:d.getConfigurationById(this.configurationId));h&&((a=h[0])!=null&&a.id)&&((c=(l=this.stores)==null?void 0:l.schedulerConfig)==null||c.set("action","edit"))}}render(){var s,d,a,l,c,h,u,p,f,y,g,x,w,S,b,v,R,T,k;const r=this.host.querySelector('[slot="custom-page-style-inputs"]'),t=(a=(d=(s=this.stores)==null?void 0:s.schedulerConfig)==null?void 0:d.state.selectedConfiguration)==null?void 0:a.id,n=Object.keys(constants91d76d21.LANGUAGE_MAP).map(_=>({label:constants91d76d21.LANGUAGE_MAP[_],value:_}));return index.h(index.Host,{key:"75f05f7ea3eb41f3610cd9a1d60196ee52f9e5ca"},index.h("div",{key:"096bb8dbd32a0fc7ee3d37e7967d94d478410999",class:"scheduler-editor-header",part:"nse__header"},index.h("h1",{key:"560bcc4419cafde8d07f49f9533ab45faaf4a8e0",class:"scheduler-editor-title",part:"nse__title"},index.h("calendar-icon",{key:"f4f6ae5e32f30199a5b8db1094fb1fcfb19c3a53",width:"18",height:"18"}),index.instance.t("schedulerEditorTitle")),index.h("div",{key:"6150a5c179ebc92f8f076ed2cf9810d9c0ec301d",class:{language:!0},part:"nse__language"},index.h("select-dropdown",{key:"2aaf54341c6f44a605428d5c15ed6931d6623d2e",name:"language",options:n,withChevron:!1,defaultSelectedOption:n.find(_=>_.value==this.selectedLanguage),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},index.h("span",{key:"4299e684efc7a2024457cfa3ae0ec9ed1312dd6b",slot:"select-icon"},index.h("translate-icon",{key:"c6fd888c7c9b2e15b21f7693d8fe17ebe0f511d5",width:"20",height:"20"})))),index.h("button",{key:"dc1ef92010c142ecdd6c1748c3fe669044af7d61",class:"scheduler-editor-close",title:"logout",onClick:_=>this.handleSchedulerConfigCloseClicked(_),part:"nse__close-button"},index.h("close-icon",{key:"ae4dce679cbcfe0281337407d5303e7378b83669",width:"18",height:"18"}))),index.h("div",{key:"18dac5e2484e313ba211748be61c17138d31ebf0",class:"scheduler-editor-content",part:"nse__content"},((c=(l=this.stores)==null?void 0:l.schedulerConfig)==null?void 0:c.state.currentUser)&&this.stores.schedulerConfig.state.action===null&&index.h("div",{class:"list-configurations",part:"nse__list-configurations"},index.h("nylas-list-configurations",{exportparts:"nlc__create-new-cta"})),((u=(h=this.stores)==null?void 0:h.schedulerConfig)==null?void 0:u.state.currentUser)&&this.stores.schedulerConfig.state.action==="create"&&index.h("nylas-editor-tabs",{mode:"composable"},index.h(ExpressFlow,{currentUser:(f=(p=this.stores)==null?void 0:p.schedulerConfig)==null?void 0:f.state.currentUser,calendars:(x=(g=(y=this.stores)==null?void 0:y.schedulerConfig)==null?void 0:g.state)==null?void 0:x.calendars,selectedConfiguration:(b=(S=(w=this.stores)==null?void 0:w.schedulerConfig)==null?void 0:S.state)==null?void 0:b.selectedConfiguration})),((R=(v=this.stores)==null?void 0:v.schedulerConfig)==null?void 0:R.state.currentUser)&&this.stores.schedulerConfig.state.action==="edit"&&index.h("nylas-editor-tabs",{key:t,mode:this.mode},this.mode==="composable"&&index.h("slot",null),this.mode==="app"&&r&&index.h("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:t},index.h("slot",{name:"custom-page-style-inputs"}))),!((k=(T=this.stores)==null?void 0:T.schedulerConfig)!=null&&k.state.currentUser)&&index.h("slot",{name:"login-required"},index.h(LoginRequired,{authenticationUrl:this.authenticationUrl}))))}get host(){return index.getElement(this)}static get watchers(){return{configurationId:["configurationIdChanged"],localization:["updateLocalization"]}}};NylasSchedulerEditor.style=NylasSchedulerEditorStyle0;exports.nylas_scheduler_editor=NylasSchedulerEditor;
|
package/dist/{nylas-scheduler-editor.entry-b6793c45.js → nylas-scheduler-editor.entry-d0214565.js}
RENAMED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
var O = Object.defineProperty;
|
|
2
2
|
var P = (r, t, n) => t in r ? O(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
|
|
3
3
|
var b = (r, t, n) => (P(r, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
-
import { p as process, b as commonjsGlobal, r as registerInstance, c as createEvent, d as debug, N as NylasIdentityRequestWrapper, h, H as Host, g as getElement, B as Buffer, F as Fragment, e as dataResponse } from "./index-
|
|
5
|
-
import { N as NylasBaseProvider, X as Xr } from "./index.es-
|
|
6
|
-
import { C as CreateNylasSchedulerConfigStore } from "./scheduler-config-store-ed4a8dfd-
|
|
4
|
+
import { p as process, b as commonjsGlobal, r as registerInstance, c as createEvent, d as debug, N as NylasIdentityRequestWrapper, i as instance, h, H as Host, g as getElement, B as Buffer, F as Fragment, e as dataResponse } from "./index-cd93b584.js";
|
|
5
|
+
import { N as NylasBaseProvider, X as Xr } from "./index.es-ef72cd61-3075f564.js";
|
|
6
|
+
import { C as CreateNylasSchedulerConfigStore } from "./scheduler-config-store-ed4a8dfd-622802c7.js";
|
|
7
|
+
import { L as LANGUAGE_CODE, a as LANGUAGE_MAP } from "./constants-91d76d21-1638ead6.js";
|
|
7
8
|
import "react";
|
|
8
9
|
import "react-dom";
|
|
9
10
|
class NylasSchedulerConfigAPIConnector {
|
|
@@ -464,11 +465,11 @@ var sha256 = { exports: {} };
|
|
|
464
465
|
r[16] = this.block, r[t >> 2] |= EXTRA[t & 3], this.block = r[16], t >= 56 && (this.hashed || this.hash(), r[0] = this.block, r[16] = r[1] = r[2] = r[3] = r[4] = r[5] = r[6] = r[7] = r[8] = r[9] = r[10] = r[11] = r[12] = r[13] = r[14] = r[15] = 0), r[14] = this.hBytes << 3 | this.bytes >>> 29, r[15] = this.bytes << 3, this.hash();
|
|
465
466
|
}
|
|
466
467
|
}, Sha256.prototype.hash = function() {
|
|
467
|
-
var r = this.h0, t = this.h1, n = this.h2, s = this.h3, c = this.h4, a = this.h5, d = this.h6, l = this.h7, u = this.blocks, f, y, g, m, p, w, S,
|
|
468
|
+
var r = this.h0, t = this.h1, n = this.h2, s = this.h3, c = this.h4, a = this.h5, d = this.h6, l = this.h7, u = this.blocks, f, y, g, m, p, w, S, v, x, _, A;
|
|
468
469
|
for (f = 16; f < 64; ++f)
|
|
469
470
|
p = u[f - 15], y = (p >>> 7 | p << 25) ^ (p >>> 18 | p << 14) ^ p >>> 3, p = u[f - 2], g = (p >>> 17 | p << 15) ^ (p >>> 19 | p << 13) ^ p >>> 10, u[f] = u[f - 16] + y + u[f - 7] + g << 0;
|
|
470
|
-
for (
|
|
471
|
-
this.first ? (this.is224 ? (
|
|
471
|
+
for (A = t & n, f = 0; f < 64; f += 4)
|
|
472
|
+
this.first ? (this.is224 ? (v = 300032, p = u[0] - 1413257819, l = p - 150054599 << 0, s = p + 24177077 << 0) : (v = 704751109, p = u[0] - 210244248, l = p - 1521486534 << 0, s = p + 143694565 << 0), this.first = !1) : (y = (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10), g = (c >>> 6 | c << 26) ^ (c >>> 11 | c << 21) ^ (c >>> 25 | c << 7), v = r & t, m = v ^ r & n ^ A, S = c & a ^ ~c & d, p = l + g + S + K[f] + u[f], w = y + m, l = s + p << 0, s = p + w << 0), y = (s >>> 2 | s << 30) ^ (s >>> 13 | s << 19) ^ (s >>> 22 | s << 10), g = (l >>> 6 | l << 26) ^ (l >>> 11 | l << 21) ^ (l >>> 25 | l << 7), x = s & r, m = x ^ s & t ^ v, S = l & c ^ ~l & a, p = d + g + S + K[f + 1] + u[f + 1], w = y + m, d = n + p << 0, n = p + w << 0, y = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10), g = (d >>> 6 | d << 26) ^ (d >>> 11 | d << 21) ^ (d >>> 25 | d << 7), _ = n & s, m = _ ^ n & r ^ x, S = d & l ^ ~d & c, p = a + g + S + K[f + 2] + u[f + 2], w = y + m, a = t + p << 0, t = p + w << 0, y = (t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10), g = (a >>> 6 | a << 26) ^ (a >>> 11 | a << 21) ^ (a >>> 25 | a << 7), A = t & n, m = A ^ t & s ^ _, S = a & d ^ ~a & l, p = c + g + S + K[f + 3] + u[f + 3], w = y + m, c = r + p << 0, r = p + w << 0;
|
|
472
473
|
this.h0 = this.h0 + r << 0, this.h1 = this.h1 + t << 0, this.h2 = this.h2 + n << 0, this.h3 = this.h3 + s << 0, this.h4 = this.h4 + c << 0, this.h5 = this.h5 + a << 0, this.h6 = this.h6 + d << 0, this.h7 = this.h7 + l << 0;
|
|
473
474
|
}, Sha256.prototype.hex = function() {
|
|
474
475
|
this.finalize();
|
|
@@ -666,38 +667,38 @@ function fetchEventSource(r, t) {
|
|
|
666
667
|
p.accept || (p.accept = EventStreamContentType);
|
|
667
668
|
let w;
|
|
668
669
|
function S() {
|
|
669
|
-
w.abort(), document.hidden ||
|
|
670
|
+
w.abort(), document.hidden || T();
|
|
670
671
|
}
|
|
671
672
|
u || document.addEventListener("visibilitychange", S);
|
|
672
|
-
let
|
|
673
|
+
let v = DefaultRetryInterval, x = 0;
|
|
673
674
|
function _() {
|
|
674
|
-
document.removeEventListener("visibilitychange", S), window.clearTimeout(
|
|
675
|
+
document.removeEventListener("visibilitychange", S), window.clearTimeout(x), w.abort();
|
|
675
676
|
}
|
|
676
677
|
n == null || n.addEventListener("abort", () => {
|
|
677
678
|
_(), g();
|
|
678
679
|
});
|
|
679
|
-
const
|
|
680
|
-
async function
|
|
681
|
-
var
|
|
680
|
+
const A = f ?? window.fetch, U = c ?? defaultOnOpen;
|
|
681
|
+
async function T() {
|
|
682
|
+
var R;
|
|
682
683
|
w = new AbortController();
|
|
683
684
|
try {
|
|
684
|
-
const I = await
|
|
685
|
-
await
|
|
686
|
-
|
|
687
|
-
}, (
|
|
688
|
-
|
|
685
|
+
const I = await A(r, Object.assign(Object.assign({}, y), { headers: p, signal: w.signal }));
|
|
686
|
+
await U(I), await getBytes(I.body, getLines(getMessages((k) => {
|
|
687
|
+
k ? p[LastEventId] = k : delete p[LastEventId];
|
|
688
|
+
}, (k) => {
|
|
689
|
+
v = k;
|
|
689
690
|
}, a))), d == null || d(), _(), g();
|
|
690
691
|
} catch (I) {
|
|
691
692
|
if (!w.signal.aborted)
|
|
692
693
|
try {
|
|
693
|
-
const
|
|
694
|
-
window.clearTimeout(
|
|
695
|
-
} catch (
|
|
696
|
-
_(), m(
|
|
694
|
+
const k = (R = l == null ? void 0 : l(I)) !== null && R !== void 0 ? R : v;
|
|
695
|
+
window.clearTimeout(x), x = window.setTimeout(T, k);
|
|
696
|
+
} catch (k) {
|
|
697
|
+
_(), m(k);
|
|
697
698
|
}
|
|
698
699
|
}
|
|
699
700
|
}
|
|
700
|
-
|
|
701
|
+
T();
|
|
701
702
|
});
|
|
702
703
|
}
|
|
703
704
|
function defaultOnOpen(r) {
|
|
@@ -1323,12 +1324,12 @@ function ExpressFlow({ currentUser: r, calendars: t }) {
|
|
|
1323
1324
|
h("nylas-custom-event-slug", { name: "custom-event-slug", exportparts: "nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield" })
|
|
1324
1325
|
);
|
|
1325
1326
|
}
|
|
1326
|
-
const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}@media screen and (max-width: 768px){:host{width:-moz-available;width:-webkit-fill-available;width:fill-available;min-width:325px}}div.scheduler-editor-content{height:610px}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-header{display:
|
|
1327
|
+
const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}@media screen and (max-width: 768px){:host{width:-moz-available;width:-webkit-fill-available;width:fill-available;min-width:325px}}div.scheduler-editor-content{height:610px}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-header{display:grid;grid-template-columns:1fr auto auto;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900);width:924px}@media screen and (max-width: 768px){div.scheduler-editor-header{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;margin:0;font-size:18px;line-height:24px;font-weight:600}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button){border:none;padding:4px;margin-right:8px}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button):hover{outline:none;color:var(--nylas-primary)}@media screen and (max-width: 768px){div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){width:-webkit-fill-available;width:fill-available;width:-moz-available}}nylas-editor-tabs{width:auto;height:inherit}nylas-editor-tabs .composable{height:inherit;overflow:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;max-width:fit-content;align-self:center}.login-required{height:inherit;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.login-required{height:auto}}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}.list-configurations{padding:2rem;height:inherit;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.list-configurations{height:auto;padding:2rem 1rem}}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}', NylasSchedulerEditorStyle0 = nylasSchedulerEditorCss, NylasSchedulerEditor = class {
|
|
1327
1328
|
constructor(r) {
|
|
1328
1329
|
registerInstance(this, r), this.init = createEvent(this, "init", 7), this.loggedIn = createEvent(this, "loggedIn", 7), this.loggedOut = createEvent(this, "loggedOut", 7), this.schedulerConfigCloseClicked = createEvent(this, "schedulerConfigCloseClicked", 7), this.handleSchedulerConfigCloseClicked = (t) => {
|
|
1329
1330
|
const n = this.schedulerConfigCloseClicked.emit(this.host);
|
|
1330
1331
|
"schedulerConfigCloseClicked" in this.eventOverrides && this.eventOverrides.schedulerConfigCloseClicked(n, this.nylasSchedulerConfigConnector), n.defaultPrevented || (localStorage.removeItem("grant"), localStorage.removeItem("user"), window.location.reload());
|
|
1331
|
-
}, this.authenticationUrl = async (t) => this.nylasApiRequest ? await this.nylasApiRequest.authenticationUrl({ provider: t }) || "" : (console.error("[nylas-scheduler-editor] Nylas API Request is not initialized."), ""), this.configurationId = void 0, this.nylasApiRequest = void 0, this.nylasSessionsConfig = void 0, this.defaultAuthArgs = void 0, this.eventOverrides = {}, this.schedulerPreviewLink = "", this.defaultSchedulerConfigState = void 0, this.mode = "app", this.additionalParticipants = void 0, this.hideEditorTabs = [], this.conferenceProviders = void 0, this.requiresSlug = !1, this.enableUserFeedback = !0, this.automaticComponentRegistration = !0;
|
|
1332
|
+
}, this.authenticationUrl = async (t) => this.nylasApiRequest ? await this.nylasApiRequest.authenticationUrl({ provider: t }) || "" : (console.error("[nylas-scheduler-editor] Nylas API Request is not initialized."), ""), this.configurationId = void 0, this.nylasApiRequest = void 0, this.nylasSessionsConfig = void 0, this.defaultAuthArgs = void 0, this.eventOverrides = {}, this.schedulerPreviewLink = "", this.defaultSchedulerConfigState = void 0, this.mode = "app", this.additionalParticipants = void 0, this.hideEditorTabs = [], this.conferenceProviders = void 0, this.requiresSlug = !1, this.enableUserFeedback = !0, this.defaultLanguage = void 0, this.localization = void 0, this.automaticComponentRegistration = !0, this.selectedLanguage = this.defaultLanguage || LANGUAGE_CODE.en;
|
|
1332
1333
|
}
|
|
1333
1334
|
connectedCallback() {
|
|
1334
1335
|
debug("[nylas-scheduler-editor] connectedCallback");
|
|
@@ -1351,7 +1352,8 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
|
|
|
1351
1352
|
...this.defaultSchedulerConfigState,
|
|
1352
1353
|
additionalParticipants: r,
|
|
1353
1354
|
conferenceProviders: this.conferenceProviders,
|
|
1354
|
-
requiresSlug: this.requiresSlug
|
|
1355
|
+
requiresSlug: this.requiresSlug,
|
|
1356
|
+
selectedLanguage: this.defaultLanguage || LANGUAGE_CODE.en
|
|
1355
1357
|
})
|
|
1356
1358
|
}, !this.nylasApiRequest && this.nylasSessionsConfig) {
|
|
1357
1359
|
const g = new NylasSessions(this.nylasSessionsConfig);
|
|
@@ -1394,7 +1396,7 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
|
|
|
1394
1396
|
}
|
|
1395
1397
|
async componentDidLoad() {
|
|
1396
1398
|
var r;
|
|
1397
|
-
debug("[nylas-scheduler-editor] componentDidLoad"), await ((r = this.baseProvider) == null ? void 0 : r.componentDidLoad());
|
|
1399
|
+
debug("[nylas-scheduler-editor] componentDidLoad"), await ((r = this.baseProvider) == null ? void 0 : r.componentDidLoad()), this.updateLocalization(this.localization);
|
|
1398
1400
|
}
|
|
1399
1401
|
async componentDisconnected() {
|
|
1400
1402
|
var r;
|
|
@@ -1404,6 +1406,11 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
|
|
|
1404
1406
|
var t, n, s, c, a, d, l, u;
|
|
1405
1407
|
r ? (await ((n = (t = this.nylasSchedulerConfigConnector) == null ? void 0 : t.schedulerConfig) == null ? void 0 : n.getConfigurationById(r)), (c = (s = this.stores) == null ? void 0 : s.schedulerConfig) == null || c.set("action", "edit")) : ((d = (a = this.stores) == null ? void 0 : a.schedulerConfig) == null || d.set("selectedConfiguration", {}), (u = (l = this.stores) == null ? void 0 : l.schedulerConfig) == null || u.set("action", null));
|
|
1406
1408
|
}
|
|
1409
|
+
updateLocalization(r) {
|
|
1410
|
+
r && Object.keys(r).forEach((t) => {
|
|
1411
|
+
t in LANGUAGE_CODE && instance.addResourceBundle(t, "translation", r[t], !1, !0);
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1407
1414
|
async store() {
|
|
1408
1415
|
var r;
|
|
1409
1416
|
return (r = this.stores) == null ? void 0 : r.schedulerConfig;
|
|
@@ -1419,6 +1426,11 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
|
|
|
1419
1426
|
var t;
|
|
1420
1427
|
(t = this.baseProvider) == null || t.unregisterComponent(r.detail);
|
|
1421
1428
|
}
|
|
1429
|
+
nylasFormDropdownChangedHandler(r) {
|
|
1430
|
+
var s, c;
|
|
1431
|
+
const { name: t, value: n } = r.detail;
|
|
1432
|
+
t === "language" && (this.selectedLanguage = LANGUAGE_CODE[n], instance.changeLanguage(this.selectedLanguage), (c = (s = this.stores) == null ? void 0 : s.schedulerConfig) == null || c.set("selectedLanguage", this.selectedLanguage));
|
|
1433
|
+
}
|
|
1422
1434
|
async loggedInHandler(r) {
|
|
1423
1435
|
var t, n, s, c, a, d, l;
|
|
1424
1436
|
if ((n = (t = this.stores) == null ? void 0 : t.schedulerConfig) == null || n.set("currentUser", r), !!this.nylasSchedulerConfigConnector && (await ((s = this.nylasSchedulerConfigConnector.schedulerConfig) == null ? void 0 : s.getCalendars()), this.configurationId)) {
|
|
@@ -1427,16 +1439,22 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
|
|
|
1427
1439
|
}
|
|
1428
1440
|
}
|
|
1429
1441
|
render() {
|
|
1430
|
-
var
|
|
1431
|
-
const r = this.host.querySelector('[slot="custom-page-style-inputs"]'), t = (
|
|
1432
|
-
|
|
1442
|
+
var s, c, a, d, l, u, f, y, g, m, p, w, S, v, x, _, A, U, T;
|
|
1443
|
+
const r = this.host.querySelector('[slot="custom-page-style-inputs"]'), t = (a = (c = (s = this.stores) == null ? void 0 : s.schedulerConfig) == null ? void 0 : c.state.selectedConfiguration) == null ? void 0 : a.id, n = Object.keys(LANGUAGE_MAP).map((R) => ({
|
|
1444
|
+
label: LANGUAGE_MAP[R],
|
|
1445
|
+
value: R
|
|
1446
|
+
}));
|
|
1447
|
+
return h(Host, { key: "75f05f7ea3eb41f3610cd9a1d60196ee52f9e5ca" }, h("div", { key: "096bb8dbd32a0fc7ee3d37e7967d94d478410999", class: "scheduler-editor-header", part: "nse__header" }, h("h1", { key: "560bcc4419cafde8d07f49f9533ab45faaf4a8e0", class: "scheduler-editor-title", part: "nse__title" }, h("calendar-icon", { key: "f4f6ae5e32f30199a5b8db1094fb1fcfb19c3a53", width: "18", height: "18" }), instance.t("schedulerEditorTitle")), h("div", { key: "6150a5c179ebc92f8f076ed2cf9810d9c0ec301d", class: {
|
|
1448
|
+
language: !0
|
|
1449
|
+
}, part: "nse__language" }, h("select-dropdown", { key: "2aaf54341c6f44a605428d5c15ed6931d6623d2e", name: "language", options: n, withChevron: !1, defaultSelectedOption: n.find((R) => R.value == this.selectedLanguage), exportparts: "sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label" }, h("span", { key: "4299e684efc7a2024457cfa3ae0ec9ed1312dd6b", slot: "select-icon" }, h("translate-icon", { key: "c6fd888c7c9b2e15b21f7693d8fe17ebe0f511d5", width: "20", height: "20" })))), h("button", { key: "dc1ef92010c142ecdd6c1748c3fe669044af7d61", class: "scheduler-editor-close", title: "logout", onClick: (R) => this.handleSchedulerConfigCloseClicked(R), part: "nse__close-button" }, h("close-icon", { key: "ae4dce679cbcfe0281337407d5303e7378b83669", width: "18", height: "18" }))), h("div", { key: "18dac5e2484e313ba211748be61c17138d31ebf0", class: "scheduler-editor-content", part: "nse__content" }, ((l = (d = this.stores) == null ? void 0 : d.schedulerConfig) == null ? void 0 : l.state.currentUser) && this.stores.schedulerConfig.state.action === null && h("div", { class: "list-configurations", part: "nse__list-configurations" }, h("nylas-list-configurations", { exportparts: "nlc__create-new-cta" })), ((f = (u = this.stores) == null ? void 0 : u.schedulerConfig) == null ? void 0 : f.state.currentUser) && this.stores.schedulerConfig.state.action === "create" && h("nylas-editor-tabs", { mode: "composable" }, h(ExpressFlow, { currentUser: (g = (y = this.stores) == null ? void 0 : y.schedulerConfig) == null ? void 0 : g.state.currentUser, calendars: (w = (p = (m = this.stores) == null ? void 0 : m.schedulerConfig) == null ? void 0 : p.state) == null ? void 0 : w.calendars, selectedConfiguration: (x = (v = (S = this.stores) == null ? void 0 : S.schedulerConfig) == null ? void 0 : v.state) == null ? void 0 : x.selectedConfiguration })), ((A = (_ = this.stores) == null ? void 0 : _.schedulerConfig) == null ? void 0 : A.state.currentUser) && this.stores.schedulerConfig.state.action === "edit" && h("nylas-editor-tabs", { key: t, mode: this.mode }, this.mode === "composable" && h("slot", null), this.mode === "app" && r && h("div", { style: { display: "none" }, slot: "custom-page-style-inputs", key: t }, h("slot", { name: "custom-page-style-inputs" }))), !((T = (U = this.stores) == null ? void 0 : U.schedulerConfig) != null && T.state.currentUser) && h("slot", { name: "login-required" }, h(LoginRequired, { authenticationUrl: this.authenticationUrl }))));
|
|
1433
1450
|
}
|
|
1434
1451
|
get host() {
|
|
1435
1452
|
return getElement(this);
|
|
1436
1453
|
}
|
|
1437
1454
|
static get watchers() {
|
|
1438
1455
|
return {
|
|
1439
|
-
configurationId: ["configurationIdChanged"]
|
|
1456
|
+
configurationId: ["configurationIdChanged"],
|
|
1457
|
+
localization: ["updateLocalization"]
|
|
1440
1458
|
};
|
|
1441
1459
|
}
|
|
1442
1460
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as f, r as G, c as C, d as O, f as D, j as Y, k as J, h as n, H as w, g as K, F as Q } from "./index-
|
|
2
|
-
import { n as z, N as X } from "./index.es-
|
|
3
|
-
import { E as S, C as Z, N as V } from "./scheduler-store-
|
|
4
|
-
import { L as ee,
|
|
5
|
-
import { i as ne, a as ie, c as oe, b as se, f as ae } from "./feedbackSync-
|
|
1
|
+
import { i as f, r as G, c as C, d as O, f as D, j as Y, k as J, h as n, H as w, g as K, F as Q } from "./index-cd93b584.js";
|
|
2
|
+
import { n as z, N as X } from "./index.es-ef72cd61-3075f564.js";
|
|
3
|
+
import { E as S, C as Z, N as V } from "./scheduler-store-8e74959b-ffa0b3c6.js";
|
|
4
|
+
import { L as ee, b as te } from "./constants-91d76d21-1638ead6.js";
|
|
5
|
+
import { i as ne, a as ie, c as oe, b as se, f as ae } from "./feedbackSync-b5d35a5b-20032e5d.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "react-dom";
|
|
8
8
|
class re {
|
|
@@ -79,7 +79,7 @@ const x = (t, e) => {
|
|
|
79
79
|
var o, r;
|
|
80
80
|
O("[nylas-scheduler] Component will load"), this.enableUserFeedback && !ne() && ie({
|
|
81
81
|
dsn: "https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",
|
|
82
|
-
release: "1.3.
|
|
82
|
+
release: "1.3.4",
|
|
83
83
|
integrations: (d) => [
|
|
84
84
|
...d.filter((s) => !1),
|
|
85
85
|
ae({
|
|
@@ -290,7 +290,7 @@ const x = (t, e) => {
|
|
|
290
290
|
captureContext: {
|
|
291
291
|
tags: {
|
|
292
292
|
"nylas-web-element": "nylas-schduling",
|
|
293
|
-
"nylas-web-element-version": "1.3.
|
|
293
|
+
"nylas-web-element-version": "1.3.4"
|
|
294
294
|
},
|
|
295
295
|
extra: {
|
|
296
296
|
configId: this.configurationId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-5611d3d5.cjs"),D=require("./index.es-e9d66a9b-fa36c085.cjs"),B=require("./scheduler-store-3acf4d70-53282ac4.cjs"),N=require("./constants-54af2051-a3596673.cjs"),E=require("./feedbackSync-e5cb0245-013ce5ec.cjs");require("react");require("react-dom");class W{constructor({schedulerAPIURL:t,nylasSchedulerStore:i,sessionId:a,configId:o,slug:r,clientId:d}){if(!t)throw new Error("schedulerAPIURL is required");if(!i)throw new Error("nylasSchedulerStore is required");if(!a&&!o&&!(r||d))throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");t==="/"&&(t=new URL(window.location.href).origin),this.configId=o,this.sessionId=a,this.schedulerAPIURL=t,this.nylasSchedulerStore=i,this.slug=r,this.clientId=d}init(){e.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new B.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const I=(n,t)=>{const i=n.isLoading,a=n.showNotification,o=n.nylasBranding;return e.h(e.Fragment,null,a&&e.h("nylas-notification",null),i&&e.h("div",{class:"loading"},e.h("div",{class:"left"},e.h("div",{class:"skeleton"})),e.h("div",{class:"right"},e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}))),!i&&t,e.h("div",{class:"footer"},o&&e.h("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e.h("span",{class:"sr-only"},"Nylas"),e.h("nylas-logo",{"aria-hidden":!0}))))},M=(n,t)=>e.h("div",{class:"message-banner"},t),$=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0;height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}',G=$,j={title:e.instance.t("genericErrorTitle"),type:D.nr.Error,category:B.ErrorCategory.Component},H=class{constructor(n){e.registerInstance(this,n),this.init=e.createEvent(this,"init",7),this.schedulerWillLoad=e.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=e.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=e.createEvent(this,"nylasSchedulerError",7),this.configSettingsLoaded=e.createEvent(this,"configSettingsLoaded",7),this.bookingRefExtracted=e.createEvent(this,"bookingRefExtracted",7),this.bookedEventInfo=e.createEvent(this,"bookedEventInfo",7),this.mode="app",this.defaultSchedulerState=void 0,this.sessionId=void 0,this.schedulerApiUrl="https://api.us.nylas.com",this.bookingInfo=void 0,this.rescheduleBookingRef=void 0,this.cancelBookingRef=void 0,this.organizerConfirmationBookingRef=void 0,this.configurationId=void 0,this.slug=void 0,this.clientId=void 0,this.nylasBranding=!0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.localization=void 0,this.showNotification=!0,this.enableUserFeedback=!0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||`${e.instance.t("noDateSelected")}`,this.refConfigId=void 0,this.language=navigator.language,this.showFeedbackModal=!1,this.bookingInfoConfirmed=null}connectedCallback(){e.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var o,r;e.debug("[nylas-scheduler] Component will load"),this.enableUserFeedback&&!E.isInitialized()&&E.init({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.3.3",integrations:d=>[...d.filter(s=>!1),E.feedbackSyncIntegration({colorScheme:"system",autoInject:!1})],autoSessionTracking:!1,beforeSend:()=>null});const n=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerWillLoad(n,this.nylasSchedulerConnector),n.defaultPrevented))return;this.stores={scheduler:B.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,...this.defaultSchedulerState})},this.baseProvider=new D.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId;let t;if(this.rescheduleBookingRef){const[d,s,c]=e.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=d,this.stores.scheduler.set("rescheduleBookingId",s),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s})}else if(this.cancelBookingRef){const[d,s,c]=e.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=d,this.stores.scheduler.set("cancelBookingId",s),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s})}else if(this.organizerConfirmationBookingRef){const[d,s,c]=e.compactStringToUUIDs(this.organizerConfirmationBookingRef);this.refConfigId=d,this.stores.scheduler.set("organizerConfirmationBookingId",s),this.stores.scheduler.set("organizerConfirmationSalt",c),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s,salt:c})}if("bookingRefExtracted"in this.eventOverrides&&(await this.eventOverrides.bookingRefExtracted(t,this.nylasSchedulerConnector),t.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;const i=(o=this.baseProvider)==null?void 0:o.getStore("scheduler");this.nylasSchedulerConnector=new W({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:i});const a=this.init.emit(this.host);"init"in this.eventOverrides&&(await this.eventOverrides.init(a,this.nylasSchedulerConnector),a.defaultPrevented)||((r=this.baseProvider)==null||r.componentWillLoad(this.nylasSchedulerConnector),this.applyThemeConfig(this.themeConfig))}async componentDidLoad(){var c,b,m,g,h,f,p,C;(c=this.baseProvider)==null||c.componentDidLoad();const n=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerDidLoad(n,this.nylasSchedulerConnector),n.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;this.localizationChanged(this.localization);const t=await((b=this.nylasSchedulerConnector)==null?void 0:b.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t==null?void 0:t.error)},host:this.host});return}else{"data"in t&&((m=t.data)!=null&&m.appearance)&&console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.");const u=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides&&(await this.eventOverrides.configSettingsLoaded(u,this.nylasSchedulerConnector),u.defaultPrevented))return}const i=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),a=(f=(h=i==null?void 0:i.get("configSettings"))==null?void 0:h.scheduler)==null?void 0:f.available_days_in_future,o=i==null?void 0:i.get("selectedTimeslot");if(o&&(o!=null&&o.start_time)){if(!this.isTimeslotValid(o))return;if(i!=null&&i.get("showBookingForm")){i==null||i.set("selectedDate",o.start_time);return}}const r=i==null?void 0:i.get("selectedDate"),d=i==null?void 0:i.get("availability");let s;if(!(d&&d.length>0)){if(r){const{startTime:u,endTime:v,endTimeForAvailableDaysInFuture:k}=this.validateAvailableDaysInFuture(r,a||30);r.getTime()<k*1e3&&(s=await((C=this.nylasSchedulerConnector)==null?void 0:C.scheduler.getAvailability(u,v)))}else{const u=new Date,{startTime:v,endTime:k,endTimeForAvailableDaysInFuture:T}=this.validateAvailableDaysInFuture(u,a||30);u.getTime()<T*1e3&&(s=await((p=this.nylasSchedulerConnector)==null?void 0:p.scheduler.getAvailability(v,k)))}if((!s||"error"in s)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(s==null?void 0:s.error)},host:this.host}),!r){let u=new Date;const v=i==null?void 0:i.get("availability").find(k=>new Date(k.start_time)>new Date);v&&(u=v.start_time),i==null||i.set("selectedDate",u)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var t;(t=this.stores)==null||t.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("rescheduleBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}cancelBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("cancelBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}organizerConfirmationBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("organizerConfirmationBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}localizationChanged(n){n&&Object.keys(n).forEach(t=>{t in N.LANGUAGE_CODE&&e.instance.addResourceBundle(t,"translation",n[t],!1,!0)})}themeConfigChanged(n){var t,i;(i=(t=this.baseProvider)==null?void 0:t.getStore("scheduler"))==null||i.set("themeConfig",n),this.applyThemeConfig(n)}languageChanged(n){const t=n.detail;this.language=t,e.instance.changeLanguage(t)}async registerComponentHandler(n){var t;(t=this.baseProvider)==null||t.registerComponent(n.detail)}async unregisterComponentHandler(n){var t;(t=this.baseProvider)==null||t.unregisterComponent(n.detail)}async monthChangedHandler(n){var d,s,c,b,m,g,h;const t=n.detail,i=(b=(c=(s=(d=this.nylasSchedulerConnector)==null?void 0:d.schedulerStore)==null?void 0:s.get("configSettings"))==null?void 0:c.scheduler)==null?void 0:b.available_days_in_future,{startTime:a,endTime:o,endTimeForAvailableDaysInFuture:r}=this.validateAvailableDaysInFuture(t,i||30);if(!n.defaultPrevented&&a<r&&t.getTime()<r*1e3){const f=await((m=this.nylasSchedulerConnector)==null?void 0:m.scheduler.getAvailability(a,o));(!f||"error"in f)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(f==null?void 0:f.error)},host:this.host});const p=(g=this.stores)==null?void 0:g.scheduler.get("selectableDates");p&&p.length>0&&((h=this.stores)==null||h.scheduler.set("selectedDate",p[0]))}}mapToBookingData(n){var d,s,c;const t=(d=this.stores)==null?void 0:d.scheduler.get("selectedTimeslot"),i=(s=this.stores)==null?void 0:s.scheduler.get("selectedLanguage"),a=(c=this.stores)==null?void 0:c.scheduler.get("selectedTimezone"),o=t!=null&&t.start_time?new Date(t==null?void 0:t.start_time).getTime()/1e3:"",r=t!=null&&t.end_time?new Date(t==null?void 0:t.end_time).getTime()/1e3:"";return{additional_guests:n.guests,guest:{...n.primaryParticipant},additional_fields:{...n.additionalFields},start_time:o,end_time:r,email_language:i,timezone:a}}async bookButtonClickedHandler(n){var c,b,m,g;if(n.defaultPrevented)return;const t=n.detail,i=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const o=(b=(c=this.nylasSchedulerConnector)==null?void 0:c.schedulerStore)==null?void 0:b.get("rescheduleBookingId");if(o){const h=await((m=this.nylasSchedulerConnector)==null?void 0:m.scheduler.rescheduleBooking(o,t));(!h||"error"in h)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(h==null?void 0:h.error)},host:this.host});const f=h==null?void 0:h.data,p=this.bookedEventInfo.emit({...h,data:{...f,...i}});"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(p,this.nylasSchedulerConnector);return}const r=await((g=this.nylasSchedulerConnector)==null?void 0:g.scheduler.bookTimeslot(t));(!r||"error"in r)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r==null?void 0:r.error)},host:this.host});const d=r==null?void 0:r.data,s=this.bookedEventInfo.emit({...r,data:{...d,...i}});"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(s,this.nylasSchedulerConnector)}dateSelectedHandler(n){const t=n.detail;this.selectedDateLabel=t?t.toLocaleDateString(void 0,{dateStyle:"full"}):`${e.instance.t("noDateSelected")}`}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}confirmBookingErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=!1}feedbackSubmittedHandler(n){const i={eventId:E.captureMessage("Scheduling Page User Feedback"),message:n.detail.feedback};E.captureFeedback(i,{includeReplay:!0,captureContext:{tags:{"nylas-web-element":"nylas-schduling","nylas-web-element-version":"1.3.3"},extra:{configId:this.configurationId,slug:this.slug}}}),this.showFeedbackModal=!1}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||j.title,category:(n==null?void 0:n.category)||j.category,type:D.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let n="";return this.sessionId||(n+=e.instance.t("sessionIdRequiredErrorMessage")),!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)&&(n=e.instance.t("sessionIdRequiredErrorMessage")+" "+e.instance.t("publicConfigErrorMessage")),this.nylasSchedulerError.emit({notification:{title:e.instance.t("schedulingComponentErrorTitle"),category:B.ErrorCategory.Component,type:D.nr.Error,description:n,id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1}return!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({notification:{title:e.instance.t("invalidTimeslotErrorTitle"),category:B.ErrorCategory.Component,type:D.nr.Error,description:e.instance.t("invalidTimeslotErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}validateAvailableDaysInFuture(n,t){const i=new Date,a=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,o=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,r=Math.floor(e.addDaysToCurrentDate(i,t).getTime()/1e3),d=Math.min(r,o);return{startTime:a<i.getTime()/1e3?Math.floor(i.getTime()/1e3):a,endTime:d,endTimeForAvailableDaysInFuture:r}}applyThemeConfig(n){if(n)for(const[t,i]of Object.entries(n))this.host.style.setProperty(`${t}`,i)}onFeedbackClick(n){n.preventDefault(),this.showFeedbackModal=!0}redirectToCustomUrl(n){window.location.assign(n)}render(){var p,C,u,v,k,T,S,z,O,R;const n=this.mode==="app",t=(p=this.baseProvider)==null?void 0:p.getStore("scheduler"),i=t==null?void 0:t.get("eventInfo"),a=t==null?void 0:t.get("showBookingForm"),o=t==null?void 0:t.get("cancelledEventInfo"),r=t==null?void 0:t.get("cancelBookingId"),d=t==null?void 0:t.get("selectedTimeslot"),s=t==null?void 0:t.get("rescheduleBookingId"),c=t==null?void 0:t.get("organizerConfirmationBookingId"),b=t==null?void 0:t.get("rejectBookingId"),m=t==null?void 0:t.get("confirmedEventInfo"),g=(t==null?void 0:t.get("nylasBranding"))||this.nylasBranding,h=t==null?void 0:t.get("selectedDate"),f=(u=(C=t==null?void 0:t.get("configSettings"))==null?void 0:C.scheduler)==null?void 0:u.confirmation_redirect_url;if(this.selectedDateLabel=h&&this.language?e.capitalizeFirstLetter(h.toLocaleDateString(N.LANGUAGE_CODE_MAP[this.language],{dateStyle:"full"})):`${e.instance.t("noDateSelected")}`,n&&(r||b)&&!o)return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e.h("nylas-cancel-booking-form",{selectedTimeslot:d,cancelBookingId:r,rejectBookingId:b,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&c)return e.h(e.Host,null,e.h(I,null,e.h("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e.h("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:c,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&o)return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e.h("nylas-cancelled-event-card",{cancelledEventInfo:o,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&m)return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e.h("nylas-confirmed-event-card",{confirmedEventInfo:m,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&i&&f){const l=(v=this.bookingInfoConfirmed)==null?void 0:v.primaryParticipant,w=((k=this.bookingInfoConfirmed)==null?void 0:k.additionalFields)||{};if(this.bookingInfo&&typeof((T=this.bookingInfo)==null?void 0:T.additionalFields)<"u"){const x=this.bookingInfo.additionalFields;Object.keys(x).forEach(L=>{!w[L]&&(x!=null&&x[L])&&(w[L]=x[L].value)})}const _=(S=this.stores)==null?void 0:S.scheduler.get("selectedTimeslot"),P=(z=this.stores)==null?void 0:z.scheduler.get("selectedTimezone"),U=(O=this.stores)==null?void 0:O.scheduler.get("selectedLanguage"),F=(R=this.stores)==null?void 0:R.scheduler.get("configSettings"),A=this.configurationId?this.configurationId:F==null?void 0:F.configuration_id,q=window.location.search,y=new URLSearchParams(q);y.set("booking_id",i.booking_id),l!=null&&l.name&&y.set("name",l.name),l!=null&&l.email&&y.set("email",l.email),_!=null&&_.start_time&&y.set("start_time",(new Date(_.start_time).getTime()/1e3).toString()),_!=null&&_.end_time&&y.set("end_time",(new Date(_.end_time).getTime()/1e3).toString()),P&&y.set("tz",P),U&&y.set("language",U),w&&y.set("additional_values",JSON.stringify(w)),this.slug&&y.set("page_slug",this.slug),A&&y.set("config_id",A),this.redirectToCustomUrl(`${f}?${y.toString()}`);return}if(n&&i)return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"booked-event-page",part:"booked-event-page"},e.h("nylas-booked-event-card",{selectedTimeslot:d,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&(!i||s)&&!a){const l=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},s&&e.h(M,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"select-date-page",part:"select-date-page"},e.h("div",{class:"left-panel"},e.h("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e.h("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e.h("div",{class:`right-panel ${s?"reschedule":""}`},e.h("h2",null,e.h("calendar-icon",null),e.h("span",{id:"selectedDate"},this.selectedDateLabel)),e.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},l&&e.h("span",{slot:"timeslot-picker-cta-label"},e.h("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:w=>this.onFeedbackClick(w)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null))}return n&&!i&&a?e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},s&&e.h(M,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"additional-data-page",part:"additional-data-page"},e.h("div",{class:"left-panel"},e.h("div",{class:"wrapper"},e.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e.h("div",{class:`right-panel ${s?"reschedule":""}`},e.h("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null)):e.h(e.Host,null,e.h("slot",null))}get host(){return e.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],themeConfig:["themeConfigChanged"]}}};H.style=G;exports.nylas_scheduling=H;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-94416062.cjs"),D=require("./index.es-ef72cd61-0860521c.cjs"),B=require("./scheduler-store-8e74959b-c8514d9a.cjs"),N=require("./constants-91d76d21-0f7c85cc.cjs"),E=require("./feedbackSync-b5d35a5b-1343e33b.cjs");require("react");require("react-dom");class W{constructor({schedulerAPIURL:t,nylasSchedulerStore:i,sessionId:a,configId:o,slug:r,clientId:d}){if(!t)throw new Error("schedulerAPIURL is required");if(!i)throw new Error("nylasSchedulerStore is required");if(!a&&!o&&!(r||d))throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");t==="/"&&(t=new URL(window.location.href).origin),this.configId=o,this.sessionId=a,this.schedulerAPIURL=t,this.nylasSchedulerStore=i,this.slug=r,this.clientId=d}init(){e.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new B.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const I=(n,t)=>{const i=n.isLoading,a=n.showNotification,o=n.nylasBranding;return e.h(e.Fragment,null,a&&e.h("nylas-notification",null),i&&e.h("div",{class:"loading"},e.h("div",{class:"left"},e.h("div",{class:"skeleton"})),e.h("div",{class:"right"},e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}))),!i&&t,e.h("div",{class:"footer"},o&&e.h("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e.h("span",{class:"sr-only"},"Nylas"),e.h("nylas-logo",{"aria-hidden":!0}))))},M=(n,t)=>e.h("div",{class:"message-banner"},t),$=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0;height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}',G=$,j={title:e.instance.t("genericErrorTitle"),type:D.nr.Error,category:B.ErrorCategory.Component},H=class{constructor(n){e.registerInstance(this,n),this.init=e.createEvent(this,"init",7),this.schedulerWillLoad=e.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=e.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=e.createEvent(this,"nylasSchedulerError",7),this.configSettingsLoaded=e.createEvent(this,"configSettingsLoaded",7),this.bookingRefExtracted=e.createEvent(this,"bookingRefExtracted",7),this.bookedEventInfo=e.createEvent(this,"bookedEventInfo",7),this.mode="app",this.defaultSchedulerState=void 0,this.sessionId=void 0,this.schedulerApiUrl="https://api.us.nylas.com",this.bookingInfo=void 0,this.rescheduleBookingRef=void 0,this.cancelBookingRef=void 0,this.organizerConfirmationBookingRef=void 0,this.configurationId=void 0,this.slug=void 0,this.clientId=void 0,this.nylasBranding=!0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.localization=void 0,this.showNotification=!0,this.enableUserFeedback=!0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||`${e.instance.t("noDateSelected")}`,this.refConfigId=void 0,this.language=navigator.language,this.showFeedbackModal=!1,this.bookingInfoConfirmed=null}connectedCallback(){e.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var o,r;e.debug("[nylas-scheduler] Component will load"),this.enableUserFeedback&&!E.isInitialized()&&E.init({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.3.4",integrations:d=>[...d.filter(s=>!1),E.feedbackSyncIntegration({colorScheme:"system",autoInject:!1})],autoSessionTracking:!1,beforeSend:()=>null});const n=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerWillLoad(n,this.nylasSchedulerConnector),n.defaultPrevented))return;this.stores={scheduler:B.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,...this.defaultSchedulerState})},this.baseProvider=new D.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId;let t;if(this.rescheduleBookingRef){const[d,s,c]=e.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=d,this.stores.scheduler.set("rescheduleBookingId",s),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s})}else if(this.cancelBookingRef){const[d,s,c]=e.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=d,this.stores.scheduler.set("cancelBookingId",s),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s})}else if(this.organizerConfirmationBookingRef){const[d,s,c]=e.compactStringToUUIDs(this.organizerConfirmationBookingRef);this.refConfigId=d,this.stores.scheduler.set("organizerConfirmationBookingId",s),this.stores.scheduler.set("organizerConfirmationSalt",c),t=this.bookingRefExtracted.emit({configurationId:d,bookingId:s,salt:c})}if("bookingRefExtracted"in this.eventOverrides&&(await this.eventOverrides.bookingRefExtracted(t,this.nylasSchedulerConnector),t.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;const i=(o=this.baseProvider)==null?void 0:o.getStore("scheduler");this.nylasSchedulerConnector=new W({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:i});const a=this.init.emit(this.host);"init"in this.eventOverrides&&(await this.eventOverrides.init(a,this.nylasSchedulerConnector),a.defaultPrevented)||((r=this.baseProvider)==null||r.componentWillLoad(this.nylasSchedulerConnector),this.applyThemeConfig(this.themeConfig))}async componentDidLoad(){var c,b,m,g,h,f,p,C;(c=this.baseProvider)==null||c.componentDidLoad();const n=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerDidLoad(n,this.nylasSchedulerConnector),n.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;this.localizationChanged(this.localization);const t=await((b=this.nylasSchedulerConnector)==null?void 0:b.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t==null?void 0:t.error)},host:this.host});return}else{"data"in t&&((m=t.data)!=null&&m.appearance)&&console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.");const u=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides&&(await this.eventOverrides.configSettingsLoaded(u,this.nylasSchedulerConnector),u.defaultPrevented))return}const i=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),a=(f=(h=i==null?void 0:i.get("configSettings"))==null?void 0:h.scheduler)==null?void 0:f.available_days_in_future,o=i==null?void 0:i.get("selectedTimeslot");if(o&&(o!=null&&o.start_time)){if(!this.isTimeslotValid(o))return;if(i!=null&&i.get("showBookingForm")){i==null||i.set("selectedDate",o.start_time);return}}const r=i==null?void 0:i.get("selectedDate"),d=i==null?void 0:i.get("availability");let s;if(!(d&&d.length>0)){if(r){const{startTime:u,endTime:v,endTimeForAvailableDaysInFuture:k}=this.validateAvailableDaysInFuture(r,a||30);r.getTime()<k*1e3&&(s=await((C=this.nylasSchedulerConnector)==null?void 0:C.scheduler.getAvailability(u,v)))}else{const u=new Date,{startTime:v,endTime:k,endTimeForAvailableDaysInFuture:T}=this.validateAvailableDaysInFuture(u,a||30);u.getTime()<T*1e3&&(s=await((p=this.nylasSchedulerConnector)==null?void 0:p.scheduler.getAvailability(v,k)))}if((!s||"error"in s)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(s==null?void 0:s.error)},host:this.host}),!r){let u=new Date;const v=i==null?void 0:i.get("availability").find(k=>new Date(k.start_time)>new Date);v&&(u=v.start_time),i==null||i.set("selectedDate",u)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var t;(t=this.stores)==null||t.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("rescheduleBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}cancelBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("cancelBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}organizerConfirmationBookingRefChanged(n){var t,i;if(n){const[a,o]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("organizerConfirmationBookingId",o),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}localizationChanged(n){n&&Object.keys(n).forEach(t=>{t in N.LANGUAGE_CODE&&e.instance.addResourceBundle(t,"translation",n[t],!1,!0)})}themeConfigChanged(n){var t,i;(i=(t=this.baseProvider)==null?void 0:t.getStore("scheduler"))==null||i.set("themeConfig",n),this.applyThemeConfig(n)}languageChanged(n){const t=n.detail;this.language=t,e.instance.changeLanguage(t)}async registerComponentHandler(n){var t;(t=this.baseProvider)==null||t.registerComponent(n.detail)}async unregisterComponentHandler(n){var t;(t=this.baseProvider)==null||t.unregisterComponent(n.detail)}async monthChangedHandler(n){var d,s,c,b,m,g,h;const t=n.detail,i=(b=(c=(s=(d=this.nylasSchedulerConnector)==null?void 0:d.schedulerStore)==null?void 0:s.get("configSettings"))==null?void 0:c.scheduler)==null?void 0:b.available_days_in_future,{startTime:a,endTime:o,endTimeForAvailableDaysInFuture:r}=this.validateAvailableDaysInFuture(t,i||30);if(!n.defaultPrevented&&a<r&&t.getTime()<r*1e3){const f=await((m=this.nylasSchedulerConnector)==null?void 0:m.scheduler.getAvailability(a,o));(!f||"error"in f)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(f==null?void 0:f.error)},host:this.host});const p=(g=this.stores)==null?void 0:g.scheduler.get("selectableDates");p&&p.length>0&&((h=this.stores)==null||h.scheduler.set("selectedDate",p[0]))}}mapToBookingData(n){var d,s,c;const t=(d=this.stores)==null?void 0:d.scheduler.get("selectedTimeslot"),i=(s=this.stores)==null?void 0:s.scheduler.get("selectedLanguage"),a=(c=this.stores)==null?void 0:c.scheduler.get("selectedTimezone"),o=t!=null&&t.start_time?new Date(t==null?void 0:t.start_time).getTime()/1e3:"",r=t!=null&&t.end_time?new Date(t==null?void 0:t.end_time).getTime()/1e3:"";return{additional_guests:n.guests,guest:{...n.primaryParticipant},additional_fields:{...n.additionalFields},start_time:o,end_time:r,email_language:i,timezone:a}}async bookButtonClickedHandler(n){var c,b,m,g;if(n.defaultPrevented)return;const t=n.detail,i=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const o=(b=(c=this.nylasSchedulerConnector)==null?void 0:c.schedulerStore)==null?void 0:b.get("rescheduleBookingId");if(o){const h=await((m=this.nylasSchedulerConnector)==null?void 0:m.scheduler.rescheduleBooking(o,t));(!h||"error"in h)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(h==null?void 0:h.error)},host:this.host});const f=h==null?void 0:h.data,p=this.bookedEventInfo.emit({...h,data:{...f,...i}});"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(p,this.nylasSchedulerConnector);return}const r=await((g=this.nylasSchedulerConnector)==null?void 0:g.scheduler.bookTimeslot(t));(!r||"error"in r)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r==null?void 0:r.error)},host:this.host});const d=r==null?void 0:r.data,s=this.bookedEventInfo.emit({...r,data:{...d,...i}});"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(s,this.nylasSchedulerConnector)}dateSelectedHandler(n){const t=n.detail;this.selectedDateLabel=t?t.toLocaleDateString(void 0,{dateStyle:"full"}):`${e.instance.t("noDateSelected")}`}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}confirmBookingErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=!1}feedbackSubmittedHandler(n){const i={eventId:E.captureMessage("Scheduling Page User Feedback"),message:n.detail.feedback};E.captureFeedback(i,{includeReplay:!0,captureContext:{tags:{"nylas-web-element":"nylas-schduling","nylas-web-element-version":"1.3.4"},extra:{configId:this.configurationId,slug:this.slug}}}),this.showFeedbackModal=!1}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||j.title,category:(n==null?void 0:n.category)||j.category,type:D.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let n="";return this.sessionId||(n+=e.instance.t("sessionIdRequiredErrorMessage")),!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)&&(n=e.instance.t("sessionIdRequiredErrorMessage")+" "+e.instance.t("publicConfigErrorMessage")),this.nylasSchedulerError.emit({notification:{title:e.instance.t("schedulingComponentErrorTitle"),category:B.ErrorCategory.Component,type:D.nr.Error,description:n,id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1}return!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({notification:{title:e.instance.t("invalidTimeslotErrorTitle"),category:B.ErrorCategory.Component,type:D.nr.Error,description:e.instance.t("invalidTimeslotErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}validateAvailableDaysInFuture(n,t){const i=new Date,a=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,o=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,r=Math.floor(e.addDaysToCurrentDate(i,t).getTime()/1e3),d=Math.min(r,o);return{startTime:a<i.getTime()/1e3?Math.floor(i.getTime()/1e3):a,endTime:d,endTimeForAvailableDaysInFuture:r}}applyThemeConfig(n){if(n)for(const[t,i]of Object.entries(n))this.host.style.setProperty(`${t}`,i)}onFeedbackClick(n){n.preventDefault(),this.showFeedbackModal=!0}redirectToCustomUrl(n){window.location.assign(n)}render(){var p,C,u,v,k,T,S,z,O,R;const n=this.mode==="app",t=(p=this.baseProvider)==null?void 0:p.getStore("scheduler"),i=t==null?void 0:t.get("eventInfo"),a=t==null?void 0:t.get("showBookingForm"),o=t==null?void 0:t.get("cancelledEventInfo"),r=t==null?void 0:t.get("cancelBookingId"),d=t==null?void 0:t.get("selectedTimeslot"),s=t==null?void 0:t.get("rescheduleBookingId"),c=t==null?void 0:t.get("organizerConfirmationBookingId"),b=t==null?void 0:t.get("rejectBookingId"),m=t==null?void 0:t.get("confirmedEventInfo"),g=(t==null?void 0:t.get("nylasBranding"))||this.nylasBranding,h=t==null?void 0:t.get("selectedDate"),f=(u=(C=t==null?void 0:t.get("configSettings"))==null?void 0:C.scheduler)==null?void 0:u.confirmation_redirect_url;if(this.selectedDateLabel=h&&this.language?e.capitalizeFirstLetter(h.toLocaleDateString(N.LANGUAGE_CODE_MAP[this.language],{dateStyle:"full"})):`${e.instance.t("noDateSelected")}`,n&&(r||b)&&!o)return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e.h("nylas-cancel-booking-form",{selectedTimeslot:d,cancelBookingId:r,rejectBookingId:b,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&c)return e.h(e.Host,null,e.h(I,null,e.h("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e.h("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:c,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&o)return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e.h("nylas-cancelled-event-card",{cancelledEventInfo:o,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&m)return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e.h("nylas-confirmed-event-card",{confirmedEventInfo:m,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&i&&f){const l=(v=this.bookingInfoConfirmed)==null?void 0:v.primaryParticipant,w=((k=this.bookingInfoConfirmed)==null?void 0:k.additionalFields)||{};if(this.bookingInfo&&typeof((T=this.bookingInfo)==null?void 0:T.additionalFields)<"u"){const x=this.bookingInfo.additionalFields;Object.keys(x).forEach(L=>{!w[L]&&(x!=null&&x[L])&&(w[L]=x[L].value)})}const _=(S=this.stores)==null?void 0:S.scheduler.get("selectedTimeslot"),P=(z=this.stores)==null?void 0:z.scheduler.get("selectedTimezone"),U=(O=this.stores)==null?void 0:O.scheduler.get("selectedLanguage"),F=(R=this.stores)==null?void 0:R.scheduler.get("configSettings"),A=this.configurationId?this.configurationId:F==null?void 0:F.configuration_id,q=window.location.search,y=new URLSearchParams(q);y.set("booking_id",i.booking_id),l!=null&&l.name&&y.set("name",l.name),l!=null&&l.email&&y.set("email",l.email),_!=null&&_.start_time&&y.set("start_time",(new Date(_.start_time).getTime()/1e3).toString()),_!=null&&_.end_time&&y.set("end_time",(new Date(_.end_time).getTime()/1e3).toString()),P&&y.set("tz",P),U&&y.set("language",U),w&&y.set("additional_values",JSON.stringify(w)),this.slug&&y.set("page_slug",this.slug),A&&y.set("config_id",A),this.redirectToCustomUrl(`${f}?${y.toString()}`);return}if(n&&i)return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"booked-event-page",part:"booked-event-page"},e.h("nylas-booked-event-card",{selectedTimeslot:d,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&(!i||s)&&!a){const l=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},s&&e.h(M,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"select-date-page",part:"select-date-page"},e.h("div",{class:"left-panel"},e.h("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e.h("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e.h("div",{class:`right-panel ${s?"reschedule":""}`},e.h("h2",null,e.h("calendar-icon",null),e.h("span",{id:"selectedDate"},this.selectedDateLabel)),e.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},l&&e.h("span",{slot:"timeslot-picker-cta-label"},e.h("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:w=>this.onFeedbackClick(w)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null))}return n&&!i&&a?e.h(e.Host,null,e.h(I,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},s&&e.h(M,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"additional-data-page",part:"additional-data-page"},e.h("div",{class:"left-panel"},e.h("div",{class:"wrapper"},e.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e.h("div",{class:`right-panel ${s?"reschedule":""}`},e.h("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:l=>this.onFeedbackClick(l)},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null)):e.h(e.Host,null,e.h("slot",null))}get host(){return e.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],themeConfig:["themeConfigChanged"]}}};H.style=G;exports.nylas_scheduling=H;
|