@nylas/web-elements 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/checkbox-component/checkbox-component.es.js +48 -38
- package/dist/cdn/multi-select-dropdown/multi-select-dropdown.es.js +554 -535
- package/dist/cdn/nylas-additional-participants/nylas-additional-participants.es.js +2 -2
- package/dist/cdn/nylas-booking-form/nylas-booking-form.es.js +25 -9
- package/dist/cdn/nylas-booking-form-config/nylas-booking-form-config.es.js +2182 -2171
- package/dist/cdn/nylas-buffer-time/nylas-buffer-time.es.js +13 -14
- package/dist/cdn/nylas-calendar-picker/nylas-calendar-picker.es.js +571 -552
- package/dist/cdn/nylas-connected-calendars/nylas-connected-calendars.es.js +26 -7
- package/dist/cdn/nylas-customize-booking-settings/nylas-customize-booking-settings.es.js +12 -2
- package/dist/cdn/nylas-date-component/nylas-date-component.es.js +13 -7
- package/dist/cdn/nylas-editor-tabs/nylas-editor-tabs.es.js +3550 -3473
- package/dist/cdn/nylas-event-location/nylas-event-location.es.js +633 -621
- package/dist/cdn/nylas-limit-future-bookings/nylas-limit-future-bookings.es.js +25 -2
- package/dist/cdn/nylas-min-booking-notice/nylas-min-booking-notice.es.js +25 -2
- package/dist/cdn/nylas-min-cancellation-notice/nylas-min-cancellation-notice.es.js +163 -140
- package/dist/cdn/nylas-page-styling/nylas-page-styling.es.js +5 -3
- package/dist/cdn/nylas-participants-custom-availability/nylas-participants-custom-availability.es.js +4 -3
- package/dist/cdn/nylas-provider/nylas-provider.es.js +1 -1
- package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +173 -96
- package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +28 -12
- package/dist/cdn/scheduler-store/scheduler-store.es.js +1 -1
- package/dist/cdn/time-period-selector/time-period-selector.es.js +25 -2
- package/dist/cjs/calendar-agenda-fill-icon_53.cjs.entry.js +88 -57
- package/dist/cjs/calendar-agenda-fill-icon_53.cjs.entry.js.map +1 -1
- package/dist/cjs/checkbox-component.cjs.entry.js +9 -1
- package/dist/cjs/checkbox-component.cjs.entry.js.map +1 -1
- package/dist/cjs/checkbox-component_3.cjs.entry.js +21 -8
- package/dist/cjs/checkbox-component_3.cjs.entry.js.map +1 -1
- package/dist/cjs/google-logo-icon_4.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/multi-select-dropdown.cjs.entry.js +19 -1
- package/dist/cjs/multi-select-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-additional-participants.cjs.entry.js +1 -1
- package/dist/cjs/nylas-additional-participants.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-booking-form-config.cjs.entry.js +34 -27
- package/dist/cjs/nylas-booking-form-config.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-buffer-time.cjs.entry.js +13 -12
- package/dist/cjs/nylas-buffer-time.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-connected-calendars.cjs.entry.js +2 -2
- package/dist/cjs/nylas-connected-calendars.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-date-component.cjs.entry.js +12 -7
- package/dist/cjs/nylas-date-component.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-editor-tabs.cjs.entry.js +2 -2
- package/dist/cjs/nylas-event-location.cjs.entry.js +32 -11
- package/dist/cjs/nylas-event-location.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-page-styling.cjs.entry.js +3 -2
- package/dist/cjs/nylas-page-styling.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-participants-custom-availability.cjs.entry.js +3 -2
- package/dist/cjs/nylas-participants-custom-availability.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-provider.cjs.entry.js +1 -1
- package/dist/cjs/nylas-scheduling.cjs.entry.js +3 -3
- package/dist/cjs/nylas-web-elements.cjs.js +1 -1
- package/dist/cjs/{scheduler-store-37a0e152.js → scheduler-store-2cd220d1.js} +2 -2
- package/dist/cjs/{scheduler-store-37a0e152.js.map → scheduler-store-2cd220d1.js.map} +1 -1
- package/dist/cjs/{scheduler-store-373adf03.js → scheduler-store-70af2279.js} +2 -2
- package/dist/cjs/{scheduler-store-373adf03.js.map → scheduler-store-70af2279.js.map} +1 -1
- package/dist/cjs/time-period-selector.cjs.entry.js +21 -1
- package/dist/cjs/time-period-selector.cjs.entry.js.map +1 -1
- package/dist/collection/components/design-system/checkbox-component/checkbox-component.js +12 -1
- package/dist/collection/components/design-system/checkbox-component/checkbox-component.js.map +1 -1
- package/dist/collection/components/design-system/multi-select-dropdown/multi-select-dropdown.js +22 -1
- package/dist/collection/components/design-system/multi-select-dropdown/multi-select-dropdown.js.map +1 -1
- package/dist/collection/components/design-system/nylas-date-component/nylas-date-component.js +14 -8
- package/dist/collection/components/design-system/nylas-date-component/nylas-date-component.js.map +1 -1
- package/dist/collection/components/design-system/nylas-date-component/test/nylas-date-component.spec.js +39 -0
- package/dist/collection/components/design-system/nylas-date-component/test/nylas-date-component.spec.js.map +1 -0
- package/dist/collection/components/design-system/time-period-selector/time-period-selector.js +28 -1
- package/dist/collection/components/design-system/time-period-selector/time-period-selector.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-date-picker/test/nylas-date-picker.spec.js +3 -1
- package/dist/collection/components/scheduler/nylas-date-picker/test/nylas-date-picker.spec.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.js +36 -27
- package/dist/collection/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-booking-form-config/test/nylas-booking-form-config.spec.js +23 -0
- package/dist/collection/components/scheduler-editor/nylas-booking-form-config/test/nylas-booking-form-config.spec.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js +13 -12
- package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-calendar-picker/test/nylas-calendar-picker.spec.js +13 -0
- package/dist/collection/components/scheduler-editor/nylas-calendar-picker/test/nylas-calendar-picker.spec.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-connected-calendars/nylas-connected-calendars.js +2 -2
- package/dist/collection/components/scheduler-editor/nylas-connected-calendars/nylas-connected-calendars.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-location/nylas-event-location.js +35 -10
- package/dist/collection/components/scheduler-editor/nylas-event-location/nylas-event-location.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-page-styling/nylas-page-styling.js +4 -1
- package/dist/collection/components/scheduler-editor/nylas-page-styling/nylas-page-styling.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.js +3 -2
- package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.js.map +1 -1
- package/dist/components/checkbox-component2.js +12 -2
- package/dist/components/checkbox-component2.js.map +1 -1
- package/dist/components/multi-select-dropdown2.js +22 -2
- package/dist/components/multi-select-dropdown2.js.map +1 -1
- package/dist/components/nylas-additional-participants2.js +1 -1
- package/dist/components/nylas-additional-participants2.js.map +1 -1
- package/dist/components/nylas-booking-form-config2.js +35 -27
- package/dist/components/nylas-booking-form-config2.js.map +1 -1
- package/dist/components/nylas-buffer-time2.js +13 -12
- package/dist/components/nylas-buffer-time2.js.map +1 -1
- package/dist/components/nylas-connected-calendars2.js +2 -2
- package/dist/components/nylas-connected-calendars2.js.map +1 -1
- package/dist/components/nylas-date-component2.js +14 -8
- package/dist/components/nylas-date-component2.js.map +1 -1
- package/dist/components/nylas-editor-tabs2.js +2 -2
- package/dist/components/nylas-event-location2.js +35 -12
- package/dist/components/nylas-event-location2.js.map +1 -1
- package/dist/components/nylas-page-styling2.js +5 -3
- package/dist/components/nylas-page-styling2.js.map +1 -1
- package/dist/components/nylas-participants-custom-availability2.js +3 -2
- package/dist/components/nylas-participants-custom-availability2.js.map +1 -1
- package/dist/components/nylas-scheduling.js +2 -2
- package/dist/components/scheduler-store.js +1 -1
- package/dist/components/time-period-selector2.js +26 -2
- package/dist/components/time-period-selector2.js.map +1 -1
- package/dist/esm/calendar-agenda-fill-icon_53.entry.js +88 -57
- package/dist/esm/calendar-agenda-fill-icon_53.entry.js.map +1 -1
- package/dist/esm/checkbox-component.entry.js +9 -1
- package/dist/esm/checkbox-component.entry.js.map +1 -1
- package/dist/esm/checkbox-component_3.entry.js +21 -8
- package/dist/esm/checkbox-component_3.entry.js.map +1 -1
- package/dist/esm/google-logo-icon_4.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/multi-select-dropdown.entry.js +19 -1
- package/dist/esm/multi-select-dropdown.entry.js.map +1 -1
- package/dist/esm/nylas-additional-participants.entry.js +1 -1
- package/dist/esm/nylas-additional-participants.entry.js.map +1 -1
- package/dist/esm/nylas-booking-form-config.entry.js +34 -27
- package/dist/esm/nylas-booking-form-config.entry.js.map +1 -1
- package/dist/esm/nylas-buffer-time.entry.js +13 -12
- package/dist/esm/nylas-buffer-time.entry.js.map +1 -1
- package/dist/esm/nylas-connected-calendars.entry.js +2 -2
- package/dist/esm/nylas-connected-calendars.entry.js.map +1 -1
- package/dist/esm/nylas-date-component.entry.js +12 -7
- package/dist/esm/nylas-date-component.entry.js.map +1 -1
- package/dist/esm/nylas-editor-tabs.entry.js +2 -2
- package/dist/esm/nylas-event-location.entry.js +32 -11
- package/dist/esm/nylas-event-location.entry.js.map +1 -1
- package/dist/esm/nylas-page-styling.entry.js +3 -2
- package/dist/esm/nylas-page-styling.entry.js.map +1 -1
- package/dist/esm/nylas-participants-custom-availability.entry.js +3 -2
- package/dist/esm/nylas-participants-custom-availability.entry.js.map +1 -1
- package/dist/esm/nylas-provider.entry.js +1 -1
- package/dist/esm/nylas-scheduling.entry.js +3 -3
- package/dist/esm/nylas-web-elements.js +1 -1
- package/dist/esm/{scheduler-store-20151a77.js → scheduler-store-3acf4d70.js} +2 -2
- package/dist/esm/{scheduler-store-20151a77.js.map → scheduler-store-3acf4d70.js.map} +1 -1
- package/dist/esm/{scheduler-store-b6d12f40.js → scheduler-store-79dc16cc.js} +2 -2
- package/dist/esm/{scheduler-store-b6d12f40.js.map → scheduler-store-79dc16cc.js.map} +1 -1
- package/dist/esm/time-period-selector.entry.js +21 -1
- package/dist/esm/time-period-selector.entry.js.map +1 -1
- package/dist/nylas-web-elements/checkbox-component.entry.js +9 -1
- package/dist/nylas-web-elements/checkbox-component.entry.js.map +1 -1
- package/dist/nylas-web-elements/multi-select-dropdown.entry.js +19 -1
- package/dist/nylas-web-elements/multi-select-dropdown.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-additional-participants.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-additional-participants.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-booking-form-config.entry.js +34 -27
- package/dist/nylas-web-elements/nylas-booking-form-config.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-buffer-time.entry.js +13 -12
- package/dist/nylas-web-elements/nylas-buffer-time.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-connected-calendars.entry.js +2 -2
- package/dist/nylas-web-elements/nylas-connected-calendars.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-date-component.entry.js +12 -7
- package/dist/nylas-web-elements/nylas-date-component.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +2 -2
- package/dist/nylas-web-elements/nylas-event-location.entry.js +32 -11
- package/dist/nylas-web-elements/nylas-event-location.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-page-styling.entry.js +3 -2
- package/dist/nylas-web-elements/nylas-page-styling.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-participants-custom-availability.entry.js +3 -2
- package/dist/nylas-web-elements/nylas-participants-custom-availability.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-provider.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-scheduling.entry.js +3 -3
- package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
- package/dist/nylas-web-elements/p-040b8553.entry.js +2 -0
- package/dist/nylas-web-elements/p-040b8553.entry.js.map +1 -0
- package/dist/nylas-web-elements/p-13a83f9a.entry.js +8 -0
- package/dist/nylas-web-elements/p-13a83f9a.entry.js.map +1 -0
- package/dist/nylas-web-elements/p-1a9fc29a.entry.js +2 -0
- package/dist/nylas-web-elements/p-1a9fc29a.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-e543a827.entry.js → p-1dedce7c.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-284c14bb.js → p-53f7b360.js} +2 -2
- package/dist/nylas-web-elements/p-7f100474.entry.js +2 -0
- package/dist/nylas-web-elements/p-7f100474.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-70d36207.entry.js → p-84e69241.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-36c73819.entry.js → p-ad7f8831.entry.js} +2 -2
- package/dist/nylas-web-elements/{scheduler-store-b6d12f40.js → scheduler-store-79dc16cc.js} +2 -2
- package/dist/nylas-web-elements/{scheduler-store-b6d12f40.js.map → scheduler-store-79dc16cc.js.map} +1 -1
- package/dist/nylas-web-elements/time-period-selector.entry.js +21 -1
- package/dist/nylas-web-elements/time-period-selector.entry.js.map +1 -1
- package/dist/types/components/design-system/checkbox-component/checkbox-component.d.ts +1 -0
- package/dist/types/components/design-system/multi-select-dropdown/multi-select-dropdown.d.ts +2 -0
- package/dist/types/components/design-system/nylas-date-component/nylas-date-component.d.ts +1 -0
- package/dist/types/components/design-system/time-period-selector/time-period-selector.d.ts +3 -0
- package/dist/types/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.d.ts +2 -0
- package/dist/types/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.d.ts +2 -0
- package/dist/types/components/scheduler-editor/nylas-event-location/nylas-event-location.d.ts +3 -0
- package/dist/types/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.d.ts +2 -2
- package/package.json +1 -1
- package/dist/nylas-web-elements/p-2fa604d7.entry.js +0 -2
- package/dist/nylas-web-elements/p-2fa604d7.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-52b9c0cb.entry.js +0 -2
- package/dist/nylas-web-elements/p-52b9c0cb.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-9db69aed.entry.js +0 -2
- package/dist/nylas-web-elements/p-9db69aed.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-a1a75dc7.entry.js +0 -8
- package/dist/nylas-web-elements/p-a1a75dc7.entry.js.map +0 -1
- /package/dist/nylas-web-elements/{p-e543a827.entry.js.map → p-1dedce7c.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-284c14bb.js.map → p-53f7b360.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-70d36207.entry.js.map → p-84e69241.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-36c73819.entry.js.map → p-ad7f8831.entry.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,h as e,F as n,c as a,H as i,a as s}from"./p-68c2fadf.js";import{R as o}from"./p-004f10b4.js";import{a as r,m as l,k as c,i as d}from"./p-05f97bb8.js";import{D as b}from"./p-f0271a79.js";import{i as p,a as h,c as f,b as u,f as y}from"./p-67577312.js";const m=".sc-google-logo-icon-h{display:flex}";const g=m;const _=class{constructor(e){t(this,e);this.width="24";this.height="24"}render(){return e("svg",{key:"a92099ec8ac0962d66c891c164e335ef3d047d22",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("g",{key:"67f404193a491c7599cb0ff6eb2eba5322d05e12","clip-path":"url(#clip0_959_12452)"},e("path",{key:"3c61ed99570e6093cad10d510093e172828eff40",d:"M23.745 12.27C23.745 11.48 23.675 10.73 23.555 10H12.255V14.51H18.725C18.435 15.99 17.585 17.24 16.325 18.09V21.09H20.185C22.445 19 23.745 15.92 23.745 12.27Z",fill:"#4285F4"}),e("path",{key:"c02254455f486c14330e39e76240c1cf4f4597a4",d:"M12.255 24C15.495 24 18.205 22.92 20.185 21.09L16.325 18.09C15.245 18.81 13.875 19.25 12.255 19.25C9.12504 19.25 6.47505 17.14 5.52505 14.29H1.54504V17.38C3.51504 21.3 7.56504 24 12.255 24Z",fill:"#34A853"}),e("path",{key:"8db3f9f9c1587778afe57689afc1a72db582d5ec",d:"M5.52501 14.2901C5.27501 13.5701 5.145 12.8001 5.145 12.0001C5.145 11.2001 5.28501 10.4301 5.52501 9.71012V6.62012H1.545C0.725004 8.24012 0.255005 10.0601 0.255005 12.0001C0.255005 13.9401 0.725004 15.7601 1.545 17.3801L5.52501 14.2901Z",fill:"#FBBC05"}),e("path",{key:"45b05683bc9c6bf46c6aef5858604016460df3e2",d:"M12.255 4.75C14.025 4.75 15.605 5.36 16.855 6.55L20.275 3.13C18.205 1.19 15.495 0 12.255 0C7.56504 0 3.51504 2.7 1.54504 6.62L5.52505 9.71C6.47505 6.86 9.12504 4.75 12.255 4.75Z",fill:"#EA4335"})),e("defs",{key:"4c047174ca3453f959e5e81b31e79abae98a1e09"},e("clipPath",{key:"0e8a1d30c69e4ff0d43a99342b111a0ced46b894",id:"clip0_959_12452"},e("rect",{key:"e653c135430f8fd0e33dea31c2d26a75ac6301a0",width:24,height:24,fill:"white"}))))}};_.style=g;const v=".sc-microsoft-logo-icon-h{display:flex}";const w=v;const x=class{constructor(e){t(this,e);this.width="22";this.height="22"}render(){return e("svg",{key:"0426f3e50fb256a3a5f5c2c221da187daddf01ab",width:this.width,height:this.height,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{key:"7613831c4bd6ec132acc5e89859acdfd6035f0c1",d:"M0.043457 0.043457H10.4782V10.4782H0.043457V0.043457Z",fill:"#F35325"}),e("path",{key:"db04c966af57fe29013c799d7a38192d121beb44",d:"M11.5217 0.043457H21.9565V10.4782H11.5217V0.043457Z",fill:"#81BC06"}),e("path",{key:"fe59fe563aede56518af70627d0ece3b83ded0fc",d:"M0.043457 11.5217H10.4782V21.9565H0.043457V11.5217Z",fill:"#05A6F0"}),e("path",{key:"07e3f81f79863f2e87827b163a2e9a9f9804cbf0",d:"M11.5217 11.5217H21.9565V21.9565H11.5217V11.5217Z",fill:"#FFBA08"}))}};x.style=w;var k;(function(t){t["EventInfo"]="eventInfo";t["Availability"]="availability";t["BookingOptions"]="bookingOptions";t["Communications"]="communications";t["Participants"]="participants";t["BookingForm"]="bookingForm";t["PageStyles"]="pageStyles"})(k||(k={}));function C({id:t,formState:a,activeTab:i},s){return e(n,null,e("div",{key:`event-info-${t}`,class:{hide:i!==k.EventInfo}},e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",{name:"title",exportparts:"net, net__title, net__dropdown-content"}),e("nylas-event-duration",{name:"duration",exportparts:"ned, ned__dropdown, ned__dropdown-button, ned__dropdown-content, ned__input_dropdown, ned__input_dropdown-input, ned__input_dropdown-content"}),e("nylas-event-location",{name:"location",exportparts:"nel, nel__location, nel__dropdown, nel__dropdown-button, nel__dropdown-content"}),e("nylas-event-description",{name:"description",exportparts:"nedesc, nedesc__textarea"})))),e("div",{key:`availability-${t}`,class:{hide:i!==k.Availability}},e("nylas-participant-booking-calendars",{participants:a.participants,name:"participant-booking-calendars",exportparts:"npbc, npbc__header, npbc__content, npbc__participant-container, npbc__participant-title"}),e("nylas-connected-calendars",{participants:a.participants,name:"connected-calendars",exportparts:"nccals, nccals__header, nccals__content, nccals__container, nccals__title, nccals__toggle-container, npbc__participant-toggle-container"}),e("nylas-availability-picker",{name:"availability",exportparts:"nap, nap__header, nap__select-timezone, nap__select-timezone-button, nap__select-timezone-dropdown-content, nap__availability, nap__day, nap__time-ranges, nap__time-range, nap__add-time-range, nap__time-picker-container, nap__time-picker-input, nap__time-picker-times"})),e("div",{key:`booking-options-${t}`,class:{hide:i!==k.BookingOptions}},e("nylas-scheduling-method",{name:"availability-method",readOnly:true,exportparts:"nsm, nsm__header, nsm__input-label, nsm__dropdown, nsm__dropdown-button, nsm__dropdown-content"}),e("nylas-custom-booking-flow",{exportparts:"ncbflow, ncbflow__header, ncbflow__title, ncbflow__content"},e("div",{slot:"inputs"},e("nylas-booking-confirmation-type",{name:"confirmation-type",exportparts:"nbct, nbct__header, nbct__dropdown, nbct__dropdown-button, nbct__dropdown-content"}),e("nylas-booking-confirmation-redirect",{name:"confirmation-redirect",exportparts:"nbcr, nbcr__header, nbcr__dropdown, nbcr__dropdown-button, nbcr__dropdown-content, nbcr__input-textfield"}))),e("nylas-buffer-time",{name:"buffer-time",exportparts:"nbt, nbt__header, nbt__body, nbt__dropdown-before, nbt__dropdown-button-before, nbt__dropdown-content-before, nbt__dropdown-after, nbt__dropdown-button-after, nbt__dropdown-content-after, nbt__preview"}),e("nylas-event-limits",null,e("div",{slot:"inputs"},e("nylas-min-booking-notice",{name:"min-booking-notice",exportparts:"nmbn, nmbn__number-dropdown, nmbn__number-dropdown-button, nmbn__number-dropdown-content, nmbn__period-dropdown, nmbn__period-dropdown-button, nmbn__period-dropdown-content"}),e("nylas-limit-future-bookings",{name:"limit-future-bookings",exportparts:"nlfb, nlfb__number-dropdown, nlfb__number-dropdown-button, nlfb__number-dropdown-content, nlfb__period-dropdown, nlfb__period-dropdown-button, nlfb__period-dropdown-content"}),e("nylas-min-cancellation-notice",{name:"min-cancellation-notice",exportparts:"nmcn, nmcn__number-dropdown, nmcn__number-dropdown-button, nmcn__number-dropdown-content, nmcn__period-dropdown, nmcn__period-dropdown-button, nmcn__period-dropdown-content"}),e("nylas-cancellation-policy",{name:"cancellation-policy",exportparts:"ncpolicy, ncpolicy__textarea"}))),e("nylas-timeslot-interval",{name:"timeslot-interval",exportparts:"nti, nti__header, nti__input-label, nti__dropdown, nti__dropdown-button, nti__dropdown-content"}),e("nylas-customize-booking-settings",{name:"customize-booking-settings",exportparts:"ncbs, ncbs__header, ncbs__settings, ncbs__settings-div, ncbs__additional_guests, ncbs__cancellation_options, ncbs__rescheduling_options"})),e("div",{key:`communications-${t}`,class:{hide:i!==k.Communications}},e("div",{class:"tab-header"},e("h3",null,"Event communications"),e("p",null,"Set up automatic confirmation emails.")),e("nylas-confirmation-email",{name:"confirmation-email-template",exportparts:"nce, nce__tab-heading, nce__header, nce__body, nce__confirmation-email-toggle--container, nce__summary, nce__reminder-input_dropdown, nce__reminder-input_dropdown-input, nce__reminder-input_dropdown-content"}),e("nylas-reminder-emails",{name:"reminder-emails",exportparts:"nre, nre__tab-heading, nre__header, nre__body, nre__confirmation-email-toggle--container, nre__summary, nre__reminder-input_dropdown, nre__reminder-input_dropdown-input, nre__reminder-input_dropdown-content"})),e("div",{key:`participants-${t}`,class:{hide:i!==k.Participants}},e("nylas-additional-participants",{name:"participants",exportparts:"nap, nap__title, nap__subtitle, nap__content, nap__input_group, nap__input_wrapper, nap__input, nap__remove-participant"}),e("nylas-participants-custom-availability",{participants:a.participants,name:"participant-custom-availability",exportparts:"npca, npca__header, npca__content, npca__participant-container, npca__participant-title, npca__participant-toggle--container, npca__toggle-label, npca__toggle-input, npca__toggle-slider"})),e("div",{key:`page-styles-${t}`,class:{hide:i!==k.PageStyles}},e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}),e("nylas-page-name",{name:"page-name",exportparts:"npn, npn__body, npn__header, npn__drawer-toggle--container, npn__input-textfield"}),e("nylas-page-styling",{name:"page-styling",exportparts:"nps, nps__header, nps__drawer-toggle--container, nps__body, nps__title-input-textfield, nps__company-logo-input-textfield, nps__color-picker, nps__color-picker-button, nps__color-picker-button-label, nps__color-picker-selected-label, nps__submit-button-label-input-textfield, nps__message-textarea"},s)),e("div",{key:`booking-form-${t}`,class:{hide:i!==k.BookingForm}},e("nylas-booking-form-config",{name:"additional-fields",exportparts:"nbfc, nbfc__header, nbfc__add_field, nbfc__add_field-button, nbfc__add_field-content, nbfc__additional_fields, nbfc__form-field, nbfc__form-field-header, nbfc__form-field-content"})))}const S='.sc-nylas-editor-tabs-h{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.scheduler-editor.sc-nylas-editor-tabs{display:flex;flex-direction:column;height:inherit}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs{height:calc(100% - 80px);display:grid;grid-template-columns:minmax(224px, 25%) 1fr}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs{display:table-column-group;height:auto}}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs{display:flex;flex-direction:column;border-right:1px solid var(--nylas-base-200);background-color:var(--nylas-base-25)}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs{border-right:none}}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs{display:flex;align-items:center;gap:0.5rem;padding:0.5rem 1rem;color:var(--nylas-base-900);background:var(--nylas-base-0);border:none;height:56px;font-family:var(--nylas-font-family);font-size:16px;font-weight:500;line-height:24px;cursor:pointer}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs:not(:first-of-type){margin-top:0.25rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs:last-of-type{margin-bottom:0.25rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.active.sc-nylas-editor-tabs{font-weight:600;background:var(--nylas-base-0);color:var(--nylas-primary);border-left:4px solid var(--nylas-primary);box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.0588235294);box-shadow:0px 1px 3px 0px rgba(0, 0, 0, 0.1019607843)}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.hide.sc-nylas-editor-tabs{display:none}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs{max-width:692px;overflow-y:auto;overflow-x:hidden}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .hide.sc-nylas-editor-tabs{display:none}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-info.sc-nylas-editor-tabs,.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-limits.sc-nylas-editor-tabs{width:inherit}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-info.sc-nylas-editor-tabs div[slot=inputs].sc-nylas-editor-tabs,.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-limits.sc-nylas-editor-tabs div[slot=inputs].sc-nylas-editor-tabs{display:flex;flex-direction:column;gap:1rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs{display:flex;flex-direction:column;margin:1rem 1rem 0.5rem;row-gap:4px}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs h3.sc-nylas-editor-tabs{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs p.sc-nylas-editor-tabs{margin:0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.footer.sc-nylas-editor-tabs{display:flex;justify-content:space-between;align-items:center;gap:1rem;min-height:80px;padding:0 1rem;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs{flex-direction:column;height:auto}}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .preview.sc-nylas-editor-tabs{margin-top:1rem;width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs{display:flex;justify-content:flex-end;align-items:center;justify-self:flex-end;gap:1rem}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs{flex-direction:column-reverse;width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.sc-nylas-editor-tabs{max-width:524px}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.unsaved-changes.sc-nylas-editor-tabs{color:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.saved-changes.sc-nylas-editor-tabs{color:var(--nylas-success)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.error.sc-nylas-editor-tabs{color:var(--nylas-error)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.error-full-width.sc-nylas-editor-tabs{max-width:660px}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button-component.sc-nylas-editor-tabs{width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs{background:var(--nylas-primary);color:var(--nylas-base-0);height:48px;border:none;border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;cursor:pointer;width:148px}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:hover{background:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:active{background:var(--nylas-base-800)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:disabled{background:var(--nylas-base-300);cursor:not-allowed}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs span.sc-nylas-editor-tabs{display:flex;align-items:center;justify-content:center;gap:0.5rem}button-component#report-issue.sc-nylas-editor-tabs{width:auto}nylas-feedback-form.sc-nylas-editor-tabs{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 H=S;var z=undefined&&undefined.__decorate||function(t,e,n,a){var i=arguments.length,s=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(t,e,n,a);else for(var r=t.length-1;r>=0;r--)if(o=t[r])s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s;return i>3&&s&&Object.defineProperty(e,n,s),s};var j=undefined&&undefined.__metadata||function(t,e){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(t,e)};const P=class{constructor(e){t(this,e);this.schedulerConfigChanged=a(this,"schedulerConfigChanged",7);this.cancelButtonClick=a(this,"cancelButtonClick",7);this.formSubmitted=a(this,"formSubmitted",7);this.previewButtonClicked=a(this,"previewButtonClicked",7);this.schedulerEditorFormUpdated=a(this,"schedulerEditorFormUpdated",7);this.setError=t=>{this.error=t.message};this.formSubmissionHandler=async t=>{t.preventDefault();const e=await this.formSubmitted.emit();r("[nylas-editor-tabs]","formSubmissionHandler",e);const n=this.formRef.checkValidity();if(!n||e.defaultPrevented){this.error=this.formRef.validationMessage||"Please fix the form errors.";return}this.isLoading=true;this.hasUnsavedChanges=false;const a=this.updateFormState();r("[nylas-editor-tabs]","formState",a);const{title:i,description:s,duration:o,availability:c,bookingCalendar:d,location:p,bookingType:h,buffer:f,availableDaysInFuture:u,minCancellationNotice:y,minBookingNotice:m,cancellationPolicy:g,timeslotInterval:_,additionalGuestsHidden:v,hideCancellationOptions:w,hideReschedulingOptions:x,participants:k,participantOpenHours:C,additionalFields:S,participantCalendars:H,conferencing:z,participantBookingCalendars:j,reminders:P,emailTemplate:L,redirectUrl:B,availabilityMethod:F,slug:O,appearance:N,name:T}=a;const $=this.selectedConfiguration?.participants?.find((t=>t.is_organizer))||k?.find((t=>t.is_organizer));const I=H&&$?.email?H[$?.email]:[];const M=$?.booking?.calendar_id||d;const R=o?parseInt(o):30;const E=k&&k?.length>0?k:[{name:$?.name??this.currentUser?.name??"",email:$?.email??this.currentUser?.email??"",is_organizer:true,timezone:c?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,availability:{calendar_ids:d&&d!==""?[d]:["primary"],open_hours:[]},booking:{calendar_id:d&&d!==""?d:"primary"}}];const D={...this.selectedConfiguration?.id&&{id:this.selectedConfiguration.id},version:this.selectedConfiguration?.version??"1.0.0",slug:O,name:T,availability:{duration_minutes:R,interval_minutes:_?.interval??R,round_to:_?.roundTo,availability_rules:{availability_method:F?F:this.selectedConfiguration?.availability?.availability_rules?.availability_method??"collective",buffer:f||{before:0,after:0},default_open_hours:c?.openHours??this.selectedConfiguration?.availability?.availability_rules?.default_open_hours??b,round_robin_group_id:this.selectedConfiguration?.availability?.availability_rules?.round_robin_group_id??""}},participants:[...E?E.map((t=>{let e=c?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone;if(C?.[t.email]?.length){e=C?.[t.email]?.[0]?.timezone}if(t.is_organizer){const n=j?.[t.email]?j?.[t.email]:M?M:"primary";const a=H?.[t.email]?H?.[t.email]:I?.length?I:["primary"];const i=a.length===1&&a[0]==="primary";return{name:t.name??"",email:t.email,is_organizer:true,timezone:e,availability:{calendar_ids:i?[n]:a,open_hours:C?.[t.email]??t.availability?.open_hours??[]},booking:{calendar_id:n}}}const n=j?.[t.email]?{calendar_id:j?.[t.email]}:t?.booking??undefined;const a=H?.[t.email]??t.availability?.calendar_ids??["primary"];const i=a.length===1&&a[0]==="primary";return{...t,timezone:e,availability:t.availability?{calendar_ids:i&&typeof n!=="undefined"?[n?.calendar_id]:a,open_hours:C?.[t.email]??t.availability?.open_hours??[]}:undefined,booking:n}})):[]],event_booking:{title:i?.toString()??"",description:s?.toString()??"",location:p?.toString()??"",booking_type:h?.toString()??"booking",timezone:c?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,conferencing:z,reminders:P},scheduler:{cancellation_policy:g??"",available_days_in_future:u??30,min_cancellation_notice:y??0,min_booking_notice:m??60,hide_additional_guests:v??false,hide_cancellation_options:w??false,hide_rescheduling_options:x??false,additional_fields:S,email_template:L,confirmation_redirect_url:B},appearance:N};const V=l(this.selectedConfiguration,D||{});const J=this.action==="create"?V:D;if(this.isConfigRoundRobin(J)){J.participants=J.participants.map((t=>({...t,is_organizer:undefined})))}const U=t=>{this.isLoading=false;this.changesSaved=true;setTimeout((()=>{this.changesSaved=false}),5e3)};const A=this.checkForBookingFormErrors(J);const Z=this.configurations?.find((t=>t.id===this.selectedConfiguration?.id))||{};const W=this.checkForOrganizerConfirmationError(l(J,Z));if(A||W){return}this.schedulerConfigChanged.emit({config:J,resetLoadingState:U,setError:this.setError,action:this.action})};this.isConfigRoundRobin=t=>t?.availability?.availability_rules?.availability_method==="max-availability"||t.availability?.availability_rules?.availability_method==="max-fairness";this.checkForOrganizerConfirmationError=t=>{let e=false;let n="";const a=t.event_booking?.booking_type==="organizer-confirmation";const i=t.scheduler?.organizer_confirmation_url;if(a&&!i){n+="Organizer confirmation URL is required when using organizer confirmation booking type.";e=true}if(e){this.isLoading=false;this.setError(new Error(n))}return e};this.checkForBookingFormErrors=t=>{let e=false;let n="";const a=t.scheduler?.additional_fields;if(a){n="Booking form error: ";Object.entries(a).forEach((t=>{const a=t[1];if(a.label===""){n+=`Label is required for field of type ${a.type}.`;e=true;return}if(a.options){for(const t of a.options){if(t===""){n+=`Empty option detected inside ${a.label} of type ${a.type}.`;e=true;break}}}}))}if(e){this.isLoading=false;this.setError(new Error(n))}return e};this.calendars=undefined;this.selectedConfiguration=undefined;this.configurations=undefined;this.currentUser=undefined;this.schedulerPreviewLink="";this.mode="app";this.hideEditorTabs=[];this.enableUserFeedback=true;this.action="create";this.showFeedbackModal=false;this.activeTab=k.EventInfo;this.isLoading=false;this.hasUnsavedChanges=false;this.changesSaved=false;this.formState={};this.error=""}configChangedHandler(t){r("[nylas-editor-tabs]","configChangedHandler",t,this.selectedConfiguration);this.formState={...this.getFormStateFromConfig(t)};if(t?.id){this.action="edit"}else{this.action="create"}}userChangedHandler(t){r("[nylas-editor-tabs]","userChangedHandler",t);if(t){this.formState={...this.getFormStateFromConfig(this.selectedConfiguration)}}}connectedCallback(){r("[nylas-editor-tabs]","connectedCallback")}componentWillLoad(){r("[nylas-editor-tabs]","componentWillLoad");this.formState=this.getFormStateFromConfig(this.selectedConfiguration)}componentDidLoad(){r("[nylas-editor-tabs]","componentDidLoad");if(this.enableUserFeedback&&!p()){h({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.3.2",integrations:t=>[...t.filter((t=>false)),y({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}if(this.selectedConfiguration?.id){this.configChangedHandler(this.selectedConfiguration)}const t=this.host.querySelector("button.tab:not(.hide)")?.name;if(t){this.activeTab=t}}disconnectedCallback(){r("[nylas-editor-tabs]","disconnectedCallback")}handleValueChanged(t){r("[nylas-editor-tabs]","handleValueChanged",t);const{name:e,value:n}=t.detail;this.setFormState(n,e);this.formState={...this.formState};this.hasUnsavedChanges=true;this.error="";this.schedulerEditorFormUpdated.emit({value:t.detail.value,name:t.detail.name})}feedbackModalClosedHandler(){this.showFeedbackModal=false}feedbackSubmittedHandler(t){const e=f("Scheduler Editor User Feedback");const n={eventId:e,message:t.detail.feedback};u(n,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduler-editor","nylas-web-element-version":"1.3.2"},extra:{configId:this.selectedConfiguration?.id,slug:this.selectedConfiguration?.slug}}});this.showFeedbackModal=false}getFormStateFromConfig(t){let e=t?.participants?.find((t=>t.is_organizer));if(!e&&t?.availability?.availability_rules?.availability_method!=="collective"){e=t?.participants?.find((t=>t.email===this.currentUser?.email));if(e){e.is_organizer=true}}if(t?.appearance){console.info("Appearance settings have been returned from the given configuration; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}return{title:t?.event_booking?.title??"",description:t?.event_booking?.description??"",duration:t?.availability?.duration_minutes?.toString()??"30",availability:{timezone:t?.event_booking?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,openHours:t?.availability?.availability_rules?.default_open_hours??b},additionalFields:t?.scheduler?.additional_fields??{},conferencing:t?.event_booking?.conferencing??{},calendarIds:e?.availability?.calendar_ids??[],participants:t?.participants??[],bookingCalendar:e?.booking?.calendar_id??e?.email??"",location:t?.event_booking?.location??"",bookingType:t?.event_booking?.booking_type??"booking",buffer:t?.availability?.availability_rules?.buffer??{before:0,after:0},cancellationPolicy:t?.scheduler?.cancellation_policy??"",availableDaysInFuture:t?.scheduler?.available_days_in_future??30,minCancellationNotice:t?.scheduler?.min_cancellation_notice??0,minBookingNotice:t?.scheduler?.min_booking_notice??60,timeslotInterval:{interval:t?.availability?.interval_minutes??t?.availability?.duration_minutes,roundTo:t?.availability?.round_to},additionalGuestsHidden:t?.scheduler?.hide_additional_guests??false,hideCancellationOptions:t?.scheduler?.hide_cancellation_options??false,hideReschedulingOptions:t?.scheduler?.hide_rescheduling_options??false,participantBookingCalendars:t?.participants?.reduce(((t,e)=>{if(e.booking?.calendar_id){t[e.email]=e.booking?.calendar_id}return t}))??{},participantCalendars:t?.participants?.reduce(((t,e)=>{t[e.email]=e.availability?.calendar_ids;return t}),{})??{},reminders:t?.event_booking?.reminders,emailTemplate:t?.scheduler?.email_template,redirectUrl:t?.scheduler?.confirmation_redirect_url,slug:t?.slug,appearance:t?.appearance,name:t?.name}}setFormState(t,e){switch(e){case"title":this.formState.title=t.toString();break;case"description":this.formState.description=t.toString();break;case"duration":this.formState.duration=t.toString();break;case"availability":this.formState.availability=JSON.parse(t.toString());break;case"participants":this.formState.participants=JSON.parse(t.toString());break;case"booking-calendar":this.formState.bookingCalendar=t.toString();break;case"participant-booking-calendars":this.formState.participantBookingCalendars=JSON.parse(t.toString());break;case"location":this.formState.location=t.toString();break;case"conference":this.formState.conferencing=JSON.parse(t.toString());break;case"confirmation-type":this.formState.bookingType=t.toString();break;case"buffer-time":this.formState.buffer=JSON.parse(t.toString());break;case"limit-future-bookings":this.formState.availableDaysInFuture=parseInt(t.toString());break;case"min-cancellation-notice":this.formState.minCancellationNotice=parseInt(t.toString());break;case"min-booking-notice":this.formState.minBookingNotice=parseInt(t.toString());break;case"cancellation-policy":this.formState.cancellationPolicy=t.toString();break;case"timeslot-interval":this.formState.timeslotInterval=JSON.parse(t.toString());break;case"customize-booking-settings":{const e=JSON.parse(t.toString());this.formState.additionalGuestsHidden=e.additionalGuestsHidden;this.formState.hideCancellationOptions=e.hideCancellationOptions;this.formState.hideReschedulingOptions=e.hideReschedulingOptions;break}case"participant-custom-availability":{const e=JSON.parse(t.toString());this.formState.participantOpenHours=e;break}case"additional-fields":this.formState.additionalFields=t;break;case"connected-calendars":this.formState.participantCalendars=JSON.parse(t.toString());break;case"confirmation-email-template":this.formState.emailTemplate=JSON.parse(t.toString());break;case"reminder-overrides":this.formState.reminders=JSON.parse(t.toString());break;case"confirmation-redirect":this.formState.redirectUrl=t.toString();break;case"availability-method":this.formState.availabilityMethod=t.toString();break;case"custom-event-slug":console.debug("custom-event-slug",t);this.formState.slug=JSON.parse(t.toString());break;case"page-styling":this.formState.appearance=JSON.parse(t.toString());break;case"page-name":this.formState.name=JSON.parse(t.toString());break}this.schedulerEditorFormUpdated.emit({value:t,name:e})}updateFormState(){const t=new FormData(this.formRef);t.forEach(((t,e)=>{this.setFormState(t,e)}));this.formState={...this.formState};return this.formState}setActiveTab(t,e){t.preventDefault();this.updateFormState();this.activeTab=e}hideTab(t){return this.hideEditorTabs?.includes(t)||false}onFeedbackClick(t){t.preventDefault();this.showFeedbackModal=true}render(){r("[nylas-editor-tabs]","render",this.formState);return e(i,{key:"877744ce17be949dd3a0677154d39f23d3a0e4c6"},e("form",{key:"b8c8ea5167dd9463a41167541ed70fbf746ce0dc",onSubmit:this.formSubmissionHandler,class:"scheduler-editor",ref:t=>this.formRef=t,noValidate:true},this.mode==="app"?e("div",{class:"form-contents",part:"editor__form-contents net__form-contents"},e("div",{class:"tabs",part:"editor__tabs net__tabs"},e("button",{name:k.EventInfo,class:{tab:true,active:this.activeTab==k.EventInfo,hide:this.hideTab(k.EventInfo)},part:"editortab__event-info net__tab-event-info",onClick:t=>this.setActiveTab(t,k.EventInfo)},e("calendar-info-icon",{width:"16",height:"16"}),"Event info"),e("button",{name:k.Availability,class:{tab:true,active:this.activeTab==k.Availability,hide:this.hideTab(k.Availability)},part:"editortab__availability net__tab-availability",onClick:t=>this.setActiveTab(t,k.Availability)},e("calendar-patterns-icon",{width:"16",height:"16"}),"Availability"),e("button",{name:k.Participants,class:{tab:true,active:this.activeTab==k.Participants,hide:this.hideTab(k.Participants)},part:"editortab__participants net__tab-participants",onClick:t=>this.setActiveTab(t,k.Participants)},e("people-icon",{width:"16",height:"16"}),"Participants"),e("button",{name:k.BookingOptions,class:{tab:true,active:this.activeTab==k.BookingOptions,hide:this.hideTab(k.BookingOptions)},part:"editortab__booking-options net__tab-booking-options",onClick:t=>this.setActiveTab(t,k.BookingOptions)},e("flow-icon",{width:"16",height:"16"}),"Booking options"),e("button",{name:k.BookingForm,class:{tab:true,active:this.activeTab=="bookingForm",hide:this.hideTab(k.BookingForm)},part:"editortab__booking-form net__tab-booking-form",onClick:t=>this.setActiveTab(t,k.BookingForm)},this.activeTab==k.BookingForm?e("calendar-agenda-fill-icon",{width:"16",height:"16"}):e("calendar-agenda-icon",{width:"16",height:"16"}),"Booking form"),e("button",{name:k.Communications,class:{tab:true,active:this.activeTab=="communications",hide:this.hideTab(k.Communications)},onClick:t=>this.setActiveTab(t,k.Communications),part:"editortab__communications net__tab-communications"},this.activeTab==k.Communications?e("envelope-fill-icon",{width:"16",height:"16"}):e("envelope-icon",{width:"16",height:"16"}),"Communications"),e("button",{name:k.PageStyles,class:{tab:true,active:this.activeTab=="pageStyles",hide:this.hideTab(k.PageStyles)},onClick:t=>this.setActiveTab(t,k.PageStyles),part:"editortab__page-styles net__tab-page-styles"},this.activeTab==k.PageStyles?e("paintbrush-fill-icon",{width:"16",height:"16"}):e("paintbrush-icon",{width:"16",height:"16"}),"Page styles")),e("div",{class:"tab-content",part:"editor__tab-content net__tab-content"},e(C,{formState:this.formState,activeTab:this.activeTab,currentUser:this.currentUser,calendars:this.calendars,id:this.selectedConfiguration?.id??"new"}))):e("div",{class:"composable",key:this.selectedConfiguration?.id},e("slot",null)),e("div",{key:"d0f4111a5e94a3e8ce82024b6bab5ff3a1fa486b",class:"footer",part:"editor__footer net__footer"},e("div",{key:"c0fdc3ba4470c56ffd339d826e4d871c1ccf9d80",class:"preview",part:"editor__footer-preview net__footer-preview"},this.enableUserFeedback&&e("button-component",{title:"Share your feedback",id:"report-issue",variant:"basic",onClick:t=>this.onFeedbackClick(t)},e("feedback-icon",null))),e("div",{key:"8215bc5a0ed81aca0a472c390b3ac8165380fe79",class:"buttons",part:"editor__footer-buttons net__footer-buttons"},e("p",{key:"80b5f296a70adbaae379f428118c730dd174d23b",class:{"unsaved-changes":this.hasUnsavedChanges&&!this.changesSaved,"saved-changes":this.changesSaved,error:this.error!=="","error-full-width":this.error!==""&&this.action==="create"}},this.error!==""?this.error:"",this.error==""&&this.hasUnsavedChanges&&!this.changesSaved?"Unsaved changes":this.error==""&&this.changesSaved?"Changes saved!":""),this.schedulerPreviewLink!==""&&this.action==="edit"&&e("button-component",{title:"Preview",type:"button",disabled:this.isLoading,clickHandler:t=>{t.preventDefault();const e=this.previewButtonClicked.emit(this.host);if(!e.defaultPrevented){window.open(c(this.schedulerPreviewLink,this.selectedConfiguration),"_blank")}},variant:"basic"},e("eye-icon",null)),e("button-component",{key:"d2983166679d914328f8fff635cff2cf2f18b776",type:"button",disabled:this.isLoading,clickHandler:t=>{t.preventDefault();this.cancelButtonClick.emit();this.error=""},variant:"basic",part:"editor__footer-cancel net__footer-cancel"},"Back"),e("button-component",{key:"6c9276bdd579c468544d8b9a1d558e216605f3c4",type:"submit",disabled:this.isLoading,part:"editor__footer-cta net__footer-cta"},this.isLoading?e("span",null,"Saving",e("loading-icon",null)," "):this.action==="create"?"Create":"Save changes")))),this.showFeedbackModal&&e("nylas-feedback-form",null))}get host(){return s(this)}static get watchers(){return{selectedConfiguration:["configChangedHandler"],currentUser:["userChangedHandler"]}}};z([o({name:"nylas-editor-tabs",stateToProps:new Map([["schedulerConfig.calendars","calendars"],["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.currentUser","currentUser"],["schedulerConfig.configurations","configurations"]]),eventToProps:{schedulerConfigChanged:async(t,e)=>{const{resetLoadingState:n,setError:a,action:i,config:s}=t.detail;const o=e=>{const[i,s]=e;if(!i&&s&&a){a(s)}if(n){n(t)}};if(i==="edit"){const t=await e.schedulerConfig.updateConfiguration(s);o(t)}else{const t=await e.schedulerConfig.createConfiguration(s);o(t)}},cancelButtonClick:async(t,e)=>{e.schedulerConfigStore.state.action=null},previewButtonClicked:async(t,e)=>{r("[nylas-editor-tabs]","previewButtonClicked",e)},formSubmitted:async(t,e)=>{r("[nylas-editor-tabs]","formSubmitted",e)},schedulerEditorFormUpdated:async(t,e)=>{r("[nylas-editor-tabs]","schedulerEditorFormUpdated",t)}},localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"],["enableUserFeedback","enableUserFeedback"],["hideEditorTabs","hideEditorTabs"]]),fireRegisterEvent:true}),j("design:type",Function),j("design:paramtypes",[]),j("design:returntype",void 0)],P.prototype,"render",null);P.style=H;const L=':host{display:grid;grid-auto-flow:row;width:100%;font-family:inherit;font-optical-sizing:auto;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;gap:1rem}@media screen and (max-width: 768px){.header{flex-direction:column;gap:0.5rem;align-items:unset}}.header h2{margin:0;font-size:1.25rem;color:var(--nylas-base-900);font-weight:600}.header p{margin:0;font-size:1rem;color:var(--nylas-base-700)}.header .actions{justify-self:end}@media screen and (max-width: 768px){.header .actions{width:100%}}.configurations{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);background:var(--nylas-base-0);height:100%;display:flex;flex-direction:column;position:relative;overflow-y:hidden}.configurations .table-container{overflow-y:auto;flex:1}.configurations .table-container table{width:100%;border-spacing:0;border-collapse:collapse;font-family:inherit;height:max-content}.configurations .table-container table.no-configurations{height:100%}.configurations .table-container table tr{color:var(--nylas-base-800);border-bottom:1px solid var(--nylas-base-200);font-family:inherit}.configurations .table-container table tr.hide{display:none}.configurations .table-container table th{font-weight:600;text-transform:uppercase;font-size:14px;line-height:20px}.configurations .table-container table tr.no-configurations td>div{display:flex;height:100%;justify-content:center;align-items:center;flex-direction:column;padding:var(--nylas-border-radius-3x)}.configurations .table-container table tr.no-configurations td>div h3{margin:0 0 1rem 0;color:var(--nylas-base-700)}.configurations .table-container table tr.no-configurations td>div p{margin:0 0 1rem 0;color:var(--nylas-base-600)}.configurations .table-container table tr.no-configurations td>div calendar-icon{margin-bottom:1rem;color:var(--nylas-base-200)}.configurations .table-container table th,.configurations .table-container table td{text-align:left;padding:1rem;font-family:inherit}.configurations .table-container table .actions{text-align:right}.configurations .table-container table .actions{display:flex;justify-content:flex-end;gap:1rem}@media screen and (max-width: 768px){.configurations .table-container table .actions{flex-direction:column;gap:0.5rem}}.configurations .table-container table .title{width:100%;max-width:300px}@media screen and (max-width: 768px){.configurations .table-container table .title{max-width:96px}}.configurations .table-container table .title div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.configurations .table-container table .title div.config-event-title{font-weight:600}.configurations .table-container table .title div.config-event-description{font-size:0.75rem}.configurations .pagination{padding:1rem;position:sticky;top:100%;display:flex;justify-content:flex-end;gap:0.5rem;background:white;width:calc(100% - 2rem);z-index:2}.configurations .pagination td.arrows{display:flex;justify-content:flex-end;gap:0.5rem}.configurations .pagination button{display:flex;flex-direction:row;justify-content:center;align-items:center;height:3vh;width:3vh;min-width:3em;min-height:3em;cursor:pointer;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background-color:transparent;color:var(--nylas-base-800);cursor:pointer}.configurations .pagination button:hover:not(:disabled){border:1px solid var(--nylas-primary)}.configurations .pagination button:active{border:1px solid var(--nylas-base-800)}.configurations .pagination button:disabled{border:1px solid var(--nylas-base-100);background-color:transparent;color:var(--nylas-base-300);cursor:not-allowed}.configurations .pagination button.right{transform:rotate(180deg)}.error-container{margin-top:1.5rem}.error-container .error{color:var(--nylas-error);padding:0.5rem 0;margin:1rem 0 0}button-component#copy button{width:108px}select-dropdown{width:auto}select-dropdown::part(sd_dropdown-button){display:block;height:48px;padding:0px 16px 8px}@media screen and (max-width: 768px){select-dropdown::part(sd_dropdown-button){width:92px}}select-dropdown::part(sd_dropdown-content){width:120px;right:0}select-dropdown::part(sd_dropdown-labelhtml){display:flex;gap:0.5rem;align-items:center;color:var(--nylas-base-900)}select-dropdown::part(sd_dropdown-labelhtml):hover{color:var(--nylas-primary)}.card-wrapper{position:absolute;top:0;left:0;height:calc(100% + 4rem);width:-webkit-fill-available;width:-moz-available;width:fill-available;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.card-wrapper{justify-content:start;height:100%}}.card-modal{background:var(--nylas-base-0);display:flex;flex-direction:column;font-family:var(--nylas-font-family);background-color:var(--nylas-base-0);color:var(--nylas-base-900);border-radius:var(--nylas-border-radius-3x);padding:32px;width:562px;box-shadow:0px 1px 4px rgba(0, 0, 0, 0.1), 0px 3px 6px rgba(0, 0, 0, 0.06)}@media screen and (max-width: 768px){.card-modal{width:auto;border-radius:0px}}.description.title-desc{margin-bottom:2rem}.description p{margin:0;font-size:18px;color:var(--nylas-base-600)}.footer{margin-top:1rem;padding-top:1rem;display:flex;justify-content:flex-end;gap:0.5rem;box-sizing:border-box;background-color:var(--nylas-base-25);width:100%;border-radius:0 0 var(--nylas-border-radius-2x) var(--nylas-border-radius-2x)}.close-button{width:100%;display:flex;justify-content:flex-end}.close-button button-component button{padding:0;height:auto}.close-button button-component button:hover{background-color:transparent !important}button-component{--dot-color:var(--nylas-base-700)}';const B=L;var F=undefined&&undefined.__decorate||function(t,e,n,a){var i=arguments.length,s=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(t,e,n,a);else for(var r=t.length-1;r>=0;r--)if(o=t[r])s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s;return i>3&&s&&Object.defineProperty(e,n,s),s};var O=undefined&&undefined.__metadata||function(t,e){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(t,e)};const N=class{constructor(e){t(this,e);this.initListConfigurations=a(this,"initListConfigurations",7);this.createButtonClick=a(this,"createButtonClick",7);this.editButtonClick=a(this,"editButtonClick",7);this.deleteButtonClick=a(this,"deleteButtonClick",7);this.configurations=[];this.schedulerPreviewLink="";this.listConfigurationsNextCursor=undefined;this.state="loading";this.error="";this.currentCursor=null;this.previousCursors=[];this.disableNextPageButton=false;this.deleteConfigurationId="";this.showDeleteButtonLoading=false}listConfigurationsNextCursorChangedHandler(t,e){if(!t||t===e){if(t===null){this.disableNextPageButton=true}return}this.disableNextPageButton=false;this.currentCursor=t}connectedCallback(){r("[nylas-list-configurations]","connectedCallback")}componentWillLoad(){r("[nylas-list-configurations]","componentWillLoad");if(this.configurations&&this.configurations.length>0){this.state="loaded"}}componentDidLoad(){r("[nylas-list-configurations]","componentDidLoad");this.initListConfigurations.emit({host:this.host})}disconnectedCallback(){r("[nylas-list-configurations]","disconnectedCallback")}async handleNylasFormDropdownChanged(t){r("[nylas-list-configurations]","handleNylasFormDropdownChanged",t.detail);const{value:e}=t.detail;const[n,a]=e.split("-");t.preventDefault();switch(n){case"delete":this.deleteConfigurationId=this.configurations[a]?.id;break;case"preview":window.open(c(this.schedulerPreviewLink,this.configurations[a]),"_blank");break;case"copy":await navigator.clipboard.writeText(c(this.schedulerPreviewLink,this.configurations[a]));break}}async registerCallback(){this.initListConfigurations.emit({host:this.host})}async getState(){return this.state}async setState(t){this.state=t}async setError(t){this.error=t}async hideDeleteConfirmation(){this.deleteConfigurationId="";this.showDeleteButtonLoading=false}closeModal(t){t.preventDefault();this.deleteConfigurationId=""}handleConfirmDeleteButtonClicked(t){t.preventDefault();this.showDeleteButtonLoading=true;const e=this.configurations.find((t=>t.id===this.deleteConfigurationId));if(e&&e?.id){this.deleteButtonClick.emit({host:this.host,configuration:e})}}getDurationString(t){const e=Math.floor(t/60);const n=t%60;return`${e?e:""} ${e?`${e>1?"hours":"hour"}`:""} ${n?n:""} ${n?`${n>1?"mins":"min"}`:""}`}getActionLabelHTML(t){const n={display:"inline-flex",alignItems:"center",gap:"0.5rem"};const a={color:"var(--nylas-error)"};switch(t){case"preview":return e("span",{style:n},e("eye-icon",{width:"16",height:"16"}),"Preview");case"copy":return e("span",{style:n},e("copy-icon",{width:"16",height:"16"}),"Copy link");case"delete":return e("span",{style:{...n,...a}},e("delete-icon",{width:"15",height:"17"}),"Delete");default:return""}}previousPageClickedHandler(){if(this.previousCursors.length===0)return;this.currentCursor=this.previousCursors.pop()||null;const t=this.previousCursors[this.previousCursors.length-1]||undefined;this.initListConfigurations.emit({host:this.host,cursor:t})}nextPageClickedHandler(){if(!this.currentCursor)return;this.previousCursors=[...this.previousCursors,this.currentCursor];this.initListConfigurations.emit({host:this.host,cursor:this.currentCursor})}render(){return e(i,null,e("div",{class:"header"},e("div",{class:"description"},e("h2",null,"All Scheduling Pages"),e("p",null,"Create and manage your Scheduling Pages.")),this.configurations&&this.configurations.length>0&&e("div",{class:"actions"},e("button-component",{part:"nlc__create-new-cta",clickHandler:()=>{this.createButtonClick.emit(this.host)}},"Create new"))),e("div",{class:"configurations"},e("div",{class:"table-container"},e("table",{class:{"no-configurations":this.state!=="loading"&&(!this.configurations||this.configurations.length===0)}},e("tr",{class:{hide:this.state==="loading"||this.configurations&&this.configurations.length===0}},e("th",null,"Page title"),e("th",null,"Duration"),e("th",null)),this.state==="loading"&&e("tr",{class:"no-configurations"},e("td",{colSpan:3},e("div",null,e("h3",null,"Loading..."),e("p",null,"Please wait while we fetch the scheduling pages")))),this.state!=="loading"&&(!this.configurations||this.configurations.length===0)&&e("tr",{class:"no-configurations"},e("td",{colSpan:3},e("div",null,e("calendar-icon",{width:"48",height:"48"}),e("h3",null,"No scheduling pages found"),e("p",null,"Get started with creating your first scheduling page"),e("button-component",{part:"nlc__create-new-cta",clickHandler:()=>{this.createButtonClick.emit(this.host)}},"Create new")))),this.state!=="loading"&&this.configurations?.map(((t,n)=>e("tr",{key:t?.id},e("td",null,e("div",{class:"title"},e("div",{class:"config-event-title",title:t?.event_booking?.title},t?.event_booking?.title),e("div",{class:"config-event-description"},t?.event_booking?.description))),e("td",null,e("div",{class:"duration"},this.getDurationString(t?.availability?.duration_minutes))),e("td",null,e("div",{class:"actions"},e("button-component",{variant:"basic",key:`edit-${n}`,clickHandler:e=>{e.preventDefault();this.editButtonClick.emit({host:this.host,configuration:t})}},e("edit-icon",{width:"16",height:"16"}),"Edit"),e("select-dropdown",{name:"actions",options:[{value:`preview-${n}`,label:"Preview",labelHTML:this.getActionLabelHTML("preview")},{value:`copy-${n}`,label:"Copy link",labelHTML:this.getActionLabelHTML("copy")},{value:`delete-${n}`,label:"Delete",labelHTML:this.getActionLabelHTML("delete")}],defaultSelectedOption:{value:"",label:""},dropdownButtonText:"...",withSearch:false,withChevron:false,exportparts:"sd_dropdown: actions__dropdown, sd_dropdown-button: actions__dropdown-button, sd_dropdown-content: actions__dropdown-content"})))))))),e("div",{class:"pagination"},e("button",{class:"arrow left",onClick:()=>this.previousPageClickedHandler(),disabled:this.previousCursors.length<=0},e("chevron-icon",null)),e("button",{class:"arrow right",onClick:()=>this.nextPageClickedHandler(),disabled:this.disableNextPageButton},e("chevron-icon",null)))),this.state==="error"&&e("div",{class:"error-container"},e("p",{class:"error"},this.error)),!!this.deleteConfigurationId&&e("div",{class:"card-wrapper"},e("div",{class:"card-modal"},e("div",{class:"close-button"},e("button-component",{tooltip:"Close",id:"close",variant:"invisible",onClick:t=>this.closeModal(t),part:"nfbf__close-button"},e("close-icon",null))),e("div",{class:"header"},e("h2",{slot:"card-title",part:"nfbf__title"},d.t("deleteSchedulingPageTitle"))),e("div",{class:"description title-desc"},e("p",null,d.t("deleteSchedulingPageDescription"))),e("div",{class:{footer:true}},e("button-component",{variant:"basic",onClick:t=>this.closeModal(t),part:"nfbf__button-outline nfbf__cancel-cta"},`${d.t("deleteSchedulingPageCancelButton")}`),e("button-component",{variant:"destructive",onClick:t=>this.handleConfirmDeleteButtonClicked(t),disabled:this.showDeleteButtonLoading,isLoading:this.showDeleteButtonLoading,part:"nfbf__button-outline nfbf__reschedule-cta"},`${d.t("deleteSchedulingPageConfirmButton")}`)))))}get host(){return s(this)}static get watchers(){return{listConfigurationsNextCursor:["listConfigurationsNextCursorChangedHandler"]}}};F([o({name:"nylas-list-configurations",stateToProps:new Map([["schedulerConfig.configurations","configurations"],["schedulerConfig.listConfigurationsNextCursor","listConfigurationsNextCursor"]]),localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"]]),eventToProps:{initListConfigurations:async(t,e)=>{const{host:n,cursor:a}=t.detail;await n.setState("loading");const[i,s]=await e.schedulerConfig.getConfigurations(a);if(!i&&s&&s.message){await n.setState("error");await n.setError(s.message);return}await n.setState("loaded")},createButtonClick:async(t,e)=>{e.schedulerConfigStore.resetSelectedConfiguration();e.schedulerConfigStore.state.action="create"},deleteButtonClick:async(t,e)=>{const{host:n,configuration:a}=t.detail;const[i,s]=await e.schedulerConfig.deleteConfiguration(a.id);if(!i&&s&&s.message){await n.setState("error");await n.setError(s.message)}await n.hideDeleteConfirmation()},editButtonClick:async(t,e)=>{const{configuration:n}=t.detail;e.schedulerConfigStore.state.selectedConfiguration=n;e.schedulerConfigStore.state.action="edit"}},fireRegisterEvent:true}),O("design:type",Function),O("design:paramtypes",[]),O("design:returntype",void 0)],N.prototype,"render",null);N.style=B;export{_ as google_logo_icon,x as microsoft_logo_icon,P as nylas_editor_tabs,N as nylas_list_configurations};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,h as e,F as n,c as a,H as i,a as s}from"./p-68c2fadf.js";import{R as o}from"./p-004f10b4.js";import{a as r,m as l,k as c,i as d}from"./p-05f97bb8.js";import{D as b}from"./p-f0271a79.js";import{i as p,a as h,c as f,b as u,f as y}from"./p-67577312.js";const m=".sc-google-logo-icon-h{display:flex}";const g=m;const _=class{constructor(e){t(this,e);this.width="24";this.height="24"}render(){return e("svg",{key:"a92099ec8ac0962d66c891c164e335ef3d047d22",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("g",{key:"67f404193a491c7599cb0ff6eb2eba5322d05e12","clip-path":"url(#clip0_959_12452)"},e("path",{key:"3c61ed99570e6093cad10d510093e172828eff40",d:"M23.745 12.27C23.745 11.48 23.675 10.73 23.555 10H12.255V14.51H18.725C18.435 15.99 17.585 17.24 16.325 18.09V21.09H20.185C22.445 19 23.745 15.92 23.745 12.27Z",fill:"#4285F4"}),e("path",{key:"c02254455f486c14330e39e76240c1cf4f4597a4",d:"M12.255 24C15.495 24 18.205 22.92 20.185 21.09L16.325 18.09C15.245 18.81 13.875 19.25 12.255 19.25C9.12504 19.25 6.47505 17.14 5.52505 14.29H1.54504V17.38C3.51504 21.3 7.56504 24 12.255 24Z",fill:"#34A853"}),e("path",{key:"8db3f9f9c1587778afe57689afc1a72db582d5ec",d:"M5.52501 14.2901C5.27501 13.5701 5.145 12.8001 5.145 12.0001C5.145 11.2001 5.28501 10.4301 5.52501 9.71012V6.62012H1.545C0.725004 8.24012 0.255005 10.0601 0.255005 12.0001C0.255005 13.9401 0.725004 15.7601 1.545 17.3801L5.52501 14.2901Z",fill:"#FBBC05"}),e("path",{key:"45b05683bc9c6bf46c6aef5858604016460df3e2",d:"M12.255 4.75C14.025 4.75 15.605 5.36 16.855 6.55L20.275 3.13C18.205 1.19 15.495 0 12.255 0C7.56504 0 3.51504 2.7 1.54504 6.62L5.52505 9.71C6.47505 6.86 9.12504 4.75 12.255 4.75Z",fill:"#EA4335"})),e("defs",{key:"4c047174ca3453f959e5e81b31e79abae98a1e09"},e("clipPath",{key:"0e8a1d30c69e4ff0d43a99342b111a0ced46b894",id:"clip0_959_12452"},e("rect",{key:"e653c135430f8fd0e33dea31c2d26a75ac6301a0",width:24,height:24,fill:"white"}))))}};_.style=g;const v=".sc-microsoft-logo-icon-h{display:flex}";const w=v;const x=class{constructor(e){t(this,e);this.width="22";this.height="22"}render(){return e("svg",{key:"0426f3e50fb256a3a5f5c2c221da187daddf01ab",width:this.width,height:this.height,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{key:"7613831c4bd6ec132acc5e89859acdfd6035f0c1",d:"M0.043457 0.043457H10.4782V10.4782H0.043457V0.043457Z",fill:"#F35325"}),e("path",{key:"db04c966af57fe29013c799d7a38192d121beb44",d:"M11.5217 0.043457H21.9565V10.4782H11.5217V0.043457Z",fill:"#81BC06"}),e("path",{key:"fe59fe563aede56518af70627d0ece3b83ded0fc",d:"M0.043457 11.5217H10.4782V21.9565H0.043457V11.5217Z",fill:"#05A6F0"}),e("path",{key:"07e3f81f79863f2e87827b163a2e9a9f9804cbf0",d:"M11.5217 11.5217H21.9565V21.9565H11.5217V11.5217Z",fill:"#FFBA08"}))}};x.style=w;var k;(function(t){t["EventInfo"]="eventInfo";t["Availability"]="availability";t["BookingOptions"]="bookingOptions";t["Communications"]="communications";t["Participants"]="participants";t["BookingForm"]="bookingForm";t["PageStyles"]="pageStyles"})(k||(k={}));function C({id:t,formState:a,activeTab:i},s){return e(n,null,e("div",{key:`event-info-${t}`,class:{hide:i!==k.EventInfo}},e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",{name:"title",exportparts:"net, net__title, net__dropdown-content"}),e("nylas-event-duration",{name:"duration",exportparts:"ned, ned__dropdown, ned__dropdown-button, ned__dropdown-content, ned__input_dropdown, ned__input_dropdown-input, ned__input_dropdown-content"}),e("nylas-event-location",{name:"location",exportparts:"nel, nel__location, nel__dropdown, nel__dropdown-button, nel__dropdown-content"}),e("nylas-event-description",{name:"description",exportparts:"nedesc, nedesc__textarea"})))),e("div",{key:`availability-${t}`,class:{hide:i!==k.Availability}},e("nylas-participant-booking-calendars",{participants:a.participants,name:"participant-booking-calendars",exportparts:"npbc, npbc__header, npbc__content, npbc__participant-container, npbc__participant-title"}),e("nylas-connected-calendars",{participants:a.participants,name:"connected-calendars",exportparts:"nccals, nccals__header, nccals__content, nccals__container, nccals__title, nccals__toggle-container, npbc__participant-toggle-container"}),e("nylas-availability-picker",{name:"availability",exportparts:"nap, nap__header, nap__select-timezone, nap__select-timezone-button, nap__select-timezone-dropdown-content, nap__availability, nap__day, nap__time-ranges, nap__time-range, nap__add-time-range, nap__time-picker-container, nap__time-picker-input, nap__time-picker-times"})),e("div",{key:`booking-options-${t}`,class:{hide:i!==k.BookingOptions}},e("nylas-scheduling-method",{name:"availability-method",readOnly:true,exportparts:"nsm, nsm__header, nsm__input-label, nsm__dropdown, nsm__dropdown-button, nsm__dropdown-content"}),e("nylas-custom-booking-flow",{exportparts:"ncbflow, ncbflow__header, ncbflow__title, ncbflow__content"},e("div",{slot:"inputs"},e("nylas-booking-confirmation-type",{name:"confirmation-type",exportparts:"nbct, nbct__header, nbct__dropdown, nbct__dropdown-button, nbct__dropdown-content"}),e("nylas-booking-confirmation-redirect",{name:"confirmation-redirect",exportparts:"nbcr, nbcr__header, nbcr__dropdown, nbcr__dropdown-button, nbcr__dropdown-content, nbcr__input-textfield"}))),e("nylas-buffer-time",{name:"buffer-time",exportparts:"nbt, nbt__header, nbt__body, nbt__dropdown-before, nbt__dropdown-button-before, nbt__dropdown-content-before, nbt__dropdown-after, nbt__dropdown-button-after, nbt__dropdown-content-after, nbt__preview"}),e("nylas-event-limits",null,e("div",{slot:"inputs"},e("nylas-min-booking-notice",{name:"min-booking-notice",exportparts:"nmbn, nmbn__number-dropdown, nmbn__number-dropdown-button, nmbn__number-dropdown-content, nmbn__period-dropdown, nmbn__period-dropdown-button, nmbn__period-dropdown-content"}),e("nylas-limit-future-bookings",{name:"limit-future-bookings",exportparts:"nlfb, nlfb__number-dropdown, nlfb__number-dropdown-button, nlfb__number-dropdown-content, nlfb__period-dropdown, nlfb__period-dropdown-button, nlfb__period-dropdown-content"}),e("nylas-min-cancellation-notice",{name:"min-cancellation-notice",exportparts:"nmcn, nmcn__number-dropdown, nmcn__number-dropdown-button, nmcn__number-dropdown-content, nmcn__period-dropdown, nmcn__period-dropdown-button, nmcn__period-dropdown-content"}),e("nylas-cancellation-policy",{name:"cancellation-policy",exportparts:"ncpolicy, ncpolicy__textarea"}))),e("nylas-timeslot-interval",{name:"timeslot-interval",exportparts:"nti, nti__header, nti__input-label, nti__dropdown, nti__dropdown-button, nti__dropdown-content"}),e("nylas-customize-booking-settings",{name:"customize-booking-settings",exportparts:"ncbs, ncbs__header, ncbs__settings, ncbs__settings-div, ncbs__additional_guests, ncbs__cancellation_options, ncbs__rescheduling_options"})),e("div",{key:`communications-${t}`,class:{hide:i!==k.Communications}},e("div",{class:"tab-header"},e("h3",null,"Event communications"),e("p",null,"Set up automatic confirmation emails.")),e("nylas-confirmation-email",{name:"confirmation-email-template",exportparts:"nce, nce__tab-heading, nce__header, nce__body, nce__confirmation-email-toggle--container, nce__summary, nce__reminder-input_dropdown, nce__reminder-input_dropdown-input, nce__reminder-input_dropdown-content"}),e("nylas-reminder-emails",{name:"reminder-emails",exportparts:"nre, nre__tab-heading, nre__header, nre__body, nre__confirmation-email-toggle--container, nre__summary, nre__reminder-input_dropdown, nre__reminder-input_dropdown-input, nre__reminder-input_dropdown-content"})),e("div",{key:`participants-${t}`,class:{hide:i!==k.Participants}},e("nylas-additional-participants",{name:"participants",exportparts:"nap, nap__title, nap__subtitle, nap__content, nap__input_group, nap__input_wrapper, nap__input, nap__remove-participant"}),e("nylas-participants-custom-availability",{participants:a.participants,name:"participant-custom-availability",exportparts:"npca, npca__header, npca__content, npca__participant-container, npca__participant-title, npca__participant-toggle--container, npca__toggle-label, npca__toggle-input, npca__toggle-slider"})),e("div",{key:`page-styles-${t}`,class:{hide:i!==k.PageStyles}},e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}),e("nylas-page-name",{name:"page-name",exportparts:"npn, npn__body, npn__header, npn__drawer-toggle--container, npn__input-textfield"}),e("nylas-page-styling",{name:"page-styling",exportparts:"nps, nps__header, nps__drawer-toggle--container, nps__body, nps__title-input-textfield, nps__company-logo-input-textfield, nps__color-picker, nps__color-picker-button, nps__color-picker-button-label, nps__color-picker-selected-label, nps__submit-button-label-input-textfield, nps__message-textarea"},s)),e("div",{key:`booking-form-${t}`,class:{hide:i!==k.BookingForm}},e("nylas-booking-form-config",{name:"additional-fields",exportparts:"nbfc, nbfc__header, nbfc__add_field, nbfc__add_field-button, nbfc__add_field-content, nbfc__additional_fields, nbfc__form-field, nbfc__form-field-header, nbfc__form-field-content"})))}const S='.sc-nylas-editor-tabs-h{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.scheduler-editor.sc-nylas-editor-tabs{display:flex;flex-direction:column;height:inherit}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs{height:calc(100% - 80px);display:grid;grid-template-columns:minmax(224px, 25%) 1fr}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs{display:table-column-group;height:auto}}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs{display:flex;flex-direction:column;border-right:1px solid var(--nylas-base-200);background-color:var(--nylas-base-25)}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs{border-right:none}}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs{display:flex;align-items:center;gap:0.5rem;padding:0.5rem 1rem;color:var(--nylas-base-900);background:var(--nylas-base-0);border:none;height:56px;font-family:var(--nylas-font-family);font-size:16px;font-weight:500;line-height:24px;cursor:pointer}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs:not(:first-of-type){margin-top:0.25rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs:last-of-type{margin-bottom:0.25rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.active.sc-nylas-editor-tabs{font-weight:600;background:var(--nylas-base-0);color:var(--nylas-primary);border-left:4px solid var(--nylas-primary);box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.0588235294);box-shadow:0px 1px 3px 0px rgba(0, 0, 0, 0.1019607843)}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.hide.sc-nylas-editor-tabs{display:none}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs{max-width:692px;overflow-y:auto;overflow-x:hidden}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .hide.sc-nylas-editor-tabs{display:none}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-info.sc-nylas-editor-tabs,.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-limits.sc-nylas-editor-tabs{width:inherit}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-info.sc-nylas-editor-tabs div[slot=inputs].sc-nylas-editor-tabs,.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-limits.sc-nylas-editor-tabs div[slot=inputs].sc-nylas-editor-tabs{display:flex;flex-direction:column;gap:1rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs{display:flex;flex-direction:column;margin:1rem 1rem 0.5rem;row-gap:4px}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs h3.sc-nylas-editor-tabs{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs p.sc-nylas-editor-tabs{margin:0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.footer.sc-nylas-editor-tabs{display:flex;justify-content:space-between;align-items:center;gap:1rem;min-height:80px;padding:0 1rem;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs{flex-direction:column;height:auto}}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .preview.sc-nylas-editor-tabs{margin-top:1rem;width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs{display:flex;justify-content:flex-end;align-items:center;justify-self:flex-end;gap:1rem}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs{flex-direction:column-reverse;width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.sc-nylas-editor-tabs{max-width:524px}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.unsaved-changes.sc-nylas-editor-tabs{color:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.saved-changes.sc-nylas-editor-tabs{color:var(--nylas-success)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.error.sc-nylas-editor-tabs{color:var(--nylas-error)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.error-full-width.sc-nylas-editor-tabs{max-width:660px}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button-component.sc-nylas-editor-tabs{width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs{background:var(--nylas-primary);color:var(--nylas-base-0);height:48px;border:none;border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;cursor:pointer;width:148px}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:hover{background:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:active{background:var(--nylas-base-800)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:disabled{background:var(--nylas-base-300);cursor:not-allowed}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs span.sc-nylas-editor-tabs{display:flex;align-items:center;justify-content:center;gap:0.5rem}button-component#report-issue.sc-nylas-editor-tabs{width:auto}nylas-feedback-form.sc-nylas-editor-tabs{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 H=S;var z=undefined&&undefined.__decorate||function(t,e,n,a){var i=arguments.length,s=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(t,e,n,a);else for(var r=t.length-1;r>=0;r--)if(o=t[r])s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s;return i>3&&s&&Object.defineProperty(e,n,s),s};var j=undefined&&undefined.__metadata||function(t,e){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(t,e)};const P=class{constructor(e){t(this,e);this.schedulerConfigChanged=a(this,"schedulerConfigChanged",7);this.cancelButtonClick=a(this,"cancelButtonClick",7);this.formSubmitted=a(this,"formSubmitted",7);this.previewButtonClicked=a(this,"previewButtonClicked",7);this.schedulerEditorFormUpdated=a(this,"schedulerEditorFormUpdated",7);this.setError=t=>{this.error=t.message};this.formSubmissionHandler=async t=>{t.preventDefault();const e=await this.formSubmitted.emit();r("[nylas-editor-tabs]","formSubmissionHandler",e);const n=this.formRef.checkValidity();if(!n||e.defaultPrevented){this.error=this.formRef.validationMessage||"Please fix the form errors.";return}this.isLoading=true;this.hasUnsavedChanges=false;const a=this.updateFormState();r("[nylas-editor-tabs]","formState",a);const{title:i,description:s,duration:o,availability:c,bookingCalendar:d,location:p,bookingType:h,buffer:f,availableDaysInFuture:u,minCancellationNotice:y,minBookingNotice:m,cancellationPolicy:g,timeslotInterval:_,additionalGuestsHidden:v,hideCancellationOptions:w,hideReschedulingOptions:x,participants:k,participantOpenHours:C,additionalFields:S,participantCalendars:H,conferencing:z,participantBookingCalendars:j,reminders:P,emailTemplate:L,redirectUrl:B,availabilityMethod:F,slug:O,appearance:N,name:T}=a;const $=this.selectedConfiguration?.participants?.find((t=>t.is_organizer))||k?.find((t=>t.is_organizer));const I=H&&$?.email?H[$?.email]:[];const M=$?.booking?.calendar_id||d;const R=o?parseInt(o):30;const E=k&&k?.length>0?k:[{name:$?.name??this.currentUser?.name??"",email:$?.email??this.currentUser?.email??"",is_organizer:true,timezone:c?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,availability:{calendar_ids:d&&d!==""?[d]:["primary"],open_hours:[]},booking:{calendar_id:d&&d!==""?d:"primary"}}];const D={...this.selectedConfiguration?.id&&{id:this.selectedConfiguration.id},version:this.selectedConfiguration?.version??"1.0.0",slug:O,name:T,availability:{duration_minutes:R,interval_minutes:_?.interval??R,round_to:_?.roundTo,availability_rules:{availability_method:F?F:this.selectedConfiguration?.availability?.availability_rules?.availability_method??"collective",buffer:f||{before:0,after:0},default_open_hours:c?.openHours??this.selectedConfiguration?.availability?.availability_rules?.default_open_hours??b,round_robin_group_id:this.selectedConfiguration?.availability?.availability_rules?.round_robin_group_id??""}},participants:[...E?E.map((t=>{let e=c?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone;if(C?.[t.email]?.length){e=C?.[t.email]?.[0]?.timezone}if(t.is_organizer){const n=j?.[t.email]?j?.[t.email]:M?M:"primary";const a=H?.[t.email]?H?.[t.email]:I?.length?I:["primary"];const i=a.length===1&&a[0]==="primary";return{name:t.name??"",email:t.email,is_organizer:true,timezone:e,availability:{calendar_ids:i?[n]:a,open_hours:C?.[t.email]??t.availability?.open_hours??[]},booking:{calendar_id:n}}}const n=j?.[t.email]?{calendar_id:j?.[t.email]}:t?.booking??undefined;const a=H?.[t.email]??t.availability?.calendar_ids??["primary"];const i=a.length===1&&a[0]==="primary";return{...t,timezone:e,availability:t.availability?{calendar_ids:i&&typeof n!=="undefined"?[n?.calendar_id]:a,open_hours:C?.[t.email]??t.availability?.open_hours??[]}:undefined,booking:n}})):[]],event_booking:{title:i?.toString()??"",description:s?.toString()??"",location:p?.toString()??"",booking_type:h?.toString()??"booking",timezone:c?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,conferencing:z,reminders:P},scheduler:{cancellation_policy:g??"",available_days_in_future:u??30,min_cancellation_notice:y??0,min_booking_notice:m??60,hide_additional_guests:v??false,hide_cancellation_options:w??false,hide_rescheduling_options:x??false,additional_fields:S,email_template:L,confirmation_redirect_url:B},appearance:N};const V=l(this.selectedConfiguration,D||{});const J=this.action==="create"?V:D;if(this.isConfigRoundRobin(J)){J.participants=J.participants.map((t=>({...t,is_organizer:undefined})))}const U=t=>{this.isLoading=false;this.changesSaved=true;setTimeout((()=>{this.changesSaved=false}),5e3)};const A=this.checkForBookingFormErrors(J);const Z=this.configurations?.find((t=>t.id===this.selectedConfiguration?.id))||{};const W=this.checkForOrganizerConfirmationError(l(J,Z));if(A||W){return}this.schedulerConfigChanged.emit({config:J,resetLoadingState:U,setError:this.setError,action:this.action})};this.isConfigRoundRobin=t=>t?.availability?.availability_rules?.availability_method==="max-availability"||t.availability?.availability_rules?.availability_method==="max-fairness";this.checkForOrganizerConfirmationError=t=>{let e=false;let n="";const a=t.event_booking?.booking_type==="organizer-confirmation";const i=t.scheduler?.organizer_confirmation_url;if(a&&!i){n+="Organizer confirmation URL is required when using organizer confirmation booking type.";e=true}if(e){this.isLoading=false;this.setError(new Error(n))}return e};this.checkForBookingFormErrors=t=>{let e=false;let n="";const a=t.scheduler?.additional_fields;if(a){n="Booking form error: ";Object.entries(a).forEach((t=>{const a=t[1];if(a.label===""){n+=`Label is required for field of type ${a.type}.`;e=true;return}if(a.options){for(const t of a.options){if(t===""){n+=`Empty option detected inside ${a.label} of type ${a.type}.`;e=true;break}}}}))}if(e){this.isLoading=false;this.setError(new Error(n))}return e};this.calendars=undefined;this.selectedConfiguration=undefined;this.configurations=undefined;this.currentUser=undefined;this.schedulerPreviewLink="";this.mode="app";this.hideEditorTabs=[];this.enableUserFeedback=true;this.action="create";this.showFeedbackModal=false;this.activeTab=k.EventInfo;this.isLoading=false;this.hasUnsavedChanges=false;this.changesSaved=false;this.formState={};this.error=""}configChangedHandler(t){r("[nylas-editor-tabs]","configChangedHandler",t,this.selectedConfiguration);this.formState={...this.getFormStateFromConfig(t)};if(t?.id){this.action="edit"}else{this.action="create"}}userChangedHandler(t){r("[nylas-editor-tabs]","userChangedHandler",t);if(t){this.formState={...this.getFormStateFromConfig(this.selectedConfiguration)}}}connectedCallback(){r("[nylas-editor-tabs]","connectedCallback")}componentWillLoad(){r("[nylas-editor-tabs]","componentWillLoad");this.formState=this.getFormStateFromConfig(this.selectedConfiguration)}componentDidLoad(){r("[nylas-editor-tabs]","componentDidLoad");if(this.enableUserFeedback&&!p()){h({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.3.3",integrations:t=>[...t.filter((t=>false)),y({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}if(this.selectedConfiguration?.id){this.configChangedHandler(this.selectedConfiguration)}const t=this.host.querySelector("button.tab:not(.hide)")?.name;if(t){this.activeTab=t}}disconnectedCallback(){r("[nylas-editor-tabs]","disconnectedCallback")}handleValueChanged(t){r("[nylas-editor-tabs]","handleValueChanged",t);const{name:e,value:n}=t.detail;this.setFormState(n,e);this.formState={...this.formState};this.hasUnsavedChanges=true;this.error="";this.schedulerEditorFormUpdated.emit({value:t.detail.value,name:t.detail.name})}feedbackModalClosedHandler(){this.showFeedbackModal=false}feedbackSubmittedHandler(t){const e=f("Scheduler Editor User Feedback");const n={eventId:e,message:t.detail.feedback};u(n,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduler-editor","nylas-web-element-version":"1.3.3"},extra:{configId:this.selectedConfiguration?.id,slug:this.selectedConfiguration?.slug}}});this.showFeedbackModal=false}getFormStateFromConfig(t){let e=t?.participants?.find((t=>t.is_organizer));if(!e&&t?.availability?.availability_rules?.availability_method!=="collective"){e=t?.participants?.find((t=>t.email===this.currentUser?.email));if(e){e.is_organizer=true}}if(t?.appearance){console.info("Appearance settings have been returned from the given configuration; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}return{title:t?.event_booking?.title??"",description:t?.event_booking?.description??"",duration:t?.availability?.duration_minutes?.toString()??"30",availability:{timezone:t?.event_booking?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,openHours:t?.availability?.availability_rules?.default_open_hours??b},additionalFields:t?.scheduler?.additional_fields??{},conferencing:t?.event_booking?.conferencing??{},calendarIds:e?.availability?.calendar_ids??[],participants:t?.participants??[],bookingCalendar:e?.booking?.calendar_id??e?.email??"",location:t?.event_booking?.location??"",bookingType:t?.event_booking?.booking_type??"booking",buffer:t?.availability?.availability_rules?.buffer??{before:0,after:0},cancellationPolicy:t?.scheduler?.cancellation_policy??"",availableDaysInFuture:t?.scheduler?.available_days_in_future??30,minCancellationNotice:t?.scheduler?.min_cancellation_notice??0,minBookingNotice:t?.scheduler?.min_booking_notice??60,timeslotInterval:{interval:t?.availability?.interval_minutes??t?.availability?.duration_minutes,roundTo:t?.availability?.round_to},additionalGuestsHidden:t?.scheduler?.hide_additional_guests??false,hideCancellationOptions:t?.scheduler?.hide_cancellation_options??false,hideReschedulingOptions:t?.scheduler?.hide_rescheduling_options??false,participantBookingCalendars:t?.participants?.reduce(((t,e)=>{if(e.booking?.calendar_id){t[e.email]=e.booking?.calendar_id}return t}))??{},participantCalendars:t?.participants?.reduce(((t,e)=>{t[e.email]=e.availability?.calendar_ids;return t}),{})??{},reminders:t?.event_booking?.reminders,emailTemplate:t?.scheduler?.email_template,redirectUrl:t?.scheduler?.confirmation_redirect_url,slug:t?.slug,appearance:t?.appearance,name:t?.name}}setFormState(t,e){switch(e){case"title":this.formState.title=t.toString();break;case"description":this.formState.description=t.toString();break;case"duration":this.formState.duration=t.toString();break;case"availability":this.formState.availability=JSON.parse(t.toString());break;case"participants":this.formState.participants=JSON.parse(t.toString());break;case"booking-calendar":this.formState.bookingCalendar=t.toString();break;case"participant-booking-calendars":this.formState.participantBookingCalendars=JSON.parse(t.toString());break;case"location":this.formState.location=t.toString();break;case"conference":this.formState.conferencing=JSON.parse(t.toString());break;case"confirmation-type":this.formState.bookingType=t.toString();break;case"buffer-time":this.formState.buffer=JSON.parse(t.toString());break;case"limit-future-bookings":this.formState.availableDaysInFuture=parseInt(t.toString());break;case"min-cancellation-notice":this.formState.minCancellationNotice=parseInt(t.toString());break;case"min-booking-notice":this.formState.minBookingNotice=parseInt(t.toString());break;case"cancellation-policy":this.formState.cancellationPolicy=t.toString();break;case"timeslot-interval":this.formState.timeslotInterval=JSON.parse(t.toString());break;case"customize-booking-settings":{const e=JSON.parse(t.toString());this.formState.additionalGuestsHidden=e.additionalGuestsHidden;this.formState.hideCancellationOptions=e.hideCancellationOptions;this.formState.hideReschedulingOptions=e.hideReschedulingOptions;break}case"participant-custom-availability":{const e=JSON.parse(t.toString());this.formState.participantOpenHours=e;break}case"additional-fields":this.formState.additionalFields=t;break;case"connected-calendars":this.formState.participantCalendars=JSON.parse(t.toString());break;case"confirmation-email-template":this.formState.emailTemplate=JSON.parse(t.toString());break;case"reminder-overrides":this.formState.reminders=JSON.parse(t.toString());break;case"confirmation-redirect":this.formState.redirectUrl=t.toString();break;case"availability-method":this.formState.availabilityMethod=t.toString();break;case"custom-event-slug":console.debug("custom-event-slug",t);this.formState.slug=JSON.parse(t.toString());break;case"page-styling":this.formState.appearance=JSON.parse(t.toString());break;case"page-name":this.formState.name=JSON.parse(t.toString());break}this.schedulerEditorFormUpdated.emit({value:t,name:e})}updateFormState(){const t=new FormData(this.formRef);t.forEach(((t,e)=>{this.setFormState(t,e)}));this.formState={...this.formState};return this.formState}setActiveTab(t,e){t.preventDefault();this.updateFormState();this.activeTab=e}hideTab(t){return this.hideEditorTabs?.includes(t)||false}onFeedbackClick(t){t.preventDefault();this.showFeedbackModal=true}render(){r("[nylas-editor-tabs]","render",this.formState);return e(i,{key:"877744ce17be949dd3a0677154d39f23d3a0e4c6"},e("form",{key:"b8c8ea5167dd9463a41167541ed70fbf746ce0dc",onSubmit:this.formSubmissionHandler,class:"scheduler-editor",ref:t=>this.formRef=t,noValidate:true},this.mode==="app"?e("div",{class:"form-contents",part:"editor__form-contents net__form-contents"},e("div",{class:"tabs",part:"editor__tabs net__tabs"},e("button",{name:k.EventInfo,class:{tab:true,active:this.activeTab==k.EventInfo,hide:this.hideTab(k.EventInfo)},part:"editortab__event-info net__tab-event-info",onClick:t=>this.setActiveTab(t,k.EventInfo)},e("calendar-info-icon",{width:"16",height:"16"}),"Event info"),e("button",{name:k.Availability,class:{tab:true,active:this.activeTab==k.Availability,hide:this.hideTab(k.Availability)},part:"editortab__availability net__tab-availability",onClick:t=>this.setActiveTab(t,k.Availability)},e("calendar-patterns-icon",{width:"16",height:"16"}),"Availability"),e("button",{name:k.Participants,class:{tab:true,active:this.activeTab==k.Participants,hide:this.hideTab(k.Participants)},part:"editortab__participants net__tab-participants",onClick:t=>this.setActiveTab(t,k.Participants)},e("people-icon",{width:"16",height:"16"}),"Participants"),e("button",{name:k.BookingOptions,class:{tab:true,active:this.activeTab==k.BookingOptions,hide:this.hideTab(k.BookingOptions)},part:"editortab__booking-options net__tab-booking-options",onClick:t=>this.setActiveTab(t,k.BookingOptions)},e("flow-icon",{width:"16",height:"16"}),"Booking options"),e("button",{name:k.BookingForm,class:{tab:true,active:this.activeTab=="bookingForm",hide:this.hideTab(k.BookingForm)},part:"editortab__booking-form net__tab-booking-form",onClick:t=>this.setActiveTab(t,k.BookingForm)},this.activeTab==k.BookingForm?e("calendar-agenda-fill-icon",{width:"16",height:"16"}):e("calendar-agenda-icon",{width:"16",height:"16"}),"Booking form"),e("button",{name:k.Communications,class:{tab:true,active:this.activeTab=="communications",hide:this.hideTab(k.Communications)},onClick:t=>this.setActiveTab(t,k.Communications),part:"editortab__communications net__tab-communications"},this.activeTab==k.Communications?e("envelope-fill-icon",{width:"16",height:"16"}):e("envelope-icon",{width:"16",height:"16"}),"Communications"),e("button",{name:k.PageStyles,class:{tab:true,active:this.activeTab=="pageStyles",hide:this.hideTab(k.PageStyles)},onClick:t=>this.setActiveTab(t,k.PageStyles),part:"editortab__page-styles net__tab-page-styles"},this.activeTab==k.PageStyles?e("paintbrush-fill-icon",{width:"16",height:"16"}):e("paintbrush-icon",{width:"16",height:"16"}),"Page styles")),e("div",{class:"tab-content",part:"editor__tab-content net__tab-content"},e(C,{formState:this.formState,activeTab:this.activeTab,currentUser:this.currentUser,calendars:this.calendars,id:this.selectedConfiguration?.id??"new"}))):e("div",{class:"composable",key:this.selectedConfiguration?.id},e("slot",null)),e("div",{key:"d0f4111a5e94a3e8ce82024b6bab5ff3a1fa486b",class:"footer",part:"editor__footer net__footer"},e("div",{key:"c0fdc3ba4470c56ffd339d826e4d871c1ccf9d80",class:"preview",part:"editor__footer-preview net__footer-preview"},this.enableUserFeedback&&e("button-component",{title:"Share your feedback",id:"report-issue",variant:"basic",onClick:t=>this.onFeedbackClick(t)},e("feedback-icon",null))),e("div",{key:"8215bc5a0ed81aca0a472c390b3ac8165380fe79",class:"buttons",part:"editor__footer-buttons net__footer-buttons"},e("p",{key:"80b5f296a70adbaae379f428118c730dd174d23b",class:{"unsaved-changes":this.hasUnsavedChanges&&!this.changesSaved,"saved-changes":this.changesSaved,error:this.error!=="","error-full-width":this.error!==""&&this.action==="create"}},this.error!==""?this.error:"",this.error==""&&this.hasUnsavedChanges&&!this.changesSaved?"Unsaved changes":this.error==""&&this.changesSaved?"Changes saved!":""),this.schedulerPreviewLink!==""&&this.action==="edit"&&e("button-component",{title:"Preview",type:"button",disabled:this.isLoading,clickHandler:t=>{t.preventDefault();const e=this.previewButtonClicked.emit(this.host);if(!e.defaultPrevented){window.open(c(this.schedulerPreviewLink,this.selectedConfiguration),"_blank")}},variant:"basic"},e("eye-icon",null)),e("button-component",{key:"d2983166679d914328f8fff635cff2cf2f18b776",type:"button",disabled:this.isLoading,clickHandler:t=>{t.preventDefault();this.cancelButtonClick.emit();this.error=""},variant:"basic",part:"editor__footer-cancel net__footer-cancel"},"Back"),e("button-component",{key:"6c9276bdd579c468544d8b9a1d558e216605f3c4",type:"submit",disabled:this.isLoading,part:"editor__footer-cta net__footer-cta"},this.isLoading?e("span",null,"Saving",e("loading-icon",null)," "):this.action==="create"?"Create":"Save changes")))),this.showFeedbackModal&&e("nylas-feedback-form",null))}get host(){return s(this)}static get watchers(){return{selectedConfiguration:["configChangedHandler"],currentUser:["userChangedHandler"]}}};z([o({name:"nylas-editor-tabs",stateToProps:new Map([["schedulerConfig.calendars","calendars"],["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.currentUser","currentUser"],["schedulerConfig.configurations","configurations"]]),eventToProps:{schedulerConfigChanged:async(t,e)=>{const{resetLoadingState:n,setError:a,action:i,config:s}=t.detail;const o=e=>{const[i,s]=e;if(!i&&s&&a){a(s)}if(n){n(t)}};if(i==="edit"){const t=await e.schedulerConfig.updateConfiguration(s);o(t)}else{const t=await e.schedulerConfig.createConfiguration(s);o(t)}},cancelButtonClick:async(t,e)=>{e.schedulerConfigStore.state.action=null},previewButtonClicked:async(t,e)=>{r("[nylas-editor-tabs]","previewButtonClicked",e)},formSubmitted:async(t,e)=>{r("[nylas-editor-tabs]","formSubmitted",e)},schedulerEditorFormUpdated:async(t,e)=>{r("[nylas-editor-tabs]","schedulerEditorFormUpdated",t)}},localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"],["enableUserFeedback","enableUserFeedback"],["hideEditorTabs","hideEditorTabs"]]),fireRegisterEvent:true}),j("design:type",Function),j("design:paramtypes",[]),j("design:returntype",void 0)],P.prototype,"render",null);P.style=H;const L=':host{display:grid;grid-auto-flow:row;width:100%;font-family:inherit;font-optical-sizing:auto;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;gap:1rem}@media screen and (max-width: 768px){.header{flex-direction:column;gap:0.5rem;align-items:unset}}.header h2{margin:0;font-size:1.25rem;color:var(--nylas-base-900);font-weight:600}.header p{margin:0;font-size:1rem;color:var(--nylas-base-700)}.header .actions{justify-self:end}@media screen and (max-width: 768px){.header .actions{width:100%}}.configurations{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);background:var(--nylas-base-0);height:100%;display:flex;flex-direction:column;position:relative;overflow-y:hidden}.configurations .table-container{overflow-y:auto;flex:1}.configurations .table-container table{width:100%;border-spacing:0;border-collapse:collapse;font-family:inherit;height:max-content}.configurations .table-container table.no-configurations{height:100%}.configurations .table-container table tr{color:var(--nylas-base-800);border-bottom:1px solid var(--nylas-base-200);font-family:inherit}.configurations .table-container table tr.hide{display:none}.configurations .table-container table th{font-weight:600;text-transform:uppercase;font-size:14px;line-height:20px}.configurations .table-container table tr.no-configurations td>div{display:flex;height:100%;justify-content:center;align-items:center;flex-direction:column;padding:var(--nylas-border-radius-3x)}.configurations .table-container table tr.no-configurations td>div h3{margin:0 0 1rem 0;color:var(--nylas-base-700)}.configurations .table-container table tr.no-configurations td>div p{margin:0 0 1rem 0;color:var(--nylas-base-600)}.configurations .table-container table tr.no-configurations td>div calendar-icon{margin-bottom:1rem;color:var(--nylas-base-200)}.configurations .table-container table th,.configurations .table-container table td{text-align:left;padding:1rem;font-family:inherit}.configurations .table-container table .actions{text-align:right}.configurations .table-container table .actions{display:flex;justify-content:flex-end;gap:1rem}@media screen and (max-width: 768px){.configurations .table-container table .actions{flex-direction:column;gap:0.5rem}}.configurations .table-container table .title{width:100%;max-width:300px}@media screen and (max-width: 768px){.configurations .table-container table .title{max-width:96px}}.configurations .table-container table .title div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.configurations .table-container table .title div.config-event-title{font-weight:600}.configurations .table-container table .title div.config-event-description{font-size:0.75rem}.configurations .pagination{padding:1rem;position:sticky;top:100%;display:flex;justify-content:flex-end;gap:0.5rem;background:white;width:calc(100% - 2rem);z-index:2}.configurations .pagination td.arrows{display:flex;justify-content:flex-end;gap:0.5rem}.configurations .pagination button{display:flex;flex-direction:row;justify-content:center;align-items:center;height:3vh;width:3vh;min-width:3em;min-height:3em;cursor:pointer;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background-color:transparent;color:var(--nylas-base-800);cursor:pointer}.configurations .pagination button:hover:not(:disabled){border:1px solid var(--nylas-primary)}.configurations .pagination button:active{border:1px solid var(--nylas-base-800)}.configurations .pagination button:disabled{border:1px solid var(--nylas-base-100);background-color:transparent;color:var(--nylas-base-300);cursor:not-allowed}.configurations .pagination button.right{transform:rotate(180deg)}.error-container{margin-top:1.5rem}.error-container .error{color:var(--nylas-error);padding:0.5rem 0;margin:1rem 0 0}button-component#copy button{width:108px}select-dropdown{width:auto}select-dropdown::part(sd_dropdown-button){display:block;height:48px;padding:0px 16px 8px}@media screen and (max-width: 768px){select-dropdown::part(sd_dropdown-button){width:92px}}select-dropdown::part(sd_dropdown-content){width:120px;right:0}select-dropdown::part(sd_dropdown-labelhtml){display:flex;gap:0.5rem;align-items:center;color:var(--nylas-base-900)}select-dropdown::part(sd_dropdown-labelhtml):hover{color:var(--nylas-primary)}.card-wrapper{position:absolute;top:0;left:0;height:calc(100% + 4rem);width:-webkit-fill-available;width:-moz-available;width:fill-available;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.card-wrapper{justify-content:start;height:100%}}.card-modal{background:var(--nylas-base-0);display:flex;flex-direction:column;font-family:var(--nylas-font-family);background-color:var(--nylas-base-0);color:var(--nylas-base-900);border-radius:var(--nylas-border-radius-3x);padding:32px;width:562px;box-shadow:0px 1px 4px rgba(0, 0, 0, 0.1), 0px 3px 6px rgba(0, 0, 0, 0.06)}@media screen and (max-width: 768px){.card-modal{width:auto;border-radius:0px}}.description.title-desc{margin-bottom:2rem}.description p{margin:0;font-size:18px;color:var(--nylas-base-600)}.footer{margin-top:1rem;padding-top:1rem;display:flex;justify-content:flex-end;gap:0.5rem;box-sizing:border-box;background-color:var(--nylas-base-25);width:100%;border-radius:0 0 var(--nylas-border-radius-2x) var(--nylas-border-radius-2x)}.close-button{width:100%;display:flex;justify-content:flex-end}.close-button button-component button{padding:0;height:auto}.close-button button-component button:hover{background-color:transparent !important}button-component{--dot-color:var(--nylas-base-700)}';const B=L;var F=undefined&&undefined.__decorate||function(t,e,n,a){var i=arguments.length,s=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(t,e,n,a);else for(var r=t.length-1;r>=0;r--)if(o=t[r])s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s;return i>3&&s&&Object.defineProperty(e,n,s),s};var O=undefined&&undefined.__metadata||function(t,e){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(t,e)};const N=class{constructor(e){t(this,e);this.initListConfigurations=a(this,"initListConfigurations",7);this.createButtonClick=a(this,"createButtonClick",7);this.editButtonClick=a(this,"editButtonClick",7);this.deleteButtonClick=a(this,"deleteButtonClick",7);this.configurations=[];this.schedulerPreviewLink="";this.listConfigurationsNextCursor=undefined;this.state="loading";this.error="";this.currentCursor=null;this.previousCursors=[];this.disableNextPageButton=false;this.deleteConfigurationId="";this.showDeleteButtonLoading=false}listConfigurationsNextCursorChangedHandler(t,e){if(!t||t===e){if(t===null){this.disableNextPageButton=true}return}this.disableNextPageButton=false;this.currentCursor=t}connectedCallback(){r("[nylas-list-configurations]","connectedCallback")}componentWillLoad(){r("[nylas-list-configurations]","componentWillLoad");if(this.configurations&&this.configurations.length>0){this.state="loaded"}}componentDidLoad(){r("[nylas-list-configurations]","componentDidLoad");this.initListConfigurations.emit({host:this.host})}disconnectedCallback(){r("[nylas-list-configurations]","disconnectedCallback")}async handleNylasFormDropdownChanged(t){r("[nylas-list-configurations]","handleNylasFormDropdownChanged",t.detail);const{value:e}=t.detail;const[n,a]=e.split("-");t.preventDefault();switch(n){case"delete":this.deleteConfigurationId=this.configurations[a]?.id;break;case"preview":window.open(c(this.schedulerPreviewLink,this.configurations[a]),"_blank");break;case"copy":await navigator.clipboard.writeText(c(this.schedulerPreviewLink,this.configurations[a]));break}}async registerCallback(){this.initListConfigurations.emit({host:this.host})}async getState(){return this.state}async setState(t){this.state=t}async setError(t){this.error=t}async hideDeleteConfirmation(){this.deleteConfigurationId="";this.showDeleteButtonLoading=false}closeModal(t){t.preventDefault();this.deleteConfigurationId=""}handleConfirmDeleteButtonClicked(t){t.preventDefault();this.showDeleteButtonLoading=true;const e=this.configurations.find((t=>t.id===this.deleteConfigurationId));if(e&&e?.id){this.deleteButtonClick.emit({host:this.host,configuration:e})}}getDurationString(t){const e=Math.floor(t/60);const n=t%60;return`${e?e:""} ${e?`${e>1?"hours":"hour"}`:""} ${n?n:""} ${n?`${n>1?"mins":"min"}`:""}`}getActionLabelHTML(t){const n={display:"inline-flex",alignItems:"center",gap:"0.5rem"};const a={color:"var(--nylas-error)"};switch(t){case"preview":return e("span",{style:n},e("eye-icon",{width:"16",height:"16"}),"Preview");case"copy":return e("span",{style:n},e("copy-icon",{width:"16",height:"16"}),"Copy link");case"delete":return e("span",{style:{...n,...a}},e("delete-icon",{width:"15",height:"17"}),"Delete");default:return""}}previousPageClickedHandler(){if(this.previousCursors.length===0)return;this.currentCursor=this.previousCursors.pop()||null;const t=this.previousCursors[this.previousCursors.length-1]||undefined;this.initListConfigurations.emit({host:this.host,cursor:t})}nextPageClickedHandler(){if(!this.currentCursor)return;this.previousCursors=[...this.previousCursors,this.currentCursor];this.initListConfigurations.emit({host:this.host,cursor:this.currentCursor})}render(){return e(i,null,e("div",{class:"header"},e("div",{class:"description"},e("h2",null,"All Scheduling Pages"),e("p",null,"Create and manage your Scheduling Pages.")),this.configurations&&this.configurations.length>0&&e("div",{class:"actions"},e("button-component",{part:"nlc__create-new-cta",clickHandler:()=>{this.createButtonClick.emit(this.host)}},"Create new"))),e("div",{class:"configurations"},e("div",{class:"table-container"},e("table",{class:{"no-configurations":this.state!=="loading"&&(!this.configurations||this.configurations.length===0)}},e("tr",{class:{hide:this.state==="loading"||this.configurations&&this.configurations.length===0}},e("th",null,"Page title"),e("th",null,"Duration"),e("th",null)),this.state==="loading"&&e("tr",{class:"no-configurations"},e("td",{colSpan:3},e("div",null,e("h3",null,"Loading..."),e("p",null,"Please wait while we fetch the scheduling pages")))),this.state!=="loading"&&(!this.configurations||this.configurations.length===0)&&e("tr",{class:"no-configurations"},e("td",{colSpan:3},e("div",null,e("calendar-icon",{width:"48",height:"48"}),e("h3",null,"No scheduling pages found"),e("p",null,"Get started with creating your first scheduling page"),e("button-component",{part:"nlc__create-new-cta",clickHandler:()=>{this.createButtonClick.emit(this.host)}},"Create new")))),this.state!=="loading"&&this.configurations?.map(((t,n)=>e("tr",{key:t?.id},e("td",null,e("div",{class:"title"},e("div",{class:"config-event-title",title:t?.event_booking?.title},t?.event_booking?.title),e("div",{class:"config-event-description"},t?.event_booking?.description))),e("td",null,e("div",{class:"duration"},this.getDurationString(t?.availability?.duration_minutes))),e("td",null,e("div",{class:"actions"},e("button-component",{variant:"basic",key:`edit-${n}`,clickHandler:e=>{e.preventDefault();this.editButtonClick.emit({host:this.host,configuration:t})}},e("edit-icon",{width:"16",height:"16"}),"Edit"),e("select-dropdown",{name:"actions",options:[{value:`preview-${n}`,label:"Preview",labelHTML:this.getActionLabelHTML("preview")},{value:`copy-${n}`,label:"Copy link",labelHTML:this.getActionLabelHTML("copy")},{value:`delete-${n}`,label:"Delete",labelHTML:this.getActionLabelHTML("delete")}],defaultSelectedOption:{value:"",label:""},dropdownButtonText:"...",withSearch:false,withChevron:false,exportparts:"sd_dropdown: actions__dropdown, sd_dropdown-button: actions__dropdown-button, sd_dropdown-content: actions__dropdown-content"})))))))),e("div",{class:"pagination"},e("button",{class:"arrow left",onClick:()=>this.previousPageClickedHandler(),disabled:this.previousCursors.length<=0},e("chevron-icon",null)),e("button",{class:"arrow right",onClick:()=>this.nextPageClickedHandler(),disabled:this.disableNextPageButton},e("chevron-icon",null)))),this.state==="error"&&e("div",{class:"error-container"},e("p",{class:"error"},this.error)),!!this.deleteConfigurationId&&e("div",{class:"card-wrapper"},e("div",{class:"card-modal"},e("div",{class:"close-button"},e("button-component",{tooltip:"Close",id:"close",variant:"invisible",onClick:t=>this.closeModal(t),part:"nfbf__close-button"},e("close-icon",null))),e("div",{class:"header"},e("h2",{slot:"card-title",part:"nfbf__title"},d.t("deleteSchedulingPageTitle"))),e("div",{class:"description title-desc"},e("p",null,d.t("deleteSchedulingPageDescription"))),e("div",{class:{footer:true}},e("button-component",{variant:"basic",onClick:t=>this.closeModal(t),part:"nfbf__button-outline nfbf__cancel-cta"},`${d.t("deleteSchedulingPageCancelButton")}`),e("button-component",{variant:"destructive",onClick:t=>this.handleConfirmDeleteButtonClicked(t),disabled:this.showDeleteButtonLoading,isLoading:this.showDeleteButtonLoading,part:"nfbf__button-outline nfbf__reschedule-cta"},`${d.t("deleteSchedulingPageConfirmButton")}`)))))}get host(){return s(this)}static get watchers(){return{listConfigurationsNextCursor:["listConfigurationsNextCursorChangedHandler"]}}};F([o({name:"nylas-list-configurations",stateToProps:new Map([["schedulerConfig.configurations","configurations"],["schedulerConfig.listConfigurationsNextCursor","listConfigurationsNextCursor"]]),localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"]]),eventToProps:{initListConfigurations:async(t,e)=>{const{host:n,cursor:a}=t.detail;await n.setState("loading");const[i,s]=await e.schedulerConfig.getConfigurations(a);if(!i&&s&&s.message){await n.setState("error");await n.setError(s.message);return}await n.setState("loaded")},createButtonClick:async(t,e)=>{e.schedulerConfigStore.resetSelectedConfiguration();e.schedulerConfigStore.state.action="create"},deleteButtonClick:async(t,e)=>{const{host:n,configuration:a}=t.detail;const[i,s]=await e.schedulerConfig.deleteConfiguration(a.id);if(!i&&s&&s.message){await n.setState("error");await n.setError(s.message)}await n.hideDeleteConfirmation()},editButtonClick:async(t,e)=>{const{configuration:n}=t.detail;e.schedulerConfigStore.state.selectedConfiguration=n;e.schedulerConfigStore.state.action="edit"}},fireRegisterEvent:true}),O("design:type",Function),O("design:paramtypes",[]),O("design:returntype",void 0)],N.prototype,"render",null);N.style=B;export{_ as google_logo_icon,x as microsoft_logo_icon,P as nylas_editor_tabs,N as nylas_list_configurations};
|
|
2
|
+
//# sourceMappingURL=p-ad7f8831.entry.js.map
|
|
@@ -178,7 +178,7 @@ class NylaSchedulerAPIConnector {
|
|
|
178
178
|
async makeAPIRequest(path, method, body, headers = {}) {
|
|
179
179
|
try {
|
|
180
180
|
const schedulerURL = new URL(this.schedulerAPIURL);
|
|
181
|
-
const version = "1.3.
|
|
181
|
+
const version = "1.3.3" || 'latest';
|
|
182
182
|
schedulerURL.pathname = path;
|
|
183
183
|
const response = await fetch(decodeURIComponent(schedulerURL.toString()), {
|
|
184
184
|
method,
|
|
@@ -705,4 +705,4 @@ function CreateNylasSchedulerStore(defaultState = {}) {
|
|
|
705
705
|
|
|
706
706
|
export { CreateNylasSchedulerStore as C, ErrorCategory as E, NylaSchedulerAPIConnector as N };
|
|
707
707
|
|
|
708
|
-
//# sourceMappingURL=scheduler-store-
|
|
708
|
+
//# sourceMappingURL=scheduler-store-79dc16cc.js.map
|
package/dist/nylas-web-elements/{scheduler-store-b6d12f40.js.map → scheduler-store-79dc16cc.js.map}
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,qBAAqB,EAAE,eAAe,CAAC,CAAC;QAC9C,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,CAAC;QAC1G,KAAK,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAC;QAC9C,KAAK,CAAC,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;KAC7C,CAAC,CAAC;IAOH,KAAK,CAAC,KAAK,GAAG;QACZ,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE;YACxC,MAAM,KAAK,GAAG,sBAAsB,CAAC,GAA0C,CAAC,CAAC;YACjF,KAAK,CAAC,GAAG,CAAC,GAAU,EAAE,KAAK,CAAC,CAAC;SAC9B;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf;;;;","names":["i18next"],"sources":["src/connector/nylas-scheduler-connector/errors/index.ts","src/connector/shared/api/scheduler.ts","src/stores/scheduler-store.ts"],"sourcesContent":["export enum ErrorCategory {\n Component = 'component',\n Api = 'api',\n Auth = 'auth',\n}\n\nexport interface ErrorDetails {\n title: string;\n message: string;\n category: ErrorCategory;\n}\n\nexport enum ComponentErrorType {\n endtime_not_in_future = 'endtime_not_in_future',\n no_booking_info = 'no_booking_info',\n no_timeslot_selected = 'no_timeslot_selected',\n no_timezone_selected = 'no_timezone_selected',\n no_booking_id = 'no_booking_id',\n no_salt = 'no_salt',\n invalid_start_time = 'invalid_start_time',\n invalid_end_time = 'invalid_end_time',\n invalid_timezone = 'invalid_timezone',\n}\n\nexport enum APIErrorType {\n invalid_session = 'invalid_session',\n general_error = 'general_error',\n internal_error = 'internal_error',\n invalid_request_error = 'invalid_request_error',\n timeslot_not_available = 'timeslot_not_available',\n provider_error = 'provider_error',\n not_found_error = 'not_found_error',\n}\n\nexport class Errors {\n component = (_title: string): Record<ComponentErrorType, (message?: string) => ErrorDetails> => {\n const category = ErrorCategory.Component;\n const title = `${_title} Error`;\n return {\n endtime_not_in_future: (message: string = '\"endtime\" can not be in the future') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_info: (message: string = 'No booking info provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timeslot_selected: (message: string = 'No timeslot selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timezone_selected: (message: string = 'No timezone selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_id: (message: string = 'No booking id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_salt: (message: string = 'No salt provided') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_start_time: (message: string = 'Invalid start time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_end_time: (message: string = 'Invalid end time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_timezone: (message: string = 'Invalid timezone') => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n\n api = (_title: string): Record<APIErrorType, (message: string) => ErrorDetails> => {\n const category = ErrorCategory.Api;\n const title = `${_title} Error`;\n\n return {\n invalid_session: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n general_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n internal_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_request_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n timeslot_not_available: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n provider_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n not_found_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n}\n","import { AvailabilityResponse, NylasSchedulerBookingDataWithFlatFields, NylasEvent, UISettingsResponse } from '@/common/types';\nimport { NylasSchedulerStoreType } from '../../../components';\nimport type { NylasErrorResponse, NylasResponse, NylasSchedulerBookingData, NylasSchedulerResponse, Timeslot } from '@nylas/core';\nimport { APIErrorType, Errors } from '@/connector/nylas-scheduler-connector/errors';\nimport { addDaysToCurrentDate } from '@/utils/utils';\nimport i18next from '@/utils/i18n';\n\ntype NylasSchedulerAPIConnectorOptions = {\n schedulerAPIURL: string;\n schedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n slug?: string;\n clientId?: string;\n};\n\n/**\n * NylaSchedulerConnector\n * This class is used to make API requests to the scheduler.\n */\nexport class NylaSchedulerAPIConnector {\n private schedulerStore: NylasSchedulerStoreType;\n private schedulerAPIURL: string;\n private sessionId: string | undefined;\n private configId: string | undefined;\n private slug: string | undefined;\n private clientId: string | undefined;\n private errors = new Errors();\n\n constructor({ schedulerAPIURL, schedulerStore, sessionId, configId, slug, clientId }: NylasSchedulerAPIConnectorOptions) {\n this.schedulerStore = schedulerStore;\n this.schedulerAPIURL = schedulerAPIURL;\n this.sessionId = sessionId;\n this.configId = configId;\n this.slug = slug;\n this.clientId = clientId;\n }\n\n private getHeaders() {\n return this.sessionId\n ? {\n Authorization: `Bearer ${this.sessionId}`,\n }\n : {};\n }\n\n /**\n * Makes an API request to the scheduler.\n * @param path The path to the API endpoint.\n * @param method The HTTP method.\n * @param body The request body (if any).\n * @returns {Promise<T>}\n */\n public async makeAPIRequest<T>(path: string, method: string, body: string | undefined, headers = {}): Promise<NylasResponse<T>> {\n try {\n const schedulerURL = new URL(this.schedulerAPIURL);\n const version = process.env.PACKAGE_VERSION || 'latest';\n schedulerURL.pathname = path;\n const response = await fetch(decodeURIComponent(schedulerURL.toString()), {\n method,\n headers: {\n 'Content-Type': 'application/json',\n 'Origin': window.location.origin,\n 'X-Source': 'nylas-scheduling',\n 'X-Nylas-Web-Elements-Version': version,\n ...headers,\n },\n body,\n });\n // The server returns a json object for errors: eg.\n // {\n // \"request_id\": \"<request_id>\",\n // \"error\": {\n // \"type\": \"not_found_error\",\n // \"message\": \"Session not found\"\n // }\n // }\n const data = await response.json();\n return data as NylasResponse<T>;\n } catch (error: any) {\n // NOTE: current server implementation doesn't return a JSON object for errors on some endpoints\n // handle this case by returning the error response as a string to be handled downstream\n return {\n error: {\n message: error.message,\n title: 'API request failed',\n type: 'api',\n },\n } as NylasErrorResponse;\n }\n }\n\n private getErrorMessage(error: NylasErrorResponse['error']) {\n let errorMessage = error?.message || error?.title || 'Something went wrong';\n if (error?.type === 'provider_error') {\n errorMessage = error?.provider_error?.error?.message || error?.provider_error?.error?.title || 'Something went wrong';\n }\n return errorMessage;\n }\n\n public setConfigId(configId: string) {\n this.configId = configId;\n }\n\n /**\n * Selects a date in the scheduler.\n */\n public selectDate(date: Date) {\n this.schedulerStore.set('selectedDate', date);\n this.schedulerStore.set('selectedTimeslot', null);\n }\n\n /**\n * Selects a time in the scheduler.\n */\n public selectTime(time: Timeslot) {\n this.schedulerStore.set('selectedTimeslot', time);\n }\n\n /**\n * Sets the timezone in the scheduler.\n */\n public selectTimezone(timezone: string) {\n this.schedulerStore.set('selectedTimezone', timezone);\n }\n\n /**\n * Sets the language in the scheduler.\n */\n public selectLanguage(language: string) {\n this.schedulerStore.set('selectedLanguage', language);\n i18next.changeLanguage(language);\n }\n\n /**\n * Toggles showBookingForm\n * @param value boolean\n */\n public async toggleAdditionalData(value: boolean) {\n if (!value) {\n // Refetch availability\n await this.refetchAvailability();\n }\n this.schedulerStore.set('showBookingForm', value);\n }\n\n /**\n * Set/update the name of the participant booking the event.\n */\n public setParticipantName(name: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n name,\n },\n });\n }\n\n /**\n * Set/update the email of the participant booking the event.\n */\n public setParticipantEmail(email: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n email,\n },\n });\n }\n\n private async refetchAvailability() {\n const today = new Date();\n // Refetch availability\n const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n const endTime = new Date(today.getFullYear(), today.getMonth() + 1, 1).getTime() / 1000;\n const result = await this.getAvailability(startTimeWithOffset, endTime);\n return result;\n }\n\n private async resetStoreStateAndFetchAvailability() {\n const today = new Date();\n // Refetch availability\n const result = await this.refetchAvailability();\n // Set selected date to first available date\n const firstAvailableDate = this.schedulerStore.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n let _selectedDate = today;\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n this.schedulerStore.set('selectedDate', _selectedDate);\n // Reset store state\n this.schedulerStore.set('eventInfo', null);\n this.schedulerStore.set('showBookingForm', false);\n this.schedulerStore.set('selectedTimeslot', null);\n\n return result;\n }\n\n /**\n * Set reschedule booking id\n */\n public async setReschedule(bookingID: string) {\n this.schedulerStore.set('isLoading', true);\n const eventInfo = this.schedulerStore.state.eventInfo;\n if (eventInfo) {\n this.schedulerStore.set('reschedulingEventInfo', eventInfo);\n }\n this.schedulerStore.set('rescheduleBookingId', bookingID);\n await this.getUISettings();\n // Set reschedule booking id\n const result = await this.resetStoreStateAndFetchAvailability().finally(() => {\n this.schedulerStore.set('isLoading', false);\n });\n\n return result;\n }\n\n /**\n * Set cancel booking id\n */\n public async setCancel(bookingID: string) {\n this.schedulerStore.set('cancelBookingId', bookingID);\n }\n\n /**\n * Set reject booking id\n */\n public async setReject(bookingID: string) {\n this.schedulerStore.set('rejectBookingId', bookingID);\n }\n\n public async resetCancel() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('cancelBookingId', '');\n this.schedulerStore.set('rejectBookingId', '');\n this.schedulerStore.set('cancelledEventInfo', null);\n return result;\n }\n\n public async goBack() {\n this.schedulerStore.set('cancelBookingId', '');\n return;\n }\n\n public async resetConfirm() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('confirmedEventInfo', undefined);\n return result;\n }\n\n /**\n * Book the selected timeslot.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async bookTimeslot(data?: NylasSchedulerBookingDataWithFlatFields & { timeslot?: Timeslot }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { selectedTimeslot, selectedTimezone, bookingInfo, selectedLanguage } = this.schedulerStore.state;\n if (!data && !bookingInfo) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_booking_info() };\n }\n\n const timeslot = data?.timeslot || selectedTimeslot;\n if (!timeslot) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timeslot_selected() };\n }\n\n const timezone = data && data?.timezone ? data?.timezone : selectedTimezone;\n const language = selectedLanguage || 'en-US';\n\n if (!timezone) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timezone_selected() };\n }\n const order = this.schedulerStore.get('availabilityOrderEmails');\n let participantToBookWith = '';\n if (order.length > 0) {\n // Get the emails in the timeslot\n const emails = timeslot?.emails || [];\n for (let i = 0; i < order.length; i++) {\n if (emails.includes(order[i])) {\n participantToBookWith = order[i];\n break;\n }\n }\n }\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const headers = this.getHeaders();\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings${configIdParam}`;\n\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n additional_fields,\n additional_guests: guests,\n guest: { ...primaryGuest },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone: timezone,\n email_language: this.getTwoLetterLanguageCode(language),\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api('Create Booking')) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api('Create Booking')[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response?.data);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Get UI settings for the scheduler.\n */\n public async getUISettings(): Promise<NylasSchedulerResponse<UISettingsResponse>> {\n this.schedulerStore.set('isLoading', true);\n const bookingId = this.schedulerStore.get('rescheduleBookingId');\n const headers = this.getHeaders();\n let configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n if (bookingId && !!configIdParam) {\n configIdParam += `&booking_id=${bookingId}`;\n } else if (bookingId) {\n configIdParam += `?booking_id=${bookingId}`;\n }\n\n const url = `/v3/scheduling/ui-settings${configIdParam}`;\n\n const response = await this.makeAPIRequest<UISettingsResponse>(url, 'GET', undefined, headers);\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getUISettingErrorTitle'))) {\n error = this.errors.api(i18next.t('getUISettingErrorTitle'))[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n if ('data' in response) {\n this.schedulerStore.set('configSettings', response.data);\n }\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n private getTwoLetterLanguageCode(language: string) {\n return language.split('-')[0];\n }\n\n private getStartTimeWithMinBookingNotice(startTime: number) {\n const scheduler = this.schedulerStore.get('configSettings')?.scheduler;\n const min_booking_notice = scheduler?.min_booking_notice;\n if (!min_booking_notice) {\n return startTime;\n }\n const today = new Date().getTime();\n\n if (startTime < (today + min_booking_notice * 60 * 1000) / 1000) {\n return Math.floor((today + min_booking_notice * 60 * 1000) / 1000);\n } else {\n return startTime;\n }\n }\n\n private getEndTimeForAvailableDaysInFuture(endTime: number) {\n const today = new Date();\n const availableDaysInFuture = this.schedulerStore.get('configSettings')?.scheduler?.available_days_in_future;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTimeWithOffset = Math.min(endTimeForAvailableDaysInFuture, endTime);\n return endTimeWithOffset;\n }\n\n /**\n * Gets the availability for a page.\n * @param startTime The start time.\n * @param endTime The end time.\n * @returns {Promise<AvailabilityResponse>}\n */\n public async getAvailability(startTime: number = 0, endTime: number = 0): Promise<NylasSchedulerResponse<AvailabilityResponse>> {\n this.schedulerStore.set('isLoading', true);\n const params = new URLSearchParams();\n const now = new Date();\n const nowTime = now.getTime();\n\n if (endTime && endTime < nowTime / 1000) {\n this.schedulerStore.set('isLoading', false);\n const error = this.errors.component(i18next.t('getAvailabilityErrorTitle')).endtime_not_in_future();\n return { error };\n }\n\n // Calculate the start of the current month if startTime is not provided\n if (!startTime) {\n const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);\n startTime = Math.floor(startOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n // Calculate the end of the current month if endTime is not provided\n if (!endTime) {\n const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0); // Setting day to 0 gets the last day of the previous month, so in this case, the last day of the current month\n endTime = Math.floor(endOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n endTime = this.getEndTimeForAvailableDaysInFuture(endTime);\n const startTimeWithMinBooking = this.getStartTimeWithMinBookingNotice(startTime);\n startTime = startTimeWithMinBooking;\n endTime = startTimeWithMinBooking > endTime ? startTimeWithMinBooking + 1 : endTime;\n\n params.append('start_time', encodeURIComponent(startTime.toString()));\n params.append('end_time', encodeURIComponent(endTime.toString()));\n if (this.configId && !this.sessionId) {\n params.append('configuration_id', encodeURIComponent(this.configId));\n } else if (this.slug && this.clientId && !this.sessionId) {\n params.append('slug', encodeURIComponent(this.slug));\n params.append('client_id', encodeURIComponent(this.clientId));\n }\n\n const rescheduleBookingId = this.schedulerStore.get('rescheduleBookingId');\n if (rescheduleBookingId) {\n params.append('booking_id', encodeURIComponent(rescheduleBookingId));\n }\n const queryString = params.toString();\n const url = `/v3/scheduling/availability${queryString ? `?${queryString}` : ''}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<AvailabilityResponse>(decodeURIComponent(url), 'GET', undefined, headers);\n\n if ('error' in response) {\n this.schedulerStore.set('availability', []);\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getAvailabilityErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('getAvailabilityErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response) {\n const availability =\n response.data?.time_slots?.map(timeslot => {\n return {\n ...timeslot,\n start_time: new Date(timeslot.start_time * 1000),\n end_time: new Date(timeslot.end_time * 1000),\n };\n }) || [];\n\n // Filter out timeslots that are in the past\n const availabilityTimeslotsFiltered = availability.filter(timeslot => timeslot.start_time.getTime() > nowTime);\n this.schedulerStore.set('availability', availabilityTimeslotsFiltered);\n const order = response.data?.order || [];\n this.schedulerStore.set('availabilityOrderEmails', order);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Cancels a booking.\n * @param bookingId The booking ID.\n */\n public async cancelBooking(bookingId: string, reason: string): Promise<NylasSchedulerResponse<Partial<NylasEvent>>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('cancelBookingErrorTitle')).no_booking_id() };\n }\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<Partial<NylasEvent>>(\n decodeURIComponent(url),\n 'DELETE',\n JSON.stringify({\n action: 'cancel',\n cancellation_reason: reason,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('cancelBookingErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('cancelBookingErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n this.schedulerStore.set('rescheduleBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Reschedules a booking.\n * @param bookingId The booking ID.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async rescheduleBooking(bookingId: string, data: NylasSchedulerBookingDataWithFlatFields): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('rescheduleBookingErrorTitle')).no_booking_id() };\n }\n const apiErrors = this.errors.api(i18next.t('rescheduleBookingErrorTitle'));\n const componentErrors = this.errors.component(i18next.t('rescheduleBookingErrorTitle'));\n const { bookingInfo, selectedTimeslot, selectedTimezone, selectedLanguage } = this.schedulerStore.state;\n // Validate data\n const { startTime, endTime, timezone } = data;\n const start_time = startTime || selectedTimeslot?.start_time;\n\n if (!start_time) {\n return { error: componentErrors.invalid_start_time('Please pass \"startTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n const end_time = endTime || selectedTimeslot?.end_time;\n if (!end_time) {\n return { error: componentErrors.invalid_end_time('Please pass \"endTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n\n const order = this.schedulerStore.get('availabilityOrderEmails');\n let participantToBookWith = '';\n if (order.length > 0) {\n // Get the emails in the timeslot\n const emails = selectedTimeslot?.emails || [];\n for (let i = 0; i < order.length; i++) {\n if (emails.includes(order[i])) {\n participantToBookWith = order[i];\n break;\n }\n }\n }\n\n const time_zone = timezone || selectedTimezone;\n if (!time_zone) {\n return { error: componentErrors.invalid_timezone('Please pass \"timezone\" in data or set \"selectedTimezone\" in the defaultSchedulerState.') };\n }\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PATCH',\n JSON.stringify({\n start_time: start_time.getTime() / 1000,\n end_time: end_time.getTime() / 1000,\n timezone: time_zone,\n additional_fields,\n guest: { ...primaryGuest },\n additional_guests: guests,\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n email_language: this.getTwoLetterLanguageCode(selectedLanguage),\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in apiErrors) {\n const errorMessage = this.getErrorMessage(error);\n error = apiErrors[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n const eventInfo = this.schedulerStore.get('reschedulingEventInfo');\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response?.data);\n } else if (eventInfo) {\n this.schedulerStore.set('eventInfo', eventInfo);\n } else {\n // We should technically never reach this point\n const event = {\n booking_id: bookingId,\n } as NylasEvent;\n this.schedulerStore.set('eventInfo', event);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Updates the booking.\n * @param bookingId The booking ID.\n */\n public async updateBooking(payload: { bookingId: string; status: 'confirmed' | 'cancelled'; reason?: string }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { bookingId, status, reason } = payload;\n const salt = this.schedulerStore.get('organizerConfirmationSalt');\n const errorTitle = status === 'confirmed' ? i18next.t('confirmBookingErrorTitle') : i18next.t('rejectBookingErrorTitle');\n\n if (!bookingId) {\n return { error: this.errors.component(errorTitle).no_booking_id() };\n }\n if (!salt) {\n return { error: this.errors.component(errorTitle).no_salt() };\n }\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PUT',\n JSON.stringify({\n status: status,\n cancellation_reason: reason,\n salt,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(errorTitle)) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(errorTitle)[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response && status === 'confirmed') {\n this.schedulerStore.set('confirmedEventInfo', response?.data);\n } else if ('request_id' in response && status === 'cancelled') {\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n }\n\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n}\n","import { DataState, NylasEvent } from '@/common/types';\nimport { debug } from '@/utils/utils';\nimport { AdditionalFields, Appearance, NylasSchedulerBookingData, ThemeConfig, Timeslot } from '@nylas/core';\nimport { createStore } from '@stencil/store';\n\nexport type AvailabilityTimeslot = {\n emails: string[];\n start_time: Date;\n end_time: Date;\n};\n\nexport type LoadingState = {\n api: 'availability' | 'createBooking' | 'cancelBooking' | 'rescheduleBooking';\n};\n\nexport type ConfigSettings = {\n configuration_id: string;\n booking?: {\n additional_fields: Record<string, string>;\n additional_guests: {\n email: string;\n name: string;\n }[];\n booking_ref: string;\n booking_ref_salt: string;\n guest: {\n email: string;\n name: string;\n };\n timezone: string;\n email_language: string;\n event_data: {\n location: string;\n when: {\n start_time: Date;\n end_time: Date;\n end_timezone: string;\n start_timezone: string;\n object: string;\n };\n };\n event_organizer: {\n name: string;\n email: string;\n is_organizer: boolean;\n };\n };\n scheduler: {\n available_days_in_future: number;\n min_cancellation_notice: number;\n min_booking_notice: number;\n rescheduling_url?: string;\n cancellation_url?: string;\n cancellation_policy?: string;\n hide_additional_guests?: boolean;\n hide_cancellation_options?: boolean;\n hide_rescheduling_options?: boolean;\n additional_fields?: Record<string, AdditionalFields>;\n confirmation_redirect_url?: string;\n organizer_confirmation_url?: string;\n };\n organizer: {\n name: string;\n email: string;\n };\n slug: string;\n appearance: Appearance;\n booking_type: string;\n name: string;\n};\n\nexport interface NylasSchedulerStoreState {\n selectedDate: Date | null;\n selectedLanguage: string;\n selectedTimezone: string;\n selectedTimeslot: Timeslot | null;\n availabilityOrderEmails: string[];\n showBookingForm: boolean;\n selectableDates: Date[] | null;\n eventDuration: number;\n availability: AvailabilityTimeslot[];\n state: DataState;\n eventInfo: NylasEvent | null;\n cancelledEventInfo: Partial<NylasEvent> | null;\n reschedulingEventInfo?: NylasEvent;\n confirmedEventInfo?: NylasEvent;\n bookingInfo?: NylasSchedulerBookingData;\n rescheduleBookingId?: string;\n cancelBookingId?: string;\n isLoading: boolean;\n nylasBranding?: boolean;\n configSettings?: ConfigSettings;\n organizerConfirmationBookingId?: string;\n rejectBookingId?: string;\n organizerConfirmationSalt?: string;\n themeConfig?: ThemeConfig;\n}\n\nexport type NylasSchedulerStoreType = ReturnType<typeof CreateNylasSchedulerStore>;\n\nexport function CreateNylasSchedulerStore(defaultState: Partial<NylasSchedulerStoreState> = {}) {\n const defaultNylasStoreState: NylasSchedulerStoreState = {\n selectedDate: null,\n selectedLanguage: navigator.language,\n selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n selectedTimeslot: null,\n showBookingForm: false,\n availabilityOrderEmails: [],\n selectableDates: null,\n availability: [],\n eventDuration: 0,\n state: 'ready',\n eventInfo: null,\n cancelledEventInfo: null,\n isLoading: false,\n nylasBranding: true,\n ...defaultState,\n };\n debug(`[defaultNylasStoreState]: `, defaultNylasStoreState);\n const store = createStore<NylasSchedulerStoreState>(defaultNylasStoreState);\n\n store.onChange('availability', availability => {\n debug(`[availability]: `, availability);\n const selectableDates = availability.map(timeslot => timeslot.start_time);\n debug(`[selectableDates]: `, selectableDates);\n store.set('selectableDates', selectableDates);\n const timeslot = availability[0];\n if (!timeslot) return;\n const durationMinutes = Math.floor((timeslot.end_time.getTime() - timeslot.start_time.getTime()) / 60000);\n debug(`[durationMinutes]: `, durationMinutes);\n store.set('eventDuration', durationMinutes);\n });\n\n /**\n * Reset the Nylas store to its default state.\n * There is something wrong with the stencil/store reset method,\n * so we have to do it via this hack.\n */\n store.reset = () => {\n for (const key in defaultNylasStoreState) {\n const value = defaultNylasStoreState[key as keyof typeof defaultNylasStoreState];\n store.set(key as any, value);\n }\n };\n\n return store;\n}\n"],"version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CAAC,CAAC;QAC9C,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,CAAC;QAC1G,KAAK,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAC;QAC9C,KAAK,CAAC,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;KAC7C,CAAC,CAAC;IAOH,KAAK,CAAC,KAAK,GAAG;QACZ,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE;YACxC,MAAM,KAAK,GAAG,sBAAsB,CAAC,GAA0C,CAAC,CAAC;YACjF,KAAK,CAAC,GAAG,CAAC,GAAU,EAAE,KAAK,CAAC,CAAC;SAC9B;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf;;;;","names":["i18next"],"sources":["src/connector/nylas-scheduler-connector/errors/index.ts","src/connector/shared/api/scheduler.ts","src/stores/scheduler-store.ts"],"sourcesContent":["export enum ErrorCategory {\n Component = 'component',\n Api = 'api',\n Auth = 'auth',\n}\n\nexport interface ErrorDetails {\n title: string;\n message: string;\n category: ErrorCategory;\n}\n\nexport enum ComponentErrorType {\n endtime_not_in_future = 'endtime_not_in_future',\n no_booking_info = 'no_booking_info',\n no_timeslot_selected = 'no_timeslot_selected',\n no_timezone_selected = 'no_timezone_selected',\n no_booking_id = 'no_booking_id',\n no_salt = 'no_salt',\n invalid_start_time = 'invalid_start_time',\n invalid_end_time = 'invalid_end_time',\n invalid_timezone = 'invalid_timezone',\n}\n\nexport enum APIErrorType {\n invalid_session = 'invalid_session',\n general_error = 'general_error',\n internal_error = 'internal_error',\n invalid_request_error = 'invalid_request_error',\n timeslot_not_available = 'timeslot_not_available',\n provider_error = 'provider_error',\n not_found_error = 'not_found_error',\n}\n\nexport class Errors {\n component = (_title: string): Record<ComponentErrorType, (message?: string) => ErrorDetails> => {\n const category = ErrorCategory.Component;\n const title = `${_title} Error`;\n return {\n endtime_not_in_future: (message: string = '\"endtime\" can not be in the future') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_info: (message: string = 'No booking info provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timeslot_selected: (message: string = 'No timeslot selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_timezone_selected: (message: string = 'No timezone selected') => {\n return {\n title,\n message,\n category,\n };\n },\n no_booking_id: (message: string = 'No booking id provided') => {\n return {\n title,\n message,\n category,\n };\n },\n no_salt: (message: string = 'No salt provided') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_start_time: (message: string = 'Invalid start time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_end_time: (message: string = 'Invalid end time') => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_timezone: (message: string = 'Invalid timezone') => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n\n api = (_title: string): Record<APIErrorType, (message: string) => ErrorDetails> => {\n const category = ErrorCategory.Api;\n const title = `${_title} Error`;\n\n return {\n invalid_session: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n general_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n internal_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n invalid_request_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n timeslot_not_available: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n provider_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n not_found_error: (message: string) => {\n return {\n title,\n message,\n category,\n };\n },\n };\n };\n}\n","import { AvailabilityResponse, NylasSchedulerBookingDataWithFlatFields, NylasEvent, UISettingsResponse } from '@/common/types';\nimport { NylasSchedulerStoreType } from '../../../components';\nimport type { NylasErrorResponse, NylasResponse, NylasSchedulerBookingData, NylasSchedulerResponse, Timeslot } from '@nylas/core';\nimport { APIErrorType, Errors } from '@/connector/nylas-scheduler-connector/errors';\nimport { addDaysToCurrentDate } from '@/utils/utils';\nimport i18next from '@/utils/i18n';\n\ntype NylasSchedulerAPIConnectorOptions = {\n schedulerAPIURL: string;\n schedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n slug?: string;\n clientId?: string;\n};\n\n/**\n * NylaSchedulerConnector\n * This class is used to make API requests to the scheduler.\n */\nexport class NylaSchedulerAPIConnector {\n private schedulerStore: NylasSchedulerStoreType;\n private schedulerAPIURL: string;\n private sessionId: string | undefined;\n private configId: string | undefined;\n private slug: string | undefined;\n private clientId: string | undefined;\n private errors = new Errors();\n\n constructor({ schedulerAPIURL, schedulerStore, sessionId, configId, slug, clientId }: NylasSchedulerAPIConnectorOptions) {\n this.schedulerStore = schedulerStore;\n this.schedulerAPIURL = schedulerAPIURL;\n this.sessionId = sessionId;\n this.configId = configId;\n this.slug = slug;\n this.clientId = clientId;\n }\n\n private getHeaders() {\n return this.sessionId\n ? {\n Authorization: `Bearer ${this.sessionId}`,\n }\n : {};\n }\n\n /**\n * Makes an API request to the scheduler.\n * @param path The path to the API endpoint.\n * @param method The HTTP method.\n * @param body The request body (if any).\n * @returns {Promise<T>}\n */\n public async makeAPIRequest<T>(path: string, method: string, body: string | undefined, headers = {}): Promise<NylasResponse<T>> {\n try {\n const schedulerURL = new URL(this.schedulerAPIURL);\n const version = process.env.PACKAGE_VERSION || 'latest';\n schedulerURL.pathname = path;\n const response = await fetch(decodeURIComponent(schedulerURL.toString()), {\n method,\n headers: {\n 'Content-Type': 'application/json',\n 'Origin': window.location.origin,\n 'X-Source': 'nylas-scheduling',\n 'X-Nylas-Web-Elements-Version': version,\n ...headers,\n },\n body,\n });\n // The server returns a json object for errors: eg.\n // {\n // \"request_id\": \"<request_id>\",\n // \"error\": {\n // \"type\": \"not_found_error\",\n // \"message\": \"Session not found\"\n // }\n // }\n const data = await response.json();\n return data as NylasResponse<T>;\n } catch (error: any) {\n // NOTE: current server implementation doesn't return a JSON object for errors on some endpoints\n // handle this case by returning the error response as a string to be handled downstream\n return {\n error: {\n message: error.message,\n title: 'API request failed',\n type: 'api',\n },\n } as NylasErrorResponse;\n }\n }\n\n private getErrorMessage(error: NylasErrorResponse['error']) {\n let errorMessage = error?.message || error?.title || 'Something went wrong';\n if (error?.type === 'provider_error') {\n errorMessage = error?.provider_error?.error?.message || error?.provider_error?.error?.title || 'Something went wrong';\n }\n return errorMessage;\n }\n\n public setConfigId(configId: string) {\n this.configId = configId;\n }\n\n /**\n * Selects a date in the scheduler.\n */\n public selectDate(date: Date) {\n this.schedulerStore.set('selectedDate', date);\n this.schedulerStore.set('selectedTimeslot', null);\n }\n\n /**\n * Selects a time in the scheduler.\n */\n public selectTime(time: Timeslot) {\n this.schedulerStore.set('selectedTimeslot', time);\n }\n\n /**\n * Sets the timezone in the scheduler.\n */\n public selectTimezone(timezone: string) {\n this.schedulerStore.set('selectedTimezone', timezone);\n }\n\n /**\n * Sets the language in the scheduler.\n */\n public selectLanguage(language: string) {\n this.schedulerStore.set('selectedLanguage', language);\n i18next.changeLanguage(language);\n }\n\n /**\n * Toggles showBookingForm\n * @param value boolean\n */\n public async toggleAdditionalData(value: boolean) {\n if (!value) {\n // Refetch availability\n await this.refetchAvailability();\n }\n this.schedulerStore.set('showBookingForm', value);\n }\n\n /**\n * Set/update the name of the participant booking the event.\n */\n public setParticipantName(name: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n name,\n },\n });\n }\n\n /**\n * Set/update the email of the participant booking the event.\n */\n public setParticipantEmail(email: string) {\n const { bookingInfo } = this.schedulerStore.state;\n this.schedulerStore.set('bookingInfo', {\n ...bookingInfo,\n primaryParticipant: {\n ...(bookingInfo?.primaryParticipant as NylasSchedulerBookingData['primaryParticipant']),\n email,\n },\n });\n }\n\n private async refetchAvailability() {\n const today = new Date();\n // Refetch availability\n const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n const endTime = new Date(today.getFullYear(), today.getMonth() + 1, 1).getTime() / 1000;\n const result = await this.getAvailability(startTimeWithOffset, endTime);\n return result;\n }\n\n private async resetStoreStateAndFetchAvailability() {\n const today = new Date();\n // Refetch availability\n const result = await this.refetchAvailability();\n // Set selected date to first available date\n const firstAvailableDate = this.schedulerStore.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n let _selectedDate = today;\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n this.schedulerStore.set('selectedDate', _selectedDate);\n // Reset store state\n this.schedulerStore.set('eventInfo', null);\n this.schedulerStore.set('showBookingForm', false);\n this.schedulerStore.set('selectedTimeslot', null);\n\n return result;\n }\n\n /**\n * Set reschedule booking id\n */\n public async setReschedule(bookingID: string) {\n this.schedulerStore.set('isLoading', true);\n const eventInfo = this.schedulerStore.state.eventInfo;\n if (eventInfo) {\n this.schedulerStore.set('reschedulingEventInfo', eventInfo);\n }\n this.schedulerStore.set('rescheduleBookingId', bookingID);\n await this.getUISettings();\n // Set reschedule booking id\n const result = await this.resetStoreStateAndFetchAvailability().finally(() => {\n this.schedulerStore.set('isLoading', false);\n });\n\n return result;\n }\n\n /**\n * Set cancel booking id\n */\n public async setCancel(bookingID: string) {\n this.schedulerStore.set('cancelBookingId', bookingID);\n }\n\n /**\n * Set reject booking id\n */\n public async setReject(bookingID: string) {\n this.schedulerStore.set('rejectBookingId', bookingID);\n }\n\n public async resetCancel() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('cancelBookingId', '');\n this.schedulerStore.set('rejectBookingId', '');\n this.schedulerStore.set('cancelledEventInfo', null);\n return result;\n }\n\n public async goBack() {\n this.schedulerStore.set('cancelBookingId', '');\n return;\n }\n\n public async resetConfirm() {\n const result = await this.resetStoreStateAndFetchAvailability();\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('confirmedEventInfo', undefined);\n return result;\n }\n\n /**\n * Book the selected timeslot.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async bookTimeslot(data?: NylasSchedulerBookingDataWithFlatFields & { timeslot?: Timeslot }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { selectedTimeslot, selectedTimezone, bookingInfo, selectedLanguage } = this.schedulerStore.state;\n if (!data && !bookingInfo) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_booking_info() };\n }\n\n const timeslot = data?.timeslot || selectedTimeslot;\n if (!timeslot) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timeslot_selected() };\n }\n\n const timezone = data && data?.timezone ? data?.timezone : selectedTimezone;\n const language = selectedLanguage || 'en-US';\n\n if (!timezone) {\n return { error: this.errors.component(i18next.t('createBookingErrorTitle')).no_timezone_selected() };\n }\n const order = this.schedulerStore.get('availabilityOrderEmails');\n let participantToBookWith = '';\n if (order.length > 0) {\n // Get the emails in the timeslot\n const emails = timeslot?.emails || [];\n for (let i = 0; i < order.length; i++) {\n if (emails.includes(order[i])) {\n participantToBookWith = order[i];\n break;\n }\n }\n }\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const headers = this.getHeaders();\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings${configIdParam}`;\n\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'POST',\n JSON.stringify({\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n additional_fields,\n additional_guests: guests,\n guest: { ...primaryGuest },\n start_time: timeslot.start_time.getTime() / 1000,\n end_time: timeslot.end_time.getTime() / 1000,\n timezone: timezone,\n email_language: this.getTwoLetterLanguageCode(language),\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api('Create Booking')) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api('Create Booking')[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response?.data);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Get UI settings for the scheduler.\n */\n public async getUISettings(): Promise<NylasSchedulerResponse<UISettingsResponse>> {\n this.schedulerStore.set('isLoading', true);\n const bookingId = this.schedulerStore.get('rescheduleBookingId');\n const headers = this.getHeaders();\n let configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n if (bookingId && !!configIdParam) {\n configIdParam += `&booking_id=${bookingId}`;\n } else if (bookingId) {\n configIdParam += `?booking_id=${bookingId}`;\n }\n\n const url = `/v3/scheduling/ui-settings${configIdParam}`;\n\n const response = await this.makeAPIRequest<UISettingsResponse>(url, 'GET', undefined, headers);\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getUISettingErrorTitle'))) {\n error = this.errors.api(i18next.t('getUISettingErrorTitle'))[errorType as APIErrorType](error?.message || error?.title || 'Something went wrong');\n }\n return { error };\n }\n if ('data' in response) {\n this.schedulerStore.set('configSettings', response.data);\n }\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n private getTwoLetterLanguageCode(language: string) {\n return language.split('-')[0];\n }\n\n private getStartTimeWithMinBookingNotice(startTime: number) {\n const scheduler = this.schedulerStore.get('configSettings')?.scheduler;\n const min_booking_notice = scheduler?.min_booking_notice;\n if (!min_booking_notice) {\n return startTime;\n }\n const today = new Date().getTime();\n\n if (startTime < (today + min_booking_notice * 60 * 1000) / 1000) {\n return Math.floor((today + min_booking_notice * 60 * 1000) / 1000);\n } else {\n return startTime;\n }\n }\n\n private getEndTimeForAvailableDaysInFuture(endTime: number) {\n const today = new Date();\n const availableDaysInFuture = this.schedulerStore.get('configSettings')?.scheduler?.available_days_in_future;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTimeWithOffset = Math.min(endTimeForAvailableDaysInFuture, endTime);\n return endTimeWithOffset;\n }\n\n /**\n * Gets the availability for a page.\n * @param startTime The start time.\n * @param endTime The end time.\n * @returns {Promise<AvailabilityResponse>}\n */\n public async getAvailability(startTime: number = 0, endTime: number = 0): Promise<NylasSchedulerResponse<AvailabilityResponse>> {\n this.schedulerStore.set('isLoading', true);\n const params = new URLSearchParams();\n const now = new Date();\n const nowTime = now.getTime();\n\n if (endTime && endTime < nowTime / 1000) {\n this.schedulerStore.set('isLoading', false);\n const error = this.errors.component(i18next.t('getAvailabilityErrorTitle')).endtime_not_in_future();\n return { error };\n }\n\n // Calculate the start of the current month if startTime is not provided\n if (!startTime) {\n const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);\n startTime = Math.floor(startOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n // Calculate the end of the current month if endTime is not provided\n if (!endTime) {\n const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0); // Setting day to 0 gets the last day of the previous month, so in this case, the last day of the current month\n endTime = Math.floor(endOfMonth.getTime() / 1000); // Convert to UNIX timestamp in seconds\n }\n\n endTime = this.getEndTimeForAvailableDaysInFuture(endTime);\n const startTimeWithMinBooking = this.getStartTimeWithMinBookingNotice(startTime);\n startTime = startTimeWithMinBooking;\n endTime = startTimeWithMinBooking > endTime ? startTimeWithMinBooking + 1 : endTime;\n\n params.append('start_time', encodeURIComponent(startTime.toString()));\n params.append('end_time', encodeURIComponent(endTime.toString()));\n if (this.configId && !this.sessionId) {\n params.append('configuration_id', encodeURIComponent(this.configId));\n } else if (this.slug && this.clientId && !this.sessionId) {\n params.append('slug', encodeURIComponent(this.slug));\n params.append('client_id', encodeURIComponent(this.clientId));\n }\n\n const rescheduleBookingId = this.schedulerStore.get('rescheduleBookingId');\n if (rescheduleBookingId) {\n params.append('booking_id', encodeURIComponent(rescheduleBookingId));\n }\n const queryString = params.toString();\n const url = `/v3/scheduling/availability${queryString ? `?${queryString}` : ''}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<AvailabilityResponse>(decodeURIComponent(url), 'GET', undefined, headers);\n\n if ('error' in response) {\n this.schedulerStore.set('availability', []);\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('getAvailabilityErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('getAvailabilityErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response) {\n const availability =\n response.data?.time_slots?.map(timeslot => {\n return {\n ...timeslot,\n start_time: new Date(timeslot.start_time * 1000),\n end_time: new Date(timeslot.end_time * 1000),\n };\n }) || [];\n\n // Filter out timeslots that are in the past\n const availabilityTimeslotsFiltered = availability.filter(timeslot => timeslot.start_time.getTime() > nowTime);\n this.schedulerStore.set('availability', availabilityTimeslotsFiltered);\n const order = response.data?.order || [];\n this.schedulerStore.set('availabilityOrderEmails', order);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Cancels a booking.\n * @param bookingId The booking ID.\n */\n public async cancelBooking(bookingId: string, reason: string): Promise<NylasSchedulerResponse<Partial<NylasEvent>>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('cancelBookingErrorTitle')).no_booking_id() };\n }\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<Partial<NylasEvent>>(\n decodeURIComponent(url),\n 'DELETE',\n JSON.stringify({\n action: 'cancel',\n cancellation_reason: reason,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(i18next.t('cancelBookingErrorTitle'))) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(i18next.t('cancelBookingErrorTitle'))[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n this.schedulerStore.set('rescheduleBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Reschedules a booking.\n * @param bookingId The booking ID.\n * @param data The booking info.\n * @returns {Promise<NylasResponse<NylasEvent>>}\n */\n public async rescheduleBooking(bookingId: string, data: NylasSchedulerBookingDataWithFlatFields): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n if (!bookingId) {\n return { error: this.errors.component(i18next.t('rescheduleBookingErrorTitle')).no_booking_id() };\n }\n const apiErrors = this.errors.api(i18next.t('rescheduleBookingErrorTitle'));\n const componentErrors = this.errors.component(i18next.t('rescheduleBookingErrorTitle'));\n const { bookingInfo, selectedTimeslot, selectedTimezone, selectedLanguage } = this.schedulerStore.state;\n // Validate data\n const { startTime, endTime, timezone } = data;\n const start_time = startTime || selectedTimeslot?.start_time;\n\n if (!start_time) {\n return { error: componentErrors.invalid_start_time('Please pass \"startTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n const end_time = endTime || selectedTimeslot?.end_time;\n if (!end_time) {\n return { error: componentErrors.invalid_end_time('Please pass \"endTime\" in data or set \"selectedTimeslot\" in the defaultSchedulerState.') };\n }\n\n const order = this.schedulerStore.get('availabilityOrderEmails');\n let participantToBookWith = '';\n if (order.length > 0) {\n // Get the emails in the timeslot\n const emails = selectedTimeslot?.emails || [];\n for (let i = 0; i < order.length; i++) {\n if (emails.includes(order[i])) {\n participantToBookWith = order[i];\n break;\n }\n }\n }\n\n const time_zone = timezone || selectedTimezone;\n if (!time_zone) {\n return { error: componentErrors.invalid_timezone('Please pass \"timezone\" in data or set \"selectedTimezone\" in the defaultSchedulerState.') };\n }\n const addFields = {};\n Object.entries(bookingInfo?.additionalFields || {}).forEach(([key, entry]) => {\n addFields[key] = (entry as { value: string; type?: string }).value;\n });\n const primaryGuest = data ? data?.primaryParticipant : bookingInfo?.primaryParticipant;\n const guests = data ? data?.guests || [] : bookingInfo?.guests || [];\n const additional_fields = data ? data?.additionalFields : addFields;\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PATCH',\n JSON.stringify({\n start_time: start_time.getTime() / 1000,\n end_time: end_time.getTime() / 1000,\n timezone: time_zone,\n additional_fields,\n guest: { ...primaryGuest },\n additional_guests: guests,\n participants: participantToBookWith ? [{ email: participantToBookWith }] : undefined,\n email_language: this.getTwoLetterLanguageCode(selectedLanguage),\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in apiErrors) {\n const errorMessage = this.getErrorMessage(error);\n error = apiErrors[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n const eventInfo = this.schedulerStore.get('reschedulingEventInfo');\n if ('data' in response) {\n this.schedulerStore.set('eventInfo', response?.data);\n } else if (eventInfo) {\n this.schedulerStore.set('eventInfo', eventInfo);\n } else {\n // We should technically never reach this point\n const event = {\n booking_id: bookingId,\n } as NylasEvent;\n this.schedulerStore.set('eventInfo', event);\n }\n\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n\n /**\n * Updates the booking.\n * @param bookingId The booking ID.\n */\n public async updateBooking(payload: { bookingId: string; status: 'confirmed' | 'cancelled'; reason?: string }): Promise<NylasSchedulerResponse<NylasEvent>> {\n this.schedulerStore.set('isLoading', true);\n const { bookingId, status, reason } = payload;\n const salt = this.schedulerStore.get('organizerConfirmationSalt');\n const errorTitle = status === 'confirmed' ? i18next.t('confirmBookingErrorTitle') : i18next.t('rejectBookingErrorTitle');\n\n if (!bookingId) {\n return { error: this.errors.component(errorTitle).no_booking_id() };\n }\n if (!salt) {\n return { error: this.errors.component(errorTitle).no_salt() };\n }\n\n const configIdParam =\n !this.sessionId && this.configId\n ? `?configuration_id=${this.configId}`\n : !this.sessionId && this.slug && this.clientId\n ? `?slug=${this.slug}&client_id=${this.clientId}`\n : '';\n const url = `/v3/scheduling/bookings/${bookingId}${configIdParam}`;\n const headers = this.getHeaders();\n const response = await this.makeAPIRequest<NylasEvent>(\n decodeURIComponent(url),\n 'PUT',\n JSON.stringify({\n status: status,\n cancellation_reason: reason,\n salt,\n }),\n headers,\n );\n\n if ('error' in response) {\n this.schedulerStore.set('isLoading', false);\n const errorType = response.error?.type;\n let error = response.error;\n if (errorType && errorType in this.errors.api(errorTitle)) {\n const errorMessage = this.getErrorMessage(error);\n error = this.errors.api(errorTitle)[errorType as APIErrorType](errorMessage);\n }\n return { error };\n }\n\n if ('data' in response && status === 'confirmed') {\n this.schedulerStore.set('confirmedEventInfo', response?.data);\n } else if ('request_id' in response && status === 'cancelled') {\n this.schedulerStore.set('cancelledEventInfo', {\n booking_id: bookingId,\n });\n }\n\n this.schedulerStore.set('organizerConfirmationBookingId', '');\n this.schedulerStore.set('isLoading', false);\n return response;\n }\n}\n","import { DataState, NylasEvent } from '@/common/types';\nimport { debug } from '@/utils/utils';\nimport { AdditionalFields, Appearance, NylasSchedulerBookingData, ThemeConfig, Timeslot } from '@nylas/core';\nimport { createStore } from '@stencil/store';\n\nexport type AvailabilityTimeslot = {\n emails: string[];\n start_time: Date;\n end_time: Date;\n};\n\nexport type LoadingState = {\n api: 'availability' | 'createBooking' | 'cancelBooking' | 'rescheduleBooking';\n};\n\nexport type ConfigSettings = {\n configuration_id: string;\n booking?: {\n additional_fields: Record<string, string>;\n additional_guests: {\n email: string;\n name: string;\n }[];\n booking_ref: string;\n booking_ref_salt: string;\n guest: {\n email: string;\n name: string;\n };\n timezone: string;\n email_language: string;\n event_data: {\n location: string;\n when: {\n start_time: Date;\n end_time: Date;\n end_timezone: string;\n start_timezone: string;\n object: string;\n };\n };\n event_organizer: {\n name: string;\n email: string;\n is_organizer: boolean;\n };\n };\n scheduler: {\n available_days_in_future: number;\n min_cancellation_notice: number;\n min_booking_notice: number;\n rescheduling_url?: string;\n cancellation_url?: string;\n cancellation_policy?: string;\n hide_additional_guests?: boolean;\n hide_cancellation_options?: boolean;\n hide_rescheduling_options?: boolean;\n additional_fields?: Record<string, AdditionalFields>;\n confirmation_redirect_url?: string;\n organizer_confirmation_url?: string;\n };\n organizer: {\n name: string;\n email: string;\n };\n slug: string;\n appearance: Appearance;\n booking_type: string;\n name: string;\n};\n\nexport interface NylasSchedulerStoreState {\n selectedDate: Date | null;\n selectedLanguage: string;\n selectedTimezone: string;\n selectedTimeslot: Timeslot | null;\n availabilityOrderEmails: string[];\n showBookingForm: boolean;\n selectableDates: Date[] | null;\n eventDuration: number;\n availability: AvailabilityTimeslot[];\n state: DataState;\n eventInfo: NylasEvent | null;\n cancelledEventInfo: Partial<NylasEvent> | null;\n reschedulingEventInfo?: NylasEvent;\n confirmedEventInfo?: NylasEvent;\n bookingInfo?: NylasSchedulerBookingData;\n rescheduleBookingId?: string;\n cancelBookingId?: string;\n isLoading: boolean;\n nylasBranding?: boolean;\n configSettings?: ConfigSettings;\n organizerConfirmationBookingId?: string;\n rejectBookingId?: string;\n organizerConfirmationSalt?: string;\n themeConfig?: ThemeConfig;\n}\n\nexport type NylasSchedulerStoreType = ReturnType<typeof CreateNylasSchedulerStore>;\n\nexport function CreateNylasSchedulerStore(defaultState: Partial<NylasSchedulerStoreState> = {}) {\n const defaultNylasStoreState: NylasSchedulerStoreState = {\n selectedDate: null,\n selectedLanguage: navigator.language,\n selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n selectedTimeslot: null,\n showBookingForm: false,\n availabilityOrderEmails: [],\n selectableDates: null,\n availability: [],\n eventDuration: 0,\n state: 'ready',\n eventInfo: null,\n cancelledEventInfo: null,\n isLoading: false,\n nylasBranding: true,\n ...defaultState,\n };\n debug(`[defaultNylasStoreState]: `, defaultNylasStoreState);\n const store = createStore<NylasSchedulerStoreState>(defaultNylasStoreState);\n\n store.onChange('availability', availability => {\n debug(`[availability]: `, availability);\n const selectableDates = availability.map(timeslot => timeslot.start_time);\n debug(`[selectableDates]: `, selectableDates);\n store.set('selectableDates', selectableDates);\n const timeslot = availability[0];\n if (!timeslot) return;\n const durationMinutes = Math.floor((timeslot.end_time.getTime() - timeslot.start_time.getTime()) / 60000);\n debug(`[durationMinutes]: `, durationMinutes);\n store.set('eventDuration', durationMinutes);\n });\n\n /**\n * Reset the Nylas store to its default state.\n * There is something wrong with the stencil/store reset method,\n * so we have to do it via this hack.\n */\n store.reset = () => {\n for (const key in defaultNylasStoreState) {\n const value = defaultNylasStoreState[key as keyof typeof defaultNylasStoreState];\n store.set(key as any, value);\n }\n };\n\n return store;\n}\n"],"version":3}
|