@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
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,c as a,h as s,a as r}from"./p-68c2fadf.js";import{n as i}from"./p-05f97bb8.js";const t='.checkbox-container{--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;display:flex;flex-direction:column;gap:0.5rem}.checkbox-container p.error{color:var(--nylas-error);font-size:14px;font-weight:400;line-height:20px;font-family:var(--nylas-font-family);margin:0}label{display:flex;align-items:center;font-family:var(--nylas-font-family);cursor:pointer;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}label input[type=checkbox]{position:absolute;opacity:0;cursor:pointer}label input[type=checkbox]:focus~.checkmark,label input[type=checkbox]:hover~.checkmark{border-color:var(--nylas-primary)}label input[type=checkbox]:checked~.checkmark{color:var(--nylas-base-0);background:var(--nylas-primary) url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnIHdpZHRoPSIxMiIgaGVpZ2h0PSI5IiB2aWV3Qm94PSIwIDAgMTIgOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPHBhdGggZD0iTTQuNTc1IDguOTc3cy0uNDA0LS4wMDctLjUzNi0uMTY1TC4wNTcgNS42NGwuODI5LTEuMjI3TDQuNDcgNy4yNjggMTAuOTIxLjA4NmwuOTIzIDEuMTAzLTYuODYzIDcuNjRjLS4xMzQtLjAwMy0uNDA2LjE0OC0uNDA2LjE0OHoiIGZpbGw9IiNGRkYiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPg0KPC9zdmc+) 50% 40% no-repeat;border:2px solid var(--nylas-primary)}label .checkmark{border-radius:var(--nylas-border-radius);border:2px solid var(--nylas-base-800);position:absolute;left:0;top:2px;width:18px;height:18px;cursor:pointer;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}label .label{margin-left:32px;font-size:16px;font-weight:400;color:var(--nylas-base-800);line-height:24px}';const l=t;const n=class{constructor(s){e(this,s);this.nylasFormCheckboxToggled=a(this,"nylasFormCheckboxToggled",7);this.componentType="checkbox";this.name="checkbox";this.checked=undefined;this.label="";this.required=false;this.isChecked=undefined;this.error=""}checkedPropChangedHandler(e){if(typeof e==="boolean"){this.isChecked=e}}componentWillLoad(){this.el.setAttribute("component-type",this.componentType)}componentDidLoad(){this.isChecked=this.checked||false}handleBookingFormSubmitted(e){if(this.required&&!this.isChecked){this.error=`${this.label} is required.`;return}if(this.error){e.preventDefault()}}toggleCheck(){this.error="";this.isChecked=!this.isChecked;this.nylasFormCheckboxToggled.emit({checked:this.isChecked,name:this.name,label:this.label})}render(){return s("div",{key:"0be06ba2c6b6ed277b3ba736827f9f60e18c6056",class:"checkbox-container"},s("label",{key:"a0a0cf6b1f546b8d1485dd3aee1b686f0e9c9cba"},s("input",{key:"96bdb407b3ab6f668cf94b83e8091a604743f93f",type:"checkbox",name:this.name,checked:this.isChecked,onChange:()=>this.toggleCheck()}),s("span",{key:"d345d3b47c14213487a9108d78abbf0db26f25af",class:"checkmark"}),s("slot",{key:"aba536e12ed7a97d18790f1a212ead284c1253ec",name:"label"},s("span",{key:"e7767302bc6865b99cf42949e8bd032e237d2ad9",class:"label"},this.label))),this.error&&s("p",{class:"error"},this.error))}get el(){return r(this)}static get watchers(){return{checked:["checkedPropChangedHandler"]}}};n.style=l;const o=':host{display:block;height: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;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0}label .error{color:var(--nylas-error)}.input_wrapper{display:flex;align-items:center;gap:1rem}input[type=date]{display:flex;height:48px;padding-left:16px;align-items:center;gap:8px;align-self:stretch;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background:var(--nylas-base-0);width:-webkit-fill-available;color:var(--nylas-base-900);font-size:16px;font-style:normal;font-weight:400;line-height:150%;width:100%;width:-moz-available;width:-webkit-fill-available}input[type=date]:focus{outline-color:var(--nylas-primary)}input[type=date].error{border-radius:var(--nylas-border-radius-2x);font-weight:600;border-color:var(--nylas-error);border-width:2px}input[type=date].error::placeholder{font-weight:400}input[type=date]::placeholder{color:var(--nylas-base-300)}';const h=o;const d={date:"YYYY-MM-DD"};const c=class{constructor(s){e(this,s);this.nylasFormInputChanged=a(this,"nylasFormInputChanged",7);this.nylasFormInputFocused=a(this,"nylasFormInputFocused",7);this.nylasFormInputBlurred=a(this,"nylasFormInputBlurred",7);this.name="input";this.defaultValue=undefined;this.label="";this.placeholder=d["date"];this.required=false;this.readOnly=false;this.autoFocus=false;this.pattern=undefined;this.maxLength=255;this.patternError="";this.requiredError="";this.value=undefined;this.error="";this.isDateValid=true}handleDefaultValueChange(e){this.value=i(e);if(this.value){this.validatePattern(this.value)}}componentDidLoad(){this.value=i(this.defaultValue||"");if(this.value){this.validatePattern(this.value)}}handleBookingFormSubmitted(e){this.validatePattern(this.value);if(this.error){e.preventDefault()}}async handleFormSubmitted(e){this.validatePattern(this.value);if(this.error){e.preventDefault()}}handleInput(e){this.error="";const a=e.target;this.value=i(a.value);this.isDateValid=a.validity.valid;this.nylasFormInputChanged.emit({value:this.value,name:this.name,label:this.label,error:this.error,type:"date"})}handleBlur(){this.nylasFormInputBlurred.emit({value:this.value,name:this.name})}handleFocus(){this.nylasFormInputFocused.emit({value:this.value,name:this.name})}validatePattern(e){this.error="";if(!this.isDateValid){this.error="Please enter a valid date";return}if(this.required&&!e){this.error=this.requiredError||"This field is required.";return}if(!this.pattern||!e&&!this.required)return;if(this.pattern.test(e)){this.error=""}else{this.error=this.patternError||"Invalid format."}}render(){return s("label",{key:"db7e5910f650055747d1f2bca13356d2c3fe3f9e",part:"ic__label",class:{error:!!this.error}},this.label&&s("p",null,s("span",{class:"label"},this.label),this.required&&s("span",{class:"required"},"*")),s("div",{key:"81d0a723cec27805587e2abdac667504d078e211",part:"ic__input_wrapper",class:"input_wrapper"},s("input",{key:"948cf92087a3763d058588c8f6b7764e96234595",type:"date",name:this.name,part:"ic__date",readOnly:this.readOnly,autoFocus:this.autoFocus,value:this.value,maxLength:this.maxLength,placeholder:this.placeholder,class:{error:!!this.error},onInput:e=>this.handleInput(e),onFocus:()=>this.handleFocus(),onBlur:()=>this.handleBlur()}),s("slot",{key:"6c1d31a29dc01621d9212a95574c329844da0eed",name:"additional-input"})),this.error&&s("span",{class:"error help-text"},this.error))}get el(){return r(this)}static get watchers(){return{defaultValue:["handleDefaultValueChange"]}}};c.style=h;const b='.radio-group{display:flex;flex-direction:column;gap:0.5rem;--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}.radio-group slot[name=label]{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;font-size:16px}.radio-group slot[name=label].error{color:var(--nylas-error)}.radio-group slot[name=label] span.required{color:var(--nylas-error);padding:0 0.25rem}.radio-group slot[name=label] p{margin:0}.radio-group slot[name=label] p.error{color:var(--nylas-error)}.radio-group slot[name=label] .error{color:var(--nylas-error)}.radio-group span.error{color:var(--nylas-error);font-size:14px;font-weight:400;line-height:20px;font-family:var(--nylas-font-family)}.radio-group label{display:flex;font-family:var(--nylas-font-family);cursor:pointer}.radio-group label .radio-option{display:flex;align-items:flex-start;gap:0.5rem}.radio-group label .radio-option input[type=radio]{cursor:pointer}.radio-group label .radio-option input[type=radio i]{width:20px;height:20px;color:var(--nylas-primary)}.radio-group label .radio-option p{display:flex;flex-direction:column;gap:0.5rem;margin:0}.radio-group label .radio-option p .title{font-size:16px;font-weight:500;line-height:20px;color:var(--nylas-base-800)}.radio-group label .radio-option p .description{font-size:14px;font-weight:400;line-height:20px;color:var(--nylas-base-600)}';const p=b;const f=class{constructor(s){e(this,s);this.nylasFormRadioChanged=a(this,"nylasFormRadioChanged",7);this.componentType="radio-group";this.name="radio-group";this.options=[];this.defaultSelectedValue="";this.label=undefined;this.required=false;this.selectedValue=undefined;this.error=""}handleDefaultSelectedValueChange(e){this.selectedValue=e}componentDidLoad(){this.selectedValue=this.defaultSelectedValue}handleBookingFormSubmitted(e){if(this.required&&!this.selectedValue){this.error=`${this.label} is required.`;return}if(this.error){e.preventDefault()}}componentWillLoad(){this.el.setAttribute("component-type",this.componentType)}handleChange(e){this.error="";this.selectedValue=e;this.nylasFormRadioChanged.emit({value:e,name:this.name,label:this.label})}render(){return s("div",{key:"42720c3b8d691a39d7667afe105c9fa8dd12c1a5",class:"radio-group"},s("slot",{key:"6b2771531918f8391b9cd53625ae7e3194754008",name:"label"},this.label&&s("p",{class:{error:!!this.error}},s("span",{class:"label"},this.label),this.required&&s("span",{class:"required"},"*"))),this.options.map((e=>s("label",null,s("div",{class:"radio-option"},s("input",{type:"radio",name:this.name,value:e.value,checked:this.selectedValue===e.value,onChange:()=>this.handleChange(e.value)}),s("p",null,s("span",{class:"title"},e.label),s("span",{class:"description"},e.description)))))),this.error&&s("span",{class:"error help-text"},this.error))}get el(){return r(this)}static get watchers(){return{defaultSelectedValue:["handleDefaultSelectedValueChange"]}}};f.style=p;export{n as checkbox_component,c as nylas_date_component,f as radio_button_group};
|
|
2
|
+
//# sourceMappingURL=p-1a9fc29a.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["checkboxComponentCss","CheckboxComponentStyle0","CheckboxComponent","this","componentType","checkedPropChangedHandler","newValue","isChecked","componentWillLoad","el","setAttribute","componentDidLoad","checked","handleBookingFormSubmitted","event","required","error","label","preventDefault","toggleCheck","nylasFormCheckboxToggled","emit","name","render","h","key","class","type","onChange","nylasDateComponentCss","NylasDateComponentStyle0","DefaultPlaceholder","date","NylasDateComponent","handleDefaultValueChange","value","sanitize","validatePattern","defaultValue","handleFormSubmitted","handleInput","e","target","isDateValid","validity","valid","nylasFormInputChanged","handleBlur","nylasFormInputBlurred","handleFocus","nylasFormInputFocused","requiredError","pattern","test","patternError","part","readOnly","autoFocus","maxLength","placeholder","onInput","onFocus","onBlur","radioButtonGroupCss","RadioButtonGroupStyle0","RadioButtonGroup","handleDefaultSelectedValueChange","selectedValue","defaultSelectedValue","handleChange","nylasFormRadioChanged","options","map","option","description"],"sources":["src/components/design-system/checkbox-component/checkbox-component.scss?tag=checkbox-component&encapsulation=shadow","src/components/design-system/checkbox-component/checkbox-component.tsx","src/components/design-system/nylas-date-component/nylas-date-component.scss?tag=nylas-date-component&encapsulation=shadow","src/components/design-system/nylas-date-component/nylas-date-component.tsx","src/components/design-system/radio-button-group/radio-button-group.scss?tag=radio-button-group&encapsulation=shadow","src/components/design-system/radio-button-group/radio-button-group.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n.checkbox-container {\n @include default-css-variables;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n p.error {\n color: var(--nylas-error);\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n font-family: var(--nylas-font-family);\n margin: 0;\n }\n}\n\nlabel {\n display: flex;\n align-items: center;\n font-family: var(--nylas-font-family);\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n\n input[type='checkbox'] {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n\n &:focus ~ .checkmark,\n &:hover ~ .checkmark {\n border-color: var(--nylas-primary);\n }\n\n &:checked ~ .checkmark {\n color: var(--nylas-base-0);\n background: var(--nylas-primary)\n url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnIHdpZHRoPSIxMiIgaGVpZ2h0PSI5IiB2aWV3Qm94PSIwIDAgMTIgOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPHBhdGggZD0iTTQuNTc1IDguOTc3cy0uNDA0LS4wMDctLjUzNi0uMTY1TC4wNTcgNS42NGwuODI5LTEuMjI3TDQuNDcgNy4yNjggMTAuOTIxLjA4NmwuOTIzIDEuMTAzLTYuODYzIDcuNjRjLS4xMzQtLjAwMy0uNDA2LjE0OC0uNDA2LjE0OHoiIGZpbGw9IiNGRkYiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPg0KPC9zdmc+)\n 50% 40% no-repeat;\n border: 2px solid var(--nylas-primary);\n }\n }\n\n .checkmark {\n border-radius: var(--nylas-border-radius);\n border: 2px solid var(--nylas-base-800);\n position: absolute;\n left: 0;\n top: 2px;\n width: 18px;\n height: 18px;\n cursor: pointer;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .label {\n margin-left: 32px;\n font-size: 16px;\n font-weight: 400;\n color: var(--nylas-base-800);\n line-height: 24px;\n }\n}\n","import { Component, h, Prop, State, Event, EventEmitter, Listen, Element, Watch } from '@stencil/core';\n\n/**\n * The `checkbox-component` component is a UI component that allows users to select a checkbox.\n * This component is used in the scheduling form to input checkbox type inputs.\n */\n@Component({\n tag: 'checkbox-component',\n styleUrl: 'checkbox-component.scss',\n shadow: true,\n})\nexport class CheckboxComponent {\n @Element() el!: HTMLElement;\n private readonly componentType: string = 'checkbox';\n\n /**\n * The name of the checkbox. This is used to identify the checkbox when submitting a form.\n */\n @Prop() name: string = 'checkbox';\n /**\n * The default value of the checkbox. This is the value that is displayed when the checkbox is rendered.\n */\n @Prop() checked?: boolean;\n /**\n * The label of the checkbox. This is displayed next to the checkbox.\n */\n @Prop() label: string = '';\n /**\n * Whether the checkbox is required. If true, the checkbox must be checked when submitting a form.\n * Default is false. If the checkbox is required and not checked, an error message is displayed.\n */\n @Prop() required: boolean = false;\n /**\n * The checked state of the checkbox.\n */\n @State() isChecked!: boolean;\n /**\n * The error message state.\n */\n @State() error: string = '';\n\n /**\n * This event is fired when the checkbox is toggled.\n */\n @Event() nylasFormCheckboxToggled!: EventEmitter<{\n checked: boolean;\n name: string;\n label: string;\n }>;\n\n @Watch('checked')\n checkedPropChangedHandler(newValue: boolean) {\n if (typeof newValue === 'boolean') {\n this.isChecked = newValue;\n }\n }\n\n // Lifecycle events\n componentWillLoad() {\n this.el.setAttribute('component-type', this.componentType);\n }\n\n componentDidLoad() {\n this.isChecked = this.checked || false;\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n if (this.required && !this.isChecked) {\n this.error = `${this.label} is required.`;\n return;\n }\n if (this.error) {\n event.preventDefault();\n }\n }\n\n // Methods\n toggleCheck() {\n this.error = '';\n this.isChecked = !this.isChecked;\n this.nylasFormCheckboxToggled.emit({\n checked: this.isChecked,\n name: this.name,\n label: this.label,\n });\n }\n\n render() {\n return (\n <div class=\"checkbox-container\">\n <label>\n <input type=\"checkbox\" name={this.name} checked={this.isChecked} onChange={() => this.toggleCheck()} />\n <span class=\"checkmark\"></span>\n <slot name=\"label\">\n <span class=\"label\">{this.label}</span>\n </slot>\n </label>\n {this.error && <p class=\"error\">{this.error}</p>}\n </div>\n );\n }\n}\n","@import '../../../common/styles/variables.scss';\n@import '../../../common/mixins/inputs.scss';\n\n:host {\n display: block;\n height: auto;\n @include default-css-variables;\n width: 100%;\n}\n\nlabel {\n @include input-label;\n flex-direction: column;\n gap: 4px;\n font-family: var(--nylas-font-family);\n font-size: 16px;\n color: var(--nylas-base-800);\n\n p {\n margin: 0;\n }\n\n .error {\n color: var(--nylas-error);\n }\n}\n\n.input_wrapper {\n display: flex;\n align-items: center;\n gap: 1rem;\n}\n\ninput[type='date'] {\n @include textfield;\n width: 100%;\n width: -moz-available;\n width: -webkit-fill-available;\n}\n","import { Component, h, Prop, State, Event, EventEmitter, Listen, Watch, Element } from '@stencil/core';\nimport { sanitize } from '@/utils/utils';\n\nconst DefaultPlaceholder = {\n date: 'YYYY-MM-DD',\n};\n\n/**\n * The `nylas-date-component` component is a UI component that allows users to input text, email, or phone number values.\n * This component is used in the scheduling form to input text, email and phone number type inputs.\n */\n\n@Component({\n tag: 'nylas-date-component',\n styleUrl: 'nylas-date-component.scss',\n shadow: true,\n})\nexport class NylasDateComponent {\n /**\n * The host element\n */\n @Element() el!: HTMLElement;\n /**\n * The name of the input. This is used to identify the input when submitting a form.\n */\n @Prop() name: string = 'input';\n /**\n * The default value of the input. This is the value that is displayed when the input is rendered.\n */\n @Prop() defaultValue?: string;\n /**\n * The label of the input. This is displayed above the input.\n */\n @Prop() label: string = '';\n\n /**\n * The placeholder of the input. This is displayed when the input is empty.\n */\n @Prop() placeholder: string = DefaultPlaceholder['date'];\n /**\n * Whether the input is required. If true, the input must have a value when submitting a form.\n * Default is false. If the input is required and the value is empty, an error message is displayed.\n */\n @Prop() required: boolean = false;\n /**\n * Whether the input is read-only. If true, the input cannot be edited.\n * Default is false.\n */\n @Prop() readOnly: boolean = false;\n /**\n * Whether the input should be focused when rendered.\n * Default is false. If true, the input is focused when rendered.\n * Use this to set the focus on the first input in a form.\n */\n @Prop() autoFocus: boolean = false;\n /**\n * The pattern to validate the input value. If the value does not match the pattern, an error message is displayed.\n * Default is null. If the pattern is not set, the pattern is determined by the input type for 'email' and 'phone_number'.\n */\n @Prop() pattern?: RegExp;\n /**\n * The maximum length of the input value. If the value is longer than the maximum length, an error message is displayed.\n * Default is 255.\n */\n @Prop() maxLength: number = 255;\n /**\n * The error message to display when the value does not match the pattern.\n * Default is 'Invalid <field> format.' where <field> is the input label.\n */\n @Prop() patternError: string = '';\n\n /**\n * This error message is displayed when the input value is empty and the input is required.\n */\n @Prop() requiredError: string = '';\n\n /**\n * The input value state.\n */\n @State() value!: string;\n /**\n * The error message state.\n */\n @State() error: string = '';\n\n /**\n * State to track the validity of the date input.\n */\n @State() isDateValid: boolean = true;\n\n /**\n * This event is fired when the input value is changed.\n * The scheduling form listens for this event to validate the input value and submit the form.\n * If using outside of the scheduling form, listen for this event to validate the input value\n * and handle the input value change.\n */\n @Event() nylasFormInputChanged!: EventEmitter<{\n value: string;\n name: string;\n label: string;\n type: string;\n error: string;\n }>;\n\n @Event() nylasFormInputFocused!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n @Event() nylasFormInputBlurred!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n // Lifecycle methods\n @Watch('defaultValue')\n handleDefaultValueChange(newValue: string) {\n this.value = sanitize(newValue);\n if (this.value) {\n this.validatePattern(this.value);\n }\n }\n\n componentDidLoad() {\n this.value = sanitize(this.defaultValue || '');\n if (this.value) {\n this.validatePattern(this.value);\n }\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n this.validatePattern(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n\n @Listen('formSubmitted', { target: 'document' })\n async handleFormSubmitted(event: CustomEvent) {\n this.validatePattern(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n\n // Methods\n handleInput(e: Event) {\n this.error = '';\n const target = e.target as HTMLInputElement;\n this.value = sanitize(target.value);\n this.isDateValid = target.validity.valid;\n this.nylasFormInputChanged.emit({\n value: this.value,\n name: this.name,\n label: this.label,\n error: this.error,\n type: 'date',\n });\n }\n\n handleBlur() {\n this.nylasFormInputBlurred.emit({\n value: this.value,\n name: this.name,\n });\n }\n\n handleFocus() {\n this.nylasFormInputFocused.emit({\n value: this.value,\n name: this.name,\n });\n }\n\n validatePattern(value: string) {\n // Reset error\n this.error = '';\n if (!this.isDateValid) {\n this.error = 'Please enter a valid date';\n return;\n }\n // Check if the field is required and value is empty\n if (this.required && !value) {\n this.error = this.requiredError || 'This field is required.';\n return;\n }\n // Check if value matches pattern\n if (!this.pattern || (!value && !this.required)) return;\n\n if (this.pattern.test(value)) {\n this.error = '';\n } else {\n this.error = this.patternError || 'Invalid format.';\n }\n }\n\n render() {\n return (\n <label part=\"ic__label\" class={{ error: !!this.error }}>\n {this.label && (\n <p>\n <span class=\"label\">{this.label}</span>\n {this.required && <span class=\"required\">*</span>}\n </p>\n )}\n <div part=\"ic__input_wrapper\" class=\"input_wrapper\">\n <input\n type=\"date\"\n name={this.name}\n part=\"ic__date\"\n readOnly={this.readOnly}\n autoFocus={this.autoFocus}\n value={this.value}\n maxLength={this.maxLength}\n placeholder={this.placeholder}\n class={{ error: !!this.error }}\n onInput={e => this.handleInput(e)}\n onFocus={() => this.handleFocus()}\n onBlur={() => this.handleBlur()}\n />\n <slot name=\"additional-input\"></slot>\n </div>\n {this.error && <span class=\"error help-text\">{this.error}</span>}\n </label>\n );\n }\n}\n","@import '../../../common/styles/variables.scss';\n@import '../../../common/mixins/inputs.scss';\n\n.radio-group {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n @include default-css-variables;\n\n slot[name='label'] {\n @include input-label;\n font-size: 16px;\n\n p {\n margin: 0;\n\n &.error {\n color: var(--nylas-error);\n }\n }\n\n .error {\n color: var(--nylas-error);\n }\n }\n\n span.error {\n color: var(--nylas-error);\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n font-family: var(--nylas-font-family);\n }\n\n label {\n display: flex;\n\n font-family: var(--nylas-font-family);\n cursor: pointer;\n\n .radio-option {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n\n input[type='radio'] {\n cursor: pointer;\n }\n\n input[type='radio' i] {\n width: 20px;\n height: 20px;\n color: var(--nylas-primary);\n }\n\n p {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n margin: 0;\n\n .title {\n font-size: 16px;\n font-weight: 500;\n line-height: 20px;\n color: var(--nylas-base-800);\n }\n\n .description {\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n }\n }\n }\n }\n}\n","// src/components/radio-group/radio-group.tsx\nimport { Component, h, Prop, State, Event, EventEmitter, Listen, Element, Watch } from '@stencil/core';\n\n/**\n * The `radio-button-group` component is a UI component that allows users to select a single option from a list of options.\n * This component is used in the scheduling form to input radio button type inputs.\n */\n@Component({\n tag: 'radio-button-group',\n styleUrl: 'radio-button-group.scss',\n shadow: true,\n})\nexport class RadioButtonGroup {\n @Element() el!: HTMLElement;\n private readonly componentType: string = 'radio-group';\n\n /**\n * The name of the radio group. This is used to identify the radio group when submitting a form.\n */\n @Prop() name: string = 'radio-group';\n /**\n * The list of options in the radio group.\n * Each option has a label and a value and an optional description.\n */\n @Prop() options: { label: string; value: string; description?: string }[] = [];\n /**\n * The default selected value of the radio group.\n */\n @Prop({ attribute: 'default-selected-value' }) defaultSelectedValue: string = '';\n /**\n * The label of the radio group. This is displayed above the radio group.\n * Label is optional. You can also use the slot 'label' to add a label.\n */\n @Prop() label?: string;\n /**\n * Whether the radio group is required. If true, the radio group must have a value when submitting a form.\n * Default is false. If the radio group is required and the value is empty, an error message is displayed.\n */\n @Prop() required: boolean = false;\n /**\n * The selected value of the radio group.\n */\n @State() selectedValue!: string;\n /**\n * The error message state.\n */\n @State() error: string = '';\n /**\n * This event is fired when the selected value changes.\n */\n @Event() nylasFormRadioChanged!: EventEmitter<{\n value: string;\n name: string;\n label?: string;\n }>;\n\n @Watch('defaultSelectedValue')\n handleDefaultSelectedValueChange(newValue: string) {\n this.selectedValue = newValue;\n }\n\n // Lifecycle methods\n componentDidLoad() {\n this.selectedValue = this.defaultSelectedValue;\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n if (this.required && !this.selectedValue) {\n this.error = `${this.label} is required.`;\n return;\n }\n if (this.error) {\n event.preventDefault();\n }\n }\n\n componentWillLoad() {\n this.el.setAttribute('component-type', this.componentType);\n }\n\n handleChange(value: string) {\n this.error = '';\n this.selectedValue = value;\n this.nylasFormRadioChanged.emit({\n value,\n name: this.name,\n label: this.label,\n });\n }\n\n render() {\n return (\n <div class=\"radio-group\">\n <slot name=\"label\">\n {this.label && (\n <p class={{ error: !!this.error }}>\n <span class=\"label\">{this.label}</span>\n {this.required && <span class=\"required\">*</span>}\n </p>\n )}\n </slot>\n {this.options.map(option => (\n <label>\n <div class=\"radio-option\">\n <input type=\"radio\" name={this.name} value={option.value} checked={this.selectedValue === option.value} onChange={() => this.handleChange(option.value)} />\n <p>\n <span class=\"title\">{option.label}</span>\n <span class=\"description\">{option.description}</span>\n </p>\n </div>\n </label>\n ))}\n {this.error && <span class=\"error help-text\">{this.error}</span>}\n </div>\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,c as s,h as e,H as n,a as i}from"./p-68c2fadf.js";import{N as o,e as r}from"./p-5952bf42.js";import{a as h}from"./p-05f97bb8.js";import{N as a,C as c}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,c as s,h as e,H as n,a as i}from"./p-68c2fadf.js";import{N as o,e as r}from"./p-5952bf42.js";import{a as h}from"./p-05f97bb8.js";import{N as a,C as c}from"./p-53f7b360.js";import{c as u}from"./p-cabb2e68.js";import{C as d}from"./p-4deaa6f5.js";class l{constructor(t,s){this.nylasAuth=t;this.nylasAuthStore=s}async validateSession(){const t=await this.isAccessTokenValid();if(!t){this.logout()}else{let t=await this.nylasAuth.getTokenInfo();if(t){const s=5*60*1e3;const e=Math.floor(Date.now()/1e3);if(t.expires_in&&t.expires_in-e<s){h("[NylasAuthConnectorMixin] Refreshing access token");t=await this.nylasAuth.refreshAccessToken();if(!t){h("[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out.");this.logout();return}}this.nylasAuthStore.state.tokenInfo=t}}this.nylasAuthStore.state.isAuthenticated=t}async isAuthenticated(){return this.nylasAuth.isAuthenticated()}async getTokenInfo(){return this.nylasAuth.getTokenInfo()}async isAccessTokenValid(){return this.nylasAuth.isAccessTokenValid()}async logout(){await this.nylasAuth.logout()}async getHostedAuthRedirectURL(t,s,e){return this.nylasAuth.getHostedAuthRedirectURL(t,s,e)}async manageHostedAuthCodeExchange(t){const s=new URL(t);const e=s.searchParams.get("code");if(e){const t=await this.nylasAuth.exchangeAuthCodeForTokenInfo(e);if(t){this.nylasAuthStore.state.tokenInfo=t;this.nylasAuthStore.state.isAuthenticated=true;return t}}return null}}class f{constructor(t,s,e,n,i,o="https://api.us.nylas.com"){this.router=t;this.schedulerAPIURL=o;this.nylasAuth=s;this.nylasAuthStore=e;this.nylasSchedulerStore=n;this.nylasSchedulerConfigStore=i}init(){h("NylasConnector init")}get authStore(){return this.nylasAuthStore}get schedulerStore(){return this.nylasSchedulerStore}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get auth(){if(this._authConnector){return this._authConnector}this._authConnector=new l(this.nylasAuth,this.nylasAuthStore);return this._authConnector}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new a({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore});return this._schedulerAPIConnector}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset()}async logout(){await this.nylasAuth.logout();this.resetStores()}}class g extends Event{constructor(t,s){super(t,s);this.oldURL=s.oldURL;this.newURL=s.newURL}}class w{constructor(){this.routeChangeListeners=[];h("HashRouter constructor")}destroy(){h("HashRouter destroy");window.removeEventListener("hashchange",this.onRouteChange.bind(this))}init(){h("HashRouter init");window.addEventListener("hashchange",this.onRouteChange.bind(this));if(typeof HashChangeEvent!=="undefined"){const t=new HashChangeEvent("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}else{const t=new g("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}}addRouteChangeListener(t,s){h("HashRouter addRouteChangeListener");this.routeChangeListeners.push([t,s])}navigate(t,s){h("HashRouter navigate");if(s){return window.history.pushState(null,"",`#${t}`)}window.location.hash=t}setRoute(t){h("HashRouter setRoute");window.location.hash=t}matchRoute(t,s){const e=t.split("/");const n=s.split("/");h(`HashRouter matchRoute route=${t} path=${s}`,{routeParts:e,pathParts:n});if(e[1]===""&&n[0]===""){return true}if(e.length!==n.length){return false}for(let t=0;t<e.length;t++){const s=e[t];const i=n[t];if(s.startsWith(":")){continue}if(s!==i){return false}}return true}getRouteParams(t){h("HashRouter getRouteParams");const s={};const e=t.split("/");const n=window.location.hash.split("/");e.forEach(((t,e)=>{if(t.startsWith(":")){const i=t.substring(1);s[i]=n[e]}}));return s}getRouteWithParams(t,s){h("HashRouter getRouteWithParams");let e=t;Object.keys(s).forEach((t=>{e=e.replace(`:${t}`,s[t])}));return e}getRoute(){h("HashRouter getRoute");return window.location.hash}onRouteChange(t){this.routeChangeListeners.forEach((async([s,e])=>{const n=t.newURL.indexOf("#")===-1?"":t.newURL.substring(t.newURL.indexOf("#")+1);h(`HashRouter onRouteChange route=${s} path=${n}`,{event:t});if(!this.matchRoute(s,n)){h(`HashRouter onRouteChange route=${s} path=${n} does not match`);return}const i=this.getRouteParams(s);await e(s,n,i)}))}getBasePath(){h("HashRouter getBasePath");return""}}function p(t={}){const s={isAuthenticated:false,tokenInfo:null,state:"ready",...t};const e=u(s);e.reset=()=>{for(const t in s){const n=s[t];e.set(t,n)}};return e}const y=":host{display:contents}";const R=y;const m=class{constructor(e){t(this,e);this.init=s(this,"init",7);this.loggedIn=s(this,"loggedIn",7);this.loggedOut=s(this,"loggedOut",7);this.handleAuthChange=async t=>{if(t){this.loggedIn.emit(this.host)}else{this.loggedOut.emit(this.host)}};this.authConfig=undefined;this.eventOverrides={};this.automaticComponentRegistration=true}connectedCallback(){h("[nylas-provider] connectedCallback")}async componentWillLoad(){h("[nylas-provider] componentWillLoad");this.stores={auth:p(),scheduler:c(),schedulerConfig:d()};this.baseProvider=new o(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=new w;this.nylasAuth=r({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const s=this.baseProvider?.getStore("auth");if(!s){throw new Error("The auth store is not set")}const e=this.baseProvider?.getStore("scheduler");if(!e){throw new Error("The scheduler store is not set")}const n=this.baseProvider?.getStore("schedulerConfig");if(!n){throw new Error("The scheduler config store is not set")}this.nylasConnector=new f(t,this.nylasAuth,s,e,n);const i=this.init.emit(this.host);if(!i.defaultPrevented){await(this.nylasConnector?.auth.validateSession())}this.handleAuthChange(s.state.isAuthenticated);this.baseProvider?.componentWillLoad(this.nylasConnector)}componentDidLoad(){const t=this.baseProvider?.getStore("auth");t?.onChange("isAuthenticated",this.handleAuthChange);this.baseProvider?.componentDidLoad()}componentDisconnected(){this.baseProvider?.componentDisconnected()}async registerComponentHandler(t){this.baseProvider?.registerComponent(t.detail)}async unregisterComponentHandler(t){this.baseProvider?.unregisterComponent(t.detail)}async getNylasAuth(){return this.nylasAuth}async getNylasConnector(){return this.nylasConnector}async getAuthStore(){return this.baseProvider?.getStore("auth")}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConfigStore(){return this.baseProvider?.getStore("schedulerConfig")}render(){return e(n,{key:"82c0167bdd5019a3fd06b54386434cbd56ad110b"},e("slot",{key:"53285ea8cf7a9ae1e2f8873aa6610b9caa8e9780"}))}get host(){return i(this)}};m.style=R;export{m as nylas_provider};
|
|
2
|
+
//# sourceMappingURL=p-1dedce7c.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as t,b as e,a as i}from"./p-05f97bb8.js";import{c as n}from"./p-cabb2e68.js";var s;(function(t){t["Component"]="component";t["Api"]="api";t["Auth"]="auth"})(s||(s={}));var o;(function(t){t["endtime_not_in_future"]="endtime_not_in_future";t["no_booking_info"]="no_booking_info";t["no_timeslot_selected"]="no_timeslot_selected";t["no_timezone_selected"]="no_timezone_selected";t["no_booking_id"]="no_booking_id";t["no_salt"]="no_salt";t["invalid_start_time"]="invalid_start_time";t["invalid_end_time"]="invalid_end_time";t["invalid_timezone"]="invalid_timezone"})(o||(o={}));var r;(function(t){t["invalid_session"]="invalid_session";t["general_error"]="general_error";t["internal_error"]="internal_error";t["invalid_request_error"]="invalid_request_error";t["timeslot_not_available"]="timeslot_not_available";t["provider_error"]="provider_error";t["not_found_error"]="not_found_error"})(r||(r={}));class a{constructor(){this.component=t=>{const e=s.Component;const i=`${t} Error`;return{endtime_not_in_future:(t='"endtime" can not be in the future')=>({title:i,message:t,category:e}),no_booking_info:(t="No booking info provided")=>({title:i,message:t,category:e}),no_timeslot_selected:(t="No timeslot selected")=>({title:i,message:t,category:e}),no_timezone_selected:(t="No timezone selected")=>({title:i,message:t,category:e}),no_booking_id:(t="No booking id provided")=>({title:i,message:t,category:e}),no_salt:(t="No salt provided")=>({title:i,message:t,category:e}),invalid_start_time:(t="Invalid start time")=>({title:i,message:t,category:e}),invalid_end_time:(t="Invalid end time")=>({title:i,message:t,category:e}),invalid_timezone:(t="Invalid timezone")=>({title:i,message:t,category:e})}};this.api=t=>{const e=s.Api;const i=`${t} Error`;return{invalid_session:t=>({title:i,message:t,category:e}),general_error:t=>({title:i,message:t,category:e}),internal_error:t=>({title:i,message:t,category:e}),invalid_request_error:t=>({title:i,message:t,category:e}),timeslot_not_available:t=>({title:i,message:t,category:e}),provider_error:t=>({title:i,message:t,category:e}),not_found_error:t=>({title:i,message:t,category:e})}}}}class c{constructor({schedulerAPIURL:t,schedulerStore:e,sessionId:i,configId:n,slug:s,clientId:o}){this.errors=new a;this.schedulerStore=e;this.schedulerAPIURL=t;this.sessionId=i;this.configId=n;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(t,e,i,n={}){try{const s=new URL(this.schedulerAPIURL);const o="1.3.2";s.pathname=t;const r=await fetch(decodeURIComponent(s.toString()),{method:e,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":o,...n},body:i});const a=await r.json();return a}catch(t){return{error:{message:t.message,title:"API request failed",type:"api"}}}}getErrorMessage(t){let e=t?.message||t?.title||"Something went wrong";if(t?.type==="provider_error"){e=t?.provider_error?.error?.message||t?.provider_error?.error?.title||"Something went wrong"}return e}setConfigId(t){this.configId=t}selectDate(t){this.schedulerStore.set("selectedDate",t);this.schedulerStore.set("selectedTimeslot",null)}selectTime(t){this.schedulerStore.set("selectedTimeslot",t)}selectTimezone(t){this.schedulerStore.set("selectedTimezone",t)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e);t.changeLanguage(e)}async toggleAdditionalData(t){if(!t){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",t)}setParticipantName(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e?.primaryParticipant,name:t}})}setParticipantEmail(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e?.primaryParticipant,email:t}})}async refetchAvailability(){const t=new Date;const e=new Date(t.getFullYear(),t.getMonth(),1).getTime()/1e3;const i=e<t.getTime()/1e3?Math.floor(t.getTime()/1e3):e;const n=new Date(t.getFullYear(),t.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(i,n);return s}async resetStoreStateAndFetchAvailability(){const t=new Date;const e=await this.refetchAvailability();const i=this.schedulerStore.get("availability").find((t=>new Date(t.start_time)>new Date));let n=t;if(i){n=i.start_time}this.schedulerStore.set("selectedDate",n);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return e}async setReschedule(t){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.state.eventInfo;if(e){this.schedulerStore.set("reschedulingEventInfo",e)}this.schedulerStore.set("rescheduleBookingId",t);await this.getUISettings();const i=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return i}async setCancel(t){this.schedulerStore.set("cancelBookingId",t)}async setReject(t){this.schedulerStore.set("rejectBookingId",t)}async resetCancel(){const t=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return t}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const t=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return t}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:i,selectedTimezone:n,bookingInfo:s,selectedLanguage:o}=this.schedulerStore.state;if(!e&&!s){return{error:this.errors.component(t.t("createBookingErrorTitle")).no_booking_info()}}const r=e?.timeslot||i;if(!r){return{error:this.errors.component(t.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:n;const c=o||"en-US";if(!a){return{error:this.errors.component(t.t("createBookingErrorTitle")).no_timezone_selected()}}const l=this.schedulerStore.get("availabilityOrderEmails");let h="";if(l.length>0){const t=r?.emails||[];for(let e=0;e<l.length;e++){if(t.includes(l[e])){h=l[e];break}}}const d={};Object.entries(s?.additionalFields||{}).forEach((([t,e])=>{d[t]=e.value}));const g=e?e?.primaryParticipant:s?.primaryParticipant;const u=e?e?.guests||[]:s?.guests||[];const f=e?e?.additionalFields:d;const m=this.getHeaders();const _=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const v=`/v3/scheduling/bookings${_}`;const y=await this.makeAPIRequest(decodeURIComponent(v),"POST",JSON.stringify({participants:h?[{email:h}]:undefined,additional_fields:f,additional_guests:u,guest:{...g},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(c)}),m);if("error"in y){this.schedulerStore.set("isLoading",false);const t=y.error?.type;let e=y.error;if(t&&t in this.errors.api("Create Booking")){const i=this.getErrorMessage(e);e=this.errors.api("Create Booking")[t](i)}return{error:e}}if("data"in y){this.schedulerStore.set("eventInfo",y?.data)}this.schedulerStore.set("isLoading",false);return y}async getUISettings(){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.get("rescheduleBookingId");const i=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(e&&!!n){n+=`&booking_id=${e}`}else if(e){n+=`?booking_id=${e}`}const s=`/v3/scheduling/ui-settings${n}`;const o=await this.makeAPIRequest(s,"GET",undefined,i);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let i=o.error;if(e&&e in this.errors.api(t.t("getUISettingErrorTitle"))){i=this.errors.api(t.t("getUISettingErrorTitle"))[e](i?.message||i?.title||"Something went wrong")}return{error:i}}if("data"in o){this.schedulerStore.set("configSettings",o.data)}this.schedulerStore.set("isLoading",false);return o}getTwoLetterLanguageCode(t){return t.split("-")[0]}getStartTimeWithMinBookingNotice(t){const e=this.schedulerStore.get("configSettings")?.scheduler;const i=e?.min_booking_notice;if(!i){return t}const n=(new Date).getTime();if(t<(n+i*60*1e3)/1e3){return Math.floor((n+i*60*1e3)/1e3)}else{return t}}getEndTimeForAvailableDaysInFuture(t){const i=new Date;const n=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const s=Math.floor(e(i,n).getTime()/1e3);const o=Math.min(s,t);return o}async getAvailability(e=0,i=0){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const s=new Date;const o=s.getTime();if(i&&i<o/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(t.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(s.getFullYear(),s.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!i){const t=new Date(s.getFullYear(),s.getMonth()+1,0);i=Math.floor(t.getTime()/1e3)}i=this.getEndTimeForAvailableDaysInFuture(i);const r=this.getStartTimeWithMinBookingNotice(e);e=r;i=r>i?r+1:i;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(i.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const a=this.schedulerStore.get("rescheduleBookingId");if(a){n.append("booking_id",encodeURIComponent(a))}const c=n.toString();const l=`/v3/scheduling/availability${c?`?${c}`:""}`;const h=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(l),"GET",undefined,h);if("error"in d){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=d.error?.type;let i=d.error;if(e&&e in this.errors.api(t.t("getAvailabilityErrorTitle"))){const n=this.getErrorMessage(i);i=this.errors.api(t.t("getAvailabilityErrorTitle"))[e](n)}return{error:i}}if("data"in d){const t=d.data?.time_slots?.map((t=>({...t,start_time:new Date(t.start_time*1e3),end_time:new Date(t.end_time*1e3)})))||[];const e=t.filter((t=>t.start_time.getTime()>o));this.schedulerStore.set("availability",e);const i=d.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",i)}this.schedulerStore.set("isLoading",false);return d}async cancelBooking(e,i){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(t.t("cancelBookingErrorTitle")).no_booking_id()}}const n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const s=`/v3/scheduling/bookings/${e}${n}`;const o=this.getHeaders();const r=await this.makeAPIRequest(decodeURIComponent(s),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:i}),o);if("error"in r){this.schedulerStore.set("isLoading",false);const e=r.error?.type;let i=r.error;if(e&&e in this.errors.api(t.t("cancelBookingErrorTitle"))){const n=this.getErrorMessage(i);i=this.errors.api(t.t("cancelBookingErrorTitle"))[e](n)}return{error:i}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return r}async rescheduleBooking(e,i){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(t.t("rescheduleBookingErrorTitle")).no_booking_id()}}const n=this.errors.api(t.t("rescheduleBookingErrorTitle"));const s=this.errors.component(t.t("rescheduleBookingErrorTitle"));const{bookingInfo:o,selectedTimeslot:r,selectedTimezone:a,selectedLanguage:c}=this.schedulerStore.state;const{startTime:l,endTime:h,timezone:d}=i;const g=l||r?.start_time;if(!g){return{error:s.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=h||r?.end_time;if(!u){return{error:s.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=this.schedulerStore.get("availabilityOrderEmails");let m="";if(f.length>0){const t=r?.emails||[];for(let e=0;e<f.length;e++){if(t.includes(f[e])){m=f[e];break}}}const _=d||a;if(!_){return{error:s.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const v={};Object.entries(o?.additionalFields||{}).forEach((([t,e])=>{v[t]=e.value}));const y=i?i?.primaryParticipant:o?.primaryParticipant;const b=i?i?.guests||[]:o?.guests||[];const k=i?i?.additionalFields:v;const I=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const T=`/v3/scheduling/bookings/${e}${I}`;const p=this.getHeaders();const w=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:u.getTime()/1e3,timezone:_,additional_fields:k,guest:{...y},additional_guests:b,participants:m?[{email:m}]:undefined,email_language:this.getTwoLetterLanguageCode(c)}),p);if("error"in w){this.schedulerStore.set("isLoading",false);const t=w.error?.type;let e=w.error;if(t&&t in n){const i=this.getErrorMessage(e);e=n[t](i)}return{error:e}}const E=this.schedulerStore.get("reschedulingEventInfo");if("data"in w){this.schedulerStore.set("eventInfo",w?.data)}else if(E){this.schedulerStore.set("eventInfo",E)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("isLoading",false);return w}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:i,status:n,reason:s}=e;const o=this.schedulerStore.get("organizerConfirmationSalt");const r=n==="confirmed"?t.t("confirmBookingErrorTitle"):t.t("rejectBookingErrorTitle");if(!i){return{error:this.errors.component(r).no_booking_id()}}if(!o){return{error:this.errors.component(r).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const c=`/v3/scheduling/bookings/${i}${a}`;const l=this.getHeaders();const h=await this.makeAPIRequest(decodeURIComponent(c),"PUT",JSON.stringify({status:n,cancellation_reason:s,salt:o}),l);if("error"in h){this.schedulerStore.set("isLoading",false);const t=h.error?.type;let e=h.error;if(t&&t in this.errors.api(r)){const i=this.getErrorMessage(e);e=this.errors.api(r)[t](i)}return{error:e}}if("data"in h&&n==="confirmed"){this.schedulerStore.set("confirmedEventInfo",h?.data)}else if("request_id"in h&&n==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:i})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return h}}function l(t={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...t};i(`[defaultNylasStoreState]: `,e);const s=n(e);s.onChange("availability",(t=>{i(`[availability]: `,t);const e=t.map((t=>t.start_time));i(`[selectableDates]: `,e);s.set("selectableDates",e);const n=t[0];if(!n)return;const o=Math.floor((n.end_time.getTime()-n.start_time.getTime())/6e4);i(`[durationMinutes]: `,o);s.set("eventDuration",o)}));s.reset=()=>{for(const t in e){const i=e[t];s.set(t,i)}};return s}export{l as C,s as E,c as N};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{i as t,b as e,a as i}from"./p-05f97bb8.js";import{c as n}from"./p-cabb2e68.js";var s;(function(t){t["Component"]="component";t["Api"]="api";t["Auth"]="auth"})(s||(s={}));var o;(function(t){t["endtime_not_in_future"]="endtime_not_in_future";t["no_booking_info"]="no_booking_info";t["no_timeslot_selected"]="no_timeslot_selected";t["no_timezone_selected"]="no_timezone_selected";t["no_booking_id"]="no_booking_id";t["no_salt"]="no_salt";t["invalid_start_time"]="invalid_start_time";t["invalid_end_time"]="invalid_end_time";t["invalid_timezone"]="invalid_timezone"})(o||(o={}));var r;(function(t){t["invalid_session"]="invalid_session";t["general_error"]="general_error";t["internal_error"]="internal_error";t["invalid_request_error"]="invalid_request_error";t["timeslot_not_available"]="timeslot_not_available";t["provider_error"]="provider_error";t["not_found_error"]="not_found_error"})(r||(r={}));class a{constructor(){this.component=t=>{const e=s.Component;const i=`${t} Error`;return{endtime_not_in_future:(t='"endtime" can not be in the future')=>({title:i,message:t,category:e}),no_booking_info:(t="No booking info provided")=>({title:i,message:t,category:e}),no_timeslot_selected:(t="No timeslot selected")=>({title:i,message:t,category:e}),no_timezone_selected:(t="No timezone selected")=>({title:i,message:t,category:e}),no_booking_id:(t="No booking id provided")=>({title:i,message:t,category:e}),no_salt:(t="No salt provided")=>({title:i,message:t,category:e}),invalid_start_time:(t="Invalid start time")=>({title:i,message:t,category:e}),invalid_end_time:(t="Invalid end time")=>({title:i,message:t,category:e}),invalid_timezone:(t="Invalid timezone")=>({title:i,message:t,category:e})}};this.api=t=>{const e=s.Api;const i=`${t} Error`;return{invalid_session:t=>({title:i,message:t,category:e}),general_error:t=>({title:i,message:t,category:e}),internal_error:t=>({title:i,message:t,category:e}),invalid_request_error:t=>({title:i,message:t,category:e}),timeslot_not_available:t=>({title:i,message:t,category:e}),provider_error:t=>({title:i,message:t,category:e}),not_found_error:t=>({title:i,message:t,category:e})}}}}class c{constructor({schedulerAPIURL:t,schedulerStore:e,sessionId:i,configId:n,slug:s,clientId:o}){this.errors=new a;this.schedulerStore=e;this.schedulerAPIURL=t;this.sessionId=i;this.configId=n;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(t,e,i,n={}){try{const s=new URL(this.schedulerAPIURL);const o="1.3.3";s.pathname=t;const r=await fetch(decodeURIComponent(s.toString()),{method:e,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":o,...n},body:i});const a=await r.json();return a}catch(t){return{error:{message:t.message,title:"API request failed",type:"api"}}}}getErrorMessage(t){let e=t?.message||t?.title||"Something went wrong";if(t?.type==="provider_error"){e=t?.provider_error?.error?.message||t?.provider_error?.error?.title||"Something went wrong"}return e}setConfigId(t){this.configId=t}selectDate(t){this.schedulerStore.set("selectedDate",t);this.schedulerStore.set("selectedTimeslot",null)}selectTime(t){this.schedulerStore.set("selectedTimeslot",t)}selectTimezone(t){this.schedulerStore.set("selectedTimezone",t)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e);t.changeLanguage(e)}async toggleAdditionalData(t){if(!t){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",t)}setParticipantName(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e?.primaryParticipant,name:t}})}setParticipantEmail(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e?.primaryParticipant,email:t}})}async refetchAvailability(){const t=new Date;const e=new Date(t.getFullYear(),t.getMonth(),1).getTime()/1e3;const i=e<t.getTime()/1e3?Math.floor(t.getTime()/1e3):e;const n=new Date(t.getFullYear(),t.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(i,n);return s}async resetStoreStateAndFetchAvailability(){const t=new Date;const e=await this.refetchAvailability();const i=this.schedulerStore.get("availability").find((t=>new Date(t.start_time)>new Date));let n=t;if(i){n=i.start_time}this.schedulerStore.set("selectedDate",n);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return e}async setReschedule(t){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.state.eventInfo;if(e){this.schedulerStore.set("reschedulingEventInfo",e)}this.schedulerStore.set("rescheduleBookingId",t);await this.getUISettings();const i=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return i}async setCancel(t){this.schedulerStore.set("cancelBookingId",t)}async setReject(t){this.schedulerStore.set("rejectBookingId",t)}async resetCancel(){const t=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return t}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const t=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return t}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:i,selectedTimezone:n,bookingInfo:s,selectedLanguage:o}=this.schedulerStore.state;if(!e&&!s){return{error:this.errors.component(t.t("createBookingErrorTitle")).no_booking_info()}}const r=e?.timeslot||i;if(!r){return{error:this.errors.component(t.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:n;const c=o||"en-US";if(!a){return{error:this.errors.component(t.t("createBookingErrorTitle")).no_timezone_selected()}}const l=this.schedulerStore.get("availabilityOrderEmails");let h="";if(l.length>0){const t=r?.emails||[];for(let e=0;e<l.length;e++){if(t.includes(l[e])){h=l[e];break}}}const d={};Object.entries(s?.additionalFields||{}).forEach((([t,e])=>{d[t]=e.value}));const g=e?e?.primaryParticipant:s?.primaryParticipant;const u=e?e?.guests||[]:s?.guests||[];const f=e?e?.additionalFields:d;const m=this.getHeaders();const _=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const v=`/v3/scheduling/bookings${_}`;const y=await this.makeAPIRequest(decodeURIComponent(v),"POST",JSON.stringify({participants:h?[{email:h}]:undefined,additional_fields:f,additional_guests:u,guest:{...g},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(c)}),m);if("error"in y){this.schedulerStore.set("isLoading",false);const t=y.error?.type;let e=y.error;if(t&&t in this.errors.api("Create Booking")){const i=this.getErrorMessage(e);e=this.errors.api("Create Booking")[t](i)}return{error:e}}if("data"in y){this.schedulerStore.set("eventInfo",y?.data)}this.schedulerStore.set("isLoading",false);return y}async getUISettings(){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.get("rescheduleBookingId");const i=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(e&&!!n){n+=`&booking_id=${e}`}else if(e){n+=`?booking_id=${e}`}const s=`/v3/scheduling/ui-settings${n}`;const o=await this.makeAPIRequest(s,"GET",undefined,i);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let i=o.error;if(e&&e in this.errors.api(t.t("getUISettingErrorTitle"))){i=this.errors.api(t.t("getUISettingErrorTitle"))[e](i?.message||i?.title||"Something went wrong")}return{error:i}}if("data"in o){this.schedulerStore.set("configSettings",o.data)}this.schedulerStore.set("isLoading",false);return o}getTwoLetterLanguageCode(t){return t.split("-")[0]}getStartTimeWithMinBookingNotice(t){const e=this.schedulerStore.get("configSettings")?.scheduler;const i=e?.min_booking_notice;if(!i){return t}const n=(new Date).getTime();if(t<(n+i*60*1e3)/1e3){return Math.floor((n+i*60*1e3)/1e3)}else{return t}}getEndTimeForAvailableDaysInFuture(t){const i=new Date;const n=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const s=Math.floor(e(i,n).getTime()/1e3);const o=Math.min(s,t);return o}async getAvailability(e=0,i=0){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const s=new Date;const o=s.getTime();if(i&&i<o/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(t.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(s.getFullYear(),s.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!i){const t=new Date(s.getFullYear(),s.getMonth()+1,0);i=Math.floor(t.getTime()/1e3)}i=this.getEndTimeForAvailableDaysInFuture(i);const r=this.getStartTimeWithMinBookingNotice(e);e=r;i=r>i?r+1:i;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(i.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const a=this.schedulerStore.get("rescheduleBookingId");if(a){n.append("booking_id",encodeURIComponent(a))}const c=n.toString();const l=`/v3/scheduling/availability${c?`?${c}`:""}`;const h=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(l),"GET",undefined,h);if("error"in d){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=d.error?.type;let i=d.error;if(e&&e in this.errors.api(t.t("getAvailabilityErrorTitle"))){const n=this.getErrorMessage(i);i=this.errors.api(t.t("getAvailabilityErrorTitle"))[e](n)}return{error:i}}if("data"in d){const t=d.data?.time_slots?.map((t=>({...t,start_time:new Date(t.start_time*1e3),end_time:new Date(t.end_time*1e3)})))||[];const e=t.filter((t=>t.start_time.getTime()>o));this.schedulerStore.set("availability",e);const i=d.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",i)}this.schedulerStore.set("isLoading",false);return d}async cancelBooking(e,i){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(t.t("cancelBookingErrorTitle")).no_booking_id()}}const n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const s=`/v3/scheduling/bookings/${e}${n}`;const o=this.getHeaders();const r=await this.makeAPIRequest(decodeURIComponent(s),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:i}),o);if("error"in r){this.schedulerStore.set("isLoading",false);const e=r.error?.type;let i=r.error;if(e&&e in this.errors.api(t.t("cancelBookingErrorTitle"))){const n=this.getErrorMessage(i);i=this.errors.api(t.t("cancelBookingErrorTitle"))[e](n)}return{error:i}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return r}async rescheduleBooking(e,i){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(t.t("rescheduleBookingErrorTitle")).no_booking_id()}}const n=this.errors.api(t.t("rescheduleBookingErrorTitle"));const s=this.errors.component(t.t("rescheduleBookingErrorTitle"));const{bookingInfo:o,selectedTimeslot:r,selectedTimezone:a,selectedLanguage:c}=this.schedulerStore.state;const{startTime:l,endTime:h,timezone:d}=i;const g=l||r?.start_time;if(!g){return{error:s.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=h||r?.end_time;if(!u){return{error:s.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=this.schedulerStore.get("availabilityOrderEmails");let m="";if(f.length>0){const t=r?.emails||[];for(let e=0;e<f.length;e++){if(t.includes(f[e])){m=f[e];break}}}const _=d||a;if(!_){return{error:s.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const v={};Object.entries(o?.additionalFields||{}).forEach((([t,e])=>{v[t]=e.value}));const y=i?i?.primaryParticipant:o?.primaryParticipant;const b=i?i?.guests||[]:o?.guests||[];const k=i?i?.additionalFields:v;const I=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const T=`/v3/scheduling/bookings/${e}${I}`;const p=this.getHeaders();const w=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:u.getTime()/1e3,timezone:_,additional_fields:k,guest:{...y},additional_guests:b,participants:m?[{email:m}]:undefined,email_language:this.getTwoLetterLanguageCode(c)}),p);if("error"in w){this.schedulerStore.set("isLoading",false);const t=w.error?.type;let e=w.error;if(t&&t in n){const i=this.getErrorMessage(e);e=n[t](i)}return{error:e}}const E=this.schedulerStore.get("reschedulingEventInfo");if("data"in w){this.schedulerStore.set("eventInfo",w?.data)}else if(E){this.schedulerStore.set("eventInfo",E)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("isLoading",false);return w}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:i,status:n,reason:s}=e;const o=this.schedulerStore.get("organizerConfirmationSalt");const r=n==="confirmed"?t.t("confirmBookingErrorTitle"):t.t("rejectBookingErrorTitle");if(!i){return{error:this.errors.component(r).no_booking_id()}}if(!o){return{error:this.errors.component(r).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const c=`/v3/scheduling/bookings/${i}${a}`;const l=this.getHeaders();const h=await this.makeAPIRequest(decodeURIComponent(c),"PUT",JSON.stringify({status:n,cancellation_reason:s,salt:o}),l);if("error"in h){this.schedulerStore.set("isLoading",false);const t=h.error?.type;let e=h.error;if(t&&t in this.errors.api(r)){const i=this.getErrorMessage(e);e=this.errors.api(r)[t](i)}return{error:e}}if("data"in h&&n==="confirmed"){this.schedulerStore.set("confirmedEventInfo",h?.data)}else if("request_id"in h&&n==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:i})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return h}}function l(t={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...t};i(`[defaultNylasStoreState]: `,e);const s=n(e);s.onChange("availability",(t=>{i(`[availability]: `,t);const e=t.map((t=>t.start_time));i(`[selectableDates]: `,e);s.set("selectableDates",e);const n=t[0];if(!n)return;const o=Math.floor((n.end_time.getTime()-n.start_time.getTime())/6e4);i(`[durationMinutes]: `,o);s.set("eventDuration",o)}));s.reset=()=>{for(const t in e){const i=e[t];s.set(t,i)}};return s}export{l as C,s as E,c as N};
|
|
2
|
+
//# sourceMappingURL=p-53f7b360.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,c as s,h as t,H as a,a as n}from"./p-68c2fadf.js";import{a as o}from"./p-05f97bb8.js";const r=':host{display:block;width:inherit;--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}.dropdown{display:inline-block;width:100%;position:relative}.dropdown .dropdown-label{display:flex;align-items:center;gap:0.25rem;color:var(--nylas-base-800)}.dropdown span.error{color:var(--nylas-error);font-size:14px}.dropbtn{width:inherit;height:48px;color:black;padding:0.5rem;font-size:1rem;cursor:pointer;display:flex;gap:0.5rem;justify-content:space-between;align-items:center;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn.error{border:1px solid var(--nylas-error)}.dropbtn:hover,.dropbtn:active{border:1px solid var(--nylas-primary)}.dropbtn:active{outline:2px solid var(--nylas-primary)}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropdown-content{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;z-index:1;border-radius:4px;position:absolute;top:72px;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:left;cursor:pointer}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content ul li label{display:flex;align-items:center;gap:0.5rem}.dropdown-content ul li label input{margin:0}.selected-options{display:flex;flex-wrap:wrap;gap:0.5rem;padding:0.5rem 0;margin-top:0.25rem;background:var(--nylas-base-0)}.selected-options .selected-option{display:flex;align-items:center;gap:0.5rem;padding:4px 8px;border-radius:var(--nylas-border-radius-2x);background:var(--nylas-base-100);color:var(--nylas-base-800);font-size:16px;font-weight:500;line-height:1.5rem;letter-spacing:0.5px}.selected-options .selected-option button{background:transparent;border:none;cursor:pointer;padding:0}.selected-options .selected-option button:hover{color:var(--nylas-primary)}';const i=r;const d=class{constructor(t){e(this,t);this.selectedOptionsChanged=s(this,"selectedOptionsChanged",7);this.name=undefined;this.label=undefined;this.options=[];this.error="";this.availableOptions=this.options;this.isOpen=false;this.ariaActivedescendant="";this.shouldFocusFirstOption=false}areOptionsEqual(e,s){if(e.length!==s.length)return false;const t=[...e].sort(((e,s)=>e.label.localeCompare(s.label)||e.value.localeCompare(s.value)));const a=[...s].sort(((e,s)=>e.label.localeCompare(s.label)||e.value.localeCompare(s.value)));return t.every(((e,s)=>{const t=a[s];return e.label===t.label&&e.value===t.value}))}optionsChangedHandler(e){if(!this.areOptionsEqual(e,this.availableOptions)){this.availableOptions=e}}componentDidLoad(){o("multi-select-dropdown","componentDidLoad");if(this.options){this.availableOptions=this.options}}componentDidRender(){o("multi-select-dropdown","componentDidRender");if(this.isOpen&&this.shouldFocusFirstOption){this.ariaActivedescendant=this.availableOptions[0]?.value;this.focusOption(0);this.shouldFocusFirstOption=false}}handleOutsideClick(e){const s=e.composedPath();const t=s.includes(this.el);if(!t&&this.isOpen){this.isOpen=false}}selectOption(e){this.availableOptions=this.availableOptions.map((s=>{if(s.value===e.value){s.selected=e.selected?false:true}return s}));const s=this.availableOptions.filter((e=>e.selected)).map((e=>e.value));this.selectedOptionsChanged.emit({value:s,name:this.name})}toggleDropdown(){this.isOpen=!this.isOpen;if(this.isOpen){this.shouldFocusFirstOption=true}else{this.ariaActivedescendant=""}}handleSelectButtonKeyDown(e){switch(e.key){case"ArrowDown":case"Enter":e.preventDefault();if(!this.isOpen){this.toggleDropdown()}break;case"Escape":this.isOpen=false;break}}handleListboxKeydown(e){const s=this.availableOptions;const t=s.findIndex((e=>e.value===this.ariaActivedescendant));switch(e.key){case"ArrowDown":case"Tab":if(!e.shiftKey){e.preventDefault();const a=t+1<s.length?t+1:0;this.ariaActivedescendant=s[a].value;this.focusOption(a)}else{e.preventDefault();const a=t-1>=0?t-1:s.length-1;this.ariaActivedescendant=s[a].value;this.focusOption(a)}break;case"ArrowUp":e.preventDefault();const a=t-1>=0?t-1:s.length-1;this.ariaActivedescendant=s[a].value;this.focusOption(a);break;case"Enter":e.preventDefault();if(this.ariaActivedescendant){this.selectOption(s[t])}break;case"Escape":this.isOpen=false;break}}focusOption(e){const s=this.availableOptions[e];if(!s)return;const t=s.value;const a=this.el.shadowRoot?.getElementById(t);if(a){a.focus();a.scrollIntoView({behavior:"smooth",block:"nearest"})}}getSelectedOptions(){return this.availableOptions.filter((e=>e.selected))}renderOption(e){return t("li",{key:e.value,id:e.value,role:"option",tabindex:"0","aria-selected":e.selected?"true":"false",onClick:s=>{s.stopImmediatePropagation();this.selectOption(e)},class:{selected:!!e.selected}},t("label",{htmlFor:e.value},t("input",{"aria-hidden":"true",id:e.value,type:"checkbox",checked:e.selected}),t("span",null,e.label)))}render(){return t(a,{key:"f8e72e38ce1323acd6ca5ada6c9b8e4a52fd5cd3"},t("div",{key:"acd2eead0fe45b85da48057a52d3f99337870795",class:"dropdown",part:"msd_dropdown"},t("label",{key:"c586999e4b30f366d6033bef3cbf1142040db8a3",class:"dropdown-label"},this.label,t("slot",{key:"2817a8851a72bbabe9309c3da79e8ca25c1c461e",name:"label-icon","aria-hidden":"true"})),t("button",{key:"588fd27317e0c73ad8a83ac18e826b62ab968128",name:this.name,part:`msd_dropdown-button ${this.error?"msd_dropdown-button--error":""}`,class:{dropbtn:true,open:this.isOpen,error:!!this.error},onClick:()=>this.toggleDropdown(),"aria-haspopup":"listbox","aria-expanded":this.isOpen?"true":"false","aria-label":this.name,onKeyDown:e=>this.handleSelectButtonKeyDown(e)},t("slot",{key:"e6fc309a7ffb30921118e1cd1d1fb4aea321a0fb",name:"select-icon","aria-hidden":"true"}),t("span",{key:"62a4abccd0100022f7e163410ffaf8fca8ebaefb",class:"selected-option",part:"msd_dropdown-button-selected-label"},this.getSelectedOptions().length>1?`Multiple options selected`:this.availableOptions.filter((e=>e.selected))[0]?.label??this.availableOptions[0]?.label),t("span",{key:"1fff4fa8e566dcec2ac9e28bcededc41c7b42585",class:this.isOpen?"open":"closed","aria-hidden":"true"},t("chevron-icon",{key:"39b47d625b2e3e78f795e3853e8a4811842036de",width:"16",height:"16"}))),this.error?t("span",{class:"error"},this.error):null,this.isOpen?null:t("div",{class:"selected-options"},this.getSelectedOptions().map((e=>t("span",{class:"selected-option"},e.label,t("button",{key:e.label,onClick:()=>this.selectOption(e)},t("close-icon",null)))))),this.isOpen?t("div",{class:"dropdown-content",part:"msd_dropdown-content"},t("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-multiselectable":true,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:e=>this.handleListboxKeydown(e)},this.availableOptions.map((e=>this.renderOption(e))))):null))}get el(){return n(this)}static get watchers(){return{options:["optionsChangedHandler"]}}};d.style=i;export{d as multi_select_dropdown};
|
|
2
|
+
//# sourceMappingURL=p-7f100474.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["multiSelectDropdownCss","MultiSelectDropdownStyle0","MultiSelectDropdown","this","options","areOptionsEqual","arr1","arr2","length","sorted1","sort","a","b","label","localeCompare","value","sorted2","every","opt1","index","opt2","optionsChangedHandler","newValue","availableOptions","componentDidLoad","debug","componentDidRender","isOpen","shouldFocusFirstOption","ariaActivedescendant","focusOption","handleOutsideClick","event","path","composedPath","isClickInside","includes","el","selectOption","option","map","o","selected","selectedOptions","filter","selectedOptionsChanged","emit","name","toggleDropdown","handleSelectButtonKeyDown","key","preventDefault","handleListboxKeydown","e","items","currentIndex","findIndex","item","shiftKey","nextIndex","prevIndex","elementId","element","shadowRoot","getElementById","focus","scrollIntoView","behavior","block","getSelectedOptions","renderOption","h","id","role","tabindex","onClick","stopImmediatePropagation","class","htmlFor","type","checked","render","Host","part","error","dropbtn","open","onKeyDown","width","height"],"sources":["src/components/design-system/multi-select-dropdown/multi-select-dropdown.scss?tag=multi-select-dropdown&encapsulation=shadow","src/components/design-system/multi-select-dropdown/multi-select-dropdown.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n width: inherit;\n @include default-css-variables;\n}\n\n.dropdown {\n display: inline-block;\n width: 100%;\n position: relative;\n\n .dropdown-label {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n color: var(--nylas-base-800);\n }\n\n span.error {\n color: var(--nylas-error);\n font-size: 14px;\n }\n}\n\n.dropbtn {\n width: inherit;\n height: 48px;\n color: black;\n padding: 0.5rem;\n font-size: 1rem;\n cursor: pointer;\n display: flex;\n gap: 0.5rem;\n justify-content: space-between;\n align-items: center;\n background: transparent;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n\n &.focus {\n background: transparent;\n }\n\n &.error {\n border: 1px solid var(--nylas-error);\n }\n\n &:hover,\n &:active {\n border: 1px solid var(--nylas-primary);\n }\n\n &:active {\n outline: 2px solid var(--nylas-primary);\n }\n\n span {\n &.open {\n transform: rotate(90deg);\n }\n\n &.closed {\n transform: rotate(270deg);\n }\n }\n}\n\n.dropdown-content {\n display: block;\n margin-top: 0.5rem;\n background-color: var(--nylas-base-0);\n width: 100%;\n max-height: 336px;\n overflow: auto;\n z-index: 1;\n border-radius: 4px;\n position: absolute;\n top: calc(48px + 24px);\n box-shadow: 0px 4px 6px -2px #0000000d;\n box-shadow: 0px 10px 15px -3px #0000001a;\n}\n\n.dropdown-content ul {\n padding: 0;\n list-style-type: none;\n color: var(--nylas-base-900);\n max-height: 336px;\n\n li {\n padding: 16px, 12px, 16px, 12px;\n color: black;\n padding: 12px 16px;\n text-decoration: none;\n display: block;\n font-family: inherit;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n letter-spacing: 0px;\n text-align: left;\n cursor: pointer;\n\n &:hover,\n &:focus {\n background-color: var(--nylas-base-100);\n }\n\n label {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n\n input {\n margin: 0;\n }\n }\n }\n}\n\n.selected-options {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n padding: 0.5rem 0;\n margin-top: 0.25rem;\n background: var(--nylas-base-0);\n\n .selected-option {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 4px 8px;\n border-radius: var(--nylas-border-radius-2x);\n background: var(--nylas-base-100);\n color: var(--nylas-base-800);\n font-size: 16px;\n font-weight: 500;\n line-height: 1.5rem;\n letter-spacing: 0.5px;\n\n button {\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 0;\n\n &:hover {\n color: var(--nylas-primary);\n }\n }\n }\n}\n","import { debug } from '@/utils/utils';\nimport { Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\n\ninterface DropdownOption {\n label: string;\n value: string;\n selected?: boolean; // Add a selected flag to each option\n}\n\n@Component({\n tag: 'multi-select-dropdown',\n styleUrl: 'multi-select-dropdown.scss',\n shadow: true,\n})\nexport class MultiSelectDropdown {\n @Element() el!: HTMLElement;\n\n // Props\n /**\n * The name of the dropdown\n */\n @Prop() name!: string;\n\n /**\n * The label of the dropdown\n */\n @Prop() label?: string;\n\n /**\n * The options to display in the dropdown\n */\n @Prop() options: DropdownOption[] = [];\n\n /**\n * Error message to display\n */\n @Prop() error?: string = '';\n\n // States\n /**\n * The copy of the options to display in the dropdown\n */\n @State() availableOptions: DropdownOption[] = this.options;\n /**\n * The open state of the dropdown\n */\n @State() isOpen: boolean = false;\n /**\n * The aria-activedescendant attribute for the listbox element to indicate the currently active\n */\n @State() ariaActivedescendant: string = '';\n\n /**\n * This flag is used to focus the first option when the dropdown is opened\n * and reset after the first option is focused\n */\n @State() shouldFocusFirstOption: boolean = false;\n\n // Events\n /**\n * This event is fired when the selected options are changed\n */\n @Event({ bubbles: true, composed: true }) selectedOptionsChanged!: EventEmitter<{\n value: string[];\n name: string;\n }>;\n\n areOptionsEqual(arr1: DropdownOption[], arr2: DropdownOption[]): boolean {\n if (arr1.length !== arr2.length) return false;\n\n // Sort both arrays by a consistent key (e.g., label and value)\n const sorted1 = [...arr1].sort((a, b) => a.label.localeCompare(b.label) || a.value.localeCompare(b.value));\n const sorted2 = [...arr2].sort((a, b) => a.label.localeCompare(b.label) || a.value.localeCompare(b.value));\n\n // Compare each object in the sorted arrays\n return sorted1.every((opt1, index) => {\n const opt2 = sorted2[index];\n return opt1.label === opt2.label && opt1.value === opt2.value;\n });\n }\n\n @Watch('options')\n optionsChangedHandler(newValue: DropdownOption[]) {\n if (!this.areOptionsEqual(newValue, this.availableOptions)) {\n this.availableOptions = newValue;\n }\n }\n\n // Lifecycle methods\n componentDidLoad() {\n debug('multi-select-dropdown', 'componentDidLoad');\n if (this.options) {\n this.availableOptions = this.options;\n }\n }\n\n componentDidRender() {\n debug('multi-select-dropdown', 'componentDidRender');\n if (this.isOpen && this.shouldFocusFirstOption) {\n // The dropdown is open and we should focus the first option\n this.ariaActivedescendant = this.availableOptions[0]?.value;\n this.focusOption(0);\n // Reset the flag\n this.shouldFocusFirstOption = false;\n }\n }\n\n // Event listeners\n @Listen('click', { target: 'document', capture: true })\n handleOutsideClick(event: MouseEvent) {\n // Get the path of the event\n const path = event.composedPath();\n\n // Check if the path includes the host element\n const isClickInside = path.includes(this.el);\n\n if (!isClickInside && this.isOpen) {\n this.isOpen = false;\n }\n }\n\n // Methods\n\n selectOption(option: DropdownOption): void {\n this.availableOptions = this.availableOptions.map(o => {\n if (o.value === option.value) {\n o.selected = option.selected ? false : true;\n }\n return o;\n });\n const selectedOptions = this.availableOptions.filter(o => o.selected).map(o => o.value);\n this.selectedOptionsChanged.emit({\n value: selectedOptions,\n name: this.name,\n });\n }\n\n toggleDropdown(): void {\n this.isOpen = !this.isOpen;\n if (this.isOpen) {\n this.shouldFocusFirstOption = true;\n } else {\n this.ariaActivedescendant = '';\n }\n }\n\n handleSelectButtonKeyDown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowDown':\n case 'Enter':\n event.preventDefault();\n if (!this.isOpen) {\n this.toggleDropdown();\n }\n break;\n case 'Escape':\n this.isOpen = false;\n break;\n }\n }\n\n handleListboxKeydown(e: KeyboardEvent) {\n const items = this.availableOptions;\n const currentIndex = items.findIndex(item => item.value === this.ariaActivedescendant);\n\n switch (e.key) {\n case 'ArrowDown':\n case 'Tab':\n if (!e.shiftKey) {\n e.preventDefault();\n const nextIndex = currentIndex + 1 < items.length ? currentIndex + 1 : 0;\n this.ariaActivedescendant = items[nextIndex].value;\n this.focusOption(nextIndex);\n } else {\n e.preventDefault();\n const prevIndex = currentIndex - 1 >= 0 ? currentIndex - 1 : items.length - 1;\n this.ariaActivedescendant = items[prevIndex].value;\n this.focusOption(prevIndex);\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n const prevIndex = currentIndex - 1 >= 0 ? currentIndex - 1 : items.length - 1;\n this.ariaActivedescendant = items[prevIndex].value;\n this.focusOption(prevIndex);\n break;\n case 'Enter':\n e.preventDefault();\n if (this.ariaActivedescendant) {\n this.selectOption(items[currentIndex]);\n }\n break;\n case 'Escape':\n this.isOpen = false;\n break;\n }\n }\n\n focusOption(index: number) {\n const option = this.availableOptions[index];\n if (!option) return; // Guard clause in case index is out of bounds\n\n const elementId = option.value;\n const element = this.el.shadowRoot?.getElementById(elementId) as HTMLLIElement;\n\n if (element) {\n element.focus(); // Set focus on the element\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n }\n }\n\n getSelectedOptions() {\n return this.availableOptions.filter(option => option.selected);\n }\n\n renderOption(option: DropdownOption) {\n return (\n <li\n key={option.value}\n id={option.value}\n role=\"option\"\n tabindex=\"0\"\n aria-selected={option.selected ? 'true' : 'false'}\n onClick={e => {\n e.stopImmediatePropagation();\n this.selectOption(option);\n }}\n class={{ selected: !!option.selected }}\n >\n <label htmlFor={option.value}>\n <input aria-hidden=\"true\" id={option.value} type=\"checkbox\" checked={option.selected} />\n <span>{option.label}</span>\n </label>\n </li>\n );\n }\n\n render() {\n return (\n <Host>\n <div class=\"dropdown\" part=\"msd_dropdown\">\n <label class=\"dropdown-label\">\n {this.label}\n <slot name=\"label-icon\" aria-hidden=\"true\"></slot>\n </label>\n <button\n name={this.name}\n part={`msd_dropdown-button ${this.error ? 'msd_dropdown-button--error' : ''}`}\n class={{ dropbtn: true, open: this.isOpen, error: !!this.error }}\n onClick={() => this.toggleDropdown()}\n aria-haspopup=\"listbox\"\n aria-expanded={this.isOpen ? 'true' : 'false'}\n aria-label={this.name}\n onKeyDown={e => this.handleSelectButtonKeyDown(e)}\n >\n <slot name=\"select-icon\" aria-hidden=\"true\"></slot>\n <span class=\"selected-option\" part=\"msd_dropdown-button-selected-label\">\n {this.getSelectedOptions().length > 1 ? `Multiple options selected` : this.availableOptions.filter(o => o.selected)[0]?.label ?? this.availableOptions[0]?.label}\n </span>\n <span class={this.isOpen ? 'open' : 'closed'} aria-hidden=\"true\">\n <chevron-icon width=\"16\" height=\"16\" />\n </span>\n </button>\n {this.error ? <span class=\"error\">{this.error}</span> : null}\n {this.isOpen ? null : (\n <div class={'selected-options'}>\n {this.getSelectedOptions().map(option => (\n <span class=\"selected-option\">\n {option.label}\n <button key={option.label} onClick={() => this.selectOption(option)}>\n <close-icon />\n </button>\n </span>\n ))}\n </div>\n )}\n {this.isOpen ? (\n <div class=\"dropdown-content\" part=\"msd_dropdown-content\">\n <ul\n tabindex=\"-1\"\n role=\"listbox\"\n aria-label={this.name}\n aria-multiselectable={true}\n aria-activedescendant={this.ariaActivedescendant}\n onKeyDown={e => this.handleListboxKeydown(e)}\n >\n {this.availableOptions.map(option => this.renderOption(option))}\n </ul>\n </div>\n ) : null}\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e,F as t,r as n,c as i,H as s,a}from"./p-68c2fadf.js";import{n as o,N as r}from"./p-5952bf42.js";import{a as l,i as c,h as d,b as h,j as f}from"./p-05f97bb8.js";import{N as g,E as p,C as u}from"./p-284c14bb.js";import{L as b,a as m}from"./p-f0271a79.js";import{i as y,a as _,c as k,b as w,f as v}from"./p-67577312.js";import"./p-cabb2e68.js";class x{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:n,configId:i,slug:s,clientId:a}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!n&&!i&&!(s||a)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=i;this.sessionId=n;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=a}init(){l("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new g({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId});return this._schedulerAPIConnector}resetStores(){this.nylasSchedulerStore.reset()}}const I=(n,i)=>{const s=n.isLoading;const a=n.showNotification;const o=n.nylasBranding;return e(t,null,a&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&i,e("div",{class:"footer"},o&&e("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true}))))};const C=(t,n)=>e("div",{class:"message-banner"},n);const B=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0;height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}';const D=B;const S={title:c.t("genericErrorTitle"),type:o.Error,category:p.Component};const T=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.schedulerWillLoad=i(this,"schedulerWillLoad",7);this.schedulerDidLoad=i(this,"schedulerDidLoad",7);this.nylasSchedulerError=i(this,"nylasSchedulerError",7);this.configSettingsLoaded=i(this,"configSettingsLoaded",7);this.bookingRefExtracted=i(this,"bookingRefExtracted",7);this.bookedEventInfo=i(this,"bookedEventInfo",7);this.mode="app";this.defaultSchedulerState=undefined;this.sessionId=undefined;this.schedulerApiUrl="https://api.us.nylas.com";this.bookingInfo=undefined;this.rescheduleBookingRef=undefined;this.cancelBookingRef=undefined;this.organizerConfirmationBookingRef=undefined;this.configurationId=undefined;this.slug=undefined;this.clientId=undefined;this.nylasBranding=true;this.eventOverrides={};this.isLoading=undefined;this.themeConfig=undefined;this.localization=undefined;this.showNotification=true;this.enableUserFeedback=true;this.automaticComponentRegistration=true;this.selectedDateLabel=(new Date).toLocaleDateString(undefined,{dateStyle:"full"})||`${c.t("noDateSelected")}`;this.refConfigId=undefined;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null}connectedCallback(){l(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){l(`[nylas-scheduler] Component will load`);if(this.enableUserFeedback&&!y()){_({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.3.2",integrations:e=>[...e.filter((e=>false)),v({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}this.stores={scheduler:u({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,...this.defaultSchedulerState})};this.baseProvider=new r(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let t;if(this.rescheduleBookingRef){const[e,n,i]=d(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",n);t=this.bookingRefExtracted.emit({configurationId:e,bookingId:n})}else if(this.cancelBookingRef){const[e,n,i]=d(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",n);t=this.bookingRefExtracted.emit({configurationId:e,bookingId:n})}else if(this.organizerConfirmationBookingRef){const[e,n,i]=d(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",n);this.stores.scheduler.set("organizerConfirmationSalt",i);t=this.bookingRefExtracted.emit({configurationId:e,bookingId:n,salt:i})}if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(t,this.nylasSchedulerConnector);if(t.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}const n=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new x({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:n});const i=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(i,this.nylasSchedulerConnector);if(i.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector);this.applyThemeConfig(this.themeConfig)}async componentDidLoad(){this.baseProvider?.componentDidLoad();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}const e=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}}const n=this.baseProvider?.getStore("scheduler");const i=n?.get("configSettings")?.scheduler?.available_days_in_future;const s=n?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(n?.get("showBookingForm")){n?.set("selectedDate",s.start_time);return}}const a=n?.get("selectedDate");const o=n?.get("availability");let r;if(o&&o.length>0){return}if(!a){const e=new Date;const{startTime:t,endTime:n,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(e,i||30);if(e.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,n))}}else{const{startTime:e,endTime:t,endTimeForAvailableDaysInFuture:n}=this.validateAvailableDaysInFuture(a,i||30);if(a.getTime()<n*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(e,t))}}if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!a){let e=new Date;const t=n?.get("availability").find((e=>new Date(e.start_time)>new Date));if(t){e=t.start_time}n?.set("selectedDate",e)}}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e)}rescheduleBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}cancelBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}organizerConfirmationBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in b)){return}c.addResourceBundle(t,"translation",e[t],false,true)}))}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=e.detail;this.language=t;c.changeLanguage(t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const n=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:a}=this.validateAvailableDaysInFuture(t,n||30);if(e.defaultPrevented){return}if(i<a&&t.getTime()<a*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const n=this.stores?.scheduler.get("selectedLanguage");const i=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const a=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:a,email_language:n,timezone:i}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const n=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const i=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=i;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const i=e?.data;const a=this.bookedEventInfo.emit({...e,data:{...i,...n}});if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(a,this.nylasSchedulerConnector)}return}const a=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!a||"error"in a){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(a?.error)},host:this.host})}const o=a?.data;const r=this.bookedEventInfo.emit({...a,data:{...o,...n}});if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=e.detail;this.selectedDateLabel=t?t.toLocaleDateString(undefined,{dateStyle:"full"}):`${c.t("noDateSelected")}`}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}feedbackSubmittedHandler(e){const t=k("Scheduling Page User Feedback");const n={eventId:t,message:e.detail.feedback};w(n,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-schduling","nylas-web-element-version":"1.3.2"},extra:{configId:this.configurationId,slug:this.slug}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||S.title,category:e?.category||S.category,type:o.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let e="";if(!this.sessionId){e+=c.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=c.t("sessionIdRequiredErrorMessage")+" "+c.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:c.t("schedulingComponentErrorTitle"),category:p.Component,type:o.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:c.t("invalidTimeslotErrorTitle"),category:p.Component,type:o.Error,description:c.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const n=new Date;const i=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const a=Math.floor(h(n,t).getTime()/1e3);const o=Math.min(a,s);const r=i<n.getTime()/1e3?Math.floor(n.getTime()/1e3):i;return{startTime:r,endTime:o,endTimeForAvailableDaysInFuture:a}}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}render(){const t=this.mode==="app";const n=this.baseProvider?.getStore("scheduler");const i=n?.get("eventInfo");const a=n?.get("showBookingForm");const o=n?.get("cancelledEventInfo");const r=n?.get("cancelBookingId");const l=n?.get("selectedTimeslot");const d=n?.get("rescheduleBookingId");const h=n?.get("organizerConfirmationBookingId");const g=n?.get("rejectBookingId");const p=n?.get("confirmedEventInfo");const u=n?.get("nylasBranding")||this.nylasBranding;const b=n?.get("selectedDate");const y=n?.get("configSettings")?.scheduler?.confirmation_redirect_url;this.selectedDateLabel=b&&this.language?f(b.toLocaleDateString(m[this.language],{dateStyle:"full"})):`${c.t("noDateSelected")}`;if(t&&(r||g)&&!o){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:l,cancelBookingId:r,rejectBookingId:g,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&h){return e(s,null,e(I,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:h,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&o){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:o,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&p){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:p,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&i&&y){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((n=>{if(!t[n]&&e?.[n]){t[n]=e[n].value}}))}const n=this.stores?.scheduler.get("selectedTimeslot");const s=this.stores?.scheduler.get("selectedTimezone");const a=this.stores?.scheduler.get("selectedLanguage");const o=this.stores?.scheduler.get("configSettings");const r=this.configurationId?this.configurationId:o?.configuration_id;const l=window.location.search;const c=new URLSearchParams(l);c.set("booking_id",i.booking_id);e?.name&&c.set("name",e.name);e?.email&&c.set("email",e.email);n?.start_time&&c.set("start_time",(new Date(n.start_time).getTime()/1e3).toString());n?.end_time&&c.set("end_time",(new Date(n.end_time).getTime()/1e3).toString());s&&c.set("tz",s);a&&c.set("language",a);t&&c.set("additional_values",JSON.stringify(t));this.slug&&c.set("page_slug",this.slug);r&&c.set("config_id",r);this.redirectToCustomUrl(`${y}?${c.toString()}`);return}if(t&&i){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:l,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!i||!!d)&&!a){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(C,null,`${c.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page"},e("div",{class:"left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e("div",{class:`right-panel ${d?"reschedule":""}`},e("h2",null,e("calendar-icon",null),e("span",{id:"selectedDate"},this.selectedDateLabel)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!i&&a){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(C,null,`${c.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page"},e("div",{class:"left-panel"},e("div",{class:"wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${d?"reschedule":""}`},e("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return a(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],themeConfig:["themeConfigChanged"]}}};T.style=D;export{T as nylas_scheduling};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{h as e,F as t,r as n,c as i,H as s,a}from"./p-68c2fadf.js";import{n as o,N as r}from"./p-5952bf42.js";import{a as l,i as c,h as d,b as h,j as f}from"./p-05f97bb8.js";import{N as g,E as p,C as u}from"./p-53f7b360.js";import{L as b,a as m}from"./p-f0271a79.js";import{i as y,a as _,c as k,b as w,f as v}from"./p-67577312.js";import"./p-cabb2e68.js";class x{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:n,configId:i,slug:s,clientId:a}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!n&&!i&&!(s||a)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=i;this.sessionId=n;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=a}init(){l("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new g({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId});return this._schedulerAPIConnector}resetStores(){this.nylasSchedulerStore.reset()}}const I=(n,i)=>{const s=n.isLoading;const a=n.showNotification;const o=n.nylasBranding;return e(t,null,a&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&i,e("div",{class:"footer"},o&&e("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true}))))};const C=(t,n)=>e("div",{class:"message-banner"},n);const B=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0;height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}';const D=B;const S={title:c.t("genericErrorTitle"),type:o.Error,category:p.Component};const T=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.schedulerWillLoad=i(this,"schedulerWillLoad",7);this.schedulerDidLoad=i(this,"schedulerDidLoad",7);this.nylasSchedulerError=i(this,"nylasSchedulerError",7);this.configSettingsLoaded=i(this,"configSettingsLoaded",7);this.bookingRefExtracted=i(this,"bookingRefExtracted",7);this.bookedEventInfo=i(this,"bookedEventInfo",7);this.mode="app";this.defaultSchedulerState=undefined;this.sessionId=undefined;this.schedulerApiUrl="https://api.us.nylas.com";this.bookingInfo=undefined;this.rescheduleBookingRef=undefined;this.cancelBookingRef=undefined;this.organizerConfirmationBookingRef=undefined;this.configurationId=undefined;this.slug=undefined;this.clientId=undefined;this.nylasBranding=true;this.eventOverrides={};this.isLoading=undefined;this.themeConfig=undefined;this.localization=undefined;this.showNotification=true;this.enableUserFeedback=true;this.automaticComponentRegistration=true;this.selectedDateLabel=(new Date).toLocaleDateString(undefined,{dateStyle:"full"})||`${c.t("noDateSelected")}`;this.refConfigId=undefined;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null}connectedCallback(){l(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){l(`[nylas-scheduler] Component will load`);if(this.enableUserFeedback&&!y()){_({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.3.3",integrations:e=>[...e.filter((e=>false)),v({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}this.stores={scheduler:u({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,...this.defaultSchedulerState})};this.baseProvider=new r(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let t;if(this.rescheduleBookingRef){const[e,n,i]=d(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",n);t=this.bookingRefExtracted.emit({configurationId:e,bookingId:n})}else if(this.cancelBookingRef){const[e,n,i]=d(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",n);t=this.bookingRefExtracted.emit({configurationId:e,bookingId:n})}else if(this.organizerConfirmationBookingRef){const[e,n,i]=d(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",n);this.stores.scheduler.set("organizerConfirmationSalt",i);t=this.bookingRefExtracted.emit({configurationId:e,bookingId:n,salt:i})}if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(t,this.nylasSchedulerConnector);if(t.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}const n=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new x({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:n});const i=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(i,this.nylasSchedulerConnector);if(i.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector);this.applyThemeConfig(this.themeConfig)}async componentDidLoad(){this.baseProvider?.componentDidLoad();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}const e=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}}const n=this.baseProvider?.getStore("scheduler");const i=n?.get("configSettings")?.scheduler?.available_days_in_future;const s=n?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(n?.get("showBookingForm")){n?.set("selectedDate",s.start_time);return}}const a=n?.get("selectedDate");const o=n?.get("availability");let r;if(o&&o.length>0){return}if(!a){const e=new Date;const{startTime:t,endTime:n,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(e,i||30);if(e.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,n))}}else{const{startTime:e,endTime:t,endTimeForAvailableDaysInFuture:n}=this.validateAvailableDaysInFuture(a,i||30);if(a.getTime()<n*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(e,t))}}if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!a){let e=new Date;const t=n?.get("availability").find((e=>new Date(e.start_time)>new Date));if(t){e=t.start_time}n?.set("selectedDate",e)}}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e)}rescheduleBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}cancelBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}organizerConfirmationBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in b)){return}c.addResourceBundle(t,"translation",e[t],false,true)}))}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=e.detail;this.language=t;c.changeLanguage(t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const n=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:a}=this.validateAvailableDaysInFuture(t,n||30);if(e.defaultPrevented){return}if(i<a&&t.getTime()<a*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const n=this.stores?.scheduler.get("selectedLanguage");const i=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const a=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:a,email_language:n,timezone:i}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const n=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const i=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=i;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const i=e?.data;const a=this.bookedEventInfo.emit({...e,data:{...i,...n}});if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(a,this.nylasSchedulerConnector)}return}const a=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!a||"error"in a){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(a?.error)},host:this.host})}const o=a?.data;const r=this.bookedEventInfo.emit({...a,data:{...o,...n}});if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=e.detail;this.selectedDateLabel=t?t.toLocaleDateString(undefined,{dateStyle:"full"}):`${c.t("noDateSelected")}`}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}feedbackSubmittedHandler(e){const t=k("Scheduling Page User Feedback");const n={eventId:t,message:e.detail.feedback};w(n,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-schduling","nylas-web-element-version":"1.3.3"},extra:{configId:this.configurationId,slug:this.slug}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||S.title,category:e?.category||S.category,type:o.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let e="";if(!this.sessionId){e+=c.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=c.t("sessionIdRequiredErrorMessage")+" "+c.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:c.t("schedulingComponentErrorTitle"),category:p.Component,type:o.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:c.t("invalidTimeslotErrorTitle"),category:p.Component,type:o.Error,description:c.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const n=new Date;const i=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const a=Math.floor(h(n,t).getTime()/1e3);const o=Math.min(a,s);const r=i<n.getTime()/1e3?Math.floor(n.getTime()/1e3):i;return{startTime:r,endTime:o,endTimeForAvailableDaysInFuture:a}}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}render(){const t=this.mode==="app";const n=this.baseProvider?.getStore("scheduler");const i=n?.get("eventInfo");const a=n?.get("showBookingForm");const o=n?.get("cancelledEventInfo");const r=n?.get("cancelBookingId");const l=n?.get("selectedTimeslot");const d=n?.get("rescheduleBookingId");const h=n?.get("organizerConfirmationBookingId");const g=n?.get("rejectBookingId");const p=n?.get("confirmedEventInfo");const u=n?.get("nylasBranding")||this.nylasBranding;const b=n?.get("selectedDate");const y=n?.get("configSettings")?.scheduler?.confirmation_redirect_url;this.selectedDateLabel=b&&this.language?f(b.toLocaleDateString(m[this.language],{dateStyle:"full"})):`${c.t("noDateSelected")}`;if(t&&(r||g)&&!o){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:l,cancelBookingId:r,rejectBookingId:g,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&h){return e(s,null,e(I,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:h,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&o){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:o,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&p){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:p,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&i&&y){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((n=>{if(!t[n]&&e?.[n]){t[n]=e[n].value}}))}const n=this.stores?.scheduler.get("selectedTimeslot");const s=this.stores?.scheduler.get("selectedTimezone");const a=this.stores?.scheduler.get("selectedLanguage");const o=this.stores?.scheduler.get("configSettings");const r=this.configurationId?this.configurationId:o?.configuration_id;const l=window.location.search;const c=new URLSearchParams(l);c.set("booking_id",i.booking_id);e?.name&&c.set("name",e.name);e?.email&&c.set("email",e.email);n?.start_time&&c.set("start_time",(new Date(n.start_time).getTime()/1e3).toString());n?.end_time&&c.set("end_time",(new Date(n.end_time).getTime()/1e3).toString());s&&c.set("tz",s);a&&c.set("language",a);t&&c.set("additional_values",JSON.stringify(t));this.slug&&c.set("page_slug",this.slug);r&&c.set("config_id",r);this.redirectToCustomUrl(`${y}?${c.toString()}`);return}if(t&&i){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:l,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!i||!!d)&&!a){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(C,null,`${c.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page"},e("div",{class:"left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e("div",{class:`right-panel ${d?"reschedule":""}`},e("h2",null,e("calendar-icon",null),e("span",{id:"selectedDate"},this.selectedDateLabel)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!i&&a){return e(s,null,e(I,{nylasBranding:u,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(C,null,`${c.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page"},e("div",{class:"left-panel"},e("div",{class:"wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${d?"reschedule":""}`},e("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return a(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],themeConfig:["themeConfigChanged"]}}};T.style=D;export{T as nylas_scheduling};
|
|
2
|
+
//# sourceMappingURL=p-84e69241.entry.js.map
|