@nylas/web-elements 2.0.6 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +212 -212
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +1044 -1044
  3. package/dist/cjs/{abstract-provider-b37458c4.js → abstract-provider-85a616a9.js} +2 -2
  4. package/dist/cjs/{abstract-provider-b37458c4.js.map → abstract-provider-85a616a9.js.map} +1 -1
  5. package/dist/cjs/calendar-agenda-fill-icon_37.cjs.entry.js +55 -55
  6. package/dist/cjs/calendar-agenda-fill-icon_37.cjs.entry.js.map +1 -1
  7. package/dist/cjs/checkbox-group_4.cjs.entry.js +3 -3
  8. package/dist/cjs/checkmark-icon_15.cjs.entry.js +2 -2
  9. package/dist/cjs/{customParseFormat-61a3a302.js → customParseFormat-dc3b45aa.js} +2 -2
  10. package/dist/cjs/{customParseFormat-61a3a302.js.map → customParseFormat-dc3b45aa.js.map} +1 -1
  11. package/dist/cjs/{feedbackSync-2c4d37fe.js → feedbackSync-eaa01d21.js} +2 -2
  12. package/dist/cjs/feedbackSync-eaa01d21.js.map +1 -0
  13. package/dist/cjs/google-logo-icon_6.cjs.entry.js +18 -18
  14. package/dist/cjs/google-logo-icon_6.cjs.entry.js.map +1 -1
  15. package/dist/cjs/index.cjs.js +2 -2
  16. package/dist/cjs/{index.es-e4fc6d92.js → index.es-a962dedb.js} +2 -2
  17. package/dist/cjs/{index.es-e4fc6d92.js.map → index.es-a962dedb.js.map} +1 -1
  18. package/dist/cjs/input-component.cjs.entry.js +1 -1
  19. package/dist/cjs/input-dropdown_2.cjs.entry.js +1 -1
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/multi-select-dropdown.cjs.entry.js +1 -1
  22. package/dist/cjs/{nylas-api-request-5b2f7ec0.js → nylas-api-request-d263af93.js} +2 -2
  23. package/dist/cjs/{nylas-api-request-5b2f7ec0.js.map → nylas-api-request-d263af93.js.map} +1 -1
  24. package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js +2 -2
  25. package/dist/cjs/nylas-date-component_2.cjs.entry.js +2 -2
  26. package/dist/cjs/nylas-form-card.cjs.entry.js +2 -2
  27. package/dist/cjs/nylas-notification_2.cjs.entry.js +1 -1
  28. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +6 -6
  29. package/dist/cjs/nylas-scheduling.cjs.entry.js +8 -8
  30. package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
  31. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  32. package/dist/cjs/{register-component-8a9c40ee.js → register-component-2eefbf66.js} +2 -2
  33. package/dist/cjs/{register-component-8a9c40ee.js.map → register-component-2eefbf66.js.map} +1 -1
  34. package/dist/cjs/textarea-component.cjs.entry.js +1 -1
  35. package/dist/cjs/{utils-c923f1a8.js → utils-e37da320.js} +113 -113
  36. package/dist/cjs/{utils-c923f1a8.js.map → utils-e37da320.js.map} +1 -1
  37. package/dist/collection/collection-manifest.json +1 -1
  38. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js +1 -1
  39. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js.map +1 -1
  40. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js +10 -10
  41. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js.map +1 -1
  42. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/test/nylas-editor-tabs.spec.js +1 -1
  43. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/test/nylas-editor-tabs.spec.js.map +1 -1
  44. package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.js +18 -18
  45. package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.js.map +1 -1
  46. package/dist/collection/components/scheduler-editor/{nylas-specific-date-availability-picker/nylas-specific-date-availability-picker.css → nylas-specific-time-availability-picker/nylas-specific-time-availability-picker.css} +46 -46
  47. package/dist/collection/components/scheduler-editor/{nylas-specific-date-availability-picker/nylas-specific-date-availability-picker.js → nylas-specific-time-availability-picker/nylas-specific-time-availability-picker.js} +41 -41
  48. package/dist/collection/components/scheduler-editor/nylas-specific-time-availability-picker/nylas-specific-time-availability-picker.js.map +1 -0
  49. package/dist/collection/components/scheduler-editor/{nylas-specific-date-availability-picker/test/nylas-specific-date-availability-picker.spec.js → nylas-specific-time-availability-picker/test/nylas-specific-time-availability-picker.spec.js} +48 -48
  50. package/dist/collection/components/scheduler-editor/nylas-specific-time-availability-picker/test/nylas-specific-time-availability-picker.spec.js.map +1 -0
  51. package/dist/collection/types/index.js.map +1 -1
  52. package/dist/components/index3.js.map +1 -1
  53. package/dist/components/nylas-editor-tabs-group2.js +2 -2
  54. package/dist/components/nylas-editor-tabs2.js +15 -15
  55. package/dist/components/nylas-editor-tabs2.js.map +1 -1
  56. package/dist/components/nylas-participants-custom-availability2.js +21 -21
  57. package/dist/components/nylas-participants-custom-availability2.js.map +1 -1
  58. package/dist/components/nylas-scheduler-editor.js +5 -5
  59. package/dist/components/nylas-scheduling.js +4 -4
  60. package/dist/components/nylas-scheduling.js.map +1 -1
  61. package/dist/components/nylas-specific-time-availability-picker.d.ts +11 -0
  62. package/dist/components/nylas-specific-time-availability-picker.js +8 -0
  63. package/dist/components/nylas-specific-time-availability-picker.js.map +1 -0
  64. package/dist/components/{nylas-specific-date-availability-picker2.js → nylas-specific-time-availability-picker2.js} +41 -41
  65. package/dist/components/nylas-specific-time-availability-picker2.js.map +1 -0
  66. package/dist/components/utils.js +112 -112
  67. package/dist/esm/{abstract-provider-45ada3b4.js → abstract-provider-a502b54d.js} +2 -2
  68. package/dist/esm/{abstract-provider-45ada3b4.js.map → abstract-provider-a502b54d.js.map} +1 -1
  69. package/dist/esm/calendar-agenda-fill-icon_37.entry.js +55 -55
  70. package/dist/esm/calendar-agenda-fill-icon_37.entry.js.map +1 -1
  71. package/dist/esm/checkbox-group_4.entry.js +3 -3
  72. package/dist/esm/checkmark-icon_15.entry.js +2 -2
  73. package/dist/esm/{customParseFormat-eeec04f5.js → customParseFormat-b5d95b34.js} +2 -2
  74. package/dist/esm/{customParseFormat-eeec04f5.js.map → customParseFormat-b5d95b34.js.map} +1 -1
  75. package/dist/esm/{feedbackSync-0ebd0eda.js → feedbackSync-92220b42.js} +2 -2
  76. package/dist/esm/feedbackSync-92220b42.js.map +1 -0
  77. package/dist/esm/google-logo-icon_6.entry.js +18 -18
  78. package/dist/esm/google-logo-icon_6.entry.js.map +1 -1
  79. package/dist/esm/{index.es-57d4a08f.js → index.es-488bc919.js} +2 -2
  80. package/dist/esm/{index.es-57d4a08f.js.map → index.es-488bc919.js.map} +1 -1
  81. package/dist/esm/index.js +2 -2
  82. package/dist/esm/input-component.entry.js +1 -1
  83. package/dist/esm/input-dropdown_2.entry.js +1 -1
  84. package/dist/esm/loader.js +1 -1
  85. package/dist/esm/multi-select-dropdown.entry.js +1 -1
  86. package/dist/esm/{nylas-api-request-ad1909c6.js → nylas-api-request-9f7ac6c5.js} +2 -2
  87. package/dist/esm/{nylas-api-request-ad1909c6.js.map → nylas-api-request-9f7ac6c5.js.map} +1 -1
  88. package/dist/esm/nylas-booked-event-card_11.entry.js +2 -2
  89. package/dist/esm/nylas-date-component_2.entry.js +2 -2
  90. package/dist/esm/nylas-form-card.entry.js +2 -2
  91. package/dist/esm/nylas-notification_2.entry.js +1 -1
  92. package/dist/esm/nylas-scheduler-editor.entry.js +6 -6
  93. package/dist/esm/nylas-scheduling.entry.js +8 -8
  94. package/dist/esm/nylas-scheduling.entry.js.map +1 -1
  95. package/dist/esm/nylas-web-elements.js +1 -1
  96. package/dist/esm/{register-component-0aad9e3d.js → register-component-3acd57e7.js} +2 -2
  97. package/dist/esm/{register-component-0aad9e3d.js.map → register-component-3acd57e7.js.map} +1 -1
  98. package/dist/esm/textarea-component.entry.js +1 -1
  99. package/dist/esm/{utils-d3c0b941.js → utils-31933f5d.js} +113 -113
  100. package/dist/esm/{utils-d3c0b941.js.map → utils-31933f5d.js.map} +1 -1
  101. package/dist/nylas-web-elements/index.esm.js +1 -1
  102. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  103. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
  104. package/dist/nylas-web-elements/{p-3216af1e.entry.js → p-20f50696.entry.js} +2 -2
  105. package/dist/nylas-web-elements/p-341f1a4c.entry.js +2 -0
  106. package/dist/nylas-web-elements/p-341f1a4c.entry.js.map +1 -0
  107. package/dist/nylas-web-elements/{p-1591deba.js → p-34c9fc7d.js} +2 -2
  108. package/dist/nylas-web-elements/{p-38fa873f.js → p-3524dab1.js} +2 -2
  109. package/dist/nylas-web-elements/p-3524dab1.js.map +1 -0
  110. package/dist/nylas-web-elements/{p-d45012f2.js → p-438d4542.js} +2 -2
  111. package/dist/nylas-web-elements/{p-21ab4e47.entry.js → p-536c5ef3.entry.js} +2 -2
  112. package/dist/nylas-web-elements/{p-a4678661.entry.js → p-5a6c2efd.entry.js} +2 -2
  113. package/dist/nylas-web-elements/p-66a89e65.js +14 -0
  114. package/dist/nylas-web-elements/{p-17c5fb16.js.map → p-66a89e65.js.map} +1 -1
  115. package/dist/nylas-web-elements/{p-88e68e14.entry.js → p-6adb19cf.entry.js} +2 -2
  116. package/dist/nylas-web-elements/{p-8937a53f.entry.js → p-6bda61cf.entry.js} +3 -3
  117. package/dist/nylas-web-elements/p-6bda61cf.entry.js.map +1 -0
  118. package/dist/nylas-web-elements/{p-30d92734.entry.js → p-7c02e476.entry.js} +2 -2
  119. package/dist/nylas-web-elements/{p-8072aa07.js → p-803a1695.js} +2 -2
  120. package/dist/nylas-web-elements/{p-186bbd43.entry.js → p-81925b89.entry.js} +2 -2
  121. package/dist/nylas-web-elements/{p-186bbd43.entry.js.map → p-81925b89.entry.js.map} +1 -1
  122. package/dist/nylas-web-elements/{p-855fe5b3.entry.js → p-83d2ff21.entry.js} +2 -2
  123. package/dist/nylas-web-elements/{p-f83aa456.entry.js → p-8673dcf1.entry.js} +2 -2
  124. package/dist/nylas-web-elements/{p-24c390bd.js → p-86e217f4.js} +2 -2
  125. package/dist/nylas-web-elements/{p-d0f51520.entry.js → p-8d5efa5e.entry.js} +2 -2
  126. package/dist/nylas-web-elements/{p-0271cef3.entry.js → p-d7323440.entry.js} +3 -3
  127. package/dist/nylas-web-elements/{p-59ff0231.entry.js → p-da25d877.entry.js} +2 -2
  128. package/dist/nylas-web-elements/{p-f0e1688e.js → p-e42db60f.js} +2 -2
  129. package/dist/nylas-web-elements/{p-c11e1016.entry.js → p-ff122d1e.entry.js} +2 -2
  130. package/dist/types/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.d.ts +5 -5
  131. package/dist/types/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.d.ts +3 -3
  132. package/dist/types/components/scheduler-editor/{nylas-specific-date-availability-picker/nylas-specific-date-availability-picker.d.ts → nylas-specific-time-availability-picker/nylas-specific-time-availability-picker.d.ts} +7 -7
  133. package/dist/types/components.d.ts +19 -19
  134. package/dist/types/types/index.d.ts +2 -2
  135. package/package.json +2 -2
  136. package/dist/cjs/feedbackSync-2c4d37fe.js.map +0 -1
  137. package/dist/collection/components/scheduler-editor/nylas-specific-date-availability-picker/nylas-specific-date-availability-picker.js.map +0 -1
  138. package/dist/collection/components/scheduler-editor/nylas-specific-date-availability-picker/test/nylas-specific-date-availability-picker.spec.js.map +0 -1
  139. package/dist/components/nylas-specific-date-availability-picker.d.ts +0 -11
  140. package/dist/components/nylas-specific-date-availability-picker.js +0 -8
  141. package/dist/components/nylas-specific-date-availability-picker.js.map +0 -1
  142. package/dist/components/nylas-specific-date-availability-picker2.js.map +0 -1
  143. package/dist/esm/feedbackSync-0ebd0eda.js.map +0 -1
  144. package/dist/nylas-web-elements/p-17c5fb16.js +0 -14
  145. package/dist/nylas-web-elements/p-38fa873f.js.map +0 -1
  146. package/dist/nylas-web-elements/p-3ddcb355.entry.js +0 -2
  147. package/dist/nylas-web-elements/p-3ddcb355.entry.js.map +0 -1
  148. package/dist/nylas-web-elements/p-8937a53f.entry.js.map +0 -1
  149. /package/dist/nylas-web-elements/{p-3216af1e.entry.js.map → p-20f50696.entry.js.map} +0 -0
  150. /package/dist/nylas-web-elements/{p-1591deba.js.map → p-34c9fc7d.js.map} +0 -0
  151. /package/dist/nylas-web-elements/{p-d45012f2.js.map → p-438d4542.js.map} +0 -0
  152. /package/dist/nylas-web-elements/{p-21ab4e47.entry.js.map → p-536c5ef3.entry.js.map} +0 -0
  153. /package/dist/nylas-web-elements/{p-a4678661.entry.js.map → p-5a6c2efd.entry.js.map} +0 -0
  154. /package/dist/nylas-web-elements/{p-88e68e14.entry.js.map → p-6adb19cf.entry.js.map} +0 -0
  155. /package/dist/nylas-web-elements/{p-30d92734.entry.js.map → p-7c02e476.entry.js.map} +0 -0
  156. /package/dist/nylas-web-elements/{p-8072aa07.js.map → p-803a1695.js.map} +0 -0
  157. /package/dist/nylas-web-elements/{p-855fe5b3.entry.js.map → p-83d2ff21.entry.js.map} +0 -0
  158. /package/dist/nylas-web-elements/{p-f83aa456.entry.js.map → p-8673dcf1.entry.js.map} +0 -0
  159. /package/dist/nylas-web-elements/{p-24c390bd.js.map → p-86e217f4.js.map} +0 -0
  160. /package/dist/nylas-web-elements/{p-d0f51520.entry.js.map → p-8d5efa5e.entry.js.map} +0 -0
  161. /package/dist/nylas-web-elements/{p-0271cef3.entry.js.map → p-d7323440.entry.js.map} +0 -0
  162. /package/dist/nylas-web-elements/{p-59ff0231.entry.js.map → p-da25d877.entry.js.map} +0 -0
  163. /package/dist/nylas-web-elements/{p-f0e1688e.js.map → p-e42db60f.js.map} +0 -0
  164. /package/dist/nylas-web-elements/{p-c11e1016.entry.js.map → p-ff122d1e.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{h as e,F as t,r as n,c as i,H as s,a as o}from"./p-6f5a3998.js";import{N as a}from"./p-f0e1688e.js";import{i as r,j as l,b as c,k as d,l as h}from"./p-17c5fb16.js";import{E as g,i as f,a as u,c as p,b as m,f as b}from"./p-38fa873f.js";import{c as _}from"./p-fc5bc07b.js";import{n as y}from"./p-1591deba.js";import{L as w,a as v}from"./p-7e885253.js";class k{constructor(){this.component=e=>{const t=g.Component;const n=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:n,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:n,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:n,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:n,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:n,message:e,category:t}),no_salt:(e="No salt provided")=>({title:n,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:n,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:n,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:n,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:n,message:e,category:t})}};this.api=e=>{const t=g.Api;const n=`${e} Error`;return{invalid_session:e=>({title:n,message:e,category:t}),general_error:e=>({title:n,message:e,category:t}),internal_error:e=>({title:n,message:e,category:t}),invalid_request_error:e=>({title:n,message:e,category:t}),timeslot_not_available:e=>({title:n,message:e,category:t}),provider_error:e=>({title:n,message:e,category:t}),not_found_error:e=>({title:n,message:e,category:t})}}}}class I{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){this.errors=new k;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=n;this.configId=i;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,n,i={}){try{const s=new URL(this.schedulerAPIURL);const o="2.0.6";s.pathname=e;const a=await fetch(decodeURIComponent(s.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":o,...this.clientId&&{"X-Nylas-Application-Public-Id":this.clientId},...i},body:n});const r=await a.json();return r}catch(e){return{error:{message:e.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){let t=e?.message||e?.title||"Something went wrong";if(e?.type==="provider_error"){t=e?.provider_error?.error?.message||e?.provider_error?.error?.title||"Something went wrong"}return t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e);this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e);r.changeLanguage(e)}async toggleAdditionalData(e){if(!e){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date;const t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const n=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(n,i);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const n=this.schedulerStore.get("availability").find((e=>new Date(e.start_time)>new Date));let i=e;if(n){i=n.start_time}this.schedulerStore.set("selectedDate",i);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return t}async setReschedule(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.state.eventInfo;if(t){this.schedulerStore.set("reschedulingEventInfo",t)}this.schedulerStore.set("rescheduleBookingId",e);await this.getUISettings();const n=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return n}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return e}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return e}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:t,selectedTimezone:n,bookingInfo:i,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!i){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:n;const l=s||"en-US";if(!a){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timezone_selected()}}const c=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(i?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:i?.primaryParticipant;const u=e?e?.guests||[]:i?.guests||[];const p=e?e?.additionalFields:g;const m=this.getHeaders();const b=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const _=`/v3/scheduling/bookings${b}`;if(c.length===0){const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,event_id:o?.event_id||undefined,master_id:o?.master_id||undefined,calendar_id:o?.calendar_id||undefined,email_language:this.getTwoLetterLanguageCode(l)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(c.length>0){d=c.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({participants:d?[{email:d}]:undefined,additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(l)}),m);if("data"in e){this.schedulerStore.set("isLoading",false);this.schedulerStore.set("eventInfo",e?.data);return e}else if(e.error?.message?.startsWith("The selected timeslot is unavailable")){continue}else{this.schedulerStore.set("isLoading",false);const t=e.error?.type;let n=e.error;if(t&&t in this.errors.api(r.t("createBookingErrorTitle"))){const e=this.getErrorMessage(n);n=this.errors.api(r.t("createBookingErrorTitle"))[t](e)}return{error:n}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(r.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.get("rescheduleBookingId");const t=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(e&&!!n){n+=`&booking_id=${e}`}else if(e){n+=`?booking_id=${e}`}const i=`/v3/scheduling/ui-settings${n}`;const s=await this.makeAPIRequest(i,"GET",undefined,t);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("getUISettingErrorTitle"))){t=this.errors.api(r.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in s){this.schedulerStore.set("configSettings",s.data);this.clientId=s.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return s}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const n=t?.min_booking_notice;if(!n){return e}const i=(new Date).getTime();if(e<(i+n*60*1e3)/1e3){return Math.floor((i+n*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const n=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const i=Math.floor(l(t,n).getTime()/1e3);const s=Math.min(i,e);return s}async getAvailability(e=0,t=0){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const i=new Date;const s=i.getTime();if(t&&t<s/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(r.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const o=this.getStartTimeWithMinBookingNotice(e);e=o;t=o>t?o+1:t;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(t.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const a=this.schedulerStore.get("rescheduleBookingId");if(a){n.append("booking_id",encodeURIComponent(a))}const l=n.toString();const c=`/v3/scheduling/availability${l?`?${l}`:""}`;const d=this.getHeaders();const h=await this.makeAPIRequest(decodeURIComponent(c),"GET",undefined,d);if("error"in h){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=h.error?.type;let t=h.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=r.t("invalidGrantError");return{error:{title:r.t("invalidGrantErrorTitle"),message:e,category:g.Api}}}if(e&&e in this.errors.api(r.t("getAvailabilityErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("getAvailabilityErrorTitle"))[e](n)}return{error:t}}if("data"in h){const e=h.data?.time_slots?.map((e=>({...e,start_time:new Date(e.start_time*1e3),end_time:new Date(e.end_time*1e3)})))||[];const t=e.filter((e=>e.start_time.getTime()>s));const n=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",n);const i=h.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",i)}this.schedulerStore.set("isLoading",false);return h}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("cancelBookingErrorTitle")).no_booking_id()}}const n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const i=`/v3/scheduling/bookings/${e}${n}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),s);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(r.t("cancelBookingErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("cancelBookingErrorTitle"))[e](n)}return{error:t}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return o}async rescheduleBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("rescheduleBookingErrorTitle")).no_booking_id()}}const n=this.errors.api(r.t("rescheduleBookingErrorTitle"));const i=this.errors.component(r.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:l}=this.schedulerStore.state;const{startTime:c,endTime:d,timezone:h}=t;const g=c||o?.start_time;if(!g){return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=this.schedulerStore.get("availabilityOrderEmails");let p="";if(u.length>0){const e=o?.emails||[];for(let t=0;t<u.length;t++){if(e.includes(u[t])){p=u[t];break}}}const m=h||a;if(!m){return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const _=o?.master_id||undefined;const y=o?.calendar_id||undefined;const w={};Object.entries(s?.additionalFields||{}).forEach((([e,t])=>{w[e]=t.value}));const v=t?t?.primaryParticipant:s?.primaryParticipant;const k=t?t?.guests||[]:s?.guests||[];const I=t?t?.additionalFields:w;const x=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const T=`/v3/scheduling/bookings/${e}${x}`;const C=this.getHeaders();const E=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:f.getTime()/1e3,timezone:m,additional_fields:I,guest:{...v},additional_guests:k,participants:p?[{email:p}]:undefined,email_language:this.getTwoLetterLanguageCode(l),event_id:b,master_id:_,calendar_id:y}),C);if("error"in E){this.schedulerStore.set("isLoading",false);const e=E.error?.type;let t=E.error;if(e&&e in n){const i=this.getErrorMessage(t);t=n[e](i)}return{error:t}}const S=this.schedulerStore.get("reschedulingEventInfo");if("data"in E){this.schedulerStore.set("eventInfo",E?.data)}else if(S){this.schedulerStore.set("eventInfo",S)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("isLoading",false);return E}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:n,reason:i}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=n==="confirmed"?r.t("confirmBookingErrorTitle"):r.t("rejectBookingErrorTitle");if(!t){return{error:this.errors.component(o).no_booking_id()}}if(!s){return{error:this.errors.component(o).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const l=`/v3/scheduling/bookings/${t}${a}`;const c=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(l),"PUT",JSON.stringify({status:n,cancellation_reason:i,salt:s}),c);if("error"in d){this.schedulerStore.set("isLoading",false);const e=d.error?.type;let t=d.error;if(e&&e in this.errors.api(o)){const n=this.getErrorMessage(t);t=this.errors.api(o)[e](n)}return{error:t}}if("data"in d&&n==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&n==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:t})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return d}async validateGroupEventTimeslot(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("configSettings")?.configuration_id;if(!t){return{error:this.errors.component(r.t("validateTimeslotErrorTitle")).no_config_id()}}const n=this.getHeaders();const i=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(i),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),n);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("validateTimeslotErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("validateTimeslotErrorTitle"))[e](n)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class x{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!n&&!i&&!(s||o)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=i;this.sessionId=n;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){c("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new I({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 T(e={}){const t={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...e};c(`[defaultNylasStoreState]: `,t);const n=_(t);n.onChange("availability",(e=>{c(`[availability]: `,e);const t=e.map((e=>e.start_time));c(`[selectableDates]: `,t);n.set("selectableDates",t);const i=e[0];if(!i)return;const s=Math.floor((i.end_time.getTime()-i.start_time.getTime())/6e4);c(`[durationMinutes]: `,s);n.set("eventDuration",s)}));n.reset=()=>{for(const e in t){const i=t[e];n.set(e,i)}};return n}const C=(n,i)=>{const s=n.isLoading;const o=n.showNotification;const a=n.nylasBranding;const r=n.version;return e(t,null,o&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&i,e("div",{class:"footer"},a&&e("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true})),e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},r))))};const E=(t,n)=>e("div",{class:"message-banner"},n);const S=':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 B=S;const L={title:r.t("genericErrorTitle"),type:y.Error,category:g.Component};const D=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.schedulerWillLoad=i(this,"schedulerWillLoad",7);this.schedulerDidLoad=i(this,"schedulerDidLoad",7);this.nylasSchedulerError=i(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=i(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=i(this,"configSettingsLoaded",7);this.bookingRefExtracted=i(this,"bookingRefExtracted",7);this.bookedEventInfo=i(this,"bookedEventInfo",7);this.mode="app";this.defaultSchedulerState=undefined;this.sessionId=undefined;this.schedulerApiUrl="https://api.us.nylas.com";this.bookingInfo=undefined;this.rescheduleBookingRef=undefined;this.cancelBookingRef=undefined;this.organizerConfirmationBookingRef=undefined;this.configurationId=undefined;this.slug=undefined;this.clientId=undefined;this.nylasBranding=true;this.eventOverrides={};this.isLoading=undefined;this.themeConfig=undefined;this.localization=undefined;this.defaultLanguage=undefined;this.showNotification=true;this.enableUserFeedback=true;this.hour12=undefined;this.automaticComponentRegistration=true;this.selectedDateLabel=(new Date).toLocaleDateString(navigator.language,{dateStyle:"full"})||`${r.t("noDateSelected")}`;this.refConfigId=undefined;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version="2.0.6"}connectedCallback(){c(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){c(`[nylas-scheduler] Component will load`);this.version="2.0.6";if(this.enableUserFeedback&&!f()){u({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),b({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}const t=new URLSearchParams(window.location.search);const n=t.get("lang");const i=n&&Object.values(w).includes(n)?n:null;this.stores={scheduler:T({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,selectedLanguage:i||this.defaultLanguage||this.bookingInfo?.language||w.en,...this.defaultSchedulerState})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;if(this.rescheduleBookingRef){const[e,t,n]=d(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.cancelBookingRef){const[e,t,n]=d(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.organizerConfirmationBookingRef){const[e,t,n]=d(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",n);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:n})}if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new x({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const r=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(r,this.nylasSchedulerConnector);if(r.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector);this.applyThemeConfig(this.themeConfig)}async componentDidLoad(){this.baseProvider?.componentDidLoad();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}const e=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}}const n=this.baseProvider?.getStore("scheduler");const i=n?.get("configSettings")?.scheduler?.available_days_in_future;const s=n?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(n?.get("showBookingForm")){n?.set("selectedDate",s.start_time);return}}const o=n?.get("selectedDate");const a=n?.get("availability");let r;if(a&&a.length>0){return}if(!o){const e=new Date;const{startTime:t,endTime:n,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(e,i||30);if(e.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,n))}}else{const{startTime:e,endTime:t,endTimeForAvailableDaysInFuture:n}=this.validateAvailableDaysInFuture(o,i||30);if(o.getTime()<n*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(e,t))}}if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=n?.get("availability").find((e=>new Date(e.start_time)>new Date));if(t){e=t.start_time}n?.set("selectedDate",e)}}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",e.language)}}rescheduleBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}cancelBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}organizerConfirmationBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in w)){return}r.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);r.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=e.detail;this.language=t;r.changeLanguage(t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const n=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(e.defaultPrevented){return}if(i<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const n=this.stores?.scheduler.get("selectedLanguage");const i=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const o=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:o,email_language:n,timezone:i}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const n=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const i=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=i;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const i=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...i,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...i};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(o,this.nylasSchedulerConnector)}return}const o=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!o||"error"in o){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o?.error)},host:this.host})}const a=o?.data;const r=this.bookedEventInfo.emit({...o,data:{...a,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=e.detail;this.selectedDateLabel=t?t.toLocaleDateString(this.language,{dateStyle:"full"}):`${r.t("noDateSelected")}`}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}eventIsFullHandler(e){const t=e.detail.error;const n=e.detail.type;if(n==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:g.Component,type:y.Info,description:"The event you selected is full. Please try a different time.",id:(new Date).getTime().toString(),ttl:3e3},host:this.host})}}feedbackSubmittedHandler(e){const t=p("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const n={eventId:t,message:e.detail.feedback};m(n,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":this.version,"nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug,version:this.version}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||L.title,category:e?.category||L.category,type:y.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let e="";if(!this.sessionId){e+=r.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=r.t("sessionIdRequiredErrorMessage")+" "+r.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:r.t("schedulingComponentErrorTitle"),category:g.Component,type:y.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:r.t("invalidTimeslotErrorTitle"),category:g.Component,type:y.Error,description:r.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const n=new Date;const i=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const o=Math.floor(l(n,t).getTime()/1e3);const a=Math.min(o,s);const r=i<n.getTime()/1e3?Math.floor(n.getTime()/1e3):i;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:n}=e.detail;if(t==="language"){const e=w[n];r.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const n=this.baseProvider?.getStore("scheduler");const i=n?.get("eventInfo");const o=n?.get("showBookingForm");const a=n?.get("cancelledEventInfo");const l=n?.get("cancelBookingId");const c=n?.get("selectedTimeslot");const d=n?.get("rescheduleBookingId");const g=n?.get("organizerConfirmationBookingId");const f=n?.get("rejectBookingId");const u=n?.get("confirmedEventInfo");const p=n?.get("nylasBranding")||this.nylasBranding;const m=n?.get("selectedDate");const b=n?.get("configSettings")?.scheduler?.confirmation_redirect_url;this.selectedDateLabel=m&&this.language?h(m.toLocaleDateString(this.language,{dateStyle:"full"})):`${r.t("noDateSelected")}`;const _=Object.keys(v).map((e=>({label:v[e],value:e})));const y=n?.get("selectedLanguage")||this.defaultLanguage||navigator.language||w.en;if(t&&(l||f)&&!a){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:c,cancelBookingId:l,rejectBookingId:f,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&g){return e(s,null,e(C,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:g,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&a){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:a,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&u){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:u,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&i&&b){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const n=this.bookingInfoConfirmed?.booking_ref;const s=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((t=>{if(!s[t]&&e?.[t]){s[t]=e[t].value}}))}const o=this.stores?.scheduler.get("selectedTimeslot");const a=this.stores?.scheduler.get("selectedTimezone");const r=this.stores?.scheduler.get("selectedLanguage");const l=this.stores?.scheduler.get("configSettings");const c=this.configurationId?this.configurationId:l?.configuration_id;const d=window.location.search;const h=new URLSearchParams(d);h.set("booking_id",i.booking_id);e?.name&&h.set("name",e.name);e?.email&&h.set("email",e.email);o?.start_time&&h.set("start_time",(new Date(o.start_time).getTime()/1e3).toString());o?.end_time&&h.set("end_time",(new Date(o.end_time).getTime()/1e3).toString());a&&h.set("tz",a);r&&h.set("language",r);s&&h.set("additional_values",JSON.stringify(s));this.slug&&h.set("page_slug",this.slug);c&&h.set("config_id",c);t&&h.set("location",t);n&&h.set("booking_ref",n);this.redirectToCustomUrl(`${b}?${h.toString()}`);return}if(t&&i){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:c,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!i||!!d)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(E,null,`${r.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},e("div",{class:"left-panel",part:"ns_left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("h2",{part:"ns_right-panel__title"},e("calendar-icon",{part:"ns_right-panel__calendar-icon"}),e("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},this.selectedDateLabel)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!i&&o){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(E,null,`${r.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},e("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},e("div",{class:"wrapper",part:"ns_left-panel__wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return o(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};D.style=B;export{D as nylas_scheduling};
2
- //# sourceMappingURL=p-186bbd43.entry.js.map
1
+ import{h as e,F as t,r as n,c as i,H as s,a as o}from"./p-6f5a3998.js";import{N as a}from"./p-e42db60f.js";import{i as r,j as l,b as c,k as d,l as h}from"./p-66a89e65.js";import{E as g,i as f,a as u,c as p,b as m,f as b}from"./p-3524dab1.js";import{c as _}from"./p-fc5bc07b.js";import{n as y}from"./p-34c9fc7d.js";import{L as w,a as v}from"./p-7e885253.js";class k{constructor(){this.component=e=>{const t=g.Component;const n=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:n,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:n,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:n,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:n,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:n,message:e,category:t}),no_salt:(e="No salt provided")=>({title:n,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:n,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:n,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:n,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:n,message:e,category:t})}};this.api=e=>{const t=g.Api;const n=`${e} Error`;return{invalid_session:e=>({title:n,message:e,category:t}),general_error:e=>({title:n,message:e,category:t}),internal_error:e=>({title:n,message:e,category:t}),invalid_request_error:e=>({title:n,message:e,category:t}),timeslot_not_available:e=>({title:n,message:e,category:t}),provider_error:e=>({title:n,message:e,category:t}),not_found_error:e=>({title:n,message:e,category:t})}}}}class I{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){this.errors=new k;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=n;this.configId=i;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,n,i={}){try{const s=new URL(this.schedulerAPIURL);const o="2.1.0";s.pathname=e;const a=await fetch(decodeURIComponent(s.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":o,...this.clientId&&{"X-Nylas-Application-Public-Id":this.clientId},...i},body:n});const r=await a.json();return r}catch(e){return{error:{message:e.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){let t=e?.message||e?.title||"Something went wrong";if(e?.type==="provider_error"){t=e?.provider_error?.error?.message||e?.provider_error?.error?.title||"Something went wrong"}return t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e);this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e);r.changeLanguage(e)}async toggleAdditionalData(e){if(!e){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date;const t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const n=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(n,i);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const n=this.schedulerStore.get("availability").find((e=>new Date(e.start_time)>new Date));let i=e;if(n){i=n.start_time}this.schedulerStore.set("selectedDate",i);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return t}async setReschedule(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.state.eventInfo;if(t){this.schedulerStore.set("reschedulingEventInfo",t)}this.schedulerStore.set("rescheduleBookingId",e);await this.getUISettings();const n=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return n}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return e}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return e}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:t,selectedTimezone:n,bookingInfo:i,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!i){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:n;const l=s||"en-US";if(!a){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timezone_selected()}}const c=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(i?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:i?.primaryParticipant;const u=e?e?.guests||[]:i?.guests||[];const p=e?e?.additionalFields:g;const m=this.getHeaders();const b=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const _=`/v3/scheduling/bookings${b}`;if(c.length===0){const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,event_id:o?.event_id||undefined,master_id:o?.master_id||undefined,calendar_id:o?.calendar_id||undefined,email_language:this.getTwoLetterLanguageCode(l)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(c.length>0){d=c.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({participants:d?[{email:d}]:undefined,additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(l)}),m);if("data"in e){this.schedulerStore.set("isLoading",false);this.schedulerStore.set("eventInfo",e?.data);return e}else if(e.error?.message?.startsWith("The selected timeslot is unavailable")){continue}else{this.schedulerStore.set("isLoading",false);const t=e.error?.type;let n=e.error;if(t&&t in this.errors.api(r.t("createBookingErrorTitle"))){const e=this.getErrorMessage(n);n=this.errors.api(r.t("createBookingErrorTitle"))[t](e)}return{error:n}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(r.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.get("rescheduleBookingId");const t=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(e&&!!n){n+=`&booking_id=${e}`}else if(e){n+=`?booking_id=${e}`}const i=`/v3/scheduling/ui-settings${n}`;const s=await this.makeAPIRequest(i,"GET",undefined,t);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("getUISettingErrorTitle"))){t=this.errors.api(r.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in s){this.schedulerStore.set("configSettings",s.data);this.clientId=s.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return s}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const n=t?.min_booking_notice;if(!n){return e}const i=(new Date).getTime();if(e<(i+n*60*1e3)/1e3){return Math.floor((i+n*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const n=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const i=Math.floor(l(t,n).getTime()/1e3);const s=Math.min(i,e);return s}async getAvailability(e=0,t=0){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const i=new Date;const s=i.getTime();if(t&&t<s/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(r.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const o=this.getStartTimeWithMinBookingNotice(e);e=o;t=o>t?o+1:t;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(t.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const a=this.schedulerStore.get("rescheduleBookingId");if(a){n.append("booking_id",encodeURIComponent(a))}const l=n.toString();const c=`/v3/scheduling/availability${l?`?${l}`:""}`;const d=this.getHeaders();const h=await this.makeAPIRequest(decodeURIComponent(c),"GET",undefined,d);if("error"in h){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=h.error?.type;let t=h.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=r.t("invalidGrantError");return{error:{title:r.t("invalidGrantErrorTitle"),message:e,category:g.Api}}}if(e&&e in this.errors.api(r.t("getAvailabilityErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("getAvailabilityErrorTitle"))[e](n)}return{error:t}}if("data"in h){const e=h.data?.time_slots?.map((e=>({...e,start_time:new Date(e.start_time*1e3),end_time:new Date(e.end_time*1e3)})))||[];const t=e.filter((e=>e.start_time.getTime()>s));const n=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",n);const i=h.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",i)}this.schedulerStore.set("isLoading",false);return h}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("cancelBookingErrorTitle")).no_booking_id()}}const n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const i=`/v3/scheduling/bookings/${e}${n}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),s);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(r.t("cancelBookingErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("cancelBookingErrorTitle"))[e](n)}return{error:t}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return o}async rescheduleBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("rescheduleBookingErrorTitle")).no_booking_id()}}const n=this.errors.api(r.t("rescheduleBookingErrorTitle"));const i=this.errors.component(r.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:l}=this.schedulerStore.state;const{startTime:c,endTime:d,timezone:h}=t;const g=c||o?.start_time;if(!g){return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=this.schedulerStore.get("availabilityOrderEmails");let p="";if(u.length>0){const e=o?.emails||[];for(let t=0;t<u.length;t++){if(e.includes(u[t])){p=u[t];break}}}const m=h||a;if(!m){return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const _=o?.master_id||undefined;const y=o?.calendar_id||undefined;const w={};Object.entries(s?.additionalFields||{}).forEach((([e,t])=>{w[e]=t.value}));const v=t?t?.primaryParticipant:s?.primaryParticipant;const k=t?t?.guests||[]:s?.guests||[];const I=t?t?.additionalFields:w;const x=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const T=`/v3/scheduling/bookings/${e}${x}`;const C=this.getHeaders();const E=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:f.getTime()/1e3,timezone:m,additional_fields:I,guest:{...v},additional_guests:k,participants:p?[{email:p}]:undefined,email_language:this.getTwoLetterLanguageCode(l),event_id:b,master_id:_,calendar_id:y}),C);if("error"in E){this.schedulerStore.set("isLoading",false);const e=E.error?.type;let t=E.error;if(e&&e in n){const i=this.getErrorMessage(t);t=n[e](i)}return{error:t}}const S=this.schedulerStore.get("reschedulingEventInfo");if("data"in E){this.schedulerStore.set("eventInfo",E?.data)}else if(S){this.schedulerStore.set("eventInfo",S)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("isLoading",false);return E}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:n,reason:i}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=n==="confirmed"?r.t("confirmBookingErrorTitle"):r.t("rejectBookingErrorTitle");if(!t){return{error:this.errors.component(o).no_booking_id()}}if(!s){return{error:this.errors.component(o).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const l=`/v3/scheduling/bookings/${t}${a}`;const c=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(l),"PUT",JSON.stringify({status:n,cancellation_reason:i,salt:s}),c);if("error"in d){this.schedulerStore.set("isLoading",false);const e=d.error?.type;let t=d.error;if(e&&e in this.errors.api(o)){const n=this.getErrorMessage(t);t=this.errors.api(o)[e](n)}return{error:t}}if("data"in d&&n==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&n==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:t})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return d}async validateGroupEventTimeslot(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("configSettings")?.configuration_id;if(!t){return{error:this.errors.component(r.t("validateTimeslotErrorTitle")).no_config_id()}}const n=this.getHeaders();const i=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(i),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),n);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("validateTimeslotErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("validateTimeslotErrorTitle"))[e](n)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class x{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!n&&!i&&!(s||o)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=i;this.sessionId=n;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){c("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new I({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 T(e={}){const t={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...e};c(`[defaultNylasStoreState]: `,t);const n=_(t);n.onChange("availability",(e=>{c(`[availability]: `,e);const t=e.map((e=>e.start_time));c(`[selectableDates]: `,t);n.set("selectableDates",t);const i=e[0];if(!i)return;const s=Math.floor((i.end_time.getTime()-i.start_time.getTime())/6e4);c(`[durationMinutes]: `,s);n.set("eventDuration",s)}));n.reset=()=>{for(const e in t){const i=t[e];n.set(e,i)}};return n}const C=(n,i)=>{const s=n.isLoading;const o=n.showNotification;const a=n.nylasBranding;const r=n.version;return e(t,null,o&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&i,e("div",{class:"footer"},a&&e("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true})),e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},r))))};const E=(t,n)=>e("div",{class:"message-banner"},n);const S=':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 B=S;const L={title:r.t("genericErrorTitle"),type:y.Error,category:g.Component};const D=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.schedulerWillLoad=i(this,"schedulerWillLoad",7);this.schedulerDidLoad=i(this,"schedulerDidLoad",7);this.nylasSchedulerError=i(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=i(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=i(this,"configSettingsLoaded",7);this.bookingRefExtracted=i(this,"bookingRefExtracted",7);this.bookedEventInfo=i(this,"bookedEventInfo",7);this.mode="app";this.defaultSchedulerState=undefined;this.sessionId=undefined;this.schedulerApiUrl="https://api.us.nylas.com";this.bookingInfo=undefined;this.rescheduleBookingRef=undefined;this.cancelBookingRef=undefined;this.organizerConfirmationBookingRef=undefined;this.configurationId=undefined;this.slug=undefined;this.clientId=undefined;this.nylasBranding=true;this.eventOverrides={};this.isLoading=undefined;this.themeConfig=undefined;this.localization=undefined;this.defaultLanguage=undefined;this.showNotification=true;this.enableUserFeedback=true;this.hour12=undefined;this.automaticComponentRegistration=true;this.selectedDateLabel=(new Date).toLocaleDateString(navigator.language,{dateStyle:"full"})||`${r.t("noDateSelected")}`;this.refConfigId=undefined;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version="2.1.0"}connectedCallback(){c(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){c(`[nylas-scheduler] Component will load`);this.version="2.1.0";if(this.enableUserFeedback&&!f()){u({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),b({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}const t=new URLSearchParams(window.location.search);const n=t.get("lang");const i=n&&Object.values(w).includes(n)?n:null;this.stores={scheduler:T({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,selectedLanguage:i||this.defaultLanguage||this.bookingInfo?.language||w.en,...this.defaultSchedulerState})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;if(this.rescheduleBookingRef){const[e,t,n]=d(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.cancelBookingRef){const[e,t,n]=d(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.organizerConfirmationBookingRef){const[e,t,n]=d(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",n);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:n})}this.applyThemeConfig(this.themeConfig);if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new x({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const r=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(r,this.nylasSchedulerConnector);if(r.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector)}async componentDidLoad(){this.baseProvider?.componentDidLoad();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}const e=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}}const n=this.baseProvider?.getStore("scheduler");const i=n?.get("configSettings")?.scheduler?.available_days_in_future;const s=n?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(n?.get("showBookingForm")){n?.set("selectedDate",s.start_time);return}}const o=n?.get("selectedDate");const a=n?.get("availability");let r;if(a&&a.length>0){return}if(!o){const e=new Date;const{startTime:t,endTime:n,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(e,i||30);if(e.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,n))}}else{const{startTime:e,endTime:t,endTimeForAvailableDaysInFuture:n}=this.validateAvailableDaysInFuture(o,i||30);if(o.getTime()<n*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(e,t))}}if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=n?.get("availability").find((e=>new Date(e.start_time)>new Date));if(t){e=t.start_time}n?.set("selectedDate",e)}}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",e.language)}}rescheduleBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}cancelBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}organizerConfirmationBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in w)){return}r.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);r.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=e.detail;this.language=t;r.changeLanguage(t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const n=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(e.defaultPrevented){return}if(i<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const n=this.stores?.scheduler.get("selectedLanguage");const i=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const o=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:o,email_language:n,timezone:i}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const n=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const i=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=i;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const i=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...i,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...i};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(o,this.nylasSchedulerConnector)}return}const o=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!o||"error"in o){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o?.error)},host:this.host})}const a=o?.data;const r=this.bookedEventInfo.emit({...o,data:{...a,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=e.detail;this.selectedDateLabel=t?t.toLocaleDateString(this.language,{dateStyle:"full"}):`${r.t("noDateSelected")}`}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}eventIsFullHandler(e){const t=e.detail.error;const n=e.detail.type;if(n==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:g.Component,type:y.Info,description:"The event you selected is full. Please try a different time.",id:(new Date).getTime().toString(),ttl:3e3},host:this.host})}}feedbackSubmittedHandler(e){const t=p("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const n={eventId:t,message:e.detail.feedback};m(n,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":this.version,"nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug,version:this.version}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||L.title,category:e?.category||L.category,type:y.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let e="";if(!this.sessionId){e+=r.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=r.t("sessionIdRequiredErrorMessage")+" "+r.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:r.t("schedulingComponentErrorTitle"),category:g.Component,type:y.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:r.t("invalidTimeslotErrorTitle"),category:g.Component,type:y.Error,description:r.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const n=new Date;const i=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const o=Math.floor(l(n,t).getTime()/1e3);const a=Math.min(o,s);const r=i<n.getTime()/1e3?Math.floor(n.getTime()/1e3):i;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:n}=e.detail;if(t==="language"){const e=w[n];r.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const n=this.baseProvider?.getStore("scheduler");const i=n?.get("eventInfo");const o=n?.get("showBookingForm");const a=n?.get("cancelledEventInfo");const l=n?.get("cancelBookingId");const c=n?.get("selectedTimeslot");const d=n?.get("rescheduleBookingId");const g=n?.get("organizerConfirmationBookingId");const f=n?.get("rejectBookingId");const u=n?.get("confirmedEventInfo");const p=n?.get("nylasBranding")||this.nylasBranding;const m=n?.get("selectedDate");const b=n?.get("configSettings")?.scheduler?.confirmation_redirect_url;this.selectedDateLabel=m&&this.language?h(m.toLocaleDateString(this.language,{dateStyle:"full"})):`${r.t("noDateSelected")}`;const _=Object.keys(v).map((e=>({label:v[e],value:e})));const y=n?.get("selectedLanguage")||this.defaultLanguage||navigator.language||w.en;if(t&&(l||f)&&!a){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:c,cancelBookingId:l,rejectBookingId:f,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&g){return e(s,null,e(C,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:g,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&a){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:a,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&u){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:u,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&i&&b){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const n=this.bookingInfoConfirmed?.booking_ref;const s=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((t=>{if(!s[t]&&e?.[t]){s[t]=e[t].value}}))}const o=this.stores?.scheduler.get("selectedTimeslot");const a=this.stores?.scheduler.get("selectedTimezone");const r=this.stores?.scheduler.get("selectedLanguage");const l=this.stores?.scheduler.get("configSettings");const c=this.configurationId?this.configurationId:l?.configuration_id;const d=window.location.search;const h=new URLSearchParams(d);h.set("booking_id",i.booking_id);e?.name&&h.set("name",e.name);e?.email&&h.set("email",e.email);o?.start_time&&h.set("start_time",(new Date(o.start_time).getTime()/1e3).toString());o?.end_time&&h.set("end_time",(new Date(o.end_time).getTime()/1e3).toString());a&&h.set("tz",a);r&&h.set("language",r);s&&h.set("additional_values",JSON.stringify(s));this.slug&&h.set("page_slug",this.slug);c&&h.set("config_id",c);t&&h.set("location",t);n&&h.set("booking_ref",n);this.redirectToCustomUrl(`${b}?${h.toString()}`);return}if(t&&i){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:c,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!i||!!d)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(E,null,`${r.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},e("div",{class:"left-panel",part:"ns_left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("h2",{part:"ns_right-panel__title"},e("calendar-icon",{part:"ns_right-panel__calendar-icon"}),e("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},this.selectedDateLabel)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!i&&o){return e(s,null,e(C,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(E,null,`${r.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},e("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},e("div",{class:"wrapper",part:"ns_left-panel__wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==y)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return o(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};D.style=B;export{D as nylas_scheduling};
2
+ //# sourceMappingURL=p-81925b89.entry.js.map