@nylas/web-elements 2.3.0 → 2.3.1-canary-20260108155205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +1 -1
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +4941 -4925
  3. package/dist/cjs/google-logo-icon_6.cjs.entry.js +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js +8 -0
  6. package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js.map +1 -1
  7. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +1 -1
  8. package/dist/cjs/nylas-scheduling.cjs.entry.js +16 -3
  9. package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
  10. package/dist/cjs/nylas-scheduling.entry.cjs.js.map +1 -1
  11. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  12. package/dist/cjs/{version-DOUE1CF3.js → version-BIKhGgjH.js} +3 -3
  13. package/dist/cjs/{version-DOUE1CF3.js.map → version-BIKhGgjH.js.map} +1 -1
  14. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js +10 -0
  15. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -1
  16. package/dist/collection/connector/shared/api/scheduler.js +18 -2
  17. package/dist/collection/connector/shared/api/scheduler.js.map +1 -1
  18. package/dist/collection/version.js +1 -1
  19. package/dist/collection/version.js.map +1 -1
  20. package/dist/components/nylas-editor-tabs-group.js +1 -1
  21. package/dist/components/nylas-editor-tabs.js +1 -1
  22. package/dist/components/nylas-scheduler-editor.js +3 -3
  23. package/dist/components/nylas-scheduling.js +18 -5
  24. package/dist/components/nylas-scheduling.js.map +1 -1
  25. package/dist/components/nylas-timeslot-picker.js +1 -1
  26. package/dist/components/{p-Yb-Jmnhb.js → p-CUriRAxu.js} +3 -3
  27. package/dist/components/{p-Yb-Jmnhb.js.map → p-CUriRAxu.js.map} +1 -1
  28. package/dist/components/{p-ne-_OsQh.js → p-D_fU0kvl.js} +11 -2
  29. package/dist/components/p-D_fU0kvl.js.map +1 -0
  30. package/dist/components/{p-OF14LJnh.js → p-DkfG_oE2.js} +3 -3
  31. package/dist/components/{p-OF14LJnh.js.map → p-DkfG_oE2.js.map} +1 -1
  32. package/dist/components/{p-rnP3lTjZ.js → p-DzM_DEIH.js} +3 -3
  33. package/dist/components/{p-rnP3lTjZ.js.map → p-DzM_DEIH.js.map} +1 -1
  34. package/dist/esm/google-logo-icon_6.entry.js +1 -1
  35. package/dist/esm/loader.js +1 -1
  36. package/dist/esm/nylas-booked-event-card_11.entry.js +8 -0
  37. package/dist/esm/nylas-booked-event-card_11.entry.js.map +1 -1
  38. package/dist/esm/nylas-scheduler-editor.entry.js +1 -1
  39. package/dist/esm/nylas-scheduling.entry.js +17 -4
  40. package/dist/esm/nylas-scheduling.entry.js.map +1 -1
  41. package/dist/esm/nylas-web-elements.js +1 -1
  42. package/dist/esm/{version-Vj35JRt4.js → version-CXFvcHg5.js} +3 -3
  43. package/dist/esm/{version-Vj35JRt4.js.map → version-CXFvcHg5.js.map} +1 -1
  44. package/dist/nylas-web-elements/nylas-scheduling.entry.esm.js.map +1 -1
  45. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  46. package/dist/nylas-web-elements/{p-2f3336a6.entry.js → p-15e67701.entry.js} +2 -2
  47. package/dist/nylas-web-elements/p-3a989daf.entry.js +2 -0
  48. package/dist/nylas-web-elements/p-3a989daf.entry.js.map +1 -0
  49. package/dist/nylas-web-elements/{p-5ae85f94.entry.js → p-544c4297.entry.js} +2 -2
  50. package/dist/nylas-web-elements/p-544c4297.entry.js.map +1 -0
  51. package/dist/nylas-web-elements/{p-5eb93f5b.entry.js → p-60fb00a8.entry.js} +2 -2
  52. package/dist/nylas-web-elements/p-CXFvcHg5.js +2 -0
  53. package/dist/nylas-web-elements/{p-Vj35JRt4.js.map → p-CXFvcHg5.js.map} +1 -1
  54. package/dist/types/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.d.ts +1 -0
  55. package/dist/types/connector/shared/api/scheduler.d.ts +1 -1
  56. package/dist/types/version.d.ts +1 -1
  57. package/package.json +1 -1
  58. package/dist/components/p-ne-_OsQh.js.map +0 -1
  59. package/dist/nylas-web-elements/p-5ae85f94.entry.js.map +0 -1
  60. package/dist/nylas-web-elements/p-Vj35JRt4.js +0 -2
  61. package/dist/nylas-web-elements/p-f32db1ab.entry.js +0 -2
  62. package/dist/nylas-web-elements/p-f32db1ab.entry.js.map +0 -1
  63. /package/dist/nylas-web-elements/{p-2f3336a6.entry.js.map → p-15e67701.entry.js.map} +0 -0
  64. /package/dist/nylas-web-elements/{p-5eb93f5b.entry.js.map → p-60fb00a8.entry.js.map} +0 -0
@@ -1,2 +0,0 @@
1
- import{h as e,F as t,r as n,c as i,H as s,a as o}from"./p-0EQQA0nE.js";import{N as a}from"./p-BS9pAWHt.js";import{i as r,c as l,a as c,f as d,h}from"./p-D7AODx4L.js";import{E as g,i as f,a as u,f as p,c as m,b}from"./p-CquJ7U5v.js";import{v as _,u as y}from"./p-Vj35JRt4.js";import{c as w}from"./p-_i6H-yQH.js";import{L as v,a as k}from"./p-COJy29df.js";class I{constructor(){this.component=e=>{const t=g.Component;const n=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:n,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:n,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:n,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:n,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:n,message:e,category:t}),no_salt:(e="No salt provided")=>({title:n,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:n,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:n,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:n,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:n,message:e,category:t})}};this.api=e=>{const t=g.Api;const n=`${e} Error`;return{invalid_session:e=>({title:n,message:e,category:t}),general_error:e=>({title:n,message:e,category:t}),internal_error:e=>({title:n,message:e,category:t}),invalid_request_error:e=>({title:n,message:e,category:t}),timeslot_not_available:e=>({title:n,message:e,category:t}),provider_error:e=>({title:n,message:e,category:t}),not_found_error:e=>({title:n,message:e,category:t})}}}}class x{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){this.errors=new I;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=n;this.configId=i;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,n,i={}){try{const s=new URL(this.schedulerAPIURL);s.pathname=e;const o=await fetch(decodeURIComponent(s.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":_,...this.clientId&&{"X-Nylas-Application-Public-Id":this.clientId},...i},body:n});const a=await o.json();return a}catch(e){return{error:{message:e.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){let t=e?.message||e?.title||"Something went wrong";if(e?.type==="provider_error"){t=e?.provider_error?.error?.message||e?.provider_error?.error?.title||"Something went wrong"}return t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e);this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e);r.changeLanguage(e)}async toggleAdditionalData(e){if(!e){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date;const t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const n=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(n,i);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const n=this.schedulerStore.get("availability").find((e=>new Date(e.start_time)>new Date));let i=e;if(n){i=n.start_time}this.schedulerStore.set("selectedDate",i);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return t}async setReschedule(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.state.eventInfo;if(t){this.schedulerStore.set("reschedulingEventInfo",t)}this.schedulerStore.set("rescheduleBookingId",e);await this.getUISettings();const n=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return n}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return e}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return e}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:t,selectedTimezone:n,bookingInfo:i,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!i){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:n;const l=s||"en-US";if(!a){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timezone_selected()}}const c=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(i?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:i?.primaryParticipant;const u=e?e?.guests||[]:i?.guests||[];const p=e?e?.additionalFields:g;const m=this.getHeaders();const b=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const _=`/v3/scheduling/bookings${b}`;if(c.length===0){const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,event_id:o?.event_id||undefined,master_id:o?.master_id||undefined,calendar_id:o?.calendar_id||undefined,email_language:this.getTwoLetterLanguageCode(l)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(c.length>0){d=c.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({participants:d?[{email:d}]:undefined,additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(l)}),m);if("data"in e){this.schedulerStore.set("isLoading",false);this.schedulerStore.set("eventInfo",e?.data);return e}else if(e.error?.message?.startsWith("The selected timeslot is unavailable")){continue}else{this.schedulerStore.set("isLoading",false);const t=e.error?.type;let n=e.error;if(t&&t in this.errors.api(r.t("createBookingErrorTitle"))){const e=this.getErrorMessage(n);n=this.errors.api(r.t("createBookingErrorTitle"))[t](e)}return{error:n}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(r.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.get("rescheduleBookingId");const t=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(e&&!!n){n+=`&booking_id=${e}`}else if(e){n+=`?booking_id=${e}`}const i=`/v3/scheduling/ui-settings${n}`;const s=await this.makeAPIRequest(i,"GET",undefined,t);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("getUISettingErrorTitle"))){t=this.errors.api(r.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in s){this.schedulerStore.set("configSettings",s.data);this.clientId=s.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return s}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const n=t?.min_booking_notice;if(!n){return e}const i=(new Date).getTime();if(e<(i+n*60*1e3)/1e3){return Math.floor((i+n*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const n=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const i=Math.floor(l(t,n).getTime()/1e3);const s=Math.min(i,e);return s}async getAvailability(e=0,t=0){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const i=new Date;const s=i.getTime();if(t&&t<s/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(r.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const o=this.getStartTimeWithMinBookingNotice(e);e=o;t=o>t?o+1:t;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(t.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const a=this.schedulerStore.get("rescheduleBookingId");if(a){n.append("booking_id",encodeURIComponent(a))}const l=n.toString();const c=`/v3/scheduling/availability${l?`?${l}`:""}`;const d=this.getHeaders();const h=await this.makeAPIRequest(decodeURIComponent(c),"GET",undefined,d);if("error"in h){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=h.error?.type;let t=h.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=r.t("invalidGrantError");return{error:{title:r.t("invalidGrantErrorTitle"),message:e,category:g.Api}}}if(e&&e in this.errors.api(r.t("getAvailabilityErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("getAvailabilityErrorTitle"))[e](n)}return{error:t}}if("data"in h){const e=h.data?.time_slots?.map((e=>({...e,start_time:new Date(e.start_time*1e3),end_time:new Date(e.end_time*1e3)})))||[];const t=e.filter((e=>e.start_time.getTime()>s));const n=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",n);const i=h.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",i)}this.schedulerStore.set("isLoading",false);return h}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("cancelBookingErrorTitle")).no_booking_id()}}const n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const i=`/v3/scheduling/bookings/${e}${n}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),s);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(r.t("cancelBookingErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("cancelBookingErrorTitle"))[e](n)}return{error:t}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return o}async rescheduleBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("rescheduleBookingErrorTitle")).no_booking_id()}}const n=this.errors.api(r.t("rescheduleBookingErrorTitle"));const i=this.errors.component(r.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:l}=this.schedulerStore.state;const{startTime:c,endTime:d,timezone:h}=t;const g=c||o?.start_time;if(!g){return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=this.schedulerStore.get("availabilityOrderEmails");let p="";if(u.length>0){const e=o?.emails||[];for(let t=0;t<u.length;t++){if(e.includes(u[t])){p=u[t];break}}}const m=h||a;if(!m){return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const _=o?.master_id||undefined;const y=o?.calendar_id||undefined;const w={};Object.entries(s?.additionalFields||{}).forEach((([e,t])=>{w[e]=t.value}));const v=t?t?.primaryParticipant:s?.primaryParticipant;const k=t?t?.guests||[]:s?.guests||[];const I=t?t?.additionalFields:w;const x=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const T=`/v3/scheduling/bookings/${e}${x}`;const C=this.getHeaders();const E=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:f.getTime()/1e3,timezone:m,additional_fields:I,guest:{...v},additional_guests:k,participants:p?[{email:p}]:undefined,email_language:this.getTwoLetterLanguageCode(l),event_id:b,master_id:_,calendar_id:y}),C);if("error"in E){this.schedulerStore.set("isLoading",false);const e=E.error?.type;let t=E.error;if(e&&e in n){const i=this.getErrorMessage(t);t=n[e](i)}return{error:t}}const S=this.schedulerStore.get("reschedulingEventInfo");if("data"in E){this.schedulerStore.set("eventInfo",E?.data)}else if(S){this.schedulerStore.set("eventInfo",S)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("isLoading",false);return E}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:n,reason:i}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=n==="confirmed"?r.t("confirmBookingErrorTitle"):r.t("rejectBookingErrorTitle");if(!t){return{error:this.errors.component(o).no_booking_id()}}if(!s){return{error:this.errors.component(o).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const l=`/v3/scheduling/bookings/${t}${a}`;const c=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(l),"PUT",JSON.stringify({status:n,cancellation_reason:i,salt:s}),c);if("error"in d){this.schedulerStore.set("isLoading",false);const e=d.error?.type;let t=d.error;if(e&&e in this.errors.api(o)){const n=this.getErrorMessage(t);t=this.errors.api(o)[e](n)}return{error:t}}if("data"in d&&n==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&n==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:t})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return d}async validateGroupEventTimeslot(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("configSettings")?.configuration_id;if(!t){return{error:this.errors.component(r.t("validateTimeslotErrorTitle")).no_config_id()}}const n=this.getHeaders();const i=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(i),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),n);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("validateTimeslotErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("validateTimeslotErrorTitle"))[e](n)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class T{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!n&&!i&&!(s||o)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=i;this.sessionId=n;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){c("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new x({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId});return this._schedulerAPIConnector}resetStores(){this.nylasSchedulerStore.reset()}}function C(e={}){const t={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...e};c(`[defaultNylasStoreState]: `,t);const n=w(t);n.onChange("availability",(e=>{c(`[availability]: `,e);const t=e.map((e=>e.start_time));c(`[selectableDates]: `,t);n.set("selectableDates",t);const i=e[0];if(!i)return;const s=Math.floor((i.end_time.getTime()-i.start_time.getTime())/6e4);c(`[durationMinutes]: `,s);n.set("eventDuration",s)}));n.reset=()=>{for(const e in t){const i=t[e];n.set(e,i)}};return n}const E=(n,i)=>{const s=n.isLoading;const o=n.showNotification;const a=n.nylasBranding;const r=n.version;return e(t,null,o&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&i,e("div",{class:"footer"},a&&e("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("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true})),e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},r))))};const S=(t,n)=>e("div",{class:"message-banner"},n);const B=':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-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--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-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;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{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;border-left:none}}.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;gap:8px;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}.language-feedback-container{width:auto;position:absolute;bottom:4px;left:16px;display:flex;gap:8px;align-items:center}.language-feedback-container button-component#report-issue{position:initial}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}';const L={title:r.t("genericErrorTitle"),category:g.Component};const D=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.schedulerWillLoad=i(this,"schedulerWillLoad",7);this.schedulerDidLoad=i(this,"schedulerDidLoad",7);this.nylasSchedulerError=i(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=i(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=i(this,"configSettingsLoaded",7);this.bookingRefExtracted=i(this,"bookingRefExtracted",7);this.bookedEventInfo=i(this,"bookedEventInfo",7);this.mode="app";this.schedulerApiUrl="https://api.us.nylas.com";this.nylasBranding=true;this.eventOverrides={};this.showNotification=true;this.enableUserFeedback=true;this.automaticComponentRegistration=true;this.selectedDateLabel=(new Date).toLocaleDateString(navigator.language,{dateStyle:"full"})||`${r.t("noDateSelected")}`;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version=_}connectedCallback(){c(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){c(`[nylas-scheduler] Component will load`);this.version=_;if(this.enableUserFeedback&&!f()){u({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),p({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}const t=new URLSearchParams(window.location.search);const n=t.get("lang");const i=n&&Object.values(v).includes(n)?n:null;this.stores={scheduler:C({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,selectedLanguage:i||this.defaultLanguage||this.bookingInfo?.language||v.en,...this.defaultSchedulerState})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;if(this.rescheduleBookingRef){const[e,t,n]=d(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.cancelBookingRef){const[e,t,n]=d(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.organizerConfirmationBookingRef){const[e,t,n]=d(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",n);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:n})}this.applyThemeConfig(this.themeConfig);if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new T({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const r=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(r,this.nylasSchedulerConnector);if(r.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector)}async componentDidLoad(){this.baseProvider?.componentDidLoad();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){c("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 e=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}}const n=this.baseProvider?.getStore("scheduler");const i=n?.get("configSettings")?.scheduler?.available_days_in_future;const s=n?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(n?.get("showBookingForm")){n?.set("selectedDate",s.start_time);return}}const o=n?.get("selectedDate");const a=n?.get("availability");let r;if(a&&a.length>0){return}if(!o){const e=new Date;const{startTime:t,endTime:n,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(e,i||30);if(e.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,n))}}else{const{startTime:e,endTime:t,endTimeForAvailableDaysInFuture:n}=this.validateAvailableDaysInFuture(o,i||30);if(o.getTime()<n*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(e,t))}}if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=n?.get("availability").find((e=>new Date(e.start_time)>new Date));if(t){e=t.start_time}n?.set("selectedDate",e)}}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",e.language)}}rescheduleBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}cancelBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}organizerConfirmationBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in v)){return}r.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);r.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=e.detail;this.language=t;r.changeLanguage(t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const n=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(e.defaultPrevented){return}if(i<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const n=this.stores?.scheduler.get("selectedLanguage");const i=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const o=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:o,email_language:n,timezone:i}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const n=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const i=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=i;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const i=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...i,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...i};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(o,this.nylasSchedulerConnector)}return}const o=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!o||"error"in o){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o?.error)},host:this.host})}const a=o?.data;const r=this.bookedEventInfo.emit({...o,data:{...a,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=e.detail;this.selectedDateLabel=t?t.toLocaleDateString(this.language,{dateStyle:"full"}):`${r.t("noDateSelected")}`}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}eventIsFullHandler(e){const t=e.detail.error;const n=e.detail.type;if(n==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:g.Component,type:y.Info,description:"The event you selected is full. Please try a different time.",id:(new Date).getTime().toString(),ttl:3e3},host:this.host})}}feedbackSubmittedHandler(e){m("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const t={message:e.detail.feedback};b(t,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":this.version,"nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug,version:this.version}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||L.title,category:e?.category||L.category,type:y.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let e="";if(!this.sessionId){e+=r.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=r.t("sessionIdRequiredErrorMessage")+" "+r.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:r.t("schedulingComponentErrorTitle"),category:g.Component,type:y.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:r.t("invalidTimeslotErrorTitle"),category:g.Component,type:y.Error,description:r.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const n=new Date;const i=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const o=Math.floor(l(n,t).getTime()/1e3);const a=Math.min(o,s);const r=i<n.getTime()/1e3?Math.floor(n.getTime()/1e3):i;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:n}=e.detail;if(t==="language"){const e=v[n];r.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const n=this.baseProvider?.getStore("scheduler");const i=n?.get("eventInfo");const o=n?.get("showBookingForm");const a=n?.get("cancelledEventInfo");const l=n?.get("cancelBookingId");const c=n?.get("selectedTimeslot");const d=n?.get("rescheduleBookingId");const g=n?.get("organizerConfirmationBookingId");const f=n?.get("rejectBookingId");const u=n?.get("confirmedEventInfo");const p=n?.get("nylasBranding")||this.nylasBranding;const m=n?.get("selectedDate");const b=n?.get("configSettings")?.scheduler?.confirmation_redirect_url;this.selectedDateLabel=m&&this.language?h(m.toLocaleDateString(this.language,{dateStyle:"full"})):`${r.t("noDateSelected")}`;const _=Object.keys(k).map((e=>({label:k[e],value:e})));const y=n?.get("selectedLanguage")||this.defaultLanguage||navigator.language||v.en;if(t&&(l||f)&&!a){return e(s,null,e(E,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:c,cancelBookingId:l,rejectBookingId:f,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),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"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&g){return e(s,null,e(E,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:g,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),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"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&a){return e(s,null,e(E,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:a,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),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"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&u){return e(s,null,e(E,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:u,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),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"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&i&&b){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const n=this.bookingInfoConfirmed?.booking_ref;const s=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((t=>{if(!s[t]&&e?.[t]){s[t]=e[t].value}}))}const o=this.stores?.scheduler.get("selectedTimeslot");const a=this.stores?.scheduler.get("selectedTimezone");const r=this.stores?.scheduler.get("selectedLanguage");const l=this.stores?.scheduler.get("configSettings");const c=this.configurationId?this.configurationId:l?.configuration_id;const d=window.location.search;const h=new URLSearchParams(d);h.set("booking_id",i.booking_id);e?.name&&h.set("name",e.name);e?.email&&h.set("email",e.email);o?.start_time&&h.set("start_time",(new Date(o.start_time).getTime()/1e3).toString());o?.end_time&&h.set("end_time",(new Date(o.end_time).getTime()/1e3).toString());a&&h.set("tz",a);r&&h.set("language",r);s&&h.set("additional_values",JSON.stringify(s));this.slug&&h.set("page_slug",this.slug);c&&h.set("config_id",c);t&&h.set("location",t);n&&h.set("booking_ref",n);this.redirectToCustomUrl(`${b}?${h.toString()}`);return}if(t&&i){return e(s,null,e(E,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:c,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),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"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!i||!!d)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(E,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(S,null,`${r.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},e("div",{class:"left-panel",part:"ns_left-panel"},e("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("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("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("h2",{part:"ns_right-panel__title"},e("calendar-icon",{part:"ns_right-panel__calendar-icon"}),e("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},this.selectedDateLabel)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!i&&o){return e(s,null,e(E,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(S,null,`${r.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},e("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},e("div",{class:"wrapper",part:"ns_left-panel__wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("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"})))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),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"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return o(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};D.style=B;export{D as nylas_scheduling};
2
- //# sourceMappingURL=p-f32db1ab.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Errors","constructor","this","component","_title","category","ErrorCategory","Component","title","endtime_not_in_future","message","no_booking_info","no_timeslot_selected","no_timezone_selected","no_booking_id","no_salt","invalid_start_time","invalid_end_time","invalid_timezone","no_config_id","api","Api","invalid_session","general_error","internal_error","invalid_request_error","timeslot_not_available","provider_error","not_found_error","NylaSchedulerAPIConnector","schedulerAPIURL","schedulerStore","sessionId","configId","slug","clientId","errors","getHeaders","Authorization","makeAPIRequest","path","method","body","headers","schedulerURL","URL","pathname","response","fetch","decodeURIComponent","toString","Origin","window","location","origin","version","data","json","error","type","getErrorMessage","errorMessage","setConfigId","selectDate","date","set","selectTime","time","selectTimezone","timezone","selectLanguage","language","i18next","changeLanguage","toggleAdditionalData","value","refetchAvailability","setParticipantName","name","bookingInfo","state","primaryParticipant","setParticipantEmail","email","today","Date","startTime","getFullYear","getMonth","getTime","startTimeWithOffset","Math","floor","endTime","result","getAvailability","resetStoreStateAndFetchAvailability","firstAvailableDate","get","find","timeslot","start_time","_selectedDate","setReschedule","bookingID","eventInfo","getUISettings","finally","setCancel","setReject","resetCancel","goBack","resetConfirm","undefined","bookTimeslot","selectedTimeslot","selectedTimezone","selectedLanguage","t","order","participantToBookWith","emails","addFields","Object","entries","additionalFields","forEach","key","entry","primaryGuest","guests","additional_fields","configIdParam","url","length","JSON","stringify","additional_guests","guest","end_time","event_id","master_id","calendar_id","email_language","getTwoLetterLanguageCode","shift","includes","participants","startsWith","errorType","bookingId","app_client_id","split","getStartTimeWithMinBookingNotice","scheduler","min_booking_notice","getEndTimeForAvailableDaysInFuture","availableDaysInFuture","available_days_in_future","endTimeForAvailableDaysInFuture","addDaysToCurrentDate","endTimeWithOffset","min","params","URLSearchParams","now","nowTime","startOfMonth","endOfMonth","startTimeWithMinBooking","append","encodeURIComponent","rescheduleBookingId","queryString","toLowerCase","availability","time_slots","map","availabilityTimeslotsFiltered","filter","availabilityTimeslotSorted","sort","a","b","cancelBooking","reason","action","cancellation_reason","booking_id","rescheduleBooking","apiErrors","componentErrors","i","time_zone","event","updateBooking","payload","status","salt","errorTitle","validateGroupEventTimeslot","configuration_id","NylasSchedulerConnector","nylasSchedulerStore","Error","href","init","debug","_schedulerAPIConnector","resetStores","reset","CreateNylasSchedulerStore","defaultState","defaultNylasStoreState","selectedDate","navigator","Intl","DateTimeFormat","resolvedOptions","timeZone","showBookingForm","availabilityOrderEmails","selectableDates","eventDuration","cancelledEventInfo","isLoading","nylasBranding","store","createStore","onChange","durationMinutes","SchedulerView","props","children","showNotification","h","Fragment","class","target","rel","slot","MessageBanner","_props","nylasSchedulingCss","genericError","NylasScheduling","hostRef","mode","schedulerApiUrl","eventOverrides","enableUserFeedback","automaticComponentRegistration","selectedDateLabel","toLocaleDateString","dateStyle","showFeedbackModal","bookingInfoConfirmed","connectedCallback","componentWillLoad","Sentry.isInitialized","Sentry.init","dsn","release","integrations","_integration","Sentry.feedbackIntegration","colorScheme","autoInject","autoSessionTracking","beforeSend","schedulerWillLoadEvent","schedulerWillLoad","emit","host","nylasSchedulerConnector","defaultPrevented","urlParams","search","langFromUrl","validLanguageFromUrl","values","LANGUAGE_CODE","stores","themeConfig","hour12","defaultLanguage","en","defaultSchedulerState","baseProvider","NylasBaseProvider","refConfigId","configurationId","bookingRefExtractedEvent","rescheduleBookingRef","rescheduleConfigId","_","compactStringToUUIDs","bookingRefExtracted","cancelBookingRef","cancelConfigId","cancelBookingId","organizerConfirmationBookingRef","organizerConfirmationConfigId","organizerConfirmationBookingId","applyThemeConfig","checkIfSessionIdOrConfigIdExists","getStore","initEvent","componentDidLoad","schedulerDidLoadEvent","schedulerDidLoad","localizationChanged","localization","settingsResponse","nylasSchedulerError","notification","getErrorObject","appearance","configSettingsLoadedEvent","configSettingsLoaded","settings","isTimeslotValid","validateAvailableDaysInFuture","componentDisconnected","bookingInfoChanged","newVal","rescheduleBookingRefChanged","cancelBookingRefChanged","organizerConfirmationBookingRefChanged","keys","lang","addResourceBundle","defaultLanguageChanged","themeConfigChanged","languageChanged","newLanguage","detail","registerComponentHandler","registerComponent","unregisterComponentHandler","unregisterComponent","monthChangedHandler","mapToBookingData","bookButtonClickedHandler","bookingData","mappedBookingData","storeRescheduleId","resultData","bookedEventInfoEvent","bookedEventInfo","dateSelectedHandler","cancelBookedEventErrorHandler","cancelBookedEventValidationErrorHandler","rescheduleBookedEventErrorHandler","confirmBookingErrorHandler","feedbackModalClosedHandler","eventIsFullHandler","_event","nylasSchedulerInfo","NotificationType","Info","description","id","ttl","feedbackSubmittedHandler","Sentry.captureMessage","extra","feedback","Sentry.captureFeedback","includeReplay","captureContext","tags","getNylasSchedulerStore","getNylasSchedulerConnector","getRef","startDate","endTimeForCurrentMonth","style","setProperty","onFeedbackClick","e","preventDefault","redirectToCustomUrl","assign","nylasFormDropdownChangedHandler","render","showDefaultScheduler","rejectBookingId","confirmedEventInfo","redirectUrl","confirmation_redirect_url","capitalizeFirstLetter","languageOptions","LANGUAGE_MAP","label","Host","part","exportparts","variant","onClick","searchPlaceholder","options","withChevron","defaultSelectedOption","width","height","recipient","booking_ref","bookingInfoAdditionalFields","configSettings","timeslotPickerCTALabel","querySelector"],"sources":["src/connector/nylas-scheduler-connector/errors/index.ts","src/connector/shared/api/scheduler.ts","src/connector/nylas-scheduler-connector/index.ts","src/stores/scheduler-store.ts","src/components/scheduler/nylas-scheduling/scheduler-view.tsx","src/components/scheduler/nylas-scheduling/message-banner.tsx","src/components/scheduler/nylas-scheduling/nylas-scheduling.scss?tag=nylas-scheduling&encapsulation=shadow","src/components/scheduler/nylas-scheduling/nylas-scheduling.tsx"],"sourcesContent":["import { ComponentErrorType, ErrorCategory, ErrorDetails } from '@/types/index';\nimport { APIErrorType } from '@nylas/core';\nexport class Errors {\n component = (_title: string): Record<ComponentErrorType, (message?: string) => ErrorDetails> => {\n const category = ErrorCategory.Component;\n const title = `${_title} Error`;\n return {\n endtime_not_in_future: (message: string = '\"endtime\" can not be in the future') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_info: (message: string = 'No booking info provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timeslot_selected: (message: string = 'No timeslot selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timezone_selected: (message: string = 'No timezone selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_id: (message: string = 'No booking id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_salt: (message: string = 'No salt provided') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_start_time: (message: string = 'Invalid start time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_end_time: (message: string = 'Invalid end time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_timezone: (message: string = 'Invalid timezone') => {\n return {\n title,\n message,\n category,\n };\n },\n no_config_id: (message: string = 'No configuration id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n\n api = (_title: string): Record<APIErrorType, (message: string) => ErrorDetails> => {\n const category = ErrorCategory.Api;\n const title = `${_title} Error`;\n\n return {\n invalid_session: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n general_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n internal_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_request_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n timeslot_not_available: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n provider_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n not_found_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n}\n","import { AvailabilityResponse, NylasSchedulerBookingData, NylasSchedulerBookingDataWithFlatFields, NylasEvent, UISettingsResponse } from '@/common/types';\nimport { NylasSchedulerStoreType } from '../../../components';\nimport type { NylasErrorResponse, NylasResponse, NylasSchedulerResponse, Timeslot } from '@nylas/core';\nimport { Errors } from '@/connector/nylas-scheduler-connector/errors';\nimport { addDaysToCurrentDate } from '@/utils/utils';\nimport i18next from '@/utils/i18n';\nimport { APIErrorType } from '@nylas/core';\nimport { ErrorCategory } from '@/types/index';\nimport { version } from '@/version';\n\ntype NylasSchedulerAPIConnectorOptions = {\n schedulerAPIURL: string;\n schedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n slug?: string;\n clientId?: string;\n};\n\n/**\n * NylaSchedulerConnector\n * This class is used to make API requests to the scheduler.\n */\nexport class NylaSchedulerAPIConnector {\n private schedulerStore: NylasSchedulerStoreType;\n private schedulerAPIURL: string;\n private sessionId: string | undefined;\n private configId: string | undefined;\n private slug: string | undefined;\n private clientId: string | undefined;\n private errors = new Errors();\n\n constructor({ schedulerAPIURL, schedulerStore, sessionId, configId, slug, clientId }: NylasSchedulerAPIConnectorOptions) {\n this.schedulerStore = schedulerStore;\n this.schedulerAPIURL = schedulerAPIURL;\n this.sessionId = sessionId;\n this.configId = configId;\n this.slug = slug;\n this.clientId = clientId;\n }\n\n private getHeaders() {\n return this.sessionId\n ? {\n Authorization: `Bearer ${this.sessionId}`,\n }\n : {};\n }\n\n /**\n * Makes an API request to the scheduler.\n * @param path The path to the API endpoint.\n * @param method The HTTP method.\n * @param body The request body (if any).\n * @returns {Promise<T>}\n */\n public async makeAPIRequest<T>(path: string, method: string, body: string | undefined, headers = {}): Promise<NylasResponse<T>> {\n try {\n const schedulerURL = new URL(this.schedulerAPIURL);\n schedulerURL.pathname = path;\n const response = await fetch(decodeURIComponent(schedulerURL.toString()), {\n method,\n headers: {\n 'Content-Type': 'application/json',\n 'Origin': window.location.origin,\n 'X-Source': 'nylas-scheduling',\n 'X-Nylas-Web-Elements-Version': version,\n ...(this.clientId && { 'X-Nylas-Application-Public-Id': this.clientId }),\n ...headers,\n },\n body,\n });\n // The server returns a json object for errors: eg.\n // {\n // \"request_id\": \"<request_id>\",\n // \"error\": {\n // \"type\": \"not_found_error\",\n // \"message\": \"Session not found\"\n // }\n // }\n const data = await response.json();\n return data as NylasResponse<T>;\n } catch (error: any) {\n // NOTE: current server implementation doesn't return a JSON object for errors on some endpoints\n // handle this case by returning the error response as a string to be handled downstream\n return {\n error: {\n message: error.message,\n title: 'API request failed',\n type: 'api',\n },\n } as NylasErrorResponse;\n }\n }\n\n private getErrorMessage(error: NylasErrorResponse['error']) {\n let errorMessage = error?.message || error?.title || 'Something went wrong';\n if (error?.type === 'provider_error') {\n errorMessage = error?.provider_error?.error?.message || error?.provider_error?.error?.title || 'Something went wrong';\n }\n return errorMessage;\n }\n\n public setConfigId(configId: string) {\n this.configId = configId;\n }\n\n /**\n * Selects a date in the scheduler.\n */\n public selectDate(date: Date) {\n this.schedulerStore.set('selectedDate', date);\n this.schedulerStore.set('selectedTimeslot', null);\n }\n\n /**\n * Selects a time in the scheduler.\n */\n public selectTime(time: Timeslot) {\n this.schedulerStore.set('selectedTimeslot', time);\n }\n\n /**\n * Sets the timezone in the scheduler.\n */\n public selectTimezone(timezone: string) {\n this.schedulerStore.set('selectedTimezone', timezone);\n }\n\n /**\n * Sets the language in the scheduler.\n */\n public selectLanguage(language: string) {\n this.schedulerStore.set('selectedLanguage', language);\n i18next.changeLanguage(language);\n }\n\n /**\n * Toggles showBookingForm\n * @param value boolean\n */\n public async toggleAdditionalData(value: boolean) {\n if (!value) {\n // Refetch availability\n await this.refetchAvailability();\n }\n this.schedulerStore.set('showBookingForm', value);\n }\n\n /**\n * Set/update the name of the participant booking the event.\n */\n public setParticipantName(name: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n name,\n },\n });\n }\n\n /**\n * Set/update the email of the participant booking the event.\n */\n public setParticipantEmail(email: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n email,\n },\n });\n }\n\n private async refetchAvailability() {\n const today = new Date();\n // Refetch availability\n const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n const endTime = new Date(today.getFullYear(), today.getMonth() + 1, 1).getTime() / 1000;\n const result = await this.getAvailability(startTimeWithOffset, endTime);\n return result;\n }\n\n private async resetStoreStateAndFetchAvailability() {\n const today = new Date();\n // Refetch availability\n const result = await this.refetchAvailability();\n // Set selected date to first available date\n const firstAvailableDate = this.schedulerStore.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n let _selectedDate = today;\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n this.schedulerStore.set('selectedDate', _selectedDate);\n // Reset store state\n this.schedulerStore.set('eventInfo', null);\n this.schedulerStore.set('showBookingForm', false);\n this.schedulerStore.set('selectedTimeslot', null);\n\n return result;\n }\n\n /**\n * Set reschedule booking id\n */\n public async setReschedule(bookingID: string) {\n this.schedulerStore.set('isLoading', true);\n const eventInfo = this.schedulerStore.state.eventInfo;\n if (eventInfo) {\n this.schedulerStore.set('reschedulingEventInfo', eventInfo);\n }\n this.schedulerStore.set('rescheduleBookingId', bookingID);\n await this.getUISettings();\n // Set reschedule booking id\n const result = await this.resetStoreStateAndFetchAvailability().finally(() => {\n this.schedulerStore.set('isLoading', false);\n });\n\n return result;\n }\n\n /**\n * Set cancel booking id\n */\n public async setCancel(bookingID: string) {\n this.schedulerStore.set('cancelBookingId', bookingID);\n }\n\n /**\n * Set reject booking id\n */\n public async setReject(bookingID: string) {\n this.schedulerStore.set('rejectBookingId', bookingID);\n }\n\n public async resetCancel() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('cancelBookingId', '');\n this.schedulerStore.set('rejectBookingId', '');\n this.schedulerStore.set('cancelledEventInfo', null);\n return result;\n }\n\n public async goBack() {\n this.schedulerStore.set('cancelBookingId', '');\n return;\n }\n\n public async resetConfirm() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('confirmedEventInfo', undefined);\n return result;\n }\n\n /**\n * Book the selected timeslot.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async bookTimeslot(data?: NylasSchedulerBookingDataWithFlatFields & { timeslot?: Timeslot }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { selectedTimeslot, selectedTimezone, bookingInfo, selectedLanguage } = this.schedulerStore.state;\n\n if (!data && !bookingInfo) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_booking_info() };\n }\n\n const timeslot = data?.timeslot || selectedTimeslot;\n if (!timeslot) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timeslot_selected() };\n }\n\n const timezone = data && data?.timezone ? data?.timezone : selectedTimezone;\n const language = selectedLanguage || 'en-US';\n\n if (!timezone) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timezone_selected() };\n }\n\n const order = [...this.schedulerStore.get('availabilityOrderEmails')];\n\n let participantToBookWith = '';\n const emails = timeslot?.emails || [];\n\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const headers = this.getHeaders();\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings${configIdParam}`;\n\n // If the order array is empty, make a single request without retries\n if (order.length === 0) {\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n additional_fields,\n additional_guests: guests,\n guest: { ...primaryGuest },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone,\n event_id: timeslot?.event_id || undefined,\n master_id: timeslot?.master_id || undefined,\n calendar_id: timeslot?.calendar_id || undefined,\n email_language: this.getTwoLetterLanguageCode(language),\n }),\n headers,\n );\n\n this.schedulerStore.set('isLoading', false);\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response.data);\n return response;\n }\n return { error: response.error };\n }\n\n while (order.length > 0) {\n participantToBookWith = order.shift()!;\n\n if (!emails.includes(participantToBookWith)) {\n continue; // Skip if the email is not part of the timeslot\n }\n\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n additional_fields,\n additional_guests: guests,\n guest: { ...primaryGuest },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone: timezone,\n email_language: this.getTwoLetterLanguageCode(language),\n }),\n headers,\n );\n\n if ('data' in response) {\n // Successful booking\n this.schedulerStore.set('isLoading', false);\n this.schedulerStore.set('eventInfo', response?.data);\n return response;\n } else if (response.error?.message?.startsWith('The selected timeslot is unavailable')) {\n // Retry with the next email in the order\n continue;\n } else {\n // Return other errors\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('createBookingErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('createBookingErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n }\n\n // If no emails in order succeed\n this.schedulerStore.set('isLoading', false);\n return {\n error: this.errors.api(i18next.t('createBookingErrorTitle')).timeslot_not_available('The selected timeslot is unavailable'),\n };\n }\n\n /**\n * Get UI settings for the scheduler.\n */\n public async getUISettings(): Promise<NylasSchedulerResponse<UISettingsResponse>> {\n this.schedulerStore.set('isLoading', true);\n const bookingId = this.schedulerStore.get('rescheduleBookingId');\n const headers = this.getHeaders();\n let configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n if (bookingId && !!configIdParam) {\n configIdParam += `&booking_id=${bookingId}`;\n } else if (bookingId) {\n configIdParam += `?booking_id=${bookingId}`;\n }\n\n const url = `/v3/scheduling/ui-settings${configIdParam}`;\n\n const response = await this.makeAPIRequest<UISettingsResponse>(url, 'GET', undefined, headers);\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getUISettingErrorTitle'))) {\n error = this.errors.api(i18next.t('getUISettingErrorTitle'))[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n if ('data' in response) {\n this.schedulerStore.set('configSettings', response.data);\n this.clientId = response.data.app_client_id || this.clientId;\n }\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n private getTwoLetterLanguageCode(language: string) {\n return language.split('-')[0];\n }\n\n private getStartTimeWithMinBookingNotice(startTime: number) {\n const scheduler = this.schedulerStore.get('configSettings')?.scheduler;\n const min_booking_notice = scheduler?.min_booking_notice;\n if (!min_booking_notice) {\n return startTime;\n }\n const today = new Date().getTime();\n\n if (startTime < (today + min_booking_notice * 60 * 1000) / 1000) {\n return Math.floor((today + min_booking_notice * 60 * 1000) / 1000);\n } else {\n return startTime;\n }\n }\n\n private getEndTimeForAvailableDaysInFuture(endTime: number) {\n const today = new Date();\n const availableDaysInFuture = this.schedulerStore.get('configSettings')?.scheduler?.available_days_in_future;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTimeWithOffset = Math.min(endTimeForAvailableDaysInFuture, endTime);\n return endTimeWithOffset;\n }\n\n /**\n * Gets the availability for a page.\n * @param startTime The start time.\n * @param endTime The end time.\n * @returns {Promise<AvailabilityResponse>}\n */\n public async getAvailability(startTime: number = 0, endTime: number = 0): Promise<NylasSchedulerResponse<AvailabilityResponse>> {\n this.schedulerStore.set('isLoading', true);\n const params = new URLSearchParams();\n const now = new Date();\n const nowTime = now.getTime();\n\n if (endTime && endTime < nowTime / 1000) {\n this.schedulerStore.set('isLoading', false);\n const error = this.errors.component(i18next.t('getAvailabilityErrorTitle')).endtime_not_in_future();\n return { error };\n }\n\n // Calculate the start of the current month if startTime is not provided\n if (!startTime) {\n const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);\n startTime = Math.floor(startOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n // Calculate the end of the current month if endTime is not provided\n if (!endTime) {\n const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0); // Setting day to 0 gets the last day of the previous month, so in this case, the last day of the current month\n endTime = Math.floor(endOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n endTime = this.getEndTimeForAvailableDaysInFuture(endTime);\n const startTimeWithMinBooking = this.getStartTimeWithMinBookingNotice(startTime);\n startTime = startTimeWithMinBooking;\n endTime = startTimeWithMinBooking > endTime ? startTimeWithMinBooking + 1 : endTime;\n\n params.append('start_time', encodeURIComponent(startTime.toString()));\n params.append('end_time', encodeURIComponent(endTime.toString()));\n if (this.configId && !this.sessionId) {\n params.append('configuration_id', encodeURIComponent(this.configId));\n } else if (this.slug && this.clientId && !this.sessionId) {\n params.append('slug', encodeURIComponent(this.slug));\n params.append('client_id', encodeURIComponent(this.clientId));\n }\n\n const rescheduleBookingId = this.schedulerStore.get('rescheduleBookingId');\n if (rescheduleBookingId) {\n params.append('booking_id', encodeURIComponent(rescheduleBookingId));\n }\n const queryString = params.toString();\n const url = `/v3/scheduling/availability${queryString ? `?${queryString}` : ''}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<AvailabilityResponse>(decodeURIComponent(url), 'GET', undefined, headers);\n\n if ('error' in response) {\n this.schedulerStore.set('availability', []);\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n // If the error message contains \"Failed to find a valid Grant\", return a custom error.\n // This is a temporary fix for showing a user friendly error message and hiding PII from the error message.\n // TODO: Implement proper error handling and remove this temporary fix.\n if (error?.message?.toLowerCase().includes('Failed to find a valid Grant')) {\n const errorMessage = i18next.t('invalidGrantError');\n return {\n error: {\n title: i18next.t('invalidGrantErrorTitle'),\n message: errorMessage,\n category: ErrorCategory.Api,\n },\n };\n }\n\n if (errorType && errorType in this.errors.api(i18next.t('getAvailabilityErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('getAvailabilityErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response) {\n const availability =\n response.data?.time_slots?.map(timeslot => {\n return {\n ...timeslot,\n start_time: new Date(timeslot.start_time * 1000),\n end_time: new Date(timeslot.end_time * 1000),\n };\n }) || [];\n\n // Filter out timeslots that are in the past\n const availabilityTimeslotsFiltered = availability.filter(timeslot => timeslot.start_time.getTime() > nowTime);\n const availabilityTimeslotSorted = availabilityTimeslotsFiltered.sort((a, b) => a.start_time.getTime() - b.start_time.getTime());\n this.schedulerStore.set('availability', availabilityTimeslotSorted);\n const order = response.data?.order || [];\n this.schedulerStore.set('availabilityOrderEmails', order);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Cancels a booking.\n * @param bookingId The booking ID.\n */\n public async cancelBooking(bookingId: string, reason: string): Promise<NylasSchedulerResponse<Partial<NylasEvent>>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('cancelBookingErrorTitle')).no_booking_id() };\n }\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<Partial<NylasEvent>>(\n decodeURIComponent(url),\n 'DELETE',\n JSON.stringify({\n action: 'cancel',\n cancellation_reason: reason,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('cancelBookingErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('cancelBookingErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n this.schedulerStore.set('rescheduleBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Reschedules a booking.\n * @param bookingId The booking ID.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async rescheduleBooking(bookingId: string, data: NylasSchedulerBookingDataWithFlatFields): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('rescheduleBookingErrorTitle')).no_booking_id() };\n }\n const apiErrors = this.errors.api(i18next.t('rescheduleBookingErrorTitle'));\n const componentErrors = this.errors.component(i18next.t('rescheduleBookingErrorTitle'));\n const { bookingInfo, selectedTimeslot, selectedTimezone, selectedLanguage } = this.schedulerStore.state;\n // Validate data\n const { startTime, endTime, timezone } = data;\n const start_time = startTime || selectedTimeslot?.start_time;\n\n if (!start_time) {\n return { error: componentErrors.invalid_start_time('Please pass \"startTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n const end_time = endTime || selectedTimeslot?.end_time;\n if (!end_time) {\n return { error: componentErrors.invalid_end_time('Please pass \"endTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n\n const order = this.schedulerStore.get('availabilityOrderEmails');\n let participantToBookWith = '';\n if (order.length > 0) {\n // Get the emails in the timeslot\n const emails = selectedTimeslot?.emails || [];\n for (let i = 0; i < order.length; i++) {\n if (emails.includes(order[i])) {\n participantToBookWith = order[i];\n break;\n }\n }\n }\n\n const time_zone = timezone || selectedTimezone;\n if (!time_zone) {\n return { error: componentErrors.invalid_timezone('Please pass \"timezone\" in data or set \"selectedTimezone\" in the defaultSchedulerState.') };\n }\n\n // Group event fields\n const event_id = selectedTimeslot?.event_id || undefined;\n const master_id = selectedTimeslot?.master_id || undefined;\n const calendar_id = selectedTimeslot?.calendar_id || undefined;\n\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PATCH',\n JSON.stringify({\n start_time: start_time.getTime() / 1000,\n end_time: end_time.getTime() / 1000,\n timezone: time_zone,\n additional_fields,\n guest: { ...primaryGuest },\n additional_guests: guests,\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n email_language: this.getTwoLetterLanguageCode(selectedLanguage),\n event_id,\n master_id,\n calendar_id,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in apiErrors) {\n const errorMessage = this.getErrorMessage(error);\n error = apiErrors[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n const eventInfo = this.schedulerStore.get('reschedulingEventInfo');\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response?.data);\n } else if (eventInfo) {\n this.schedulerStore.set('eventInfo', eventInfo);\n } else {\n // We should technically never reach this point\n const event = {\n booking_id: bookingId,\n } as NylasEvent;\n this.schedulerStore.set('eventInfo', event);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Updates the booking.\n * @param bookingId The booking ID.\n */\n public async updateBooking(payload: { bookingId: string; status: 'confirmed' | 'cancelled'; reason?: string }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { bookingId, status, reason } = payload;\n const salt = this.schedulerStore.get('organizerConfirmationSalt');\n const errorTitle = status === 'confirmed' ? i18next.t('confirmBookingErrorTitle') : i18next.t('rejectBookingErrorTitle');\n\n if (!bookingId) {\n return { error: this.errors.component(errorTitle).no_booking_id() };\n }\n if (!salt) {\n return { error: this.errors.component(errorTitle).no_salt() };\n }\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PUT',\n JSON.stringify({\n status: status,\n cancellation_reason: reason,\n salt,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(errorTitle)) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(errorTitle)[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response && status === 'confirmed') {\n this.schedulerStore.set('confirmedEventInfo', response?.data);\n } else if ('request_id' in response && status === 'cancelled') {\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n }\n\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Validate timeslot for group event booking\n */\n public async validateGroupEventTimeslot(timeslot: Timeslot) {\n this.schedulerStore.set('isLoading', true);\n const configId = this.schedulerStore.get('configSettings')?.configuration_id;\n if (!configId) {\n return { error: this.errors.component(i18next.t('validateTimeslotErrorTitle')).no_config_id() };\n }\n\n const headers = this.getHeaders();\n const url = `/v3/scheduling/configurations/${configId}/group-events/validate-timeslot`;\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n ...timeslot,\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('validateTimeslotErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('validateTimeslotErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n this.refetchAvailability();\n return { error };\n }\n\n this.schedulerStore.set('selectedTimeslot', timeslot);\n this.schedulerStore.set('showBookingForm', true);\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n}\n","import { NylasSchedulerStoreType } from '../../stores/scheduler-store';\nimport { debug } from '@/utils/utils';\nimport { NylasSchedulerConnectorInterface } from '../connector-interface';\nimport { NylaSchedulerAPIConnector } from '../shared/api/scheduler';\n\ntype NylasSchedulerConnectorOptions = {\n schedulerAPIURL: string;\n nylasSchedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n slug?: string;\n clientId?: string;\n};\n/**\n * Base class for the Nylas connector.\n */\nexport class NylasSchedulerConnector implements NylasSchedulerConnectorInterface {\n public schedulerAPIURL: string;\n public nylasSchedulerStore: NylasSchedulerStoreType;\n public sessionId: string | undefined;\n public configId: string | undefined;\n public slug: string | undefined;\n public clientId: string | undefined;\n\n private _schedulerAPIConnector: NylaSchedulerAPIConnector | undefined;\n\n constructor({ schedulerAPIURL, nylasSchedulerStore, sessionId, configId, slug, clientId }: NylasSchedulerConnectorOptions) {\n if (!schedulerAPIURL) {\n throw new Error('schedulerAPIURL is required');\n }\n\n if (!nylasSchedulerStore) {\n throw new Error('nylasSchedulerStore is required');\n }\n\n if (!sessionId && !configId && !(slug || clientId)) {\n throw new Error('sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.');\n }\n\n // If the url is only /, then we need to add the base url.\n // We assume that the base url is the same as the current url.\n if (schedulerAPIURL === '/') {\n const url = new URL(window.location.href);\n schedulerAPIURL = url.origin;\n }\n\n this.configId = configId;\n this.sessionId = sessionId;\n this.schedulerAPIURL = schedulerAPIURL;\n this.nylasSchedulerStore = nylasSchedulerStore;\n this.slug = slug;\n this.clientId = clientId;\n }\n\n public init() {\n debug('NylasConnector init');\n }\n\n public get schedulerStore() {\n return this.nylasSchedulerStore;\n }\n\n public get scheduler() {\n if (this._schedulerAPIConnector) {\n return this._schedulerAPIConnector;\n }\n this._schedulerAPIConnector = new NylaSchedulerAPIConnector({\n schedulerAPIURL: this.schedulerAPIURL,\n schedulerStore: this.schedulerStore,\n sessionId: this.sessionId,\n configId: this.configId,\n slug: this.slug,\n clientId: this.clientId,\n });\n return this._schedulerAPIConnector;\n }\n\n public resetStores() {\n this.nylasSchedulerStore.reset();\n }\n}\nexport type PublicMethods<T> = {\n [K in keyof T]: T[K] extends Function ? (string extends K ? never : K) : never;\n}[keyof T];\n\nexport type NylasSchedulerConnectorPublicMethods = PublicMethods<NylasSchedulerConnector>;\n","import { DataState, NylasEvent, NylasSchedulerBookingData } from '@/common/types';\nimport { debug } from '@/utils/utils';\nimport { AdditionalFields, Appearance, ThemeConfig, Timeslot, Notetaker } from '@nylas/core';\nimport { createStore } from '@stencil/store';\n\nexport type AvailabilityTimeslot = {\n emails: string[];\n start_time: Date;\n end_time: Date;\n capacity?: number;\n event_id?: string;\n master_id?: string;\n calendar_id?: string;\n};\n\nexport type LoadingState = {\n api: 'availability' | 'createBooking' | 'cancelBooking' | 'rescheduleBooking';\n};\n\nexport type ConfigSettings = {\n configuration_id: string;\n booking?: {\n additional_fields: Record<string, string>;\n additional_guests: {\n email: string;\n name: string;\n }[];\n booking_ref: string;\n booking_ref_salt: string;\n guest: {\n email: string;\n name: string;\n };\n timezone: string;\n email_language: string;\n event_data: {\n location: string;\n when: {\n start_time: Date;\n end_time: Date;\n end_timezone: string;\n start_timezone: string;\n object: string;\n };\n };\n event_organizer: {\n name: string;\n email: string;\n is_organizer: boolean;\n };\n };\n scheduler: {\n available_days_in_future: number;\n min_cancellation_notice: number;\n min_booking_notice: number;\n rescheduling_url?: string;\n cancellation_url?: string;\n cancellation_policy?: string;\n hide_additional_guests?: boolean;\n hide_cancellation_options?: boolean;\n hide_rescheduling_options?: boolean;\n additional_fields?: Record<string, AdditionalFields>;\n confirmation_redirect_url?: string;\n organizer_confirmation_url?: string;\n notetaker_settings?: Notetaker;\n };\n organizer: {\n name: string;\n email: string;\n };\n slug: string;\n appearance: Appearance;\n booking_type: string;\n name: string;\n};\n\nexport interface NylasSchedulerStoreState {\n selectedDate: Date | null;\n selectedLanguage: string;\n selectedTimezone: string;\n selectedTimeslot: Timeslot | null;\n availabilityOrderEmails: string[];\n showBookingForm: boolean;\n selectableDates: Date[] | null;\n eventDuration: number;\n availability: AvailabilityTimeslot[];\n state: DataState;\n eventInfo: NylasEvent | null;\n cancelledEventInfo: Partial<NylasEvent> | null;\n reschedulingEventInfo?: NylasEvent;\n confirmedEventInfo?: NylasEvent;\n bookingInfo?: NylasSchedulerBookingData;\n rescheduleBookingId?: string;\n cancelBookingId?: string;\n isLoading: boolean;\n nylasBranding?: boolean;\n configSettings?: ConfigSettings;\n organizerConfirmationBookingId?: string;\n rejectBookingId?: string;\n organizerConfirmationSalt?: string;\n themeConfig?: ThemeConfig;\n hour12?: boolean;\n}\n\nexport type NylasSchedulerStoreType = ReturnType<typeof CreateNylasSchedulerStore>;\n\nexport function CreateNylasSchedulerStore(defaultState: Partial<NylasSchedulerStoreState> = {}) {\n const defaultNylasStoreState: NylasSchedulerStoreState = {\n selectedDate: null,\n selectedLanguage: navigator.language,\n selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n selectedTimeslot: null,\n showBookingForm: false,\n availabilityOrderEmails: [],\n selectableDates: null,\n availability: [],\n eventDuration: 0,\n state: 'ready',\n eventInfo: null,\n cancelledEventInfo: null,\n isLoading: false,\n nylasBranding: true,\n ...defaultState,\n };\n debug(`[defaultNylasStoreState]: `, defaultNylasStoreState);\n const store = createStore<NylasSchedulerStoreState>(defaultNylasStoreState);\n\n store.onChange('availability', availability => {\n debug(`[availability]: `, availability);\n const selectableDates = availability.map(timeslot => timeslot.start_time);\n debug(`[selectableDates]: `, selectableDates);\n store.set('selectableDates', selectableDates);\n const timeslot = availability[0];\n if (!timeslot) return;\n const durationMinutes = Math.floor((timeslot.end_time.getTime() - timeslot.start_time.getTime()) / 60000);\n debug(`[durationMinutes]: `, durationMinutes);\n store.set('eventDuration', durationMinutes);\n });\n\n /**\n * Reset the Nylas store to its default state.\n * There is something wrong with the stencil/store reset method,\n * so we have to do it via this hack.\n */\n store.reset = () => {\n for (const key in defaultNylasStoreState) {\n const value = defaultNylasStoreState[key as keyof typeof defaultNylasStoreState];\n store.set(key as any, value);\n }\n };\n\n return store;\n}\n","import { Fragment, FunctionalComponent, h } from '@stencil/core';\n\nexport type SchedulerViewProps = {\n isLoading?: boolean;\n showNotification?: boolean;\n nylasBranding?: boolean;\n version?: string;\n};\n\n/**\n * The Scheduler view component.\n */\nexport const SchedulerView: FunctionalComponent<SchedulerViewProps> = (props: SchedulerViewProps, children) => {\n const isLoading = props.isLoading;\n const showNotification = props.showNotification;\n const nylasBranding = props.nylasBranding;\n const version = props.version;\n return (\n <Fragment>\n {showNotification && <nylas-notification></nylas-notification>}\n\n {isLoading && (\n <div class={'loading'}>\n <div class={'left'}>\n <div class={'skeleton'} />\n </div>\n <div class={'right'}>\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n </div>\n </div>\n )}\n {!isLoading && children}\n <div class={'footer'}>\n {nylasBranding && (\n <a\n href=\"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler\"\n class=\"powered-by-nylas\"\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n >\n Powered by&nbsp;<span class=\"sr-only\">Nylas</span>\n <nylas-logo aria-hidden={true} />\n </a>\n )}\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">{version}</span>\n </tooltip-component>\n </div>\n </Fragment>\n );\n};\n","import { FunctionalComponent, h } from '@stencil/core';\n\nexport type HeaderBannerProps = {};\n\nexport const MessageBanner: FunctionalComponent<HeaderBannerProps> = (_props: HeaderBannerProps, children) => <div class=\"message-banner\">{children}</div>;\n","@use '../../../common/styles/variables' as *;\n\n:host {\n display: flex;\n flex-direction: column;\n overflow: visible;\n border-radius: var(--nylas-border-radius-2x);\n width: fit-content;\n background: var(--nylas-base-0);\n position: relative;\n box-shadow: 0px 4px 8px 2px rgba(0, 0, 0, 0.05),\n 0px 8px 16px -2px rgba(0, 0, 0, 0.1);\n\n @include default-css-variables;\n font-family: var(--nylas-font-family);\n font-optical-sizing: auto;\n font-style: normal;\n font-variation-settings: 'slnt' 0;\n\n @media #{$mobile} {\n width: auto;\n min-width: 325px;\n }\n}\n\n:root {\n font-family: inherit;\n}\n\n.error {\n padding: 8rem 12rem;\n color: var(--nylas-base-0);\n background-color: var(--nylas-error);\n margin: 1.5rem;\n border-radius: var(--nylas-border-radius-2x);\n}\n\n.message-banner {\n text-align: right;\n color: var(--nylas-base-800);\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-color-primary-200);\n margin: 0;\n}\n\n.loading {\n margin: 1.5rem;\n display: flex;\n gap: 1rem;\n\n .skeleton {\n border-radius: var(--nylas-border-radius-2x);\n animation: pulsate 1.5s infinite;\n\n &:nth-child(2) {\n animation-delay: -100ms;\n }\n\n &:nth-child(3) {\n animation-delay: -200ms;\n }\n\n &:nth-child(4) {\n animation-delay: -300ms;\n }\n\n &:nth-child(5) {\n animation-delay: -400ms;\n }\n }\n\n .left .skeleton {\n height: 100%;\n width: 400px;\n }\n\n .right .skeleton {\n height: 5rem;\n width: 300px;\n margin-bottom: 1rem;\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n}\n\n@keyframes pulsate {\n 0% {\n background-color: var(--nylas-base-50);\n }\n\n 50% {\n background-color: var(--nylas-base-100);\n }\n\n 100% {\n background-color: var(--nylas-base-50);\n }\n}\n\n.select-date-page,\n.additional-data-page,\n.booked-event-page,\n.manual-confirmation-page,\n.cancelled-event-page,\n.cancel-flow-page {\n border-top-left-radius: var(--nylas-border-radius-2x);\n border-top-right-radius: var(--nylas-border-radius-2x);\n}\n\n.select-date-page,\n.additional-data-page {\n display: flex;\n\n @media #{$mobile} {\n flex-direction: column;\n }\n}\n\n.booked-event-page,\n.manual-confirmation-page {\n background-color: var(--nylas-base-50);\n}\n\n.cancelled-event-page,\n.manual-confirmation-page,\n.cancel-flow-page {\n padding: 1rem;\n height: 496px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.booked-event-page,\n.manual-confirmation-page,\n.cancelled-event-page,\n.cancel-flow-page {\n min-width: 784px;\n background: var(--nylas-base-50);\n\n @media #{$mobile} {\n min-width: 90%;\n }\n}\n\n.left-panel {\n display: flex;\n flex-direction: column;\n min-width: 424px;\n border-top-left-radius: inherit;\n background: var(--nylas-base-0);\n position: relative;\n padding: 1rem 0 0 0;\n height: 624px;\n\n @media #{$mobile} {\n border-top-right-radius: inherit;\n min-width: unset;\n height: auto;\n }\n}\n\n.select-date-page .left-panel {\n @media #{$mobile} {\n height: 624px;\n }\n}\n\n.border {\n margin-left: -20px; // Offset left padding\n margin-right: -20px; // Offset right padding\n border-top-width: 1px;\n height: 0.5px;\n background-color: var(--nylas-base-200);\n\n @media #{$mobile} {\n display: none;\n }\n}\n\n.right-panel {\n min-width: 360px;\n width: 360px;\n background-color: var(--nylas-base-50);\n height: 624px;\n padding-top: 16px;\n border-left: 1px solid var(--nylas-base-200);\n border-top-right-radius: inherit;\n\n &.reschedule {\n border-top-right-radius: 0px;\n }\n\n @media #{$mobile} {\n border-top-right-radius: 0px;\n width: inherit;\n min-width: unset;\n height: auto;\n border-left: none;\n }\n\n h2 {\n display: flex;\n margin: 0;\n height: 48px;\n gap: 0.5rem;\n justify-content: center;\n align-items: center;\n width: auto;\n font-size: 1.125rem;\n line-height: 1.5rem;\n font-weight: 500;\n text-align: center;\n color: var(--nylas-base-800);\n }\n}\n\n.additional-data-page {\n .left-panel {\n background-color: var(--nylas-base-50);\n }\n\n .right-panel {\n background-color: var(--nylas-base-0);\n }\n}\n\nnylas-selected-event-card {\n height: calc(640px - 36px);\n padding: 0 1rem;\n\n @media #{$mobile} {\n height: 250px;\n }\n}\n\n.footer {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n gap: 8px;\n padding: 16px;\n font-size: 14px;\n font-weight: 300;\n color: var(--nylas-base-500);\n border-top: 1px solid var(--nylas-base-200);\n min-height: 24px;\n\n .powered-by-nylas {\n display: flex;\n align-items: center;\n text-decoration: none;\n\n color: var(--nylas-base-500);\n\n &:hover {\n color: var(--nylas-base-800);\n }\n }\n\n svg {\n fill: var(--nylas-base-500);\n }\n}\n\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.footer svg {\n margin-top: 1px;\n}\n\nnylas-selected-event-card::part(nsec__timezone) {\n position: absolute;\n bottom: 0;\n}\n\nnylas-notification {\n margin: 1.5rem;\n width: -webkit-fill-available;\n width: -moz-available;\n position: absolute;\n}\n\nnylas-locale-switch {\n position: absolute;\n padding: 18px 20px;\n bottom: 0;\n width: -webkit-fill-available;\n width: -moz-available;\n border-top: 1px solid var(--nylas-base-200);\n\n @media #{$mobile} {\n height: auto;\n }\n}\n\nnylas-date-picker {\n padding: 0 20px;\n}\n\nbutton-component#report-issue {\n width: auto;\n position: absolute;\n bottom: 4px;\n left: 16px;\n}\n\n.language-feedback-container {\n width: auto;\n position: absolute;\n bottom: 4px;\n left: 16px;\n display: flex;\n gap: 8px;\n align-items: center;\n button-component#report-issue {\n position: initial;\n }\n}\n\n\nnylas-feedback-form {\n position: absolute;\n top: 0;\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n background: rgba(0, 0, 0, 0.6);\n z-index: 2;\n border-radius: inherit;\n}","import { NylasBaseProvider } from '@/common/abstract-provider';\nimport { RegisteredComponent } from '@/common/register-component';\nimport type { SchedulerEventOverride } from '@/common/component-types';\nimport { NylasSchedulerConnector } from '@/connector/nylas-scheduler-connector';\nimport { CreateNylasSchedulerStore, NylasSchedulerStoreState, NylasSchedulerStoreType } from '@/stores/scheduler-store';\nimport { ThemeConfig, Notification, NotificationType, NylasSchedulerErrorResponse, Timeslot, NylasSchedulerResponse, NylasSuccessResponse } from '@nylas/core';\nimport { Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { addDaysToCurrentDate, capitalizeFirstLetter, compactStringToUUIDs, debug } from '@/utils/utils';\nimport { SchedulerView } from './scheduler-view';\nimport { MessageBanner } from './message-banner';\nimport i18next from '@/utils/i18n';\nimport { NylasSchedulerBookingDataWithFlatFields, NylasEvent, UISettingsResponse } from '@/common/types';\nimport { LANGUAGE_CODE, LANGUAGE_MAP, Locale } from '@/common/constants';\nimport * as Sentry from '@sentry/browser';\nimport { ErrorCategory } from '@/types/index';\nimport type { BookedEventInfo, NylasSchedulerBookingData } from '@/common/types';\nimport { version } from '@/version';\nconst genericError = { title: i18next.t('genericErrorTitle'), type: NotificationType.Error, category: ErrorCategory.Component };\n\n/**\n * The `nylas-scheduling` component is used to display the Nylas Scheduling UI.\n *\n * @part ndp - [nylas-date-picker] The date picker host.\n * @part ndp__title - [nylas-date-picker] The title.\n * @part ndp__month-header - [nylas-date-picker] The month header.\n * @part ndp__month-button - [nylas-date-picker] The month button.\n * @part ndp__day - [nylas-date-picker] The day.\n * @part ndp__date - [nylas-date-picker] The date.\n * @part ndp__date--selected - [nylas-date-picker] The selected date.\n * @part ndp__date--current-day - [nylas-date-picker] The current day.\n * @part ndp__date--current-month - [nylas-date-picker] The dates in the current month.\n * @part ndp__date--disabled - [nylas-date-picker] The disabled dates.\n * @part ntp - [nylas-timeslot-picker] The timeslot picker component.\n * @part ntp__timeslot - [nylas-timeslot-picker] The timeslot button.\n * @part ntp__timeslot--selected - [nylas-timeslot-picker] The selected timeslot button.\n * @part ntp__button-primary - [nylas-timeslot-picker] The timeslot picker CTA.\n * @part nsec - [nylas-selected-event-card] The selected event card component.\n * @part nsec__card - [nylas-selected-event-card] The card component.\n * @part nsec__icon - [nylas-selected-event-card] The calendar icon.\n * @part nsec__date - [nylas-selected-event-card] The date selected.\n * @part nsec__time - [nylas-selected-event-card] The timeslot selected.\n * @part nbf - [nylas-booking-form] The booking form host.\n * @part nbf__input-textfield - [nylas-booking-form] The input textfield.\n * @part nbf__button-ghost - [nylas-booking-form] The ghost button.\n * @part nbf__button-outline - [nylas-booking-form] The outline button.\n * @part nbf__button-primary - [nylas-booking-form] The primary button.\n * @part nbf__input-wrapper - [nylas-booking-form] The input wrapper.\n * @part nbf__checkbox-component - [nylas-booking-form] The checkbox component.\n * @part nbf__radio-button-group - [nylas-booking-form] The radio button group.\n * @part nbf__textarea-component - [nylas-booking-form] The textarea component.\n * @part nbf__dropdown - [nylas-booking-form] The dropdown component.\n * @part nbf__dropdown-button - [nylas-booking-form] The dropdown button.\n * @part nbf__dropdown-content - [nylas-booking-form] The dropdown content.\n * @part ncec - [nylas-cancelled-event-card] The cancelled event card host.\n * @part ncec__icon - [nylas-cancelled-event-card] The calendar icon.\n * @part ncec__title - [nylas-cancelled-event-card] The title of the cancelled event card.\n * @part ncec__description - [nylas-cancelled-event-card] The description of the cancelled event card.\n * @part ncec__button-outline - [nylas-cancelled-event-card] The close button CTA.\n * @part ncec__card - [nylas-cancelled-event-card] The cancelled event card.\n * @part nbec - [nylas-booked-event-card] The booked event card host.\n * @part nbec__card - [nylas-booked-event-card] The booked event card.\n * @part nbec__title - [nylas-booked-event-card] The title of the booked event card.\n * @part nbec__description - [nylas-booked-event-card] The description of the booked event card.\n * @part nbec__button-outline - [nylas-booked-event-card] The cancel & reschedule button CTA.\n * @part nbec__cancel-cta - [nylas-booked-event-card] The cancel button CTA.\n * @part nbec__reschedule-cta - [nylas-booked-event-card] The reschedule button CTA.\n * @part nls - [nylas-locale-switch] The locale switch container.\n * @part nls__timezone - [nylas-locale-switch] The timezone select container\n * @part nls__timezone-dropdown - [nylas-locale-switch] The timezone dropdown\n * @part nls__timezone-drop-button - [nylas-locale-switch] The timezone dropdown button\n * @part nls__timezone-drop-button-selected-label - [nylas-locale-switch] The timezone dropdown button selected label\n * @part nls__timezone-drop-content - [nylas-locale-switch] The timezone dropdown content\n * @part nls__timezone-drop-label - [nylas-locale-switch] The timezone dropdown label\n * @part nls__language - [nylas-locale-switch] The language select container\n * @part nls__language-dropdown - [nylas-locale-switch] The language dropdown\n * @part nls__language-drop-button - [nylas-locale-switch] The language dropdown button\n * @part nls__language-drop-content - [nylas-locale-switch] The language dropdown content\n * @part nls__language-drop-label - [nylas-locale-switch] The language dropdown label\n * @part ncbf - [nylas-cancel-booking-form] The cancel booking form container.\n * @part ncbf__icon - [nylas-cancel-booking-form] The calendar icon.\n * @part ncbf__title - [nylas-cancel-booking-form] The title of the cancel booking form.\n * @part ncbf__description - [nylas-cancel-booking-form] The description of the cancel booking form.\n * @part ncbf__reason-textarea - [nylas-cancel-booking-form] The reason textarea.\n * @part ncbf__button-cta - [nylas-cancel-booking-form] The cancel booking form CTA button.\n * @part ncbf__button-outline - [nylas-cancel-booking-form] The cancel booking form outline button.\n * @part ncbf__card - [nylas-cancel-booking-form] The cancel booking form card.\n * @part ns_booked-event-page - The booked event page (namespace).\n * @part ns_select-date-page - The select date page (namespace).\n * @part ns_left-panel - The left panel (namespace).\n * @part ns_right-panel - The right panel (namespace).\n * @part ns_right-panel__title - The right panel title (namespace).\n * @part ns_right-panel__calendar-icon - The right panel calendar icon (namespace).\n * @part ns_right-panel__selected-date - The right panel selected date (namespace).\n * @part ns_reschedule - The reschedule (namespace).\n * @part ns_additional-data-page - The additional data page (namespace).\n * @part ns_left-panel__wrapper - The left panel wrapper (namespace).\n */\n@Component({\n tag: 'nylas-scheduling',\n styleUrl: 'nylas-scheduling.scss',\n shadow: true,\n})\nexport class NylasScheduling {\n /**\n * Stores to be used by the provider.\n */\n private stores?: { scheduler: NylasSchedulerStoreType };\n\n /**\n * This is a base provide that defines the common methods and properties\n * that all providers should have.\n *\n * Because stencil does not support abstract classes, we have to use a\n * property to store the base provider instance.\n */\n private baseProvider?: NylasBaseProvider<Exclude<typeof this.stores, undefined>>;\n\n /**\n * The Nylas Scheduler Connector instance.\n * The branins of the provider. It manages data fetching and state synchronization.\n */\n private nylasSchedulerConnector?: NylasSchedulerConnector;\n\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasSchedulingElement;\n\n /**\n * This is used to set the mode for the Nylas Scheduler.\n * The mode can be either `app` or `composable`. The default mode is `app`.\n * - `app`: This mode is used to show the default Nylas Scheduler UI.\n * - `composable`: This mode is used to show the composable Nylas Scheduler UI\n * by passing the individual scheduler components as children.\n */\n @Prop() readonly mode: 'app' | 'composable' = 'app';\n\n /**\n * The default scheduler store state.\n * Used to set the initial state of the scheduler store.\n */\n @Prop({ attribute: 'default-scheduler-store-state' }) readonly defaultSchedulerState?: Partial<NylasSchedulerStoreState>;\n\n /**\n * The session ID for the Nylas Scheduler.\n * This is used to authenticate the user.\n */\n @Prop() readonly sessionId?: string;\n\n /**\n * The URL for the Nylas Scheduler API. (staging or production URL)\n */\n @Prop() readonly schedulerApiUrl: string = 'https://api.us.nylas.com';\n\n /**\n * This enables passing the bookingInfo object to the Scheduler UI for direct booking event creation.\n * When used with timeslotConfirmedHandler, it bypasses the additional data page and immediately\n * invokes the handler after booking.\n */\n @Prop() readonly bookingInfo?: NylasSchedulerBookingData;\n\n /**\n * Booking Ref required for rescheduling flow.\n */\n @Prop() readonly rescheduleBookingRef?: string;\n\n /**\n * Booking Ref required for cancelling flow.\n */\n @Prop() readonly cancelBookingRef?: string;\n\n /**\n * Booking Ref required for the manual confirmation flow.\n */\n @Prop() readonly organizerConfirmationBookingRef?: string;\n\n /**\n * The config ID for the Nylas Scheduler. This should be passed in when using a public config,\n * in which case the sessionId is not required.\n */\n @Prop() readonly configurationId?: string;\n\n /**\n * The slug of the configuration (public config) to be used for the Nylas Scheduler. This is used in conjunction with the clientId.\n * When the configurationId is not provided, the slug and clientId are used to make requests to the Scheduler API endpoints.\n * If the configurationId is provided, this prop will be ignored.\n */\n @Prop() readonly slug?: string;\n\n /**\n * The app ID of the configuration (public config) to be used for the Nylas Scheduler. This is used in conjunction with the slug.\n * When the configurationId is not provided, the slug and clientId are used to make requests to the Scheduler API endpoints.\n * If the configurationId is provided, this prop will be ignored.\n */\n @Prop() readonly clientId?: string;\n\n /**\n * This prop lets you hide the Nylas branding.\n * Default is true.\n */\n @Prop() readonly nylasBranding?: boolean = true;\n\n /**\n * This provides an easy way to override the default function of the event emitter.\n * An example of this is the `timeslotConfirmed` event. By default, this event will set the scheduler store state for `showBookingForm` to `true` which will\n * show the booking form. However, if you want to override this behavior, you can pass in the prop `eventOverride` like:\n * ```html\n * <nylas-scheduling eventOverride={{\"timeslotConfirmed\": (event, nylasConnector) => { console.log(\"Timeslot confirmed event fired!\"); } }} />\n * ```\n */\n @Prop({ attribute: 'event-overrides' }) readonly eventOverrides: SchedulerEventOverride = {};\n\n /**\n * The loading state. This is used to set the loading state for the Nylas Scheduler when fetching data.\n */\n @Prop() readonly isLoading?: boolean;\n\n /**\n * Theme config, used to automatically generate a theme with color palette and\n * CSS variables to customize the look and feel of the Nylas Scheduler.\n */\n @Prop() readonly themeConfig?: ThemeConfig;\n\n /**\n * This prop will allow to override the default localization strings for each language.\n * Nylas scheduling page currently support the following language codes: en, es, fr, de, sv, zh, ja, nl.\n */\n @Prop() readonly localization?: Partial<Record<LANGUAGE_CODE, Locale>>;\n\n /**\n * This prop will allow to set a default language for the Nylas scheduling page.\n */\n @Prop() readonly defaultLanguage?: LANGUAGE_CODE;\n\n /*\n * Displays notifications for errors by default. When enabled (`true`), errors\n * automatically appear as notifications. Disabling this feature (`false`) allows\n * the parent application to capture and manage errors by listening to the\n * `nylasSchedulerError` event, providing flexibility in error handling.\n */\n @Prop() readonly showNotification?: boolean = true;\n\n @Prop() readonly enableUserFeedback?: boolean = true;\n\n @Prop() readonly hour12?: boolean | undefined;\n\n /**\n * Automatically register components that have the `@RegisterComponent` decorator.\n * If this is set to false, you will need to manually register components using the\n * `registerComponent` method.\n * @default true\n */\n @State() automaticComponentRegistration: boolean = true;\n\n /**\n * The selected date label for the Nylas Scheduler.\n * This is used to set the initial date label for the Nylas Scheduler.\n */\n @State() selectedDateLabel: string = new Date().toLocaleDateString(navigator.language, { dateStyle: 'full' }) || `${i18next.t('noDateSelected')}`;\n\n /**\n * The config id extracted from the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef.\n */\n @State() refConfigId?: string;\n\n /**\n * The selected language for the Nylas Scheduler.\n */\n @State() language: string = navigator.language;\n\n /**\n * The state for showing the feedback modal.\n */\n @State() showFeedbackModal: boolean = false;\n\n /**\n * The state of bookingInfo after the user has confirmed the booking.\n */\n @State() bookingInfoConfirmed: NylasSchedulerBookingDataWithFlatFields | null = null;\n\n /**\n * The version of the Nylas Scheduler.\n */\n @State() version: string = version;\n\n /**\n * This event is fired when the provider is initialized.\n * It can be used to set the initial state of the provider,\n * or to prevent the provider from firing some default behavior.\n */\n @Event({ cancelable: true }) init!: EventEmitter<HTMLNylasSchedulingElement>;\n\n /**\n * This event is fired when the scheduler component enters componentWillLoad lifecycle.\n */\n @Event() schedulerWillLoad!: EventEmitter<HTMLNylasSchedulingElement>;\n\n /**\n * This event is fired when the scheduler component enters componentDidLoad lifecycle.\n */\n @Event() schedulerDidLoad!: EventEmitter<HTMLNylasSchedulingElement>;\n\n @Event({\n eventName: 'nylasSchedulerError',\n })\n nylasSchedulerError!: EventEmitter<{ notification: Notification; host: HTMLElement }>;\n\n @Event({\n eventName: 'nylasSchedulerInfo',\n })\n nylasSchedulerInfo!: EventEmitter<{ notification: Notification; host: HTMLElement }>;\n\n @Event({\n eventName: 'configSettingsLoaded',\n })\n configSettingsLoaded!: EventEmitter<{ settings: NylasSchedulerResponse<UISettingsResponse> }>;\n\n /**\n * This event is triggered if either the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef prop\n * is supplied and the component has been attached to the DOM. It emits the configurationId\n * and bookingId derived from the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef. Subscribe to this\n * event to obtain the extracted configurationId, which is necessary to generate the sessionID\n * for configurations that are not public.\n */\n @Event() bookingRefExtracted!: EventEmitter<{ configurationId: string; bookingId: string; salt?: string }>;\n\n /**\n * This event is triggered on successful booking request. It emits the event data.\n */\n @Event() bookedEventInfo!: EventEmitter<NylasSchedulerResponse<BookedEventInfo>>;\n\n /**\n * This function is called when the component is connected to the DOM.\n * At this point in the component lifecycle, the base provider has not yet\n * been initialized. So avoid using the base provider in this method or stores\n * in this method.\n */\n connectedCallback() {\n debug(`[nylas-scheduler] connectedCallback`);\n }\n\n async componentWillLoad() {\n debug(`[nylas-scheduler] Component will load`);\n this.version = version;\n\n if (this.enableUserFeedback && !Sentry.isInitialized()) {\n Sentry.init({\n dsn: 'https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816',\n release: this.version,\n integrations: integrations => [\n ...integrations.filter(_integration => false), // Removes default integrations (including Breadcrumbs)\n Sentry.feedbackIntegration({\n colorScheme: 'system',\n autoInject: false,\n }),\n ],\n // Disable all other event capture\n autoSessionTracking: false, // Disable session tracking\n beforeSend: () => null, // Prevents error events from being sent\n });\n }\n\n // Emit the schedulerWillLoad event to allow the parent application to set the initial\n // state of the provider or to prevent the provider from firing some default behavior.\n const schedulerWillLoadEvent = this.schedulerWillLoad.emit(this.host);\n if ('schedulerWillLoad' in this.eventOverrides) {\n await this.eventOverrides.schedulerWillLoad(schedulerWillLoadEvent, this.nylasSchedulerConnector);\n if (schedulerWillLoadEvent.defaultPrevented) {\n return;\n }\n }\n\n // Check for lang query parameter in URL\n const urlParams = new URLSearchParams(window.location.search);\n const langFromUrl = urlParams.get('lang');\n const validLanguageFromUrl = langFromUrl && Object.values(LANGUAGE_CODE).includes(langFromUrl as LANGUAGE_CODE) ? (langFromUrl as LANGUAGE_CODE) : null;\n\n this.stores = {\n scheduler: CreateNylasSchedulerStore({\n bookingInfo: this.bookingInfo,\n nylasBranding: this.nylasBranding,\n themeConfig: this.themeConfig,\n hour12: this.hour12,\n selectedLanguage: validLanguageFromUrl || this.defaultLanguage || this.bookingInfo?.language || LANGUAGE_CODE.en,\n ...this.defaultSchedulerState,\n }),\n };\n\n this.baseProvider = new NylasBaseProvider(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);\n\n // Set the configId to the reschedule configId if rescheduleBookingRef is provided or\n // Set the configId to the cancel configId if cancelBookingRef is provided\n this.refConfigId = this.configurationId;\n let bookingRefExtractedEvent;\n if (this.rescheduleBookingRef) {\n const [rescheduleConfigId, rescheduleBookingId, _] = compactStringToUUIDs(this.rescheduleBookingRef);\n this.refConfigId = rescheduleConfigId;\n this.stores.scheduler.set('rescheduleBookingId', rescheduleBookingId);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: rescheduleConfigId, bookingId: rescheduleBookingId });\n } else if (this.cancelBookingRef) {\n const [cancelConfigId, cancelBookingId, _] = compactStringToUUIDs(this.cancelBookingRef);\n this.refConfigId = cancelConfigId;\n this.stores.scheduler.set('cancelBookingId', cancelBookingId);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: cancelConfigId, bookingId: cancelBookingId });\n } else if (this.organizerConfirmationBookingRef) {\n const [organizerConfirmationConfigId, organizerConfirmationBookingId, salt] = compactStringToUUIDs(this.organizerConfirmationBookingRef);\n this.refConfigId = organizerConfirmationConfigId;\n this.stores.scheduler.set('organizerConfirmationBookingId', organizerConfirmationBookingId);\n this.stores.scheduler.set('organizerConfirmationSalt', salt);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: organizerConfirmationConfigId, bookingId: organizerConfirmationBookingId, salt: salt });\n }\n // Override theme\n this.applyThemeConfig(this.themeConfig);\n\n if ('bookingRefExtracted' in this.eventOverrides) {\n await this.eventOverrides.bookingRefExtracted(bookingRefExtractedEvent, this.nylasSchedulerConnector);\n if (bookingRefExtractedEvent.defaultPrevented) {\n return;\n }\n }\n\n if (!this.checkIfSessionIdOrConfigIdExists()) {\n return;\n }\n\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n this.nylasSchedulerConnector = new NylasSchedulerConnector({\n schedulerAPIURL: this.schedulerApiUrl,\n sessionId: this.sessionId,\n configId: this.refConfigId,\n slug: this.slug,\n clientId: this.clientId,\n nylasSchedulerStore,\n });\n\n const initEvent = this.init.emit(this.host);\n if ('init' in this.eventOverrides) {\n await this.eventOverrides.init(initEvent, this.nylasSchedulerConnector);\n if (initEvent.defaultPrevented) {\n return;\n }\n }\n\n this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector);\n }\n\n async componentDidLoad() {\n this.baseProvider?.componentDidLoad();\n\n const schedulerDidLoadEvent = this.schedulerDidLoad.emit(this.host);\n if ('schedulerDidLoad' in this.eventOverrides) {\n await this.eventOverrides.schedulerDidLoad(schedulerDidLoadEvent, this.nylasSchedulerConnector);\n if (schedulerDidLoadEvent.defaultPrevented) {\n return;\n }\n }\n\n // If sessionId is not provided, do not fetch availability\n if (!this.checkIfSessionIdOrConfigIdExists()) {\n return;\n }\n this.localizationChanged(this.localization);\n const settingsResponse = await this.nylasSchedulerConnector?.scheduler.getUISettings();\n if (!settingsResponse || 'error' in settingsResponse) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(settingsResponse?.error) }, host: this.host });\n return;\n } else {\n if ('data' in settingsResponse && settingsResponse.data?.appearance) {\n debug(\n '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.',\n );\n }\n const configSettingsLoadedEvent = this.configSettingsLoaded.emit({ settings: settingsResponse });\n if ('configSettingsLoaded' in this.eventOverrides) {\n await this.eventOverrides.configSettingsLoaded(configSettingsLoadedEvent, this.nylasSchedulerConnector);\n if (configSettingsLoadedEvent.defaultPrevented) {\n return;\n }\n }\n }\n\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n const availableDaysInFuture = nylasSchedulerStore?.get('configSettings')?.scheduler?.available_days_in_future;\n const selectedTimeslot = nylasSchedulerStore?.get('selectedTimeslot');\n\n if (selectedTimeslot && selectedTimeslot?.start_time) {\n if (!this.isTimeslotValid(selectedTimeslot)) {\n return;\n }\n\n // If the selected timeslot is already set, do not fetch availability\n if (nylasSchedulerStore?.get('showBookingForm')) {\n nylasSchedulerStore?.set('selectedDate', selectedTimeslot.start_time);\n return;\n }\n }\n\n const selectedDate = nylasSchedulerStore?.get('selectedDate');\n const availability = nylasSchedulerStore?.get('availability');\n let result;\n\n if (availability && availability.length > 0) {\n return;\n }\n\n if (!selectedDate) {\n const today = new Date();\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(today, availableDaysInFuture || 30);\n if (today.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n }\n } else {\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(selectedDate, availableDaysInFuture || 30);\n if (selectedDate.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n }\n }\n\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n\n if (!selectedDate) {\n let _selectedDate = new Date();\n const firstAvailableDate = nylasSchedulerStore?.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n nylasSchedulerStore?.set('selectedDate', _selectedDate);\n }\n }\n\n componentDisconnected() {\n this.baseProvider?.componentDisconnected();\n }\n\n @Watch('bookingInfo')\n bookingInfoChanged(newVal?: NylasSchedulerBookingData) {\n this.stores?.scheduler.set('bookingInfo', newVal);\n if (newVal?.language && !this.defaultLanguage) {\n this.stores?.scheduler.set('selectedLanguage', newVal.language);\n }\n }\n\n @Watch('rescheduleBookingRef')\n rescheduleBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('rescheduleBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('cancelBookingRef')\n cancelBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('cancelBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('organizerConfirmationBookingRef')\n organizerConfirmationBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('organizerConfirmationBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('localization')\n localizationChanged(newVal?: Partial<Record<LANGUAGE_CODE, Locale>>) {\n if (!newVal) {\n return;\n }\n\n Object.keys(newVal).forEach(lang => {\n if (!(lang in LANGUAGE_CODE)) {\n return;\n }\n i18next.addResourceBundle(\n lang,\n 'translation',\n newVal[lang],\n false, // Merge with existing translations\n true, // Replace the existing translations with the same key\n );\n });\n }\n\n @Watch('defaultLanguage')\n defaultLanguageChanged(newVal?: LANGUAGE_CODE) {\n if (newVal) {\n this.stores?.scheduler.set('selectedLanguage', newVal);\n i18next.changeLanguage(newVal);\n }\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newVal?: ThemeConfig) {\n // Set the theme config in the store, hosted page will use this to apply/re-apply the theme\n this.baseProvider?.getStore('scheduler')?.set('themeConfig', newVal);\n this.applyThemeConfig(newVal);\n }\n\n @Listen('languageChanged')\n languageChanged(event: CustomEvent<string>) {\n const newLanguage = event.detail;\n this.language = newLanguage;\n i18next.changeLanguage(newLanguage);\n }\n\n /**\n * This is a custom event handler that is used to register a component with the provider.\n * It is used by components that have the `@RegisterComponent` decorator.\n * @param event A custom event that contains the component to register\n * @returns Promise<void>\n */\n @Listen('registerComponent')\n async registerComponentHandler(event: CustomEvent<RegisteredComponent<any, any>>): Promise<void> {\n this.baseProvider?.registerComponent(event.detail);\n }\n\n /**\n * This is a custom event handler that is used to unregister a component with the provider.\n * It is used by components that have the `@RegisterComponent` decorator.\n * @param event A custom event that contains the component to unregister\n * @returns Promise<void>\n */\n @Listen('unregisterComponent')\n async unregisterComponentHandler(event: CustomEvent<RegisteredComponent<any, any>>): Promise<void> {\n this.baseProvider?.unregisterComponent(event.detail);\n }\n\n /**\n * This is a custom event handler that is used to refetch the availability when the month is changed.\n */\n @Listen('monthChanged')\n async monthChangedHandler(event: CustomEvent<Date>) {\n const date = event.detail;\n const availableDaysInFuture = this.nylasSchedulerConnector?.schedulerStore?.get('configSettings')?.scheduler?.available_days_in_future;\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(date, availableDaysInFuture || 30);\n\n if (event.defaultPrevented) {\n return;\n }\n\n if (startTime < endTimeForAvailableDaysInFuture && date.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n const result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const selectableDates = this.stores?.scheduler.get('selectableDates');\n if (selectableDates && selectableDates.length > 0) {\n this.stores?.scheduler.set('selectedDate', selectableDates[0]);\n }\n }\n }\n\n mapToBookingData(bookingInfo: NylasSchedulerBookingDataWithFlatFields): any {\n const timeslot = this.stores?.scheduler.get('selectedTimeslot');\n const language = this.stores?.scheduler.get('selectedLanguage');\n const timezone = this.stores?.scheduler.get('selectedTimezone');\n const startTime = timeslot?.start_time ? new Date(timeslot?.start_time).getTime() / 1000 : '';\n const endTime = timeslot?.end_time ? new Date(timeslot?.end_time).getTime() / 1000 : '';\n return {\n additional_guests: bookingInfo.guests,\n guest: { ...bookingInfo.primaryParticipant },\n additional_fields: { ...bookingInfo.additionalFields },\n start_time: startTime,\n end_time: endTime,\n email_language: language,\n timezone: timezone,\n };\n }\n\n /**\n * This is a custom event handler to book an event.\n */\n @Listen('detailsConfirmed')\n async bookButtonClickedHandler(event: CustomEvent<NylasSchedulerBookingDataWithFlatFields>) {\n if (event.defaultPrevented) {\n return;\n }\n const bookingData = event.detail;\n const mappedBookingData = this.mapToBookingData(bookingData);\n this.bookingInfoConfirmed = bookingData;\n\n const storeRescheduleId = this.nylasSchedulerConnector?.schedulerStore?.get('rescheduleBookingId');\n const rescheduleBookingId = storeRescheduleId;\n if (rescheduleBookingId) {\n const result = await this.nylasSchedulerConnector?.scheduler.rescheduleBooking(rescheduleBookingId, bookingData);\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const resultData = (result as NylasSuccessResponse<NylasEvent>)?.data;\n const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result, data: { ...resultData, ...mappedBookingData } });\n this.bookingInfoConfirmed = { ...this.bookingInfoConfirmed, ...resultData };\n if ('bookedEventInfo' in this.eventOverrides) {\n await this.eventOverrides.bookedEventInfo(bookedEventInfoEvent, this.nylasSchedulerConnector);\n }\n return;\n }\n const result = await this.nylasSchedulerConnector?.scheduler.bookTimeslot(bookingData);\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const resultData = (result as NylasSuccessResponse<NylasEvent>)?.data;\n const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result, data: { ...resultData, ...mappedBookingData } });\n this.bookingInfoConfirmed = { ...this.bookingInfoConfirmed, ...resultData };\n if ('bookedEventInfo' in this.eventOverrides) {\n await this.eventOverrides.bookedEventInfo(bookedEventInfoEvent, this.nylasSchedulerConnector);\n }\n }\n\n /**\n * This is a custom event handler to update the selected date label.\n */\n @Listen('dateSelected')\n dateSelectedHandler(event: CustomEvent<Date>) {\n const date = event.detail;\n this.selectedDateLabel = date ? date.toLocaleDateString(this.language, { dateStyle: 'full' }) : `${i18next.t('noDateSelected')}`;\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * cancel booking button is clicked on the cancel booking form.\n */\n @Listen('cancelBookedEventError')\n cancelBookedEventErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n @Listen('cancelBookedEventValidationError')\n cancelBookedEventValidationErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * reschedule button is clicked on the booked event card.\n */\n @Listen('rescheduleBookedEventError')\n rescheduleBookedEventErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * manual confirmation button is clicked on the manual confirmation card.\n */\n @Listen('confirmBookingError')\n confirmBookingErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n @Listen('feedbackModalClosed')\n feedbackModalClosedHandler() {\n this.showFeedbackModal = false;\n }\n\n @Listen('validateTimeslotError')\n eventIsFullHandler(_event: CustomEvent<{ error: string; type: 'error' | 'info' }>) {\n const errorMessage = _event.detail.error;\n const type = _event.detail.type;\n if (type === 'error') {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject({ message: errorMessage }) }, host: this.host });\n } else {\n this.nylasSchedulerInfo.emit({\n notification: {\n title: 'Event is full',\n category: ErrorCategory.Component,\n type: NotificationType.Info,\n description: 'The event you selected is full. Please try a different time.',\n id: new Date().getTime().toString(),\n ttl: 3000,\n },\n host: this.host,\n });\n }\n }\n\n @Listen('feedbackSubmitted')\n feedbackSubmittedHandler(event: CustomEvent<{ feedback: string }>) {\n const eventId = Sentry.captureMessage('Scheduling Page User Feedback', {\n extra: {\n configId: this.configurationId,\n slug: this.slug,\n },\n });\n const feedback = {\n eventId: eventId,\n message: event.detail.feedback,\n };\n Sentry.captureFeedback(feedback, {\n includeReplay: true,\n captureContext: {\n tags: {\n 'nylas-web-element': 'nylas-scheduling',\n 'nylas-web-element-version': this.version,\n 'nylas-config-id': this.configurationId,\n 'nylas-slug': this.slug,\n 'host-url': window.location.href,\n },\n extra: {\n configId: this.configurationId,\n slug: this.slug,\n version: this.version,\n },\n },\n });\n this.showFeedbackModal = false;\n }\n\n /**\n * This method is used to retrieve the NylasScheduler instance\n * @returns The NylasScheduler instance\n */\n @Method()\n async getNylasSchedulerStore(): Promise<NylasSchedulerStoreType | undefined> {\n return this.baseProvider?.getStore('scheduler');\n }\n\n /**\n * This method is used to retrieve the NylasConnector instance\n * @returns The NylasConnector instance\n */\n @Method()\n async getNylasSchedulerConnector() {\n return this.nylasSchedulerConnector;\n }\n\n @Method()\n async getRef() {\n return this.host;\n }\n\n private getErrorObject(error: NylasSchedulerErrorResponse['error']): Notification {\n return {\n title: error?.title || genericError.title,\n category: error?.category || genericError.category,\n type: NotificationType.Error,\n description: error?.message || '',\n id: new Date().getTime().toString(),\n ttl: 'none',\n };\n }\n private checkIfSessionIdOrConfigIdExists(): boolean {\n if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {\n let description = '';\n\n if (!this.sessionId) {\n description += i18next.t('sessionIdRequiredErrorMessage');\n }\n\n if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {\n description = i18next.t('sessionIdRequiredErrorMessage') + ' ' + i18next.t('publicConfigErrorMessage');\n }\n\n this.nylasSchedulerError.emit({\n notification: {\n title: i18next.t('schedulingComponentErrorTitle'),\n category: ErrorCategory.Component,\n type: NotificationType.Error,\n description: description,\n id: new Date().getTime().toString(),\n ttl: 'none',\n },\n host: this.host,\n });\n return false;\n }\n return true;\n }\n\n private isTimeslotValid(timeslot: Timeslot): boolean {\n const selectedDate = new Date(timeslot.start_time);\n if (selectedDate < new Date()) {\n this.nylasSchedulerError.emit({\n notification: {\n title: i18next.t('invalidTimeslotErrorTitle'),\n category: ErrorCategory.Component,\n type: NotificationType.Error,\n description: i18next.t('invalidTimeslotErrorMessage'),\n id: new Date().getTime().toString(),\n ttl: 'none',\n },\n host: this.host,\n });\n return false;\n }\n return true;\n }\n\n private validateAvailableDaysInFuture(\n startDate: Date,\n availableDaysInFuture: number,\n ): {\n startTime: number;\n endTime: number;\n endTimeForAvailableDaysInFuture: number;\n } {\n const today = new Date();\n const startTime = new Date(startDate.getFullYear(), startDate.getMonth(), 1).getTime() / 1000;\n const endTimeForCurrentMonth = new Date(startDate.getFullYear(), startDate.getMonth() + 1, 1).getTime() / 1000;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTime = Math.min(endTimeForAvailableDaysInFuture, endTimeForCurrentMonth);\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n return { startTime: startTimeWithOffset, endTime, endTimeForAvailableDaysInFuture };\n }\n\n private applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n onFeedbackClick(e: Event) {\n e.preventDefault();\n this.showFeedbackModal = true;\n }\n\n redirectToCustomUrl(url: string) {\n window.location.assign(url);\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(\n event: CustomEvent<{\n value: string;\n name: string;\n }>,\n ) {\n const { name, value } = event.detail;\n if (name === 'language') {\n const selectedLanguage = LANGUAGE_CODE[value as LANGUAGE_CODE];\n i18next.changeLanguage(selectedLanguage);\n this.stores?.scheduler?.set('selectedLanguage', selectedLanguage);\n }\n }\n\n /**\n * @slot timeslot-picker-cta-label - This slot is used to pass a custom label to the timeslot picker CTA. The default label is \"Next\".\n * @slot custom-booking-form - This slot is used to pass a custom booking form to the Nylas Scheduling component.\n * @deprecated Deprecated in favor of using the additional fields defined in the config settings.\n */\n render() {\n const showDefaultScheduler = this.mode === 'app';\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n const eventInfo = nylasSchedulerStore?.get('eventInfo');\n const showBookingForm = nylasSchedulerStore?.get('showBookingForm');\n const cancelledEventInfo = nylasSchedulerStore?.get('cancelledEventInfo');\n const cancelBookingId = nylasSchedulerStore?.get('cancelBookingId');\n const selectedTimeslot = nylasSchedulerStore?.get('selectedTimeslot') as Timeslot;\n const rescheduleBookingId = nylasSchedulerStore?.get('rescheduleBookingId');\n const organizerConfirmationBookingId = nylasSchedulerStore?.get('organizerConfirmationBookingId');\n const rejectBookingId = nylasSchedulerStore?.get('rejectBookingId');\n const confirmedEventInfo = nylasSchedulerStore?.get('confirmedEventInfo');\n const nylasBranding = nylasSchedulerStore?.get('nylasBranding') || this.nylasBranding;\n const selectedDate = nylasSchedulerStore?.get('selectedDate');\n const redirectUrl = nylasSchedulerStore?.get('configSettings')?.scheduler?.confirmation_redirect_url;\n this.selectedDateLabel =\n selectedDate && this.language ? capitalizeFirstLetter(selectedDate.toLocaleDateString(this.language, { dateStyle: 'full' })) : `${i18next.t('noDateSelected')}`;\n const languageOptions = Object.keys(LANGUAGE_MAP).map(key => ({\n label: LANGUAGE_MAP[key],\n value: key,\n }));\n const selectedLanguage = nylasSchedulerStore?.get('selectedLanguage') || this.defaultLanguage || navigator.language || LANGUAGE_CODE.en;\n if (showDefaultScheduler && (cancelBookingId || rejectBookingId) && !cancelledEventInfo) {\n return (\n <Host>\n <SchedulerView version={this.version} nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancel-flow-page\" part=\"cancel-flow-page\">\n <nylas-cancel-booking-form\n selectedTimeslot={selectedTimeslot}\n cancelBookingId={cancelBookingId}\n rejectBookingId={rejectBookingId}\n exportparts=\"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card\"\n />\n </div>\n </SchedulerView>\n <div class=\"language-feedback-container\">\n {this.enableUserFeedback && (\n <button-component id=\"report-issue\" variant={'basic'} onClick={e => this.onFeedbackClick(e)}>\n <feedback-icon />\n </button-component>\n )}\n <select-dropdown\n name=\"language\"\n searchPlaceholder={i18next.t('search')}\n options={languageOptions}\n withChevron={false}\n themeConfig={this.themeConfig}\n defaultSelectedOption={languageOptions.find(lang => lang.value == selectedLanguage)}\n 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\"\n >\n <span slot=\"select-icon\">\n <translate-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n {this.showFeedbackModal && <nylas-feedback-form></nylas-feedback-form>}\n </Host>\n );\n }\n\n // Manual confirmation page is shown when the event is manually confirmed\n if (showDefaultScheduler && organizerConfirmationBookingId) {\n return (\n <Host>\n <SchedulerView>\n <div class=\"manual-confirmation-page\" part=\"manual-confirmation-page\">\n <nylas-organizer-confirmation-card\n organizerConfirmationBookingId={organizerConfirmationBookingId}\n exportparts=\"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline\"\n />\n </div>\n </SchedulerView>\n <div class=\"language-feedback-container\">\n {this.enableUserFeedback && (\n <button-component id=\"report-issue\" variant={'basic'} onClick={e => this.onFeedbackClick(e)}>\n <feedback-icon />\n </button-component>\n )}\n <select-dropdown\n name=\"language\"\n searchPlaceholder={i18next.t('search')}\n options={languageOptions}\n withChevron={false}\n themeConfig={this.themeConfig}\n defaultSelectedOption={languageOptions.find(lang => lang.value == selectedLanguage)}\n 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\"\n >\n <span slot=\"select-icon\">\n <translate-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n {this.showFeedbackModal && <nylas-feedback-form></nylas-feedback-form>}\n </Host>\n );\n }\n\n // Cancelled event card is shown when the event is cancelled\n if (showDefaultScheduler && cancelledEventInfo) {\n return (\n <Host>\n <SchedulerView version={this.version} nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancelled-event-page\" part=\"cancelled-event-page\">\n <nylas-cancelled-event-card\n cancelledEventInfo={cancelledEventInfo}\n exportparts=\"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card\"\n />\n </div>\n </SchedulerView>\n <div class=\"language-feedback-container\">\n {this.enableUserFeedback && (\n <button-component id=\"report-issue\" variant={'basic'} onClick={e => this.onFeedbackClick(e)}>\n <feedback-icon />\n </button-component>\n )}\n <select-dropdown\n name=\"language\"\n searchPlaceholder={i18next.t('search')}\n options={languageOptions}\n withChevron={false}\n themeConfig={this.themeConfig}\n defaultSelectedOption={languageOptions.find(lang => lang.value == selectedLanguage)}\n 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\"\n >\n <span slot=\"select-icon\">\n <translate-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n {this.showFeedbackModal && <nylas-feedback-form></nylas-feedback-form>}\n </Host>\n );\n }\n\n // Confirmed event card is shown when the event is confirmed\n if (showDefaultScheduler && confirmedEventInfo) {\n return (\n <Host>\n <SchedulerView version={this.version} nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancelled-event-page\" part=\"confirmed-event-page\">\n <nylas-confirmed-event-card\n confirmedEventInfo={confirmedEventInfo}\n exportparts=\"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card\"\n />\n </div>\n </SchedulerView>\n <div class=\"language-feedback-container\">\n {this.enableUserFeedback && (\n <button-component id=\"report-issue\" variant={'basic'} onClick={e => this.onFeedbackClick(e)}>\n <feedback-icon />\n </button-component>\n )}\n <select-dropdown\n name=\"language\"\n searchPlaceholder={i18next.t('search')}\n options={languageOptions}\n withChevron={false}\n themeConfig={this.themeConfig}\n defaultSelectedOption={languageOptions.find(lang => lang.value == selectedLanguage)}\n 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\"\n >\n <span slot=\"select-icon\">\n <translate-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n {this.showFeedbackModal && <nylas-feedback-form></nylas-feedback-form>}\n </Host>\n );\n }\n\n // Redirected to custom URL when the event is booked and redirect URL is provided\n if (showDefaultScheduler && eventInfo && redirectUrl) {\n const recipient = this.bookingInfoConfirmed?.primaryParticipant;\n const location = this.bookingInfoConfirmed?.location;\n const booking_ref = this.bookingInfoConfirmed?.booking_ref;\n const additionalFields = this.bookingInfoConfirmed?.additionalFields || {};\n if (this.bookingInfo && typeof this.bookingInfo?.additionalFields !== 'undefined') {\n const bookingInfoAdditionalFields = this.bookingInfo.additionalFields;\n // Merge additional fields from the bookingInfo with the additional fields from the booking form\n Object.keys(bookingInfoAdditionalFields).forEach(key => {\n if (!additionalFields[key] && bookingInfoAdditionalFields?.[key]) {\n additionalFields[key] = bookingInfoAdditionalFields[key].value;\n }\n });\n }\n const selectedTimeslot = this.stores?.scheduler.get('selectedTimeslot');\n const selectedTimezone = this.stores?.scheduler.get('selectedTimezone');\n const selectedLanguage = this.stores?.scheduler.get('selectedLanguage');\n const configSettings = this.stores?.scheduler.get('configSettings');\n\n const configurationId = this.configurationId ? this.configurationId : configSettings?.configuration_id;\n const queryString = window.location.search;\n\n const urlParams = new URLSearchParams(queryString);\n urlParams.set('booking_id', eventInfo.booking_id);\n recipient?.name && urlParams.set('name', recipient.name);\n recipient?.email && urlParams.set('email', recipient.email);\n selectedTimeslot?.start_time && urlParams.set('start_time', (new Date(selectedTimeslot.start_time).getTime() / 1000).toString());\n selectedTimeslot?.end_time && urlParams.set('end_time', (new Date(selectedTimeslot.end_time).getTime() / 1000).toString());\n selectedTimezone && urlParams.set('tz', selectedTimezone);\n selectedLanguage && urlParams.set('language', selectedLanguage);\n additionalFields && urlParams.set('additional_values', JSON.stringify(additionalFields));\n this.slug && urlParams.set('page_slug', this.slug);\n configurationId && urlParams.set('config_id', configurationId);\n location && urlParams.set('location', location);\n booking_ref && urlParams.set('booking_ref', booking_ref);\n this.redirectToCustomUrl(`${redirectUrl}?${urlParams.toString()}`);\n return;\n }\n\n // Booked event card is shown when the event is booked or booking is sent\n if (showDefaultScheduler && eventInfo) {\n return (\n <Host>\n <SchedulerView version={this.version} nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"booked-event-page\" part=\"booked-event-page ns_booked-event-page\">\n <nylas-booked-event-card\n selectedTimeslot={selectedTimeslot}\n eventInfo={eventInfo}\n exportparts=\"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta\"\n />\n </div>\n </SchedulerView>\n <div class=\"language-feedback-container\">\n {this.enableUserFeedback && (\n <button-component id=\"report-issue\" variant={'basic'} onClick={e => this.onFeedbackClick(e)}>\n <feedback-icon />\n </button-component>\n )}\n <select-dropdown\n name=\"language\"\n searchPlaceholder={i18next.t('search')}\n options={languageOptions}\n withChevron={false}\n themeConfig={this.themeConfig}\n defaultSelectedOption={languageOptions.find(lang => lang.value == selectedLanguage)}\n 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\"\n >\n <span slot=\"select-icon\">\n <translate-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n {this.showFeedbackModal && <nylas-feedback-form></nylas-feedback-form>}\n </Host>\n );\n }\n // Date and time picker is shown when the event is not booked and no additional data is shown\n if (showDefaultScheduler && (!eventInfo || !!rescheduleBookingId) && !showBookingForm) {\n const timeslotPickerCTALabel = this.host.querySelector('[slot=\"timeslot-picker-cta-label\"]');\n return (\n <Host>\n <SchedulerView version={this.version} nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n {rescheduleBookingId && <MessageBanner>{`${i18next.t('rescheduleTitle')}`}</MessageBanner>}\n <div class=\"select-date-page\" part=\"select-date-page ns_select-date-page\">\n <div class=\"left-panel\" part=\"ns_left-panel\">\n <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\"></nylas-date-picker>\n <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\"></nylas-locale-switch>\n </div>\n <div class={`right-panel ${rescheduleBookingId ? 'reschedule' : ''}`} part={`ns_right-panel ${rescheduleBookingId ? 'ns_reschedule' : ''}`}>\n <h2 part=\"ns_right-panel__title\">\n <calendar-icon part=\"ns_right-panel__calendar-icon\"></calendar-icon>\n <span id=\"selectedDate\" part=\"ns_right-panel__selected-date\">\n {this.selectedDateLabel}\n </span>\n </h2>\n <nylas-timeslot-picker exportparts=\"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary\">\n {timeslotPickerCTALabel && (\n <span slot=\"timeslot-picker-cta-label\">\n <slot name=\"timeslot-picker-cta-label\"></slot>\n </span>\n )}\n </nylas-timeslot-picker>\n </div>\n </div>\n </SchedulerView>\n {this.enableUserFeedback && (\n <button-component id=\"report-issue\" variant={'basic'} onClick={e => this.onFeedbackClick(e)}>\n <feedback-icon />\n </button-component>\n )}\n {this.showFeedbackModal && <nylas-feedback-form></nylas-feedback-form>}\n </Host>\n );\n }\n // Additional data is shown when the time is selected, event is not booked and additional data is shown\n if (showDefaultScheduler && !eventInfo && showBookingForm) {\n return (\n <Host>\n <SchedulerView version={this.version} nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n {rescheduleBookingId && <MessageBanner>{`${i18next.t('rescheduleTitle')}`}</MessageBanner>}\n <div class=\"additional-data-page\" part=\"additional-data-page ns_additional-data-page\">\n <div class=\"left-panel ns_left-panel\" part=\"ns_left-panel\">\n <div class=\"wrapper\" part=\"ns_left-panel__wrapper\">\n <nylas-selected-event-card exportparts=\"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone\"></nylas-selected-event-card>\n </div>\n </div>\n <div class={`right-panel ${rescheduleBookingId ? 'reschedule' : ''}`} part={`ns_right-panel ${rescheduleBookingId ? 'ns_reschedule' : ''}`}>\n <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\"></nylas-booking-form>\n </div>\n </div>\n </SchedulerView>\n <div class=\"language-feedback-container\">\n {this.enableUserFeedback && (\n <button-component id=\"report-issue\" variant={'basic'} onClick={e => this.onFeedbackClick(e)}>\n <feedback-icon />\n </button-component>\n )}\n <select-dropdown\n name=\"language\"\n searchPlaceholder={i18next.t('search')}\n options={languageOptions}\n withChevron={false}\n themeConfig={this.themeConfig}\n defaultSelectedOption={languageOptions.find(lang => lang.value == selectedLanguage)}\n 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\"\n >\n <span slot=\"select-icon\">\n <translate-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n {this.showFeedbackModal && <nylas-feedback-form></nylas-feedback-form>}\n </Host>\n );\n }\n\n return (\n <Host>\n <slot />\n </Host>\n );\n }\n}\n"],"mappings":"wWAEaA,EAAb,WAAAC,GACEC,KAAAC,UAAaC,IACX,MAAMC,EAAWC,EAAcC,UAC/B,MAAMC,EAAQ,GAAGJ,UACjB,MAAO,CACLK,sBAAuB,CAACC,EAAkB,wCACjC,CACLF,QACAE,UACAL,aAGJM,gBAAiB,CAACD,EAAkB,8BAC3B,CACLF,QACAE,UACAL,aAGJO,qBAAsB,CAACF,EAAkB,0BAChC,CACLF,QACAE,UACAL,aAGJQ,qBAAsB,CAACH,EAAkB,0BAChC,CACLF,QACAE,UACAL,aAGJS,cAAe,CAACJ,EAAkB,4BACzB,CACLF,QACAE,UACAL,aAGJU,QAAS,CAACL,EAAkB,sBACnB,CACLF,QACAE,UACAL,aAGJW,mBAAoB,CAACN,EAAkB,wBAC9B,CACLF,QACAE,UACAL,aAGJY,iBAAkB,CAACP,EAAkB,sBAC5B,CACLF,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