@nylas/web-elements 2.5.11 → 2.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +6 -3
- package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +1 -1
- package/dist/cjs/calendar-agenda-fill-icon_39.cjs.entry.js +3 -3
- package/dist/cjs/calendar-agenda-fill-icon_39.cjs.entry.js.map +1 -1
- package/dist/cjs/google-logo-icon_6.cjs.entry.js +1 -1
- package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +1 -1
- package/dist/cjs/nylas-scheduling.cjs.entry.js +1 -1
- package/dist/cjs/{version-DbvVCdbm.js → version-FXnnI00G.js} +3 -3
- package/dist/cjs/{version-DbvVCdbm.js.map → version-FXnnI00G.js.map} +1 -1
- package/dist/collection/components/scheduler-editor/nylas-page-styling/nylas-page-styling.js +3 -3
- package/dist/collection/components/scheduler-editor/nylas-page-styling/nylas-page-styling.js.map +1 -1
- package/dist/collection/version.js +1 -1
- package/dist/collection/version.js.map +1 -1
- package/dist/components/nylas-editor-tabs-group.js +1 -1
- package/dist/components/nylas-editor-tabs.js +1 -1
- package/dist/components/nylas-page-styling.js +1 -1
- package/dist/components/nylas-scheduler-editor.js +4 -4
- package/dist/components/nylas-scheduling.js +1 -1
- package/dist/components/{p-Bgb7cz6Z.js → p-77cQPnsG.js} +4 -4
- package/dist/components/{p-Bgb7cz6Z.js.map → p-77cQPnsG.js.map} +1 -1
- package/dist/components/{p-DmOB6JTr.js → p-Cl71OI5D.js} +3 -3
- package/dist/components/{p-DmOB6JTr.js.map → p-Cl71OI5D.js.map} +1 -1
- package/dist/components/{p-DP3OiAjS.js → p-Cm6e2qUq.js} +4 -4
- package/dist/components/{p-DP3OiAjS.js.map → p-Cm6e2qUq.js.map} +1 -1
- package/dist/components/{p-B05sg_l1.js → p-DvPuyp-I.js} +5 -5
- package/dist/components/p-DvPuyp-I.js.map +1 -0
- package/dist/esm/calendar-agenda-fill-icon_39.entry.js +3 -3
- package/dist/esm/calendar-agenda-fill-icon_39.entry.js.map +1 -1
- package/dist/esm/google-logo-icon_6.entry.js +1 -1
- package/dist/esm/nylas-scheduler-editor.entry.js +1 -1
- package/dist/esm/nylas-scheduling.entry.js +1 -1
- package/dist/esm/{version-BHcQFl5b.js → version-BEjJeakd.js} +3 -3
- package/dist/esm/{version-BHcQFl5b.js.map → version-BEjJeakd.js.map} +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
- package/dist/nylas-web-elements/{p-0a7c5cd7.entry.js → p-32e39f3d.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-f1942b81.entry.js → p-7c1bc27a.entry.js} +3 -3
- package/dist/nylas-web-elements/p-7c1bc27a.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-BHcQFl5b.js → p-BEjJeakd.js} +2 -2
- package/dist/nylas-web-elements/{p-BHcQFl5b.js.map → p-BEjJeakd.js.map} +1 -1
- package/dist/nylas-web-elements/{p-620804db.entry.js → p-ad0e7f3b.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-8a1b1bb7.entry.js → p-fe855b8f.entry.js} +2 -2
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p-B05sg_l1.js.map +0 -1
- package/dist/nylas-web-elements/p-f1942b81.entry.js.map +0 -1
- /package/dist/nylas-web-elements/{p-0a7c5cd7.entry.js.map → p-32e39f3d.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-620804db.entry.js.map → p-ad0e7f3b.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-8a1b1bb7.entry.js.map → p-fe855b8f.entry.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e,F as t,r as i,c as n,H as s,a as o}from"./p-0EQQA0nE.js";import{N as a}from"./p-FlNKXp4j.js";import{n as r,L as l,i as c,f as d,h,a as g,j as f,k as u,l as p,m,c as b}from"./p-OpKyWV8q.js";import{E as y,v as _,u as w}from"./p-BHcQFl5b.js";import{c as v}from"./p-_i6H-yQH.js";import{i as k,a as I,f as x,c as C,b as T}from"./p-B8tfyAQm.js";class S{constructor(){this.component=e=>{const t=y.Component;const i=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:i,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:i,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:i,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:i,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:i,message:e,category:t}),no_salt:(e="No salt provided")=>({title:i,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:i,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:i,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:i,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:i,message:e,category:t})}};this.api=e=>{const t=y.Api;const i=`${e} Error`;return{invalid_session:e=>({title:i,message:e,category:t}),general_error:e=>({title:i,message:e,category:t}),internal_error:e=>({title:i,message:e,category:t}),invalid_request_error:e=>({title:i,message:e,category:t}),timeslot_not_available:e=>({title:i,message:e,category:t}),provider_error:e=>({title:i,message:e,category:t}),not_found_error:e=>({title:i,message:e,category:t})}}}}class E{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:i,configId:n,slug:s,clientId:o}){this.errors=new S;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=i;this.configId=n;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,i,n={},s){try{const o=new URL(this.schedulerAPIURL);o.pathname=e;const a=await fetch(decodeURIComponent(o.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},...n},body:i,signal:s});const r=await a.json();return r}catch(e){if(e.name==="AbortError"){throw 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}setSchedulerAPIURL(e){if(e==="/"){e=new URL(window.location.href).origin}this.schedulerAPIURL=e}setSessionId(e){this.sessionId=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){const t=r(e)||l.en;this.schedulerStore.set("selectedLanguage",t);c.changeLanguage(t)}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 i=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const n=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(i,n);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const i=this.schedulerStore.get("availability").find((e=>{const t=d(e.start_time);return t?t>new Date:false}));let n=e;if(i){n=d(i.start_time)||e}this.schedulerStore.set("selectedDate",n);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 i=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return i}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:i,bookingInfo:n,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!n){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:i;const r=s||"en-US";if(!a){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_timezone_selected()}}const l=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(n?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:n?.primaryParticipant;const u=e?e?.guests||[]:n?.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 y=`/v3/scheduling/bookings${b}`;if(l.length===0){const e=await this.makeAPIRequest(decodeURIComponent(y),"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(r)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(l.length>0){d=l.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(y),"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(r)}),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 i=e.error;if(t&&t in this.errors.api(c.t("createBookingErrorTitle"))){const e=this.getErrorMessage(i);i=this.errors.api(c.t("createBookingErrorTitle"))[t](e)}return{error:i}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(c.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("rescheduleBookingId");const i=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(t&&!!n){n+=`&booking_id=${t}`}else if(t){n+=`?booking_id=${t}`}const s=`/v3/scheduling/ui-settings${n}`;const o=await this.makeAPIRequest(s,"GET",undefined,i,e);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(c.t("getUISettingErrorTitle"))){t=this.errors.api(c.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in o){this.schedulerStore.set("configSettings",o.data);this.clientId=o.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return o}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const i=t?.min_booking_notice;if(!i){return e}const n=(new Date).getTime();if(e<(n+i*60*1e3)/1e3){return Math.floor((n+i*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const i=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const n=Math.floor(h(t,i).getTime()/1e3);const s=Math.min(n,e);return s}async getAvailability(e=0,t=0,i){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const s=new Date;const o=s.getTime();if(t&&t<o/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(c.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(s.getFullYear(),s.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(s.getFullYear(),s.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const a=this.getStartTimeWithMinBookingNotice(e);e=a;t=a>t?a+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 r=this.schedulerStore.get("rescheduleBookingId");if(r){n.append("booking_id",encodeURIComponent(r))}const l=n.toString();const d=`/v3/scheduling/availability${l?`?${l}`:""}`;const h=this.getHeaders();const g=await this.makeAPIRequest(decodeURIComponent(d),"GET",undefined,h,i);if("error"in g){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=g.error?.type;let t=g.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=c.t("invalidGrantError");return{error:{title:c.t("invalidGrantErrorTitle"),message:e,category:y.Api}}}if(e&&e in this.errors.api(c.t("getAvailabilityErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("getAvailabilityErrorTitle"))[e](i)}return{error:t}}if("data"in g){const e=g.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()>o));const i=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",i);const n=g.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",n)}this.schedulerStore.set("isLoading",false);return g}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(c.t("cancelBookingErrorTitle")).no_booking_id()}}const i=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const n=`/v3/scheduling/bookings/${e}${i}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(n),"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(c.t("cancelBookingErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("cancelBookingErrorTitle"))[e](i)}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(c.t("rescheduleBookingErrorTitle")).no_booking_id()}}const i=this.errors.api(c.t("rescheduleBookingErrorTitle"));const n=this.errors.component(c.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:r}=this.schedulerStore.state;const{startTime:l,endTime:d,timezone:h}=t;const g=l||o?.start_time;if(!g){return{error:n.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:n.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:n.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const y=o?.master_id||undefined;const _=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 C=`/v3/scheduling/bookings/${e}${x}`;const T=this.getHeaders();const S=await this.makeAPIRequest(decodeURIComponent(C),"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(r),event_id:b,master_id:y,calendar_id:_}),T);if("error"in S){this.schedulerStore.set("isLoading",false);const e=S.error?.type;let t=S.error;if(e&&e in i){const n=this.getErrorMessage(t);t=i[e](n)}return{error:t}}const E=this.schedulerStore.get("reschedulingEventInfo");if("data"in S){this.schedulerStore.set("eventInfo",S?.data);if(S.data?.booking_id){this.schedulerStore.set("rescheduleBookingId",S.data.booking_id)}}else if(E){this.schedulerStore.set("eventInfo",E)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("reschedulingEventInfo",undefined);this.schedulerStore.set("isLoading",false);return S}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:i,reason:n}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=i==="confirmed"?c.t("confirmBookingErrorTitle"):c.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 r=`/v3/scheduling/bookings/${t}${a}`;const l=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(r),"PUT",JSON.stringify({status:i,cancellation_reason:n,salt:s}),l);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 i=this.getErrorMessage(t);t=this.errors.api(o)[e](i)}return{error:t}}if("data"in d&&i==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&i==="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(c.t("validateTimeslotErrorTitle")).no_config_id()}}const i=this.getHeaders();const n=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(n),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),i);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(c.t("validateTimeslotErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("validateTimeslotErrorTitle"))[e](i)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class L{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:i,configId:n,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!i&&!n&&!(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=n;this.sessionId=i;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){g("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}setSchedulerAPIURL(e){if(e==="/"){e=new URL(window.location.href).origin}this.schedulerAPIURL=e;if(this._schedulerAPIConnector){this._schedulerAPIConnector.setSchedulerAPIURL(e)}}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new E({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 B(e={}){const t={selectedDate:null,selectedLanguage:f()||l.en,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};g(`[defaultNylasStoreState]: `,t);const i=v(t);i.onChange("availability",(e=>{g(`[availability]: `,e);const t=e.map((e=>e.start_time));g(`[selectableDates]: `,t);i.set("selectableDates",t);const n=e[0];if(!n)return;const s=Math.floor((n.end_time.getTime()-n.start_time.getTime())/6e4);g(`[durationMinutes]: `,s);i.set("eventDuration",s)}));i.reset=()=>{for(const e in t){const n=t[e];i.set(e,n)}};return i}const D=(i,n)=>{const s=i.isLoading;const o=i.showNotification;const a=i.nylasBranding;const r=i.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&&n,e("div",{key:"ns-footer",class:"footer",part:"ns_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 z=(t,i)=>e("div",{class:"message-banner"},i);const R=':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 $={title:c.t("genericErrorTitle"),category:y.Component};const U=class{constructor(e){i(this,e);this.init=n(this,"init",7);this.schedulerWillLoad=n(this,"schedulerWillLoad",7);this.schedulerDidLoad=n(this,"schedulerDidLoad",7);this.nylasSchedulerError=n(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=n(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=n(this,"configSettingsLoaded",7);this.bookingRefExtracted=n(this,"bookingRefExtracted",7);this.bookedEventInfo=n(this,"bookedEventInfo",7);this.initDeferred=false;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=`${c.t("noDateSelected")}`;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version=_}connectedCallback(){g(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){g(`[nylas-scheduler] Component will load`);this.version=_;await new Promise((e=>setTimeout(e,0)));if(this.enableUserFeedback&&!k()){I({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),x({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 i=r(t.get("lang"))||r(t.get("language"));const n=i||this.defaultLanguage||r(this.bookingInfo?.language)||this.defaultSchedulerState?.selectedLanguage||f()||l.en;this.language=n;c.changeLanguage(n);this.stores={scheduler:B({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,...this.defaultSchedulerState,selectedLanguage:n})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;try{if(this.rescheduleBookingRef){const[e,t,i]=u(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,i]=u(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,i]=u(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",i);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:i})}}catch(e){g(e);const t=this.rescheduleBookingRef||this.cancelBookingRef||this.organizerConfirmationBookingRef;this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${t}`})},host:this.host})}this.applyThemeConfig(this.themeConfig);if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists(false)){this.initDeferred=true;return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new L({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const d=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(d,this.nylasSchedulerConnector);if(d.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector)}async componentDidLoad(){if(this.initDeferred){return}this.baseProvider?.componentDidLoad();await Promise.resolve();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}await this.performSchedulerDataFetch()}async performSchedulerDataFetch(){this.fetchAbortController?.abort();this.fetchAbortController=new AbortController;const{signal:e}=this.fetchAbortController;try{if(this.nylasSchedulerConnector){if(this.schedulerApiUrl){this.nylasSchedulerConnector.setSchedulerAPIURL(this.schedulerApiUrl)}if(this.sessionId){this.nylasSchedulerConnector.sessionId=this.sessionId;this.nylasSchedulerConnector.scheduler.setSessionId(this.sessionId)}}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings(e));if(e.aborted)return;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){g("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 i=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(i,this.nylasSchedulerConnector);if(e.aborted)return;if(i.defaultPrevented){return}}}const i=this.baseProvider?.getStore("scheduler");const n=i?.get("configSettings")?.scheduler?.available_days_in_future;const s=i?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(i?.get("showBookingForm")){i?.set("selectedDate",s.start_time);return}}const o=d(i?.get("selectedDate"));const a=i?.get("availability");let r;if(a&&a.length>0){return}if(!o){const t=new Date;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(t.getTime()<o*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s,e))}}else{const{startTime:t,endTime:i,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(o,n||30);if(o.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,i,e))}}if(e.aborted)return;if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=i?.get("availability").find((e=>{const t=d(e.start_time);return t?t>new Date:false}));if(t){e=d(t.start_time)||e}i?.set("selectedDate",e)}}catch(e){if(e.name==="AbortError")return;throw e}}hasValidAuthConfig(){return!!(this.sessionId||this.refConfigId||this.slug&&this.clientId)}async performDeferredInit(){if(!this.hasValidAuthConfig()||!this.initDeferred||!this.baseProvider){return}document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.initDeferred=false;this.refConfigId=this.refConfigId||this.configurationId;this.baseProvider.eventOverrides=this.eventOverrides;const e=this.baseProvider.getStore("scheduler");this.nylasSchedulerConnector=new L({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:e});const t=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(t,this.nylasSchedulerConnector);if(t.defaultPrevented){return}}await this.baseProvider.componentWillLoad(this.nylasSchedulerConnector);this.baseProvider.componentDidLoad();await Promise.resolve();const i=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(i,this.nylasSchedulerConnector);if(i.defaultPrevented){return}}await this.performSchedulerDataFetch()}async authPropsChanged(e){if(e&&"bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(this.initDeferred&&this.hasValidAuthConfig()){this.performDeferredInit()}}configurationIdChanged(){if(!this.rescheduleBookingRef&&!this.cancelBookingRef&&!this.organizerConfirmationBookingRef){this.refConfigId=this.configurationId}this.authPropsChanged()}schedulerApiUrlChanged(){if(this.nylasSchedulerConnector&&this.schedulerApiUrl){this.nylasSchedulerConnector.setSchedulerAPIURL(this.schedulerApiUrl);document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.stores?.scheduler.set("availability",[]);this.performSchedulerDataFetch()}}sessionIdChanged(){if(this.nylasSchedulerConnector&&this.sessionId){this.nylasSchedulerConnector.sessionId=this.sessionId;this.nylasSchedulerConnector.scheduler.setSessionId(this.sessionId);document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.performSchedulerDataFetch()}this.authPropsChanged()}slugChanged(){this.authPropsChanged()}clientIdChanged(){this.authPropsChanged()}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",r(e.language)||l.en)}}rescheduleBookingRefChanged(e){let t;if(e){try{const[i,n]=u(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}cancelBookingRefChanged(e){let t;if(e){try{const[i,n]=u(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}organizerConfirmationBookingRefChanged(e){let t;if(e){try{const[i,n,s]=u(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.stores?.scheduler.set("organizerConfirmationSalt",s);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n,salt:s})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in l)){return}c.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);c.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=r(e.detail)||l.en;this.language=t;c.changeLanguage(t);this.stores?.scheduler?.set("selectedLanguage",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 i=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:n,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,i||30);if(e.defaultPrevented){return}if(n<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(n,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 i=this.stores?.scheduler.get("selectedLanguage");const n=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:i,timezone:n}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const i=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const n=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=n;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 n=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...n,...i}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...n};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,...i}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=d(e.detail);this.selectedDateLabel=t?this.formatSelectedDateLabel(t):`${c.t("noDateSelected")}`}getSelectedLanguage(){const e=this.stores?.scheduler.get("selectedLanguage")||this.defaultLanguage||f()||l.en;return r(e)||l.en}getSelectedDateLocale(){const e=this.getSelectedLanguage();return p[e]||e||p[l.en]}formatSelectedDateLabel(e){return m(e.toLocaleDateString(this.getSelectedDateLocale(),{dateStyle:"full"}))}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 i=e.detail.type;if(i==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:y.Component,type:w.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){C("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const t={message:e.detail.feedback};T(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||$.title,category:e?.category||$.category,type:w.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(e=true){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){if(e){let e="";if(!this.sessionId){e+=c.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=c.t("sessionIdRequiredErrorMessage")+" "+c.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:c.t("schedulingComponentErrorTitle"),category:y.Component,type:w.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:c.t("invalidTimeslotErrorTitle"),category:y.Component,type:w.Error,description:c.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const i=new Date;const n=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(h(i,t).getTime()/1e3);const a=Math.min(o,s);const r=n<i.getTime()/1e3?Math.floor(i.getTime()/1e3):n;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,i]of Object.entries(e)){this.host.style.setProperty(`${t}`,i)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:i}=e.detail;if(t==="language"){const e=l[i];c.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const i=this.baseProvider?.getStore("scheduler");const n=i?.get("eventInfo");const o=i?.get("showBookingForm");const a=i?.get("cancelledEventInfo");const r=i?.get("cancelBookingId");const l=i?.get("selectedTimeslot");const h=i?.get("rescheduleBookingId");const g=i?.get("organizerConfirmationBookingId");const f=i?.get("rejectBookingId");const u=i?.get("confirmedEventInfo");const p=i?.get("nylasBranding")||this.nylasBranding;const m=d(i?.get("selectedDate"));const y=i?.get("configSettings")?.scheduler?.confirmation_redirect_url;const _=Object.keys(b).map((e=>({label:b[e],value:e})));const w=this.getSelectedLanguage();const v=m?this.formatSelectedDateLabel(m):`${c.t("noDateSelected")}`;if(t&&(r||f)&&!a){return e(s,null,e(D,{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:l,cancelBookingId:r,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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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(D,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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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(D,{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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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(D,{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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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&&n&&y){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const i=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",n.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);i&&h.set("booking_ref",i);const g=new URL(y,window.location.origin);h.forEach(((e,t)=>{g.searchParams.set(t,e)}));this.redirectToCustomUrl(g.toString());return}if(t&&n){return e(s,null,e(D,{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:l,eventInfo:n,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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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&&(!n||!!h)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},h&&e(z,null,`${c.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 ${h?"reschedule":""}`,part:`ns_right-panel ${h?"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"},v)),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&&!n&&o){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},h&&e(z,null,`${c.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 ${h?"reschedule":""}`,part:`ns_right-panel ${h?"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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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{configurationId:["configurationIdChanged"],schedulerApiUrl:["schedulerApiUrlChanged"],sessionId:["sessionIdChanged"],slug:["slugChanged"],clientId:["clientIdChanged"],bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};U.style=R;export{U as nylas_scheduling};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{h as e,F as t,r as i,c as n,H as s,a as o}from"./p-0EQQA0nE.js";import{N as a}from"./p-FlNKXp4j.js";import{n as r,L as l,i as c,f as d,h,a as g,j as f,k as u,l as p,m,c as b}from"./p-OpKyWV8q.js";import{E as y,v as _,u as w}from"./p-BEjJeakd.js";import{c as v}from"./p-_i6H-yQH.js";import{i as k,a as I,f as x,c as C,b as T}from"./p-B8tfyAQm.js";class S{constructor(){this.component=e=>{const t=y.Component;const i=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:i,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:i,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:i,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:i,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:i,message:e,category:t}),no_salt:(e="No salt provided")=>({title:i,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:i,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:i,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:i,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:i,message:e,category:t})}};this.api=e=>{const t=y.Api;const i=`${e} Error`;return{invalid_session:e=>({title:i,message:e,category:t}),general_error:e=>({title:i,message:e,category:t}),internal_error:e=>({title:i,message:e,category:t}),invalid_request_error:e=>({title:i,message:e,category:t}),timeslot_not_available:e=>({title:i,message:e,category:t}),provider_error:e=>({title:i,message:e,category:t}),not_found_error:e=>({title:i,message:e,category:t})}}}}class E{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:i,configId:n,slug:s,clientId:o}){this.errors=new S;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=i;this.configId=n;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,i,n={},s){try{const o=new URL(this.schedulerAPIURL);o.pathname=e;const a=await fetch(decodeURIComponent(o.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},...n},body:i,signal:s});const r=await a.json();return r}catch(e){if(e.name==="AbortError"){throw 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}setSchedulerAPIURL(e){if(e==="/"){e=new URL(window.location.href).origin}this.schedulerAPIURL=e}setSessionId(e){this.sessionId=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){const t=r(e)||l.en;this.schedulerStore.set("selectedLanguage",t);c.changeLanguage(t)}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 i=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const n=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(i,n);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const i=this.schedulerStore.get("availability").find((e=>{const t=d(e.start_time);return t?t>new Date:false}));let n=e;if(i){n=d(i.start_time)||e}this.schedulerStore.set("selectedDate",n);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 i=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return i}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:i,bookingInfo:n,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!n){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:i;const r=s||"en-US";if(!a){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_timezone_selected()}}const l=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(n?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:n?.primaryParticipant;const u=e?e?.guests||[]:n?.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 y=`/v3/scheduling/bookings${b}`;if(l.length===0){const e=await this.makeAPIRequest(decodeURIComponent(y),"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(r)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(l.length>0){d=l.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(y),"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(r)}),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 i=e.error;if(t&&t in this.errors.api(c.t("createBookingErrorTitle"))){const e=this.getErrorMessage(i);i=this.errors.api(c.t("createBookingErrorTitle"))[t](e)}return{error:i}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(c.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("rescheduleBookingId");const i=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(t&&!!n){n+=`&booking_id=${t}`}else if(t){n+=`?booking_id=${t}`}const s=`/v3/scheduling/ui-settings${n}`;const o=await this.makeAPIRequest(s,"GET",undefined,i,e);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(c.t("getUISettingErrorTitle"))){t=this.errors.api(c.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in o){this.schedulerStore.set("configSettings",o.data);this.clientId=o.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return o}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const i=t?.min_booking_notice;if(!i){return e}const n=(new Date).getTime();if(e<(n+i*60*1e3)/1e3){return Math.floor((n+i*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const i=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const n=Math.floor(h(t,i).getTime()/1e3);const s=Math.min(n,e);return s}async getAvailability(e=0,t=0,i){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const s=new Date;const o=s.getTime();if(t&&t<o/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(c.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(s.getFullYear(),s.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(s.getFullYear(),s.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const a=this.getStartTimeWithMinBookingNotice(e);e=a;t=a>t?a+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 r=this.schedulerStore.get("rescheduleBookingId");if(r){n.append("booking_id",encodeURIComponent(r))}const l=n.toString();const d=`/v3/scheduling/availability${l?`?${l}`:""}`;const h=this.getHeaders();const g=await this.makeAPIRequest(decodeURIComponent(d),"GET",undefined,h,i);if("error"in g){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=g.error?.type;let t=g.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=c.t("invalidGrantError");return{error:{title:c.t("invalidGrantErrorTitle"),message:e,category:y.Api}}}if(e&&e in this.errors.api(c.t("getAvailabilityErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("getAvailabilityErrorTitle"))[e](i)}return{error:t}}if("data"in g){const e=g.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()>o));const i=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",i);const n=g.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",n)}this.schedulerStore.set("isLoading",false);return g}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(c.t("cancelBookingErrorTitle")).no_booking_id()}}const i=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const n=`/v3/scheduling/bookings/${e}${i}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(n),"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(c.t("cancelBookingErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("cancelBookingErrorTitle"))[e](i)}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(c.t("rescheduleBookingErrorTitle")).no_booking_id()}}const i=this.errors.api(c.t("rescheduleBookingErrorTitle"));const n=this.errors.component(c.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:r}=this.schedulerStore.state;const{startTime:l,endTime:d,timezone:h}=t;const g=l||o?.start_time;if(!g){return{error:n.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:n.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:n.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const y=o?.master_id||undefined;const _=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 C=`/v3/scheduling/bookings/${e}${x}`;const T=this.getHeaders();const S=await this.makeAPIRequest(decodeURIComponent(C),"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(r),event_id:b,master_id:y,calendar_id:_}),T);if("error"in S){this.schedulerStore.set("isLoading",false);const e=S.error?.type;let t=S.error;if(e&&e in i){const n=this.getErrorMessage(t);t=i[e](n)}return{error:t}}const E=this.schedulerStore.get("reschedulingEventInfo");if("data"in S){this.schedulerStore.set("eventInfo",S?.data);if(S.data?.booking_id){this.schedulerStore.set("rescheduleBookingId",S.data.booking_id)}}else if(E){this.schedulerStore.set("eventInfo",E)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("reschedulingEventInfo",undefined);this.schedulerStore.set("isLoading",false);return S}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:i,reason:n}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=i==="confirmed"?c.t("confirmBookingErrorTitle"):c.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 r=`/v3/scheduling/bookings/${t}${a}`;const l=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(r),"PUT",JSON.stringify({status:i,cancellation_reason:n,salt:s}),l);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 i=this.getErrorMessage(t);t=this.errors.api(o)[e](i)}return{error:t}}if("data"in d&&i==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&i==="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(c.t("validateTimeslotErrorTitle")).no_config_id()}}const i=this.getHeaders();const n=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(n),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),i);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(c.t("validateTimeslotErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("validateTimeslotErrorTitle"))[e](i)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class L{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:i,configId:n,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!i&&!n&&!(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=n;this.sessionId=i;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){g("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}setSchedulerAPIURL(e){if(e==="/"){e=new URL(window.location.href).origin}this.schedulerAPIURL=e;if(this._schedulerAPIConnector){this._schedulerAPIConnector.setSchedulerAPIURL(e)}}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new E({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 B(e={}){const t={selectedDate:null,selectedLanguage:f()||l.en,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};g(`[defaultNylasStoreState]: `,t);const i=v(t);i.onChange("availability",(e=>{g(`[availability]: `,e);const t=e.map((e=>e.start_time));g(`[selectableDates]: `,t);i.set("selectableDates",t);const n=e[0];if(!n)return;const s=Math.floor((n.end_time.getTime()-n.start_time.getTime())/6e4);g(`[durationMinutes]: `,s);i.set("eventDuration",s)}));i.reset=()=>{for(const e in t){const n=t[e];i.set(e,n)}};return i}const D=(i,n)=>{const s=i.isLoading;const o=i.showNotification;const a=i.nylasBranding;const r=i.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&&n,e("div",{key:"ns-footer",class:"footer",part:"ns_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 z=(t,i)=>e("div",{class:"message-banner"},i);const R=':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 $={title:c.t("genericErrorTitle"),category:y.Component};const U=class{constructor(e){i(this,e);this.init=n(this,"init",7);this.schedulerWillLoad=n(this,"schedulerWillLoad",7);this.schedulerDidLoad=n(this,"schedulerDidLoad",7);this.nylasSchedulerError=n(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=n(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=n(this,"configSettingsLoaded",7);this.bookingRefExtracted=n(this,"bookingRefExtracted",7);this.bookedEventInfo=n(this,"bookedEventInfo",7);this.initDeferred=false;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=`${c.t("noDateSelected")}`;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version=_}connectedCallback(){g(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){g(`[nylas-scheduler] Component will load`);this.version=_;await new Promise((e=>setTimeout(e,0)));if(this.enableUserFeedback&&!k()){I({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),x({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 i=r(t.get("lang"))||r(t.get("language"));const n=i||this.defaultLanguage||r(this.bookingInfo?.language)||this.defaultSchedulerState?.selectedLanguage||f()||l.en;this.language=n;c.changeLanguage(n);this.stores={scheduler:B({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,...this.defaultSchedulerState,selectedLanguage:n})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;try{if(this.rescheduleBookingRef){const[e,t,i]=u(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,i]=u(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,i]=u(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",i);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:i})}}catch(e){g(e);const t=this.rescheduleBookingRef||this.cancelBookingRef||this.organizerConfirmationBookingRef;this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${t}`})},host:this.host})}this.applyThemeConfig(this.themeConfig);if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists(false)){this.initDeferred=true;return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new L({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const d=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(d,this.nylasSchedulerConnector);if(d.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector)}async componentDidLoad(){if(this.initDeferred){return}this.baseProvider?.componentDidLoad();await Promise.resolve();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}await this.performSchedulerDataFetch()}async performSchedulerDataFetch(){this.fetchAbortController?.abort();this.fetchAbortController=new AbortController;const{signal:e}=this.fetchAbortController;try{if(this.nylasSchedulerConnector){if(this.schedulerApiUrl){this.nylasSchedulerConnector.setSchedulerAPIURL(this.schedulerApiUrl)}if(this.sessionId){this.nylasSchedulerConnector.sessionId=this.sessionId;this.nylasSchedulerConnector.scheduler.setSessionId(this.sessionId)}}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings(e));if(e.aborted)return;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){g("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 i=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(i,this.nylasSchedulerConnector);if(e.aborted)return;if(i.defaultPrevented){return}}}const i=this.baseProvider?.getStore("scheduler");const n=i?.get("configSettings")?.scheduler?.available_days_in_future;const s=i?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(i?.get("showBookingForm")){i?.set("selectedDate",s.start_time);return}}const o=d(i?.get("selectedDate"));const a=i?.get("availability");let r;if(a&&a.length>0){return}if(!o){const t=new Date;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(t.getTime()<o*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s,e))}}else{const{startTime:t,endTime:i,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(o,n||30);if(o.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,i,e))}}if(e.aborted)return;if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=i?.get("availability").find((e=>{const t=d(e.start_time);return t?t>new Date:false}));if(t){e=d(t.start_time)||e}i?.set("selectedDate",e)}}catch(e){if(e.name==="AbortError")return;throw e}}hasValidAuthConfig(){return!!(this.sessionId||this.refConfigId||this.slug&&this.clientId)}async performDeferredInit(){if(!this.hasValidAuthConfig()||!this.initDeferred||!this.baseProvider){return}document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.initDeferred=false;this.refConfigId=this.refConfigId||this.configurationId;this.baseProvider.eventOverrides=this.eventOverrides;const e=this.baseProvider.getStore("scheduler");this.nylasSchedulerConnector=new L({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:e});const t=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(t,this.nylasSchedulerConnector);if(t.defaultPrevented){return}}await this.baseProvider.componentWillLoad(this.nylasSchedulerConnector);this.baseProvider.componentDidLoad();await Promise.resolve();const i=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(i,this.nylasSchedulerConnector);if(i.defaultPrevented){return}}await this.performSchedulerDataFetch()}async authPropsChanged(e){if(e&&"bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(this.initDeferred&&this.hasValidAuthConfig()){this.performDeferredInit()}}configurationIdChanged(){if(!this.rescheduleBookingRef&&!this.cancelBookingRef&&!this.organizerConfirmationBookingRef){this.refConfigId=this.configurationId}this.authPropsChanged()}schedulerApiUrlChanged(){if(this.nylasSchedulerConnector&&this.schedulerApiUrl){this.nylasSchedulerConnector.setSchedulerAPIURL(this.schedulerApiUrl);document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.stores?.scheduler.set("availability",[]);this.performSchedulerDataFetch()}}sessionIdChanged(){if(this.nylasSchedulerConnector&&this.sessionId){this.nylasSchedulerConnector.sessionId=this.sessionId;this.nylasSchedulerConnector.scheduler.setSessionId(this.sessionId);document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.performSchedulerDataFetch()}this.authPropsChanged()}slugChanged(){this.authPropsChanged()}clientIdChanged(){this.authPropsChanged()}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",r(e.language)||l.en)}}rescheduleBookingRefChanged(e){let t;if(e){try{const[i,n]=u(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}cancelBookingRefChanged(e){let t;if(e){try{const[i,n]=u(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}organizerConfirmationBookingRefChanged(e){let t;if(e){try{const[i,n,s]=u(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.stores?.scheduler.set("organizerConfirmationSalt",s);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n,salt:s})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in l)){return}c.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);c.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=r(e.detail)||l.en;this.language=t;c.changeLanguage(t);this.stores?.scheduler?.set("selectedLanguage",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 i=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:n,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,i||30);if(e.defaultPrevented){return}if(n<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(n,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 i=this.stores?.scheduler.get("selectedLanguage");const n=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:i,timezone:n}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const i=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const n=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=n;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 n=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...n,...i}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...n};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,...i}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=d(e.detail);this.selectedDateLabel=t?this.formatSelectedDateLabel(t):`${c.t("noDateSelected")}`}getSelectedLanguage(){const e=this.stores?.scheduler.get("selectedLanguage")||this.defaultLanguage||f()||l.en;return r(e)||l.en}getSelectedDateLocale(){const e=this.getSelectedLanguage();return p[e]||e||p[l.en]}formatSelectedDateLabel(e){return m(e.toLocaleDateString(this.getSelectedDateLocale(),{dateStyle:"full"}))}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 i=e.detail.type;if(i==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:y.Component,type:w.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){C("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const t={message:e.detail.feedback};T(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||$.title,category:e?.category||$.category,type:w.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(e=true){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){if(e){let e="";if(!this.sessionId){e+=c.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=c.t("sessionIdRequiredErrorMessage")+" "+c.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:c.t("schedulingComponentErrorTitle"),category:y.Component,type:w.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:c.t("invalidTimeslotErrorTitle"),category:y.Component,type:w.Error,description:c.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const i=new Date;const n=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(h(i,t).getTime()/1e3);const a=Math.min(o,s);const r=n<i.getTime()/1e3?Math.floor(i.getTime()/1e3):n;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,i]of Object.entries(e)){this.host.style.setProperty(`${t}`,i)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:i}=e.detail;if(t==="language"){const e=l[i];c.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const i=this.baseProvider?.getStore("scheduler");const n=i?.get("eventInfo");const o=i?.get("showBookingForm");const a=i?.get("cancelledEventInfo");const r=i?.get("cancelBookingId");const l=i?.get("selectedTimeslot");const h=i?.get("rescheduleBookingId");const g=i?.get("organizerConfirmationBookingId");const f=i?.get("rejectBookingId");const u=i?.get("confirmedEventInfo");const p=i?.get("nylasBranding")||this.nylasBranding;const m=d(i?.get("selectedDate"));const y=i?.get("configSettings")?.scheduler?.confirmation_redirect_url;const _=Object.keys(b).map((e=>({label:b[e],value:e})));const w=this.getSelectedLanguage();const v=m?this.formatSelectedDateLabel(m):`${c.t("noDateSelected")}`;if(t&&(r||f)&&!a){return e(s,null,e(D,{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:l,cancelBookingId:r,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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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(D,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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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(D,{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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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(D,{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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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&&n&&y){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const i=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",n.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);i&&h.set("booking_ref",i);const g=new URL(y,window.location.origin);h.forEach(((e,t)=>{g.searchParams.set(t,e)}));this.redirectToCustomUrl(g.toString());return}if(t&&n){return e(s,null,e(D,{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:l,eventInfo:n,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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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&&(!n||!!h)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},h&&e(z,null,`${c.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 ${h?"reschedule":""}`,part:`ns_right-panel ${h?"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"},v)),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&&!n&&o){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},h&&e(z,null,`${c.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 ${h?"reschedule":""}`,part:`ns_right-panel ${h?"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:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),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{configurationId:["configurationIdChanged"],schedulerApiUrl:["schedulerApiUrlChanged"],sessionId:["sessionIdChanged"],slug:["slugChanged"],clientId:["clientIdChanged"],bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};U.style=R;export{U as nylas_scheduling};
|
|
2
|
+
//# sourceMappingURL=p-fe855b8f.entry.js.map
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.5.
|
|
1
|
+
export declare const version = "2.5.12";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"p-B05sg_l1.js","mappings":";;;;;;;;;;;;AAAA,MAAM,mBAAmB,GAAG,woNAAwoN;;;;;;;;;;;;;;;;MC6CvpN,gBAAgB,GAAAA,kBAAA,CAAA,MAAA,gBAAA,SAAAC,CAAA,CAAA;AAN7B,IAAA,WAAA,GAAA;;;;;;;AAiBU,QAAA,IAAI,CAAA,IAAA,GAAW,cAAc;AAU7B,QAAA,IAAM,CAAA,MAAA,GAAY,IAAI;AAqBrB,QAAA,IAAgB,CAAA,gBAAA,GAAmB,IAAI;AAKvC,QAAA,IAAa,CAAA,aAAA,GAAY,KAAK;AAwaxC;IAvZC,iBAAiB,GAAA;AACf,QAAA,KAAK,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;QAGhD,cAAc,CAAC,MAAK;AAClB,YAAA,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,gBAAA,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC;gBACvC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,EAAE,CAAC;;AAE7C,SAAC,CAAC;;IAGJ,oBAAoB,GAAA;AAClB,QAAA,KAAK,CAAC,oBAAoB,EAAE,sBAAsB,CAAC;;IAGrD,iBAAiB,GAAA;AACf,QAAA,KAAK,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;QAEhD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;;IAG3C,gBAAgB,GAAA;AACd,QAAA,KAAK,CAAC,oBAAoB,EAAE,kBAAkB,CAAC;AAC/C,QA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AA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,yBAAyB,EAAA,EAClC,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAG,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAO,CAC3I,CACF,CACF,CACF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7BX,UAAA,CAAA;AArBC,IAAA,iBAAiB,CAAsG;AACtH,QAAA,IAAI,EAAE,oBAAoB;QAC1B,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;YAClE,CAAC,kCAAkC,EAAE,kBAAkB,CAAC;YACxD,CAAC,6BAA6B,EAAE,aAAa,CAAC;SAC/C,CAAC;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,YAAY,EAAE,OACZ,KAAiI,EACjI,8BAA6D,KAC3D;AACF,gBAAA,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM;gBAErC,IAAI,YAAY,EAAE;oBAChB,YAAY,CAAC,KAAK,CAAC;;aAEtB;AACF,SAAA;AACD,QAAA,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;CAgCD,EAAA,gBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement","i18next"],"sources":["src/components/scheduler-editor/nylas-page-styling/nylas-page-styling.scss?tag=nylas-page-styling&encapsulation=shadow","src/components/scheduler-editor/nylas-page-styling/nylas-page-styling.tsx"],"sourcesContent":["@use '../../../common/styles/variables' as *;\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-page-styling {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n text-align: left;\n\n .hidden {\n display: none;\n }\n\n &.no-border {\n border: none;\n }\n\n .header {\n padding: 1rem;\n display: grid;\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid var(--nylas-base-200);\n\n h3 {\n border-radius: var(--nylas-border-radius-2x);\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n\n .drawer-toggle {\n display: flex;\n gap: 24px;\n align-items: center;\n\n .chevron {\n display: flex;\n align-self: center;\n cursor: pointer;\n\n &:hover,\n &:active {\n color: var(--nylas-primary);\n }\n\n &.open {\n transform: rotate(90deg);\n }\n\n &.closed {\n transform: rotate(270deg);\n }\n\n &.disabled {\n cursor: not-allowed;\n color: var(--nylas-base-300);\n\n &:hover {\n color: var(--nylas-base-300);\n }\n }\n }\n }\n }\n\n .nylas-page-styling__body {\n display: grid;\n grid-template-columns: 1fr auto;\n background-color: var(--nylas-base-25);\n border-radius: 0 0 var(--nylas-border-radius-2x);\n\n @media #{$mobile} {\n grid-template-columns: 1fr;\n }\n\n .nylas-page-styling__section {\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n color: var(--nylas-base-800);\n\n &.no-padding {\n padding: 0;\n }\n\n @media #{$mobile} {\n border: none;\n }\n\n .nylas-page-styling__row {\n display: grid;\n grid-template-columns: 1fr;\n align-items: center;\n\n label {\n display: flex;\n align-items: center;\n\n span.required {\n color: var(--nylas-error, #cc4841);\n }\n\n span.label-icon {\n margin-left: 4px;\n\n tooltip-component {\n display: flex;\n }\n }\n }\n\n p {\n margin: 0.25rem 0 0 0;\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n color: var(--nylas-base-900);\n }\n\n .subsection {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n\n &.hide {\n display: none;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n\n .input-container,\n >* {\n display: flex;\n flex-direction: column;\n column-gap: 2rem;\n row-gap: 0.25rem;\n width: 100%;\n flex: 1;\n\n textarea {\n padding: 12px 16px;\n border-width: 1;\n resize: vertical;\n border-radius: 8px;\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n border: 1px solid var(--nylas-base-200);\n }\n }\n }\n }\n }\n\n span.error-message {\n color: var(--nylas-error);\n }\n\n span.help-text {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n}","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug, error, sanitize } from '@/utils/utils';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Appearance, Configuration, ThemeConfig } from '@nylas/core';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE } from '@/common/constants';\n\n/**\n * The `nylas-page-styling` component is a UI component that allows users to customize the styling of the scheduling page.\n * To use this component, pass a slot `custom-page-style-inputs` to the `nylas-scheduler-editor` component with the input\n * fields you want to display. The component will automatically update the appearance object when the input fields are changed.\n * Ensure that the input fields have the `name` attribute set to the key in the appearance object.\n *\n * If you want to style the Nylas hosted scheduler page, you can use this component to customize the appearance of the page.\n * The fields that can be customized in the Nylas hosted scheduler page are:\n * - Primary color: (name: color)\n * - Company logo: (name: company_logo_url)\n * - Submit button label: (name: submit_button_label)\n * - Thank you message: (name: thank_you_message)\n *\n * This component cannot be used as an independent component. It must be used within the `nylas-scheduler-editor` component.\n *\n * @slot custom-page-style-inputs - This slot is used to pass a custom page style form to the Nylas Scheduler Editor component.\n * @part nps - The nylas-page-styling container\n * @part nps__header - The header of the page styling section\n * @part nps__drawer-toggle--container - The page styling drawer toggle container\n * @part nps__body - The body of the page styling section\n * @part nps__title-input-textfield - The page styling page title input textfield\n * @part nps__company-name-input-textfield - The page styling company name input textfield\n * @part nps__input-image-url - The page styling company logo input textfield\n * @part nps__color-picker - The page styling color picker\n * @part nps__color-picker-button - The page styling color picker button\n * @part nps__color-picker-button-label - The page styling color input field label *\n * @part nps__color-picker-button-selected-label - The page styling color picker label denoting which color is selected\n * @part nps__submit-button-label-input-textfield - The page styling submut button label input textfield\n * @part nps__message-textarea - The page styling thank you message textarea\n */\n@Component({\n tag: 'nylas-page-styling',\n styleUrl: 'nylas-page-styling.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasPageStyling {\n @Element() host!: HTMLNylasPageStylingElement;\n /**\n * @internal\n * The selected configuration.\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * @internal\n * The name of the component\n */\n @Prop() name: string = 'page-styling';\n /**\n * @internal\n * The appearance data to display\n */\n @Prop() appearance?: Appearance;\n /**\n * @internal\n * Is the page styling card open\n */\n @Prop() isOpen: boolean = true;\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: LANGUAGE_CODE;\n /**\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: ThemeConfig;\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The confirmation email template state.\n */\n @State() currentAppearance!: Appearance;\n /**\n * The cloned custom slot content provided by consumers.\n */\n @State() customInputsSlot: Element | null = null;\n\n /**\n * Whether a custom slot was provided. When false, default translated inputs are rendered.\n */\n @State() hasCustomSlot: boolean = false;\n\n /**\n * This event is fired when the email reminders change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n /**\n * This event is fired when the form is submitted in the parent component.\n */\n @Event() bookingFormSubmitted!: EventEmitter<void>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-page-styling', 'connectedCallback');\n // Use queueMicrotask to defer theme application until after React has set props.\n // This fixes the timing issue where connectedCallback fires before React sets themeConfig.\n queueMicrotask(() => {\n if (this.themeConfig) {\n this.applyThemeConfig(this.themeConfig);\n this.host.setAttribute('data-themed', '');\n }\n });\n }\n\n disconnectedCallback() {\n debug('nylas-page-styling', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-page-styling', 'componentWillLoad');\n // See comment in the @Watch('name') decorator for more information.\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-page-styling', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n }\n }\n\n componentWillUpdate() {\n debug('nylas-page-styling', 'componentWillUpdate');\n }\n\n componentDidUpdate() {\n debug('nylas-page-styling', 'componentDidUpdate');\n }\n\n componentWillRender() {\n debug('nylas-page-styling', 'componentWillRender');\n }\n\n componentDidRender() {\n debug('nylas-page-styling', 'componentDidRender');\n }\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-page-styling', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedLanguage')\n selectedLanguageChangedHandler(newVal: LANGUAGE_CODE, oldVal: LANGUAGE_CODE) {\n if (newVal === oldVal) return;\n i18next.changeLanguage(newVal);\n }\n\n @Watch('themeConfig')\n themeConfigChangedHandler(newVal: ThemeConfig, oldVal: ThemeConfig) {\n if (newVal === oldVal) return;\n this.applyThemeConfig(newVal);\n }\n\n 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 customInputsSlotChangedHandler(newValue: Element | null) {\n debug('nylas-page-styling', 'customInputsSlotChangedHandler', newValue);\n\n const appearance = this.currentAppearance;\n\n function updateInputDefaultValues(element: HTMLElement) {\n // Process elements with a 'name' attribute\n if (element.hasAttribute && element.hasAttribute('name')) {\n const key = element.getAttribute('name');\n if (appearance && key && key in appearance && appearance[key] !== undefined) {\n // Update attributes based on component type\n const componentType = element.getAttribute('component-type');\n\n element.setAttribute('data-page-styling', 'true');\n\n if (componentType === 'checkbox') {\n element.setAttribute('checked', appearance[key]);\n } else if (componentType === 'radio-group') {\n element.setAttribute('default-selected-value', appearance[key]);\n } else if (componentType === 'color-picker') {\n element.setAttribute('default-selected-color', appearance[key]);\n } else if (componentType === 'select-dropdown') {\n const options = element.getAttribute('options');\n const selectedOption = options ? JSON.parse(options).find((option: { value: string }) => option.value === appearance[key]) : null;\n element.setAttribute('default-selected-option', JSON.stringify(selectedOption));\n } else if (componentType === 'image-url') {\n element.setAttribute('image-url', appearance[key]);\n } else {\n // Default case: set the default value\n element.setAttribute('default-value', appearance[key]);\n }\n }\n }\n\n // Recursively process child elements (skip text nodes)\n element.childNodes.forEach(child => {\n if (child.nodeType === Node.ELEMENT_NODE) {\n updateInputDefaultValues(child as HTMLElement); // Cast child to HTMLElement\n }\n });\n }\n\n // Start the recursive process with the cloned element (newValue)\n if (newValue) {\n updateInputDefaultValues(newValue as HTMLElement);\n }\n }\n\n cloneAndCopyProps(element: HTMLElement): HTMLElement {\n // Clone the current element\n const clonedElement = element.cloneNode(false) as HTMLElement; // Do a shallow clone first\n const componentType = element.getAttribute('component-type');\n const key = element.getAttribute('name');\n\n // Copy properties like 'options' and 'value' for custom elements\n if ((element as any).options) {\n const options = (element as any).getAttribute('options');\n debug('page-styling options', element, options);\n if (typeof options === 'string') {\n try {\n const parsedOptions = JSON.parse(options);\n (clonedElement as any).options = parsedOptions; // Parse the 'options' string\n if (componentType === 'select-dropdown' && key && key in this.currentAppearance) {\n const selectedOption = parsedOptions.find((option: { value: string }) => option.value === this.currentAppearance[key]);\n (clonedElement as any).setAttribute('default-selected-option', JSON.stringify(selectedOption));\n }\n } catch (e) {\n error('Error parsing options', e);\n }\n } else {\n (clonedElement as any).options = (element as any).options; // Copy 'options' property\n }\n }\n\n if ((element as any).value) {\n (clonedElement as any).value = (element as any).value; // Copy 'value' property\n }\n\n // Recursively process child elements\n element.childNodes.forEach(child => {\n if (child.nodeType === Node.ELEMENT_NODE) {\n // If the child is an element, recursively clone and process it\n const clonedChild = this.cloneAndCopyProps(child as HTMLElement);\n clonedElement.appendChild(clonedChild); // Append the cloned child to the parent clone\n } else if (child.nodeType === Node.TEXT_NODE) {\n // For text nodes, just clone and append the text content\n clonedElement.appendChild(child.cloneNode(true));\n }\n });\n\n return clonedElement; // Return the cloned element with its children\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-page-styling', 'selectedConfigurationChangedHandler', newValue);\n this.currentAppearance = newValue?.appearance || {};\n // Register the loaded appearance with the form so it is included on submit. The form\n // value was previously only set on user input, so loading/reloading a configuration\n // (initial mount, tab switch, parent re-broadcast) left appearance unregistered and the\n // save sent `appearance: null` — dropping the thank-you message and other page-styling\n // fields. Done before the slot early-returns below so it always runs. (CUST-5437)\n if (typeof this.internals?.setFormValue === 'function') {\n this.internals.setFormValue(JSON.stringify(this.currentAppearance), this.name);\n }\n // Get the slot element\n const editor = document.querySelector('nylas-scheduler-editor');\n const slotElement = editor?.shadowRoot?.querySelector('slot[name=\"custom-page-style-inputs\"]') as HTMLSlotElement;\n if (!slotElement) {\n this.hasCustomSlot = false;\n return;\n }\n\n // Get the slotted content (the nodes passed into the slot)\n const slottedElements = slotElement?.assignedElements({ flatten: true });\n\n if (!slottedElements || slottedElements.length === 0) {\n this.hasCustomSlot = false;\n return;\n }\n\n this.hasCustomSlot = true;\n\n const divElement = document.createElement('div');\n\n // Clone each of the slotted nodes and append them to the cloned slot\n slottedElements?.forEach(element => {\n const clonedElement = this.cloneAndCopyProps(element as HTMLElement); // Clone recursively and copy properties\n\n // Clone the slotted element (deep clone)\n this.customInputsSlotChangedHandler(clonedElement);\n // Append the cloned element to the document fragment\n divElement.appendChild(clonedElement);\n });\n\n // Replace the original content with the new cloned and updated content\n const bodyElement = this.host.shadowRoot?.querySelector('.nylas-page-styling');\n const slotContainer = bodyElement?.querySelector('.nylas-page-styling__body .subsection');\n\n if (slotContainer) {\n // Remove existing children (if necessary) and append the new content\n slotContainer.innerHTML = ''; // Clear existing content\n divElement.childNodes.forEach(child => {\n slotContainer.appendChild(child); // Append each child of divElement\n });\n this.customInputsSlot = divElement;\n }\n }\n\n checkIfElementIsInSlot(name: string): boolean {\n const findElement = document?.querySelector(`[slot=\"custom-page-style-inputs\"] [name=\"${name}\"]`);\n if (findElement) return true;\n const shadowElement = this.host.shadowRoot?.querySelector(`[data-page-styling] [name=\"${name}\"], [data-page-styling][name=\"${name}\"]`);\n return !!shadowElement;\n }\n\n @Listen('nylasFormInputChanged', { target: 'document' })\n async nylasFormInputChangeHandler(event: CustomEvent<{ value: string; name: string; type?: string }>) {\n const { name, value } = event.detail;\n const type = event.detail?.type;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n switch (name) {\n case 'submit_button_label':\n this.currentAppearance = { ...this.currentAppearance, submit_button_label: value };\n break;\n case 'thank_you_message':\n if (type === 'multi_line_text') {\n const value = sanitize(event.detail.value);\n this.currentAppearance = { ...this.currentAppearance, thank_you_message: value };\n }\n break;\n default:\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n break;\n }\n this.updateConfirmationFormValue();\n }\n\n @Listen('nylasFormDropdownChanged', { target: 'document' })\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-page-styling', 'nylasFormDropdownChangedHandler', event.detail);\n const { value, name } = event.detail;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n if (name === 'color') {\n this.currentAppearance = { ...this.currentAppearance, color: value };\n } else {\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n }\n this.updateConfirmationFormValue();\n }\n\n @Listen('valueChanged', { target: 'document' })\n valueChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-page-styling', 'valueChangedHandler', event.detail);\n const { value, name } = event.detail;\n\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n this.updateConfirmationFormValue(false);\n }\n\n @Listen('nylasFormCheckboxToggled', { target: 'document' })\n checkboxToggledHandler(event: CustomEvent<{ checked: boolean; name: string; label: string }>) {\n const { checked, name } = event.detail;\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n this.currentAppearance = { ...this.currentAppearance, [name]: checked };\n this.updateConfirmationFormValue();\n }\n\n @Listen('nylasFormRadioChanged', { target: 'document' })\n radioChangedHandler(event: CustomEvent<{ value: string; name: string; label: string; type: string }>) {\n const { value, name } = event.detail;\n if (!this.checkIfElementIsInSlot(name)) {\n return;\n }\n this.currentAppearance = { ...this.currentAppearance, [name]: value };\n this.updateConfirmationFormValue();\n }\n\n updateConfirmationFormValue(valueChanged: boolean = true) {\n debug('nylas-page-styling', 'updateConfirmationFormValue');\n this.internals.setFormValue(JSON.stringify(this.currentAppearance), this.name);\n if (valueChanged) {\n this.valueChanged.emit({ value: JSON.stringify(this.currentAppearance), name: this.name });\n }\n }\n\n toggleConfirmationEmail() {\n this.isOpen = !this.isOpen;\n }\n\n renderDefaultInputs() {\n return (\n <div>\n <div>\n <label part=\"nps__input-image-url\">{i18next.t('nylasPageStyling.companyLogoUrl')}</label>\n <input-image-url name=\"company_logo_url\" image-url={this.currentAppearance?.company_logo_url} data-page-styling=\"true\" />\n </div>\n <div>\n <label part=\"nps__color-picker-button-label\">{i18next.t('nylasPageStyling.primaryColor')}</label>\n <div>\n <div class=\"color-picker-container\">\n <input-color-picker name=\"color\" default-selected-color={this.currentAppearance?.color} data-page-styling=\"true\" />\n </div>\n </div>\n </div>\n <div>\n <label part=\"nps__submit-button-label-input-textfield\">{i18next.t('nylasPageStyling.submitButtonLabel')}</label>\n <div>\n <input-component name=\"submit_button_label\" type=\"text\" default-value={this.currentAppearance?.submit_button_label} data-page-styling=\"true\" />\n </div>\n </div>\n <div>\n <label part=\"nps__message-textarea\">{i18next.t('nylasPageStyling.thankYouMessage')}</label>\n <div>\n <textarea-component\n name=\"thank_you_message\"\n placeholder={i18next.t('nylasPageStyling.thankYouMessagePlaceholder')}\n default-value={this.currentAppearance?.thank_you_message}\n maxLength={500}\n data-page-styling=\"true\"\n />\n </div>\n </div>\n </div>\n );\n }\n\n @RegisterComponent<NylasPageStyling, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-page-styling',\n stateToProps: new Map([\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.selectedLanguage', 'selectedLanguage'],\n ['schedulerConfig.themeConfig', 'themeConfig'],\n ]),\n eventToProps: {\n valueChanged: async (\n event: CustomEvent<{ value: string; name: string; valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void }>,\n _nylasSchedulerConfigConnector: NylasSchedulerConfigConnector,\n ) => {\n const { valueChanged } = event.detail;\n // If a handler is passed, call it.\n if (valueChanged) {\n valueChanged(event);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const showContent = this.customInputsSlot || (!this.hasCustomSlot && !!this.currentAppearance);\n\n return (\n <Host>\n <div part=\"nps\" class={{ 'nylas-page-styling': true, 'no-border': !showContent }}>\n {showContent ? (\n <div class=\"header\" part=\"nps__header\">\n <div>\n <h3>{i18next.t('nylasPageStyling.headerTitle')}</h3>\n </div>\n <div class=\"drawer-toggle\" part=\"nps__drawer-toggle--container\">\n <span class={`chevron ${this.isOpen ? 'open' : 'closed'} `} onClick={() => this.toggleConfirmationEmail()}>\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n </div>\n ) : null}\n <div class=\"hidden\">\n <input-color-picker name=\"color-picker\" />\n </div>\n <div id=\"nylas-page-styling__body\" class=\"nylas-page-styling__body\" part=\"nps__body\">\n <div class={{ 'nylas-page-styling__section': true, 'no-padding': !showContent }}>\n <div class=\"nylas-page-styling__row\">\n <div class={{ subsection: true, hide: !this.isOpen }}>{!this.hasCustomSlot && this.currentAppearance ? this.renderDefaultInputs() : null}</div>\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|