@nylas/web-elements 2.2.0 → 2.2.2
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/nylas-web-elements/{abstract-provider-D75Ucvku.js → abstract-provider-9AZudYSI.js} +2 -2
- package/dist/nylas-web-elements/{abstract-provider-D75Ucvku.js.map → abstract-provider-9AZudYSI.js.map} +1 -1
- package/dist/nylas-web-elements/add-circle-icon.entry.js +1 -1
- package/dist/nylas-web-elements/archive-icon.entry.js +1 -1
- package/dist/nylas-web-elements/arrow-icon.entry.js +1 -1
- package/dist/nylas-web-elements/bold-icon.entry.js +1 -1
- package/dist/nylas-web-elements/button-component.entry.js +1 -1
- package/dist/nylas-web-elements/calendar-agenda-fill-icon.entry.js +1 -1
- package/dist/nylas-web-elements/calendar-agenda-icon.entry.js +1 -1
- package/dist/nylas-web-elements/calendar-cancel-icon.entry.js +1 -1
- package/dist/nylas-web-elements/calendar-check-icon.entry.js +1 -1
- package/dist/nylas-web-elements/calendar-icon.entry.js +1 -1
- package/dist/nylas-web-elements/calendar-info-icon.entry.js +1 -1
- package/dist/nylas-web-elements/calendar-patterns-icon.entry.js +1 -1
- package/dist/nylas-web-elements/checkbox-component.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/checkbox-component.entry.js +1 -1
- package/dist/nylas-web-elements/checkbox-component.entry.js.map +1 -1
- package/dist/nylas-web-elements/checkbox-group.entry.js +1 -1
- package/dist/nylas-web-elements/checkmark-circle-icon.entry.js +1 -1
- package/dist/nylas-web-elements/checkmark-icon.entry.js +1 -1
- package/dist/nylas-web-elements/chevron-icon.entry.js +1 -1
- package/dist/nylas-web-elements/clock-icon.entry.js +1 -1
- package/dist/nylas-web-elements/close-icon.entry.js +1 -1
- package/dist/nylas-web-elements/copy-icon.entry.js +1 -1
- package/dist/nylas-web-elements/{customParseFormat-Bk5PI6Cs.js → customParseFormat-BJNMxHY2.js} +2 -2
- package/dist/nylas-web-elements/{customParseFormat-Bk5PI6Cs.js.map → customParseFormat-BJNMxHY2.js.map} +1 -1
- package/dist/nylas-web-elements/delete-icon.entry.js +1 -1
- package/dist/nylas-web-elements/document-refresh-icon.entry.js +1 -1
- package/dist/nylas-web-elements/dragable-icon.entry.js +1 -1
- package/dist/nylas-web-elements/edit-icon.entry.js +1 -1
- package/dist/nylas-web-elements/envelope-fill-icon.entry.js +1 -1
- package/dist/nylas-web-elements/envelope-icon.entry.js +1 -1
- package/dist/nylas-web-elements/eye-icon.entry.js +1 -1
- package/dist/nylas-web-elements/feedback-icon.entry.js +1 -1
- package/dist/nylas-web-elements/flow-icon.entry.js +1 -1
- package/dist/nylas-web-elements/folder-icon.entry.js +1 -1
- package/dist/nylas-web-elements/forward-icon.entry.js +1 -1
- package/dist/nylas-web-elements/globe-icon.entry.js +1 -1
- package/dist/nylas-web-elements/google-logo-icon.entry.js +1 -1
- package/dist/nylas-web-elements/google-meet-icon.entry.js +1 -1
- package/dist/nylas-web-elements/inbox-icon.entry.js +1 -1
- package/dist/nylas-web-elements/{index-BVtainOy.js → index-BPPwIJj2.js} +2 -2
- package/dist/nylas-web-elements/{index-BVtainOy.js.map → index-BPPwIJj2.js.map} +1 -1
- package/dist/nylas-web-elements/{index-B-KMpdMZ.js → index-Cbn5rIwb.js} +2 -2
- package/dist/nylas-web-elements/index-Cbn5rIwb.js.map +1 -0
- package/dist/nylas-web-elements/index.esm.js +1 -1
- package/dist/nylas-web-elements/info-icon.entry.js +1 -1
- package/dist/nylas-web-elements/input-color-picker.entry.js +1 -1
- package/dist/nylas-web-elements/input-component.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/input-component.entry.js +1 -1
- package/dist/nylas-web-elements/input-component.entry.js.map +1 -1
- package/dist/nylas-web-elements/input-dropdown.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/input-dropdown.entry.js +1 -1
- package/dist/nylas-web-elements/input-dropdown.entry.js.map +1 -1
- package/dist/nylas-web-elements/input-image-url.entry.js +1 -1
- package/dist/nylas-web-elements/italic-icon.entry.js +1 -1
- package/dist/nylas-web-elements/loading-icon.entry.js +1 -1
- package/dist/nylas-web-elements/location-icon.entry.js +1 -1
- package/dist/nylas-web-elements/location-off-icon.entry.js +1 -1
- package/dist/nylas-web-elements/microsoft-logo-icon.entry.js +1 -1
- package/dist/nylas-web-elements/microsoft-teams-icon.entry.js +1 -1
- package/dist/nylas-web-elements/multi-select-dropdown.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/multi-select-dropdown.entry.js +1 -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-api-request-B1V2koVc.js → nylas-api-request-rYAjhY1J.js} +2 -2
- package/dist/nylas-web-elements/{nylas-api-request-B1V2koVc.js.map → nylas-api-request-rYAjhY1J.js.map} +1 -1
- package/dist/nylas-web-elements/nylas-availability-picker.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-booked-event-card.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-booking-calendar-picker.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-booking-confirmation-redirect.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-booking-confirmation-type.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-booking-form-config.entry.js +2 -2
- package/dist/nylas-web-elements/nylas-booking-form.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-buffer-time.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-calendar-picker.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-cancel-booking-form.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-cancellation-policy.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-cancellation-policy.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-cancellation-policy.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-cancelled-event-card.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-confirmation-email.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-confirmed-event-card.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-connected-calendars.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-custom-booking-flow.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-custom-event-slug.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-customize-booking-settings.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-customize-booking-settings.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-customize-booking-settings.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-date-component.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-date-picker.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-date-picker.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-disable-emails.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-editor-tabs-group.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-editor-tabs-group.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-editor-tabs-group.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-editor-tabs.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-editor-tabs.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-calendar.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-capacity.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-description.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-description.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-description.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-duration.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-duration.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-duration.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-info.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-limits.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-limits.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-limits.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-location.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-location.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-location.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-timeslot.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-title.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-title.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-title.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-feedback-form.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-form-card.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-form-card.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-form-card.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-list-configurations.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-locale-switch.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-logo.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-min-booking-notice.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-notification.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-notification.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-organizer-confirmation-card.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-page-name.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-page-name.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-page-name.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-page-styling.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-participant-booking-calendars.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-participants-custom-availability.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-reminder-emails.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-reminder-time.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-scheduler-editor.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js +3 -3
- package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-scheduling-method.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-scheduling.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-select-event-type.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-selected-event-card.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-specific-time-availability-picker.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-time-window-picker.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-time-window-picker.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-time-window-picker.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-timeslot-interval.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-timeslot-interval.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-timeslot-interval.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-timeslot-picker.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
- package/dist/nylas-web-elements/paintbrush-fill-icon.entry.js +1 -1
- package/dist/nylas-web-elements/paintbrush-icon.entry.js +1 -1
- package/dist/nylas-web-elements/people-icon.entry.js +1 -1
- package/dist/nylas-web-elements/person-clipboard-icon.entry.js +1 -1
- package/dist/nylas-web-elements/person-icon.entry.js +1 -1
- package/dist/nylas-web-elements/play-icon.entry.js +1 -1
- package/dist/nylas-web-elements/plus-icon.entry.js +1 -1
- package/dist/nylas-web-elements/radio-button-group.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/radio-button-group.entry.js +1 -1
- package/dist/nylas-web-elements/radio-button-group.entry.js.map +1 -1
- package/dist/nylas-web-elements/refresh-icon.entry.js +1 -1
- package/dist/nylas-web-elements/{register-component-BHk70oxk.js → register-component-Blj8K64f.js} +2 -2
- package/dist/nylas-web-elements/{register-component-BHk70oxk.js.map → register-component-Blj8K64f.js.map} +1 -1
- package/dist/nylas-web-elements/reply-all-icon.entry.js +1 -1
- package/dist/nylas-web-elements/reply-icon.entry.js +1 -1
- package/dist/nylas-web-elements/search-icon.entry.js +1 -1
- package/dist/nylas-web-elements/select-dropdown.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/select-dropdown.entry.js +1 -1
- package/dist/nylas-web-elements/select-dropdown.entry.js.map +1 -1
- package/dist/nylas-web-elements/sent-icon.entry.js +1 -1
- package/dist/nylas-web-elements/spam-icon.entry.js +1 -1
- package/dist/nylas-web-elements/star-icon.entry.js +1 -1
- package/dist/nylas-web-elements/stop-icon.entry.js +1 -1
- package/dist/nylas-web-elements/textarea-component.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/textarea-component.entry.js +1 -1
- package/dist/nylas-web-elements/textarea-component.entry.js.map +1 -1
- package/dist/nylas-web-elements/time-period-selector.entry.js +1 -1
- package/dist/nylas-web-elements/toggle-switch.entry.js +1 -1
- package/dist/nylas-web-elements/tooltip-component.entry.js +1 -1
- package/dist/nylas-web-elements/translate-icon.entry.js +1 -1
- package/dist/nylas-web-elements/trash-fill-icon.entry.js +1 -1
- package/dist/nylas-web-elements/trash-icon.entry.js +1 -1
- package/dist/nylas-web-elements/underline-icon.entry.js +1 -1
- package/dist/nylas-web-elements/{utils-Bj5Y75fX.js → utils-DhmCcrVs.js} +3 -3
- package/dist/nylas-web-elements/{utils-Bj5Y75fX.js.map → utils-DhmCcrVs.js.map} +1 -1
- package/dist/nylas-web-elements/warning-icon.entry.js +1 -1
- package/dist/nylas-web-elements/zoom-icon.entry.js +1 -1
- package/dist/types/components/design-system/input-component/input-component.d.ts +1 -0
- package/dist/types/components/design-system/multi-select-dropdown/multi-select-dropdown.d.ts +1 -0
- package/dist/types/components/design-system/textarea-component/textarea-component.d.ts +1 -0
- package/dist/types/components/scheduler-editor/nylas-customize-booking-settings/nylas-customize-booking-settings.d.ts +1 -1
- package/dist/types/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.d.ts +1 -0
- package/dist/types/components.d.ts +4 -4
- package/package.json +3 -3
- package/readme.md +1 -1
- package/dist/nylas-web-elements/index-B-KMpdMZ.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,a as n,h as l,d as o,e as a}from"./index-
|
|
1
|
+
import{r as e,a as n,h as l,d as o,e as a}from"./index-Cbn5rIwb.js";import{R as s}from"./register-component-Blj8K64f.js";import{b as t,i as d}from"./utils-DhmCcrVs.js";const r=':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;width:inherit}.nylas-scheduling-method{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200)}.nylas-scheduling-method .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-scheduling-method .header h3{margin:0;font-size:16px;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-scheduling-method .nylas-scheduling-method__dropdown{padding:1rem;display:flex;flex-direction:column;gap:4px}.nylas-scheduling-method .nylas-scheduling-method__dropdown span.nylas-scheduling-method__dropdown-label{display:flex;align-items:center;gap:4px;color:var(--nylas-base-800);margin:0.25rem 0 0 0;font-size:14px;font-weight:400;line-height:20px;text-align:left}.nylas-scheduling-method .nylas-scheduling-method__dropdown span.nylas-scheduling-method__dropdown-label tooltip-component{display:flex}.nylas-scheduling-method .nylas-scheduling-method__dropdown select-dropdown::part(sd_dropdown){width:100%}.nylas-scheduling-method .nylas-scheduling-method__dropdown select-dropdown::part(sd_dropdown-content){width:100%;max-width:unset}.nylas-scheduling-method .nylas-scheduling-method__dropdown select-dropdown::part(sd_dropdown-button){width:100%;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.nylas-scheduling-method .nylas-scheduling-method__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}.nylas-scheduling-method .nylas-scheduling-method__dropdown input-component::part(ic__input){background:var(--nylas-base-50);outline:none;cursor:not-allowed}';var i=undefined&&undefined.__decorate||function(e,n,l,o){var a=arguments.length,s=a<3?n:o===null?o=Object.getOwnPropertyDescriptor(n,l):o,t;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,n,l,o);else for(var d=e.length-1;d>=0;d--)if(t=e[d])s=(a<3?t(s):a>3?t(n,l,s):t(n,l))||s;return a>3&&s&&Object.defineProperty(n,l,s),s};var c=undefined&&undefined.__metadata||function(e,n){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,n)};const h=class{constructor(l){e(this,l);this.valueChanged=n(this,"valueChanged",7);if(l.$hostElement$["s-ei"]){this.internals=l.$hostElement$["s-ei"]}else{this.internals=l.$hostElement$.attachInternals();l.$hostElement$["s-ei"]=this.internals}this.name="availability-method";this.readOnly=false;this.showSubTitle=false;this.selectedBookingType=""}connectedCallback(){t("nylas-scheduling-method","connectedCallback")}disconnectedCallback(){t("nylas-scheduling-method","disconnectedCallback")}componentWillLoad(){t("nylas-scheduling-method","componentWillLoad");this.host.setAttribute("name",this.name)}componentDidLoad(){t("nylas-scheduling-method","componentDidLoad");const e=this.selectedConfiguration?.availability?.availability_rules?.availability_method?.toString();if(e&&typeof this.internals.setFormValue==="function"){this.internals.setFormValue(e,this.name)}this.selectedBookingType=e||"collective"}componentWillUpdate(){t("nylas-scheduling-method","componentWillUpdate")}componentDidUpdate(){t("nylas-scheduling-method","componentDidUpdate")}componentWillRender(){t("nylas-scheduling-method","componentWillRender")}componentDidRender(){t("nylas-scheduling-method","componentDidRender")}elementNameChangedHandler(e){t("nylas-scheduling-method","elementNameChangedHandler",e);this.host.setAttribute("name",e)}selectedLanguageChangedHandler(e,n){if(e===n)return;d.changeLanguage(e)}selectedConfigurationChangedHandler(e,n){const l=e?.availability?.availability_rules?.availability_method??"collective";this.internals.setFormValue(l,this.name);this.selectedBookingType=l||"collective"}themeConfigChangedHandler(e,n){if(e===n)return;this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[n,l]of Object.entries(e)){this.host.style.setProperty(`${n}`,l)}}}nylasFormDropdownChangedHandler(e){t("nylas-scheduling-method","nylasFormDropdownChangedHandler",e.detail);const n=e=>{const{value:n}=e.detail;if(n){this.selectedBookingType=n;this.internals.setFormValue(n,this.name)}};this.valueChanged.emit({value:e.detail.value,name:this.name,valueChanged:n})}render(){const e=[{label:d.t("nylasSchedulingMethod.schedulingMethodOptions",{context:"collective"}),value:"collective"},{label:d.t("nylasSchedulingMethod.schedulingMethodOptions",{context:"maxFairness"}),value:"max-fairness"},{label:d.t("nylasSchedulingMethod.schedulingMethodOptions",{context:"maxAvailability"}),value:"max-availability"}];const n=this.selectedConfiguration?.availability?.availability_rules?.availability_method?.toString();const a=this.participantOptions&&this.participantOptions?.length>0&&!!this.participantOptions[0].email&&!!this.participantOptions[0].name&&!!this.participantOptions[0].calendars&&this.participantOptions[0].calendars.length>0;if((n||!a)&&!this.readOnly){return null}return l(o,null,l("div",{class:"nylas-scheduling-method",part:"nsm"},l("div",{class:"header",part:"nsm__header"},l("h3",null,d.t("nylasSchedulingMethod.headerTitle"))),l("div",{class:"nylas-scheduling-method__dropdown"},this.showSubTitle&&l("span",{class:"nylas-scheduling-method__dropdown-label"},d.t("nylasSchedulingMethod.headerSubTitle"),l("tooltip-component",null,l("info-icon",{slot:"tooltip-icon"}),l("span",{slot:"tooltip-content"},l("strong",null,d.t("nylasSchedulingMethod.tooltip.standard.label")),l("br",null),"- ",d.t("nylasSchedulingMethod.tooltip.standard.desc"),l("br",null),l("br",null),l("strong",null,d.t("nylasSchedulingMethod.tooltip.maxFairness.label")),l("br",null),"- ",d.t("nylasSchedulingMethod.tooltip.maxFairness.desc"),l("br",null),l("br",null),l("strong",null,d.t("nylasSchedulingMethod.tooltip.maxAvailability.label")),l("br",null),"- ",d.t("nylasSchedulingMethod.tooltip.maxAvailability.desc"),l("br",null)))),this.readOnly?l("input-component",{name:"availability-method-read-only",type:"text",exportparts:"ic__label: nsm__input-label, ic__input: nsm__input, ic__input_wrapper: nsm__input_wrapper",readOnly:true,defaultValue:e.find((e=>e.value==n))?.label??e[0].label,themeConfig:this.themeConfig}):l("select-dropdown",{name:this.name,options:e,withSearch:false,exportparts:"sd_dropdown: nsm__dropdown, sd_dropdown-button: nsm__dropdown-button, sd_dropdown-content: nsm__dropdown-content",defaultSelectedOption:e.find((e=>e.value==n))??e[0],themeConfig:this.themeConfig}))))}static get formAssociated(){return true}get host(){return a(this)}static get watchers(){return{name:["elementNameChangedHandler"],selectedLanguage:["selectedLanguageChangedHandler"],selectedConfiguration:["selectedConfigurationChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};i([s({name:"nylas-scheduling-method",stateToProps:new Map([["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.selectedLanguage","selectedLanguage"],["schedulerConfig.themeConfig","themeConfig"]]),localPropsToProp:new Map([["additionalParticipants","participantOptions"]]),eventToProps:{valueChanged:async(e,n)=>{const{valueChanged:l}=e.detail;if(l){l(e)}}},fireRegisterEvent:true}),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],h.prototype,"render",null);h.style=r;export{h as nylas_scheduling_method};
|
|
2
2
|
//# sourceMappingURL=nylas-scheduling-method.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e,F as t,r as n,a as i,d as s,e as o}from"./index-B-KMpdMZ.js";import{N as a}from"./abstract-provider-D75Ucvku.js";import{i as r,e as l,b as c,f as d,h}from"./utils-Bj5Y75fX.js";import{E as g}from"./index-Cs6ndJrm.js";import{c as f}from"./index-BVtainOy.js";import{n as u}from"./index.es-BRLyNGE1.js";import{L as p,a as m}from"./constants-DhnshuDN.js";import{i as b,a as _,f as y,c as w,b as v}from"./index-BhxFO8d8.js";class k{constructor(){this.component=e=>{const t=g.Component;const n=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:n,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:n,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:n,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:n,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:n,message:e,category:t}),no_salt:(e="No salt provided")=>({title:n,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:n,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:n,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:n,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:n,message:e,category:t})}};this.api=e=>{const t=g.Api;const n=`${e} Error`;return{invalid_session:e=>({title:n,message:e,category:t}),general_error:e=>({title:n,message:e,category:t}),internal_error:e=>({title:n,message:e,category:t}),invalid_request_error:e=>({title:n,message:e,category:t}),timeslot_not_available:e=>({title:n,message:e,category:t}),provider_error:e=>({title:n,message:e,category:t}),not_found_error:e=>({title:n,message:e,category:t})}}}}class I{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){this.errors=new k;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=n;this.configId=i;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,n,i={}){try{const s=new URL(this.schedulerAPIURL);const o="2.2.0"?"2.2.0":"latest";s.pathname=e;const a=await fetch(decodeURIComponent(s.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":o,...this.clientId&&{"X-Nylas-Application-Public-Id":this.clientId},...i},body:n});const r=await a.json();return r}catch(e){return{error:{message:e.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){let t=e?.message||e?.title||"Something went wrong";if(e?.type==="provider_error"){t=e?.provider_error?.error?.message||e?.provider_error?.error?.title||"Something went wrong"}return t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e);this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e);r.changeLanguage(e)}async toggleAdditionalData(e){if(!e){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date;const t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const n=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(n,i);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const n=this.schedulerStore.get("availability").find((e=>new Date(e.start_time)>new Date));let i=e;if(n){i=n.start_time}this.schedulerStore.set("selectedDate",i);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return t}async setReschedule(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.state.eventInfo;if(t){this.schedulerStore.set("reschedulingEventInfo",t)}this.schedulerStore.set("rescheduleBookingId",e);await this.getUISettings();const n=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return n}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return e}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return e}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:t,selectedTimezone:n,bookingInfo:i,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!i){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:n;const l=s||"en-US";if(!a){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timezone_selected()}}const c=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(i?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:i?.primaryParticipant;const u=e?e?.guests||[]:i?.guests||[];const p=e?e?.additionalFields:g;const m=this.getHeaders();const b=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const _=`/v3/scheduling/bookings${b}`;if(c.length===0){const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,event_id:o?.event_id||undefined,master_id:o?.master_id||undefined,calendar_id:o?.calendar_id||undefined,email_language:this.getTwoLetterLanguageCode(l)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(c.length>0){d=c.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({participants:d?[{email:d}]:undefined,additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(l)}),m);if("data"in e){this.schedulerStore.set("isLoading",false);this.schedulerStore.set("eventInfo",e?.data);return e}else if(e.error?.message?.startsWith("The selected timeslot is unavailable")){continue}else{this.schedulerStore.set("isLoading",false);const t=e.error?.type;let n=e.error;if(t&&t in this.errors.api(r.t("createBookingErrorTitle"))){const e=this.getErrorMessage(n);n=this.errors.api(r.t("createBookingErrorTitle"))[t](e)}return{error:n}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(r.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.get("rescheduleBookingId");const t=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(e&&!!n){n+=`&booking_id=${e}`}else if(e){n+=`?booking_id=${e}`}const i=`/v3/scheduling/ui-settings${n}`;const s=await this.makeAPIRequest(i,"GET",undefined,t);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("getUISettingErrorTitle"))){t=this.errors.api(r.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in s){this.schedulerStore.set("configSettings",s.data);this.clientId=s.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return s}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const n=t?.min_booking_notice;if(!n){return e}const i=(new Date).getTime();if(e<(i+n*60*1e3)/1e3){return Math.floor((i+n*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const n=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const i=Math.floor(l(t,n).getTime()/1e3);const s=Math.min(i,e);return s}async getAvailability(e=0,t=0){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const i=new Date;const s=i.getTime();if(t&&t<s/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(r.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const o=this.getStartTimeWithMinBookingNotice(e);e=o;t=o>t?o+1:t;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(t.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const a=this.schedulerStore.get("rescheduleBookingId");if(a){n.append("booking_id",encodeURIComponent(a))}const l=n.toString();const c=`/v3/scheduling/availability${l?`?${l}`:""}`;const d=this.getHeaders();const h=await this.makeAPIRequest(decodeURIComponent(c),"GET",undefined,d);if("error"in h){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=h.error?.type;let t=h.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=r.t("invalidGrantError");return{error:{title:r.t("invalidGrantErrorTitle"),message:e,category:g.Api}}}if(e&&e in this.errors.api(r.t("getAvailabilityErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("getAvailabilityErrorTitle"))[e](n)}return{error:t}}if("data"in h){const e=h.data?.time_slots?.map((e=>({...e,start_time:new Date(e.start_time*1e3),end_time:new Date(e.end_time*1e3)})))||[];const t=e.filter((e=>e.start_time.getTime()>s));const n=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",n);const i=h.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",i)}this.schedulerStore.set("isLoading",false);return h}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("cancelBookingErrorTitle")).no_booking_id()}}const n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const i=`/v3/scheduling/bookings/${e}${n}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),s);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(r.t("cancelBookingErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("cancelBookingErrorTitle"))[e](n)}return{error:t}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return o}async rescheduleBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("rescheduleBookingErrorTitle")).no_booking_id()}}const n=this.errors.api(r.t("rescheduleBookingErrorTitle"));const i=this.errors.component(r.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:l}=this.schedulerStore.state;const{startTime:c,endTime:d,timezone:h}=t;const g=c||o?.start_time;if(!g){return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=this.schedulerStore.get("availabilityOrderEmails");let p="";if(u.length>0){const e=o?.emails||[];for(let t=0;t<u.length;t++){if(e.includes(u[t])){p=u[t];break}}}const m=h||a;if(!m){return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const _=o?.master_id||undefined;const y=o?.calendar_id||undefined;const w={};Object.entries(s?.additionalFields||{}).forEach((([e,t])=>{w[e]=t.value}));const v=t?t?.primaryParticipant:s?.primaryParticipant;const k=t?t?.guests||[]:s?.guests||[];const I=t?t?.additionalFields:w;const x=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const T=`/v3/scheduling/bookings/${e}${x}`;const C=this.getHeaders();const B=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:f.getTime()/1e3,timezone:m,additional_fields:I,guest:{...v},additional_guests:k,participants:p?[{email:p}]:undefined,email_language:this.getTwoLetterLanguageCode(l),event_id:b,master_id:_,calendar_id:y}),C);if("error"in B){this.schedulerStore.set("isLoading",false);const e=B.error?.type;let t=B.error;if(e&&e in n){const i=this.getErrorMessage(t);t=n[e](i)}return{error:t}}const E=this.schedulerStore.get("reschedulingEventInfo");if("data"in B){this.schedulerStore.set("eventInfo",B?.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 B}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:n,reason:i}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=n==="confirmed"?r.t("confirmBookingErrorTitle"):r.t("rejectBookingErrorTitle");if(!t){return{error:this.errors.component(o).no_booking_id()}}if(!s){return{error:this.errors.component(o).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const l=`/v3/scheduling/bookings/${t}${a}`;const c=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(l),"PUT",JSON.stringify({status:n,cancellation_reason:i,salt:s}),c);if("error"in d){this.schedulerStore.set("isLoading",false);const e=d.error?.type;let t=d.error;if(e&&e in this.errors.api(o)){const n=this.getErrorMessage(t);t=this.errors.api(o)[e](n)}return{error:t}}if("data"in d&&n==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&n==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:t})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return d}async validateGroupEventTimeslot(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("configSettings")?.configuration_id;if(!t){return{error:this.errors.component(r.t("validateTimeslotErrorTitle")).no_config_id()}}const n=this.getHeaders();const i=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(i),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),n);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("validateTimeslotErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("validateTimeslotErrorTitle"))[e](n)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class x{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!n&&!i&&!(s||o)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=i;this.sessionId=n;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){c("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new I({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId});return this._schedulerAPIConnector}resetStores(){this.nylasSchedulerStore.reset()}}function T(e={}){const t={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...e};c(`[defaultNylasStoreState]: `,t);const n=f(t);n.onChange("availability",(e=>{c(`[availability]: `,e);const t=e.map((e=>e.start_time));c(`[selectableDates]: `,t);n.set("selectableDates",t);const i=e[0];if(!i)return;const s=Math.floor((i.end_time.getTime()-i.start_time.getTime())/6e4);c(`[durationMinutes]: `,s);n.set("eventDuration",s)}));n.reset=()=>{for(const e in t){const i=t[e];n.set(e,i)}};return n}const C=(n,i)=>{const s=n.isLoading;const o=n.showNotification;const a=n.nylasBranding;const r=n.version;return e(t,null,o&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&i,e("div",{class:"footer"},a&&e("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true})),e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},r))))};const B=(t,n)=>e("div",{class:"message-banner"},n);const E=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto;border-left:none}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}.language-feedback-container{width:auto;position:absolute;bottom:4px;left:16px;display:flex;gap:8px;align-items:center}.language-feedback-container button-component#report-issue{position:initial}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}';const S={title:r.t("genericErrorTitle"),type:u.Error,category:g.Component};const L=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.schedulerWillLoad=i(this,"schedulerWillLoad",7);this.schedulerDidLoad=i(this,"schedulerDidLoad",7);this.nylasSchedulerError=i(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=i(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=i(this,"configSettingsLoaded",7);this.bookingRefExtracted=i(this,"bookingRefExtracted",7);this.bookedEventInfo=i(this,"bookedEventInfo",7);this.mode="app";this.schedulerApiUrl="https://api.us.nylas.com";this.nylasBranding=true;this.eventOverrides={};this.showNotification=true;this.enableUserFeedback=true;this.automaticComponentRegistration=true;this.selectedDateLabel=(new Date).toLocaleDateString(navigator.language,{dateStyle:"full"})||`${r.t("noDateSelected")}`;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version="2.2.0"?"2.2.0":"unknown"}connectedCallback(){c(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){c(`[nylas-scheduler] Component will load`);this.version="2.2.0"?"2.2.0":"unknown";if(this.enableUserFeedback&&!b()){_({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),y({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}const t=new URLSearchParams(window.location.search);const n=t.get("lang");const i=n&&Object.values(p).includes(n)?n:null;this.stores={scheduler:T({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,selectedLanguage:i||this.defaultLanguage||this.bookingInfo?.language||p.en,...this.defaultSchedulerState})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;if(this.rescheduleBookingRef){const[e,t,n]=d(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.cancelBookingRef){const[e,t,n]=d(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.organizerConfirmationBookingRef){const[e,t,n]=d(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",n);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:n})}this.applyThemeConfig(this.themeConfig);if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new x({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const r=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(r,this.nylasSchedulerConnector);if(r.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector)}async componentDidLoad(){this.baseProvider?.componentDidLoad();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}const e=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}}const n=this.baseProvider?.getStore("scheduler");const i=n?.get("configSettings")?.scheduler?.available_days_in_future;const s=n?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(n?.get("showBookingForm")){n?.set("selectedDate",s.start_time);return}}const o=n?.get("selectedDate");const a=n?.get("availability");let r;if(a&&a.length>0){return}if(!o){const e=new Date;const{startTime:t,endTime:n,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(e,i||30);if(e.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,n))}}else{const{startTime:e,endTime:t,endTimeForAvailableDaysInFuture:n}=this.validateAvailableDaysInFuture(o,i||30);if(o.getTime()<n*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(e,t))}}if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=n?.get("availability").find((e=>new Date(e.start_time)>new Date));if(t){e=t.start_time}n?.set("selectedDate",e)}}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",e.language)}}rescheduleBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}cancelBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}organizerConfirmationBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in p)){return}r.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);r.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=e.detail;this.language=t;r.changeLanguage(t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const n=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(e.defaultPrevented){return}if(i<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const n=this.stores?.scheduler.get("selectedLanguage");const i=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const o=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:o,email_language:n,timezone:i}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const n=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const i=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=i;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const i=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...i,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...i};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(o,this.nylasSchedulerConnector)}return}const o=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!o||"error"in o){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o?.error)},host:this.host})}const a=o?.data;const r=this.bookedEventInfo.emit({...o,data:{...a,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=e.detail;this.selectedDateLabel=t?t.toLocaleDateString(this.language,{dateStyle:"full"}):`${r.t("noDateSelected")}`}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}eventIsFullHandler(e){const t=e.detail.error;const n=e.detail.type;if(n==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:g.Component,type:u.Info,description:"The event you selected is full. Please try a different time.",id:(new Date).getTime().toString(),ttl:3e3},host:this.host})}}feedbackSubmittedHandler(e){const t=w("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const n={eventId:t,message:e.detail.feedback};v(n,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":this.version,"nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug,version:this.version}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||S.title,category:e?.category||S.category,type:u.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let e="";if(!this.sessionId){e+=r.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=r.t("sessionIdRequiredErrorMessage")+" "+r.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:r.t("schedulingComponentErrorTitle"),category:g.Component,type:u.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:r.t("invalidTimeslotErrorTitle"),category:g.Component,type:u.Error,description:r.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const n=new Date;const i=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const o=Math.floor(l(n,t).getTime()/1e3);const a=Math.min(o,s);const r=i<n.getTime()/1e3?Math.floor(n.getTime()/1e3):i;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:n}=e.detail;if(t==="language"){const e=p[n];r.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const n=this.baseProvider?.getStore("scheduler");const i=n?.get("eventInfo");const o=n?.get("showBookingForm");const a=n?.get("cancelledEventInfo");const l=n?.get("cancelBookingId");const c=n?.get("selectedTimeslot");const d=n?.get("rescheduleBookingId");const g=n?.get("organizerConfirmationBookingId");const f=n?.get("rejectBookingId");const u=n?.get("confirmedEventInfo");const b=n?.get("nylasBranding")||this.nylasBranding;const _=n?.get("selectedDate");const y=n?.get("configSettings")?.scheduler?.confirmation_redirect_url;this.selectedDateLabel=_&&this.language?h(_.toLocaleDateString(this.language,{dateStyle:"full"})):`${r.t("noDateSelected")}`;const w=Object.keys(m).map((e=>({label:m[e],value:e})));const v=n?.get("selectedLanguage")||this.defaultLanguage||navigator.language||p.en;if(t&&(l||f)&&!a){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:c,cancelBookingId:l,rejectBookingId:f,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&g){return e(s,null,e(C,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:g,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&a){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:a,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&u){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:u,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&i&&y){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const n=this.bookingInfoConfirmed?.booking_ref;const s=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((t=>{if(!s[t]&&e?.[t]){s[t]=e[t].value}}))}const o=this.stores?.scheduler.get("selectedTimeslot");const a=this.stores?.scheduler.get("selectedTimezone");const r=this.stores?.scheduler.get("selectedLanguage");const l=this.stores?.scheduler.get("configSettings");const c=this.configurationId?this.configurationId:l?.configuration_id;const d=window.location.search;const h=new URLSearchParams(d);h.set("booking_id",i.booking_id);e?.name&&h.set("name",e.name);e?.email&&h.set("email",e.email);o?.start_time&&h.set("start_time",(new Date(o.start_time).getTime()/1e3).toString());o?.end_time&&h.set("end_time",(new Date(o.end_time).getTime()/1e3).toString());a&&h.set("tz",a);r&&h.set("language",r);s&&h.set("additional_values",JSON.stringify(s));this.slug&&h.set("page_slug",this.slug);c&&h.set("config_id",c);t&&h.set("location",t);n&&h.set("booking_ref",n);this.redirectToCustomUrl(`${y}?${h.toString()}`);return}if(t&&i){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:c,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!i||!!d)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(B,null,`${r.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},e("div",{class:"left-panel",part:"ns_left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("h2",{part:"ns_right-panel__title"},e("calendar-icon",{part:"ns_right-panel__calendar-icon"}),e("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},this.selectedDateLabel)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!i&&o){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(B,null,`${r.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},e("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},e("div",{class:"wrapper",part:"ns_left-panel__wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return o(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};L.style=E;export{L as nylas_scheduling};
|
|
1
|
+
import{h as e,F as t,r as n,a as i,d as s,e as o}from"./index-Cbn5rIwb.js";import{N as a}from"./abstract-provider-9AZudYSI.js";import{i as r,e as l,b as c,f as d,h}from"./utils-DhmCcrVs.js";import{E as g}from"./index-Cs6ndJrm.js";import{c as f}from"./index-BPPwIJj2.js";import{n as u}from"./index.es-BRLyNGE1.js";import{L as p,a as m}from"./constants-DhnshuDN.js";import{i as b,a as _,f as y,c as w,b as v}from"./index-BhxFO8d8.js";class k{constructor(){this.component=e=>{const t=g.Component;const n=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:n,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:n,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:n,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:n,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:n,message:e,category:t}),no_salt:(e="No salt provided")=>({title:n,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:n,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:n,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:n,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:n,message:e,category:t})}};this.api=e=>{const t=g.Api;const n=`${e} Error`;return{invalid_session:e=>({title:n,message:e,category:t}),general_error:e=>({title:n,message:e,category:t}),internal_error:e=>({title:n,message:e,category:t}),invalid_request_error:e=>({title:n,message:e,category:t}),timeslot_not_available:e=>({title:n,message:e,category:t}),provider_error:e=>({title:n,message:e,category:t}),not_found_error:e=>({title:n,message:e,category:t})}}}}class I{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){this.errors=new k;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=n;this.configId=i;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,n,i={}){try{const s=new URL(this.schedulerAPIURL);const o="2.2.2"?"2.2.2":"latest";s.pathname=e;const a=await fetch(decodeURIComponent(s.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":o,...this.clientId&&{"X-Nylas-Application-Public-Id":this.clientId},...i},body:n});const r=await a.json();return r}catch(e){return{error:{message:e.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){let t=e?.message||e?.title||"Something went wrong";if(e?.type==="provider_error"){t=e?.provider_error?.error?.message||e?.provider_error?.error?.title||"Something went wrong"}return t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e);this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e);r.changeLanguage(e)}async toggleAdditionalData(e){if(!e){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date;const t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const n=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(n,i);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const n=this.schedulerStore.get("availability").find((e=>new Date(e.start_time)>new Date));let i=e;if(n){i=n.start_time}this.schedulerStore.set("selectedDate",i);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return t}async setReschedule(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.state.eventInfo;if(t){this.schedulerStore.set("reschedulingEventInfo",t)}this.schedulerStore.set("rescheduleBookingId",e);await this.getUISettings();const n=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return n}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return e}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return e}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:t,selectedTimezone:n,bookingInfo:i,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!i){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:n;const l=s||"en-US";if(!a){return{error:this.errors.component(r.t("createBookingErrorTitle")).no_timezone_selected()}}const c=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(i?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:i?.primaryParticipant;const u=e?e?.guests||[]:i?.guests||[];const p=e?e?.additionalFields:g;const m=this.getHeaders();const b=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const _=`/v3/scheduling/bookings${b}`;if(c.length===0){const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,event_id:o?.event_id||undefined,master_id:o?.master_id||undefined,calendar_id:o?.calendar_id||undefined,email_language:this.getTwoLetterLanguageCode(l)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(c.length>0){d=c.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({participants:d?[{email:d}]:undefined,additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(l)}),m);if("data"in e){this.schedulerStore.set("isLoading",false);this.schedulerStore.set("eventInfo",e?.data);return e}else if(e.error?.message?.startsWith("The selected timeslot is unavailable")){continue}else{this.schedulerStore.set("isLoading",false);const t=e.error?.type;let n=e.error;if(t&&t in this.errors.api(r.t("createBookingErrorTitle"))){const e=this.getErrorMessage(n);n=this.errors.api(r.t("createBookingErrorTitle"))[t](e)}return{error:n}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(r.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(){this.schedulerStore.set("isLoading",true);const e=this.schedulerStore.get("rescheduleBookingId");const t=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(e&&!!n){n+=`&booking_id=${e}`}else if(e){n+=`?booking_id=${e}`}const i=`/v3/scheduling/ui-settings${n}`;const s=await this.makeAPIRequest(i,"GET",undefined,t);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("getUISettingErrorTitle"))){t=this.errors.api(r.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in s){this.schedulerStore.set("configSettings",s.data);this.clientId=s.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return s}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const n=t?.min_booking_notice;if(!n){return e}const i=(new Date).getTime();if(e<(i+n*60*1e3)/1e3){return Math.floor((i+n*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const n=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const i=Math.floor(l(t,n).getTime()/1e3);const s=Math.min(i,e);return s}async getAvailability(e=0,t=0){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const i=new Date;const s=i.getTime();if(t&&t<s/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(r.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const o=this.getStartTimeWithMinBookingNotice(e);e=o;t=o>t?o+1:t;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(t.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const a=this.schedulerStore.get("rescheduleBookingId");if(a){n.append("booking_id",encodeURIComponent(a))}const l=n.toString();const c=`/v3/scheduling/availability${l?`?${l}`:""}`;const d=this.getHeaders();const h=await this.makeAPIRequest(decodeURIComponent(c),"GET",undefined,d);if("error"in h){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=h.error?.type;let t=h.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=r.t("invalidGrantError");return{error:{title:r.t("invalidGrantErrorTitle"),message:e,category:g.Api}}}if(e&&e in this.errors.api(r.t("getAvailabilityErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("getAvailabilityErrorTitle"))[e](n)}return{error:t}}if("data"in h){const e=h.data?.time_slots?.map((e=>({...e,start_time:new Date(e.start_time*1e3),end_time:new Date(e.end_time*1e3)})))||[];const t=e.filter((e=>e.start_time.getTime()>s));const n=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",n);const i=h.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",i)}this.schedulerStore.set("isLoading",false);return h}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("cancelBookingErrorTitle")).no_booking_id()}}const n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const i=`/v3/scheduling/bookings/${e}${n}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),s);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(r.t("cancelBookingErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("cancelBookingErrorTitle"))[e](n)}return{error:t}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return o}async rescheduleBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(r.t("rescheduleBookingErrorTitle")).no_booking_id()}}const n=this.errors.api(r.t("rescheduleBookingErrorTitle"));const i=this.errors.component(r.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:l}=this.schedulerStore.state;const{startTime:c,endTime:d,timezone:h}=t;const g=c||o?.start_time;if(!g){return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=this.schedulerStore.get("availabilityOrderEmails");let p="";if(u.length>0){const e=o?.emails||[];for(let t=0;t<u.length;t++){if(e.includes(u[t])){p=u[t];break}}}const m=h||a;if(!m){return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const _=o?.master_id||undefined;const y=o?.calendar_id||undefined;const w={};Object.entries(s?.additionalFields||{}).forEach((([e,t])=>{w[e]=t.value}));const v=t?t?.primaryParticipant:s?.primaryParticipant;const k=t?t?.guests||[]:s?.guests||[];const I=t?t?.additionalFields:w;const x=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const T=`/v3/scheduling/bookings/${e}${x}`;const C=this.getHeaders();const E=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:f.getTime()/1e3,timezone:m,additional_fields:I,guest:{...v},additional_guests:k,participants:p?[{email:p}]:undefined,email_language:this.getTwoLetterLanguageCode(l),event_id:b,master_id:_,calendar_id:y}),C);if("error"in E){this.schedulerStore.set("isLoading",false);const e=E.error?.type;let t=E.error;if(e&&e in n){const i=this.getErrorMessage(t);t=n[e](i)}return{error:t}}const S=this.schedulerStore.get("reschedulingEventInfo");if("data"in E){this.schedulerStore.set("eventInfo",E?.data)}else if(S){this.schedulerStore.set("eventInfo",S)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("isLoading",false);return E}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:n,reason:i}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=n==="confirmed"?r.t("confirmBookingErrorTitle"):r.t("rejectBookingErrorTitle");if(!t){return{error:this.errors.component(o).no_booking_id()}}if(!s){return{error:this.errors.component(o).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const l=`/v3/scheduling/bookings/${t}${a}`;const c=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(l),"PUT",JSON.stringify({status:n,cancellation_reason:i,salt:s}),c);if("error"in d){this.schedulerStore.set("isLoading",false);const e=d.error?.type;let t=d.error;if(e&&e in this.errors.api(o)){const n=this.getErrorMessage(t);t=this.errors.api(o)[e](n)}return{error:t}}if("data"in d&&n==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&n==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:t})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return d}async validateGroupEventTimeslot(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("configSettings")?.configuration_id;if(!t){return{error:this.errors.component(r.t("validateTimeslotErrorTitle")).no_config_id()}}const n=this.getHeaders();const i=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(i),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),n);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(r.t("validateTimeslotErrorTitle"))){const n=this.getErrorMessage(t);t=this.errors.api(r.t("validateTimeslotErrorTitle"))[e](n)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class x{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:n,configId:i,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!n&&!i&&!(s||o)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=i;this.sessionId=n;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){c("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new I({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId});return this._schedulerAPIConnector}resetStores(){this.nylasSchedulerStore.reset()}}function T(e={}){const t={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...e};c(`[defaultNylasStoreState]: `,t);const n=f(t);n.onChange("availability",(e=>{c(`[availability]: `,e);const t=e.map((e=>e.start_time));c(`[selectableDates]: `,t);n.set("selectableDates",t);const i=e[0];if(!i)return;const s=Math.floor((i.end_time.getTime()-i.start_time.getTime())/6e4);c(`[durationMinutes]: `,s);n.set("eventDuration",s)}));n.reset=()=>{for(const e in t){const i=t[e];n.set(e,i)}};return n}const C=(n,i)=>{const s=n.isLoading;const o=n.showNotification;const a=n.nylasBranding;const r=n.version;return e(t,null,o&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&i,e("div",{class:"footer"},a&&e("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true})),e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},r))))};const E=(t,n)=>e("div",{class:"message-banner"},n);const S=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto;border-left:none}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}.language-feedback-container{width:auto;position:absolute;bottom:4px;left:16px;display:flex;gap:8px;align-items:center}.language-feedback-container button-component#report-issue{position:initial}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}';const B={title:r.t("genericErrorTitle"),type:u.Error,category:g.Component};const L=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.schedulerWillLoad=i(this,"schedulerWillLoad",7);this.schedulerDidLoad=i(this,"schedulerDidLoad",7);this.nylasSchedulerError=i(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=i(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=i(this,"configSettingsLoaded",7);this.bookingRefExtracted=i(this,"bookingRefExtracted",7);this.bookedEventInfo=i(this,"bookedEventInfo",7);this.mode="app";this.schedulerApiUrl="https://api.us.nylas.com";this.nylasBranding=true;this.eventOverrides={};this.showNotification=true;this.enableUserFeedback=true;this.automaticComponentRegistration=true;this.selectedDateLabel=(new Date).toLocaleDateString(navigator.language,{dateStyle:"full"})||`${r.t("noDateSelected")}`;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version="2.2.2"?"2.2.2":"unknown"}connectedCallback(){c(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){c(`[nylas-scheduler] Component will load`);this.version="2.2.2"?"2.2.2":"unknown";if(this.enableUserFeedback&&!b()){_({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),y({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}const t=new URLSearchParams(window.location.search);const n=t.get("lang");const i=n&&Object.values(p).includes(n)?n:null;this.stores={scheduler:T({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,selectedLanguage:i||this.defaultLanguage||this.bookingInfo?.language||p.en,...this.defaultSchedulerState})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;if(this.rescheduleBookingRef){const[e,t,n]=d(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.cancelBookingRef){const[e,t,n]=d(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.organizerConfirmationBookingRef){const[e,t,n]=d(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",n);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:n})}this.applyThemeConfig(this.themeConfig);if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new x({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const r=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(r,this.nylasSchedulerConnector);if(r.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector)}async componentDidLoad(){this.baseProvider?.componentDidLoad();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}const e=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}}const n=this.baseProvider?.getStore("scheduler");const i=n?.get("configSettings")?.scheduler?.available_days_in_future;const s=n?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(n?.get("showBookingForm")){n?.set("selectedDate",s.start_time);return}}const o=n?.get("selectedDate");const a=n?.get("availability");let r;if(a&&a.length>0){return}if(!o){const e=new Date;const{startTime:t,endTime:n,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(e,i||30);if(e.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,n))}}else{const{startTime:e,endTime:t,endTimeForAvailableDaysInFuture:n}=this.validateAvailableDaysInFuture(o,i||30);if(o.getTime()<n*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(e,t))}}if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=n?.get("availability").find((e=>new Date(e.start_time)>new Date));if(t){e=t.start_time}n?.set("selectedDate",e)}}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",e.language)}}rescheduleBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}cancelBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}organizerConfirmationBookingRefChanged(e){if(e){const[t,n]=d(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.refConfigId=t;this.nylasSchedulerConnector?.scheduler.setConfigId(t)}}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in p)){return}r.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);r.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=e.detail;this.language=t;r.changeLanguage(t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const n=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(e.defaultPrevented){return}if(i<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const n=this.stores?.scheduler.get("selectedLanguage");const i=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const o=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:o,email_language:n,timezone:i}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const n=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const i=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=i;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const i=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...i,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...i};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(o,this.nylasSchedulerConnector)}return}const o=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!o||"error"in o){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o?.error)},host:this.host})}const a=o?.data;const r=this.bookedEventInfo.emit({...o,data:{...a,...n}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=e.detail;this.selectedDateLabel=t?t.toLocaleDateString(this.language,{dateStyle:"full"}):`${r.t("noDateSelected")}`}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}eventIsFullHandler(e){const t=e.detail.error;const n=e.detail.type;if(n==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:g.Component,type:u.Info,description:"The event you selected is full. Please try a different time.",id:(new Date).getTime().toString(),ttl:3e3},host:this.host})}}feedbackSubmittedHandler(e){const t=w("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const n={eventId:t,message:e.detail.feedback};v(n,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":this.version,"nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug,version:this.version}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||B.title,category:e?.category||B.category,type:u.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let e="";if(!this.sessionId){e+=r.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=r.t("sessionIdRequiredErrorMessage")+" "+r.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:r.t("schedulingComponentErrorTitle"),category:g.Component,type:u.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:r.t("invalidTimeslotErrorTitle"),category:g.Component,type:u.Error,description:r.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const n=new Date;const i=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const o=Math.floor(l(n,t).getTime()/1e3);const a=Math.min(o,s);const r=i<n.getTime()/1e3?Math.floor(n.getTime()/1e3):i;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:n}=e.detail;if(t==="language"){const e=p[n];r.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const n=this.baseProvider?.getStore("scheduler");const i=n?.get("eventInfo");const o=n?.get("showBookingForm");const a=n?.get("cancelledEventInfo");const l=n?.get("cancelBookingId");const c=n?.get("selectedTimeslot");const d=n?.get("rescheduleBookingId");const g=n?.get("organizerConfirmationBookingId");const f=n?.get("rejectBookingId");const u=n?.get("confirmedEventInfo");const b=n?.get("nylasBranding")||this.nylasBranding;const _=n?.get("selectedDate");const y=n?.get("configSettings")?.scheduler?.confirmation_redirect_url;this.selectedDateLabel=_&&this.language?h(_.toLocaleDateString(this.language,{dateStyle:"full"})):`${r.t("noDateSelected")}`;const w=Object.keys(m).map((e=>({label:m[e],value:e})));const v=n?.get("selectedLanguage")||this.defaultLanguage||navigator.language||p.en;if(t&&(l||f)&&!a){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:c,cancelBookingId:l,rejectBookingId:f,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&g){return e(s,null,e(C,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:g,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&a){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:a,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&u){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:u,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&i&&y){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const n=this.bookingInfoConfirmed?.booking_ref;const s=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((t=>{if(!s[t]&&e?.[t]){s[t]=e[t].value}}))}const o=this.stores?.scheduler.get("selectedTimeslot");const a=this.stores?.scheduler.get("selectedTimezone");const r=this.stores?.scheduler.get("selectedLanguage");const l=this.stores?.scheduler.get("configSettings");const c=this.configurationId?this.configurationId:l?.configuration_id;const d=window.location.search;const h=new URLSearchParams(d);h.set("booking_id",i.booking_id);e?.name&&h.set("name",e.name);e?.email&&h.set("email",e.email);o?.start_time&&h.set("start_time",(new Date(o.start_time).getTime()/1e3).toString());o?.end_time&&h.set("end_time",(new Date(o.end_time).getTime()/1e3).toString());a&&h.set("tz",a);r&&h.set("language",r);s&&h.set("additional_values",JSON.stringify(s));this.slug&&h.set("page_slug",this.slug);c&&h.set("config_id",c);t&&h.set("location",t);n&&h.set("booking_ref",n);this.redirectToCustomUrl(`${y}?${h.toString()}`);return}if(t&&i){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:c,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!i||!!d)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(E,null,`${r.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},e("div",{class:"left-panel",part:"ns_left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("h2",{part:"ns_right-panel__title"},e("calendar-icon",{part:"ns_right-panel__calendar-icon"}),e("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},this.selectedDateLabel)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!i&&o){return e(s,null,e(C,{version:this.version,nylasBranding:b,isLoading:this.isLoading,showNotification:this.showNotification},d&&e(E,null,`${r.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},e("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},e("div",{class:"wrapper",part:"ns_left-panel__wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${d?"reschedule":""}`,part:`ns_right-panel ${d?"ns_reschedule":""}`},e("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:r.t("search"),options:w,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:w.find((e=>e.value==v)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return o(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};L.style=S;export{L as nylas_scheduling};
|
|
2
2
|
//# sourceMappingURL=nylas-scheduling.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,a as n,h as t,d as l,e as a}from"./index-
|
|
1
|
+
import{r as e,a as n,h as t,d as l,e as a}from"./index-Cbn5rIwb.js";import{R as s}from"./register-component-Blj8K64f.js";import{b as o,i as r}from"./utils-DhmCcrVs.js";import{C as c}from"./constants-DhnshuDN.js";const y=':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;width:inherit}.nylas-select-event-type{height:inherit;overflow-y:auto}.nylas-select-event-type div.header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--nylas-base-200)}.nylas-select-event-type div.header h2{font-size:18px;padding:0 24px;line-height:24px;margin:0;font-weight:600;color:var(--nylas-base-800)}.nylas-select-event-type div.header button-component button{background:transparent;border:none;cursor:pointer}.nylas-select-event-type div.header button-component button:hover,.nylas-select-event-type div.header button-component button:active{color:var(--nylas-primary);background-color:transparent}.nylas-select-event-type div.header button-component button:disabled{cursor:not-allowed}.nylas-select-event-type div.content{padding:40px}.nylas-select-event-type div.content h3{margin:0 0 32px 0;font-size:18px;line-height:24px;font-weight:600}.nylas-select-event-type div.content div.event-type{display:flex;flex-direction:column;gap:8px}.nylas-select-event-type div.content div.event-type div.event-type-option{padding:16px;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-3x);width:inherit;cursor:pointer;display:flex;flex-direction:column;gap:8px}.nylas-select-event-type div.content div.event-type div.event-type-option h4{margin:0;font-size:16px;line-height:24px;font-weight:600;color:var(--nylas-base-900)}.nylas-select-event-type div.content div.event-type div.event-type-option p{margin:0;font-size:14px;line-height:21px;font-weight:400;color:var(--nylas-base-800)}';var i=undefined&&undefined.__decorate||function(e,n,t,l){var a=arguments.length,s=a<3?n:l===null?l=Object.getOwnPropertyDescriptor(n,t):l,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,n,t,l);else for(var r=e.length-1;r>=0;r--)if(o=e[r])s=(a<3?o(s):a>3?o(n,t,s):o(n,t))||s;return a>3&&s&&Object.defineProperty(n,t,s),s};var p=undefined&&undefined.__metadata||function(e,n){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,n)};const d=class{constructor(t){e(this,t);this.returnToAllSchedulingPagesEvent=n(this,"returnToAllSchedulingPagesEvent",7);this.createEventTypeSelected=n(this,"createEventTypeSelected",7);this.name="select-event-type";this.enableEventTypes={one_on_one:true,collective:true,max_fairness:true,max_availability:true,group:true}}connectedCallback(){o("nylas-select-event-type","connectedCallback")}disconnectedCallback(){o("nylas-select-event-type","disconnectedCallback")}componentWillLoad(){o("nylas-select-event-type","componentWillLoad");this.host.setAttribute("name",this.name)}componentDidLoad(){o("nylas-select-event-type","componentDidLoad")}elementNameChangedHandler(e){o("nylas-select-event-type","elementNameChangedHandler",e);this.host.setAttribute("name",e)}selectedLanguageChangedHandler(e,n){if(e===n)return;r.changeLanguage(e)}themeConfigChangedHandler(e,n){if(e===n)return;this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[n,t]of Object.entries(e)){this.host.style.setProperty(`${n}`,t)}}}render(){const e={"one-on-one":"one_on_one",collective:"collective","max-fairness":"max_fairness","max-availability":"max_availability",group:"group"};const n=[{label:r.t("nylasSelectEventType.eventTypeOptions.oneOnOne.label"),value:c.one_on_one,description:r.t("nylasSelectEventType.eventTypeOptions.oneOnOne.desc")},{label:r.t("nylasSelectEventType.eventTypeOptions.collective.label"),value:c.collective,description:r.t("nylasSelectEventType.eventTypeOptions.collective.desc")},{label:r.t("nylasSelectEventType.eventTypeOptions.maxFairness.label"),value:c.max_fairness,description:r.t("nylasSelectEventType.eventTypeOptions.maxFairness.desc")},{label:r.t("nylasSelectEventType.eventTypeOptions.maxAvailability.label"),value:c.max_availability,description:r.t("nylasSelectEventType.eventTypeOptions.maxAvailability.desc")},{label:r.t("nylasSelectEventType.eventTypeOptions.group.label"),value:c.group,description:r.t("nylasSelectEventType.eventTypeOptions.group.desc")}];const a=[c.collective,c.max_availability,c.max_fairness];const s=this.participantOptions&&this.participantOptions?.length>0&&!!this.participantOptions[0].email&&!!this.participantOptions[0].name&&!!this.participantOptions[0].calendars&&this.participantOptions[0].calendars.length>0;const o=this.enableEventTypes?n.filter((n=>{const t=n.value;const l=e[t];console.log("key",t,this.enableEventTypes?this.enableEventTypes[l]:"no enableEventTypes");if(a.includes(t)&&!s){return false}return this.enableEventTypes&&this.enableEventTypes[l]})):n;return t(l,null,t("div",{class:"nylas-select-event-type",part:"nset"},t("div",{class:"header",part:"nset__header"},t("h2",null,r.t("nylasSelectEventType.createEventHeaderTitle")),t("button-component",{variant:"invisible",part:"nset__header__back-button",onClick:e=>{this.returnToAllSchedulingPagesEvent.emit()}},t("chevron-icon",{width:"16",height:"16"}),t("span",null,r.t("nylasSelectEventType.returnToAllSchedulingPages")))),t("div",{class:"content",part:"nset__content"},t("h3",null,r.t("nylasSelectEventType.eventTypeHeaderTitle")),t("div",{class:"event-type",part:"nset__content__event-type"},o.length===0&&t("p",null,r.t("nylasSelectEventType.noEventTypesEnabled")),o.map((e=>t("div",{class:"event-type-option",onClick:n=>{this.createEventTypeSelected.emit({eventType:e.value})},part:`nset__content__event-type-option-${e.value}`},t("h4",null,e.label),t("p",null,e.description))))))))}get host(){return a(this)}static get watchers(){return{name:["elementNameChangedHandler"],selectedLanguage:["selectedLanguageChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};i([s({name:"nylas-select-event-type",stateToProps:new Map([["schedulerConfig.selectedLanguage","selectedLanguage"],["schedulerConfig.additionalParticipants","participantOptions"],["schedulerConfig.enableEventTypes","enableEventTypes"],["schedulerConfig.themeConfig","themeConfig"]]),eventToProps:{returnToAllSchedulingPagesEvent:async(e,n)=>{n.schedulerConfigStore.state.action=null;n.schedulerConfigStore.set("selectedEventType",undefined)},createEventTypeSelected:async(e,n)=>{const{eventType:t}=e.detail;n.schedulerConfigStore.state.action="create";n.schedulerConfigStore.state.selectedEventType=t}},fireRegisterEvent:true}),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",void 0)],d.prototype,"render",null);d.style=y;export{d as nylas_select_event_type};
|
|
2
2
|
//# sourceMappingURL=nylas-select-event-type.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,h as a,d as n,e as s}from"./index-
|
|
1
|
+
import{r as e,h as a,d as n,e as s}from"./index-Cbn5rIwb.js";import{R as l}from"./register-component-Blj8K64f.js";import{i as r,b as o,h as c,m as t}from"./utils-DhmCcrVs.js";import{b as d,T as i}from"./constants-DhnshuDN.js";const f=':host{--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;display:block;position:relative;height:inherit;display:flex;flex-direction:column;justify-content:center;align-items:center;font-family:var(--nylas-font-family)}.event-card{display:flex;align-items:center;flex-direction:column;gap:4px;width:calc(100% - 3rem);background-color:var(--nylas-base-0);color:var(--nylas-base-800);border-radius:var(--nylas-border-radius-2x);padding:3rem 1.5rem 1.5rem 1.5rem;position:relative;box-shadow:0px 1px 3px 0px rgba(0, 0, 0, 0.1), 0px 1px 2px 0px rgba(0, 0, 0, 0.06)}@media screen and (max-width: 768px){.event-card{margin-bottom:2rem}}.nylas-selected-event-card__date{font-size:min(max(16px, 3vw), 18px);font-weight:600}.nylas-selected-event-card__time{font-size:16px;font-weight:500}.calendar-icon{width:3rem;height:3rem;border-radius:50%;position:absolute;top:-1.25rem;left:50%;transform:translateX(-50%);background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200)}calendar-icon{display:flex;align-items:center;justify-content:center;height:100%}.event-timezone{display:flex;color:var(--nylas-base-600);margin-bottom:8px;gap:4px;align-items:center}@media screen and (max-width: 768px){.event-timezone{margin-bottom:16px}}';var y=undefined&&undefined.__decorate||function(e,a,n,s){var l=arguments.length,r=l<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,n):s,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(e,a,n,s);else for(var c=e.length-1;c>=0;c--)if(o=e[c])r=(l<3?o(r):l>3?o(a,n,r):o(a,n))||r;return l>3&&r&&Object.defineProperty(a,n,r),r};var b=undefined&&undefined.__metadata||function(e,a){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,a)};const p=class{constructor(a){e(this,a);this.selectedTimezone=Intl.DateTimeFormat().resolvedOptions().timeZone;this.startTime="";this.endTime=""}themeConfigChanged(e){this.applyThemeConfig(e)}selectedLanguageChangedHandler(e,a){if(e===a)return;r.changeLanguage(e)}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){o(`[nylas-selected-event-card] Component will load`)}async componentDidLoad(){o(`[nylas-selected-event-card] Component did load`);if(!this.selectedDate){console.warn('[nylas-selected-event-card] "selectedDate" prop is not provided.')}if(!this.selectedTimeslot){console.warn('[nylas-selected-event-card] "selectedTimeslot" prop is not provided.')}this.applyThemeConfig(this.themeConfig);const e=d[this.selectedLanguage||"en"];const a=new Intl.DateTimeFormat(e,{hour:"2-digit",minute:"2-digit",timeZone:this.selectedTimezone,hour12:this.hour12});this.startTime=a.format(new Date(this.selectedTimeslot?.start_time));this.endTime=a.format(new Date(this.selectedTimeslot?.end_time))}applyThemeConfig(e){if(e){for(const[a,n]of Object.entries(e)){this.host.style.setProperty(`${a}`,n)}}}render(){return a(n,{key:"26ad288d90c716428697c55be2c212548c166f0c",part:"nsec"},a("div",{key:"0254e7f037bf2b6a09948264e0b92e3be0c24980",class:"event-card",part:"nsec__card"},a("div",{key:"ed0687a2179f9dac19ff1a01747cf6c4f66e4fac",class:"calendar-icon",part:"nsec__icon"},a("calendar-icon",{key:"95d08f6cedd6df4741941ce626a3ecc31402b53e"})),a("div",{key:"fec779856f0cf94e99caf8525f8d1bec1e1426af",class:"nylas-selected-event-card__date",part:"nsec__date"},this.selectedDate?c(t(this.selectedTimeslot?.start_time,this.selectedTimezone,d[this.selectedLanguage||"en"])):"-"),a("div",{key:"fb7262fbafabc18ab0d4fb12d0a266ec4dc6b087",class:"nylas-selected-event-card__time",part:"nsec__time"},this.startTime," - ",this.endTime)),a("div",{key:"e2c91468ab74eb1609960917f90cd3d839913f07",class:"event-timezone",part:"nsec__timezone"},a("globe-icon",{key:"b809c99728e16f3d8906d7289a1b9a112cf005a9"}),i[this.selectedTimezone]))}get host(){return s(this)}static get watchers(){return{themeConfig:["themeConfigChanged"],selectedLanguage:["selectedLanguageChangedHandler"]}}};y([l({name:"nylas-selected-event-card",stateToProps:new Map([["scheduler.selectedDate","selectedDate"],["scheduler.selectedTimeslot","selectedTimeslot"],["scheduler.selectedTimezone","selectedTimezone"],["scheduler.selectedLanguage","selectedLanguage"],["scheduler.themeConfig","themeConfig"],["scheduler.hour12","hour12"]]),eventToProps:{},fireRegisterEvent:true}),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",void 0)],p.prototype,"render",null);p.style=f;export{p as nylas_selected_event_card};
|
|
2
2
|
//# sourceMappingURL=nylas-selected-event-card.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as i,a as e,h as t,d as a,e as s}from"./index-B-KMpdMZ.js";import{R as n}from"./register-component-BHk70oxk.js";import{b as r,i as l,E as c,D as p,G as o}from"./utils-Bj5Y75fX.js";const d=':host{display:block;width:100%}.nylas-specific-time-availability-picker{display:flex;flex-direction:column;gap:1rem;border-top:1px solid var(--nylas-base-200)}.nylas-specific-time-availability-picker .content{display:flex;flex-direction:column;gap:1.5rem;padding:16px}.nylas-specific-time-availability-picker .header{display:flex;flex-direction:column;gap:0.5rem}.nylas-specific-time-availability-picker .header .header-description{margin:0;font-size:0.875rem;color:var(--nylas-base-600);line-height:1.5}.nylas-specific-time-availability-picker .specific-times{display:flex;flex-direction:column;gap:1rem}.nylas-specific-time-availability-picker .empty-state{display:flex;flex-direction:column;align-items:center;padding:2rem 1rem;text-align:center}.nylas-specific-time-availability-picker .empty-state .empty-icon{margin-bottom:1.5rem;opacity:0.4;color:var(--nylas-base-400)}.nylas-specific-time-availability-picker .empty-state .empty-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--nylas-base-700);line-height:1.5}.nylas-specific-time-availability-picker .empty-state .empty-subtitle{margin:0;font-size:0.875rem;color:var(--nylas-base-500);line-height:1.5;max-width:300px}.nylas-specific-time-availability-picker .specific-time-entry{display:flex;flex-direction:column;gap:0;padding:12px;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius);background:var(--nylas-base-0)}.nylas-specific-time-availability-picker .specific-time-entry .entry-content{display:grid;grid-template-columns:160px auto 30px 30px;gap:12px}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .entry-content{grid-template-areas:"date calendar_toggle remove" "time_or_unavailable time_or_unavailable time_or_unavailable";grid-template-columns:1fr auto auto;grid-template-rows:1fr 1fr}}.nylas-specific-time-availability-picker .specific-time-entry .date-input-container{flex:0 0 auto;width:160px}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .date-input-container{grid-area:date}}.nylas-specific-time-availability-picker .specific-time-entry .date-input-container .date-input{width:100%}.nylas-specific-time-availability-picker .specific-time-entry .date-input-container nylas-date-component::part(ic__date){border:1px solid var(--nylas-base-200);height:50px;display:flex;align-items:center}.nylas-specific-time-availability-picker .specific-time-entry .time-pickers{display:grid;grid-template-columns:auto 10px 1fr;width:342px;gap:14px;flex:1;min-width:0}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .time-pickers{flex:1;width:auto;grid-area:time_or_unavailable}}.nylas-specific-time-availability-picker .specific-time-entry .time-pickers .time-separator{font-size:0.875rem;color:var(--nylas-base-600);font-weight:500;flex-shrink:0;line-height:1;padding:0 0px 0px 6px;margin-top:18px}.nylas-specific-time-availability-picker .specific-time-entry .unavailable-text{flex:1;display:flex;align-items:center;padding:0 15px;border-radius:var(--nylas-border-radius);background:var(--nylas-base-50);min-height:50px}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .unavailable-text{grid-area:time_or_unavailable}}.nylas-specific-time-availability-picker .specific-time-entry .unavailable-text .unavailable-label{font-size:0.875rem;color:var(--nylas-base-500);font-style:italic}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button{display:flex;align-items:center;justify-content:center;width:40px;height:48px;padding-left:8px;border:none;border-radius:4px;background:transparent;color:var(--nylas-base-400);cursor:pointer;transition:all 0.2s ease;flex-shrink:0}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .toggle-button{grid-area:calendar_toggle}}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button:hover{color:var(--nylas-primary)}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button:focus{outline:none}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button.unavailable{color:var(--nylas-error)}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button.unavailable:hover{color:var(--nylas-error)}.nylas-specific-time-availability-picker .specific-time-entry .remove-button{display:flex;align-items:center;justify-content:center;width:40px;height:48px;padding:0;border:none;border-radius:4px;background:transparent;color:var(--nylas-base-400);cursor:pointer;transition:all 0.2s ease;flex-shrink:0}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .remove-button{grid-area:remove}}.nylas-specific-time-availability-picker .specific-time-entry .remove-button:hover{color:var(--nylas-error)}.nylas-specific-time-availability-picker .specific-time-entry .remove-button:focus{outline:none;background:var(--nylas-base-100);box-shadow:0 0 0 2px var(--nylas-primary)}.nylas-specific-time-availability-picker .specific-time-entry .remove-button:active{background:var(--nylas-base-200)}.nylas-specific-time-availability-picker .specific-time-entry .error-message{width:-webkit-fill-available;padding:4px 8px;background:var(--nylas-error-50);color:var(--nylas-error);font-size:12px;border-radius:4px;border:1px solid var(--nylas-error-200);margin-top:8px}.nylas-specific-time-availability-picker .add-button-container{display:flex;justify-content:flex-start}.nylas-specific-time-availability-picker .add-button-container button-component{width:100%}::part(nstap__add-button){border:1px dashed var(--nylas-base-200);background:var(--nylas-base-0);color:var(--nylas-base-700)}::part(nstap__add-button):hover{border-color:var(--nylas-primary);background:var(--nylas-base-50);color:var(--nylas-primary)}::part(nstap__time-picker-container){flex:1;min-width:0}::part(nstap__time-picker-input){width:100%;font-size:0.875rem;min-height:50px;display:flex;align-items:center}::part(nstap__date-input){width:100%}::part(nstap__date-field){width:100%;font-size:0.875rem;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius);padding:0.5rem 0.75rem}::part(nstap__date-field):focus{border-color:var(--nylas-primary);box-shadow:0 0 0 3px rgba(59, 130, 246, 0.1)}::part(nstap__date-wrapper){margin:0}::part(nstap__date-label){margin:0;padding:0}::part(nstap__date-label) p{display:none}';var m=undefined&&undefined.__decorate||function(i,e,t,a){var s=arguments.length,n=s<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a,r;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")n=Reflect.decorate(i,e,t,a);else for(var l=i.length-1;l>=0;l--)if(r=i[l])n=(s<3?r(n):s>3?r(e,t,n):r(e,t))||n;return s>3&&n&&Object.defineProperty(e,t,n),n};var y=undefined&&undefined.__metadata||function(i,e){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(i,e)};const f=class{constructor(t){i(this,t);this.valueChanged=e(this,"valueChanged",7);if(t.$hostElement$["s-ei"]){this.internals=t.$hostElement$["s-ei"]}else{this.internals=t.$hostElement$.attachInternals();t.$hostElement$["s-ei"]=this.internals}this.name="specific-time-availability";this.specificDateEntries=[];this.validationErrors={}}connectedCallback(){r("nylas-specific-time-availability-picker","connectedCallback")}disconnectedCallback(){r("nylas-specific-time-availability-picker","disconnectedCallback")}componentWillLoad(){r("nylas-specific-time-availability-picker","componentWillLoad");this.host.setAttribute("name",this.name)}componentDidLoad(){r("nylas-specific-time-availability-picker","componentDidLoad");if(this.selectedConfiguration){this.configChangedHandler(this.selectedConfiguration)}else if(this.specificTimesAvailability&&this.specificTimesAvailability.length>0){this.loadSpecificTimeAvailability()}this.applyThemeConfig(this.themeConfig)}get isInternalsAvailable(){return typeof this.internals.setFormValue==="function"}elementNameChangedHandler(i){r("nylas-specific-time-availability-picker","elementNameChangedHandler",i);this.host.setAttribute("name",i)}configChangedHandler(i){r("nylas-specific-time-availability-picker","configChangedHandler",i);this.loadSpecificTimeAvailability()}selectedLanguageChangedHandler(i,e){if(i===e)return;l.changeLanguage(i)}themeConfigChangedHandler(i,e){if(i===e)return;this.applyThemeConfig(i)}applyThemeConfig(i){if(i){for(const[e,t]of Object.entries(i)){this.host.style.setProperty(`${e}`,t)}}}loadSpecificTimeAvailability(){if(!this.specificTimesAvailability||this.specificTimesAvailability.length===0){return}const i=this.specificTimesAvailability.map(((i,e)=>{const t=i.start==="00:00"&&i.end==="00:00";return{id:`specific-time-${e}`,date:i.date,startTime:t?"09:00am":c(i.start),endTime:t?"05:00pm":c(i.end),isUnavailable:t}}));this.specificDateEntries=i;this.emitValueChanged()}addSpecificTimeAvailability(){const i=new Date;const e=new Date(i);e.setDate(i.getDate()+this.specificDateEntries.length);const t=e.toISOString().split("T")[0];const a={id:`specific-time-${Date.now()}`,date:t,startTime:"09:00am",endTime:"05:00pm",isUnavailable:false};this.specificDateEntries=[...this.specificDateEntries,a];if(this.isInternalsAvailable){this.internals.setValidity({customError:false})}this.emitValueChanged()}removeSpecificTimeAvailability(i){this.specificDateEntries=this.specificDateEntries.filter((e=>e.id!==i));if(this.validationErrors[i]){const e={...this.validationErrors};delete e[i];this.validationErrors=e}this.emitValueChanged()}toggleAvailability(i){this.specificDateEntries=this.specificDateEntries.map((e=>{if(e.id===i){return{...e,isUnavailable:!e.isUnavailable}}return e}));if(this.validationErrors[i]){const e={...this.validationErrors};delete e[i];this.validationErrors=e}this.emitValueChanged()}validateEntry(i){if(!i.date){return l.t("nylasSpecificTimeAvailabilityPicker.errors.dateRequired")}const e=new Date(i.date);if(isNaN(e.getTime())){return l.t("nylasSpecificTimeAvailabilityPicker.errors.invalidDateFormat")}if(i.isUnavailable){return null}if(!i.startTime||!i.endTime){return l.t("nylasSpecificTimeAvailabilityPicker.errors.timesRequired")}const t=p(i.startTime);const a=p(i.endTime);if(t>=a){return l.t("nylasSpecificTimeAvailabilityPicker.errors.startTimeBeforeEndTime")}return null}validateAllEntries(){const i={};let e=false;this.specificDateEntries.forEach((t=>{const a=this.validateEntry(t);if(a){i[t.id]=a;e=true}}));this.validationErrors=i;if(e){const e=this.host.shadowRoot?.querySelector(`[data-entry-id="${Object.keys(i)[0]}"]`);if(this.isInternalsAvailable){this.internals.setValidity({customError:true},"Please fix validation errors",e)}}else{if(this.isInternalsAvailable){this.internals.setValidity({customError:false})}}return!e}handleTimeChange(i){const{key:e,value:t}=i.detail;const[a,s]=e.split("_");this.specificDateEntries=this.specificDateEntries.map((i=>{if(i.id===a){return{...i,[s==="start"?"startTime":"endTime"]:t}}return i}));if(this.validationErrors[a]){const i={...this.validationErrors};delete i[a];this.validationErrors=i}if(this.isInternalsAvailable){this.internals.setValidity({customError:false})}this.emitValueChanged()}setFormError(i){const{key:e,message:t}=i.detail;const[a]=e.split("_");if(t){this.validationErrors={...this.validationErrors,[a]:t};const i=this.host.shadowRoot?.getElementById(e);if(i&&this.isInternalsAvailable){this.internals.setValidity({customError:true},t,i)}}else{const i={...this.validationErrors};delete i[a];this.validationErrors=i;if(this.isInternalsAvailable){this.internals.setValidity({customError:false})}}}handleFormInputChange(i){const{name:e,value:t}=i.detail;if(e.startsWith("date-")&&e.includes("specific-time-")){const i=e.replace("date-","");this.specificDateEntries=this.specificDateEntries.map((e=>{if(e.id===i){return{...e,date:t}}return e}));if(this.validationErrors[i]){const e={...this.validationErrors};delete e[i];this.validationErrors=e}this.emitValueChanged()}}emitValueChanged(){const i=this.validateAllEntries();const e=this.specificDateEntries.filter((i=>i.date&&(i.isUnavailable||i.startTime&&i.endTime))).map((i=>({date:i.date,start:i.isUnavailable?"00:00":o(i.startTime),end:i.isUnavailable?"00:00":o(i.endTime)})));const t=JSON.stringify(e);if(this.isInternalsAvailable&&i){this.internals.setFormValue(t,this.name)}this.valueChanged.emit({value:t,name:this.name})}render(){return t(a,{key:"686401eefb5dbeb49631170b49c028369fa827b8"},t("div",{key:"f0c698b4b90eeae6577b6251212e8e5665ae4f32",class:"nylas-specific-time-availability-picker",part:"nstap"},t("div",{key:"cf083015f165865aa71bf2fa47e430c334f4ee61",class:"content",part:"nstap__content"},t("div",{key:"b0c5d6214cf66ec69b19a3a51eb2ba7c238b9216",class:"header",part:"nstap__header"},t("p",{key:"4db2a444db97282c9460dde577767405138752af",class:"header-description",part:"nstap__header-description"},l.t("nylasSpecificTimeAvailabilityPicker.headerDescription"))),t("div",{key:"d18cbc71db72333b119587c841d1584655caeb10",class:"specific-times",part:"nstap__specific-times"},this.specificDateEntries.length===0?t("div",{class:"empty-state",part:"nstap__empty-state"},t("div",{class:"empty-icon",part:"nstap__empty-icon"},t("calendar-icon",{width:"32",height:"32"})),t("h3",{class:"empty-title",part:"nstap__empty-title"},l.t("nylasSpecificTimeAvailabilityPicker.emptyState.title")),t("p",{class:"empty-subtitle",part:"nstap__empty-subtitle"},l.t("nylasSpecificTimeAvailabilityPicker.emptyState.subtitle"))):this.specificDateEntries.map((i=>t("div",{class:"specific-time-entry",part:"nstap__specific-time-entry",key:i.id,"data-entry-id":i.id},t("div",{class:"entry-content",part:"nstap__entry-content"},t("div",{class:"date-input-container",part:"nstap__date-input-container"},t("nylas-date-component",{name:`date-${i.id}`,defaultValue:i.date,placeholder:"yyyy-mm-dd",part:"nstap__date-input",class:"date-input",themeConfig:this.themeConfig,exportparts:"ic__date: nstap__date-field, ic__input_wrapper: nstap__date-wrapper, ic__label: nstap__date-label"})),i.isUnavailable?t("div",{class:"unavailable-text",part:"nstap__unavailable-text"},t("span",{class:"unavailable-label"},l.t("nylasSpecificTimeAvailabilityPicker.entireDayUnavailable"))):t("div",{class:"time-pickers",part:"nstap__time-pickers"},t("nylas-time-window-picker",{id:`${i.id}_start`,time:i.startTime,name:`${i.id}_start`,key:`${i.id}_start`,language:this.selectedLanguage,hasError:!!this.validationErrors[i.id],themeConfig:this.themeConfig,exportparts:"time-picker: nstap__time-picker-container, time-input: nstap__time-picker-input, times: nstap__time-picker-times"}),t("span",{class:"time-separator"},"-"),t("nylas-time-window-picker",{id:`${i.id}_end`,time:i.endTime,name:`${i.id}_end`,key:`${i.id}_end`,minimumStartTime:i.startTime,language:this.selectedLanguage,hasError:!!this.validationErrors[i.id],themeConfig:this.themeConfig,exportparts:"time-picker: nstap__time-picker-container, time-input: nstap__time-picker-input, times: nstap__time-picker-times"})),t("button",{type:"button",class:{"toggle-button":true,unavailable:i.isUnavailable},part:"nstap__toggle-button",onClick:()=>this.toggleAvailability(i.id),title:i.isUnavailable?l.t("nylasSpecificTimeAvailabilityPicker.markAsAvailable"):l.t("nylasSpecificTimeAvailabilityPicker.markAsUnavailable")},t("calendar-icon",{width:"20",height:"20"})),t("button",{type:"button",class:"remove-button",part:"nstap__remove-button",onClick:()=>this.removeSpecificTimeAvailability(i.id),"aria-label":"Remove specific date"},t("close-icon",{width:"16",height:"16"}))),this.validationErrors[i.id]&&t("div",{class:"error-message",part:"nstap__error-message"},this.validationErrors[i.id]))))),t("div",{key:"a19b81a8b03e9365abc79013f60c71c39e525449",class:"add-button-container",part:"nstap__add-button-container"},t("button-component",{key:"c7a64f0af13a781d69a0535ed546b535eb538849",id:"add-specific-time-open-hour",onClick:()=>this.addSpecificTimeAvailability(),part:"nstap__add-button",variant:"basic"},t("add-circle-icon",{key:"53f911b0a3579039ba64f8444fe465958d17c716",width:"24",height:"24"}),l.t("nylasSpecificTimeAvailabilityPicker.addSpecificTimeAvailability"))))))}static get formAssociated(){return true}get host(){return s(this)}static get watchers(){return{name:["elementNameChangedHandler"],selectedConfiguration:["configChangedHandler"],selectedLanguage:["selectedLanguageChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};m([n({name:"nylas-specific-time-availability-picker",stateToProps:new Map([["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.selectedLanguage","selectedLanguage"],["schedulerConfig.themeConfig","themeConfig"]]),fireRegisterEvent:true}),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",void 0)],f.prototype,"render",null);f.style=d;export{f as nylas_specific_time_availability_picker};
|
|
1
|
+
import{r as i,a as e,h as t,d as a,e as s}from"./index-Cbn5rIwb.js";import{R as n}from"./register-component-Blj8K64f.js";import{b as r,i as l,E as c,D as p,G as o}from"./utils-DhmCcrVs.js";const d=':host{display:block;width:100%}.nylas-specific-time-availability-picker{display:flex;flex-direction:column;gap:1rem;border-top:1px solid var(--nylas-base-200)}.nylas-specific-time-availability-picker .content{display:flex;flex-direction:column;gap:1.5rem;padding:16px}.nylas-specific-time-availability-picker .header{display:flex;flex-direction:column;gap:0.5rem}.nylas-specific-time-availability-picker .header .header-description{margin:0;font-size:0.875rem;color:var(--nylas-base-600);line-height:1.5}.nylas-specific-time-availability-picker .specific-times{display:flex;flex-direction:column;gap:1rem}.nylas-specific-time-availability-picker .empty-state{display:flex;flex-direction:column;align-items:center;padding:2rem 1rem;text-align:center}.nylas-specific-time-availability-picker .empty-state .empty-icon{margin-bottom:1.5rem;opacity:0.4;color:var(--nylas-base-400)}.nylas-specific-time-availability-picker .empty-state .empty-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--nylas-base-700);line-height:1.5}.nylas-specific-time-availability-picker .empty-state .empty-subtitle{margin:0;font-size:0.875rem;color:var(--nylas-base-500);line-height:1.5;max-width:300px}.nylas-specific-time-availability-picker .specific-time-entry{display:flex;flex-direction:column;gap:0;padding:12px;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius);background:var(--nylas-base-0)}.nylas-specific-time-availability-picker .specific-time-entry .entry-content{display:grid;grid-template-columns:160px auto 30px 30px;gap:12px}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .entry-content{grid-template-areas:"date calendar_toggle remove" "time_or_unavailable time_or_unavailable time_or_unavailable";grid-template-columns:1fr auto auto;grid-template-rows:1fr 1fr}}.nylas-specific-time-availability-picker .specific-time-entry .date-input-container{flex:0 0 auto;width:160px}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .date-input-container{grid-area:date}}.nylas-specific-time-availability-picker .specific-time-entry .date-input-container .date-input{width:100%}.nylas-specific-time-availability-picker .specific-time-entry .date-input-container nylas-date-component::part(ic__date){border:1px solid var(--nylas-base-200);height:50px;display:flex;align-items:center}.nylas-specific-time-availability-picker .specific-time-entry .time-pickers{display:grid;grid-template-columns:auto 10px 1fr;width:342px;gap:14px;flex:1;min-width:0}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .time-pickers{flex:1;width:auto;grid-area:time_or_unavailable}}.nylas-specific-time-availability-picker .specific-time-entry .time-pickers .time-separator{font-size:0.875rem;color:var(--nylas-base-600);font-weight:500;flex-shrink:0;line-height:1;padding:0 0px 0px 6px;margin-top:18px}.nylas-specific-time-availability-picker .specific-time-entry .unavailable-text{flex:1;display:flex;align-items:center;padding:0 15px;border-radius:var(--nylas-border-radius);background:var(--nylas-base-50);min-height:50px}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .unavailable-text{grid-area:time_or_unavailable}}.nylas-specific-time-availability-picker .specific-time-entry .unavailable-text .unavailable-label{font-size:0.875rem;color:var(--nylas-base-500);font-style:italic}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button{display:flex;align-items:center;justify-content:center;width:40px;height:48px;padding-left:8px;border:none;border-radius:4px;background:transparent;color:var(--nylas-base-400);cursor:pointer;transition:all 0.2s ease;flex-shrink:0}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .toggle-button{grid-area:calendar_toggle}}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button:hover{color:var(--nylas-primary)}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button:focus{outline:none}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button.unavailable{color:var(--nylas-error)}.nylas-specific-time-availability-picker .specific-time-entry .toggle-button.unavailable:hover{color:var(--nylas-error)}.nylas-specific-time-availability-picker .specific-time-entry .remove-button{display:flex;align-items:center;justify-content:center;width:40px;height:48px;padding:0;border:none;border-radius:4px;background:transparent;color:var(--nylas-base-400);cursor:pointer;transition:all 0.2s ease;flex-shrink:0}@media (max-width: 768px){.nylas-specific-time-availability-picker .specific-time-entry .remove-button{grid-area:remove}}.nylas-specific-time-availability-picker .specific-time-entry .remove-button:hover{color:var(--nylas-error)}.nylas-specific-time-availability-picker .specific-time-entry .remove-button:focus{outline:none;background:var(--nylas-base-100);box-shadow:0 0 0 2px var(--nylas-primary)}.nylas-specific-time-availability-picker .specific-time-entry .remove-button:active{background:var(--nylas-base-200)}.nylas-specific-time-availability-picker .specific-time-entry .error-message{width:-webkit-fill-available;padding:4px 8px;background:var(--nylas-error-50);color:var(--nylas-error);font-size:12px;border-radius:4px;border:1px solid var(--nylas-error-200);margin-top:8px}.nylas-specific-time-availability-picker .add-button-container{display:flex;justify-content:flex-start}.nylas-specific-time-availability-picker .add-button-container button-component{width:100%}::part(nstap__add-button){border:1px dashed var(--nylas-base-200);background:var(--nylas-base-0);color:var(--nylas-base-700)}::part(nstap__add-button):hover{border-color:var(--nylas-primary);background:var(--nylas-base-50);color:var(--nylas-primary)}::part(nstap__time-picker-container){flex:1;min-width:0}::part(nstap__time-picker-input){width:100%;font-size:0.875rem;min-height:50px;display:flex;align-items:center}::part(nstap__date-input){width:100%}::part(nstap__date-field){width:100%;font-size:0.875rem;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius);padding:0.5rem 0.75rem}::part(nstap__date-field):focus{border-color:var(--nylas-primary);box-shadow:0 0 0 3px rgba(59, 130, 246, 0.1)}::part(nstap__date-wrapper){margin:0}::part(nstap__date-label){margin:0;padding:0}::part(nstap__date-label) p{display:none}';var m=undefined&&undefined.__decorate||function(i,e,t,a){var s=arguments.length,n=s<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a,r;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")n=Reflect.decorate(i,e,t,a);else for(var l=i.length-1;l>=0;l--)if(r=i[l])n=(s<3?r(n):s>3?r(e,t,n):r(e,t))||n;return s>3&&n&&Object.defineProperty(e,t,n),n};var y=undefined&&undefined.__metadata||function(i,e){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(i,e)};const f=class{constructor(t){i(this,t);this.valueChanged=e(this,"valueChanged",7);if(t.$hostElement$["s-ei"]){this.internals=t.$hostElement$["s-ei"]}else{this.internals=t.$hostElement$.attachInternals();t.$hostElement$["s-ei"]=this.internals}this.name="specific-time-availability";this.specificDateEntries=[];this.validationErrors={}}connectedCallback(){r("nylas-specific-time-availability-picker","connectedCallback")}disconnectedCallback(){r("nylas-specific-time-availability-picker","disconnectedCallback")}componentWillLoad(){r("nylas-specific-time-availability-picker","componentWillLoad");this.host.setAttribute("name",this.name)}componentDidLoad(){r("nylas-specific-time-availability-picker","componentDidLoad");if(this.selectedConfiguration){this.configChangedHandler(this.selectedConfiguration)}else if(this.specificTimesAvailability&&this.specificTimesAvailability.length>0){this.loadSpecificTimeAvailability()}this.applyThemeConfig(this.themeConfig)}get isInternalsAvailable(){return typeof this.internals.setFormValue==="function"}elementNameChangedHandler(i){r("nylas-specific-time-availability-picker","elementNameChangedHandler",i);this.host.setAttribute("name",i)}configChangedHandler(i){r("nylas-specific-time-availability-picker","configChangedHandler",i);this.loadSpecificTimeAvailability()}selectedLanguageChangedHandler(i,e){if(i===e)return;l.changeLanguage(i)}themeConfigChangedHandler(i,e){if(i===e)return;this.applyThemeConfig(i)}applyThemeConfig(i){if(i){for(const[e,t]of Object.entries(i)){this.host.style.setProperty(`${e}`,t)}}}loadSpecificTimeAvailability(){if(!this.specificTimesAvailability||this.specificTimesAvailability.length===0){return}const i=this.specificTimesAvailability.map(((i,e)=>{const t=i.start==="00:00"&&i.end==="00:00";return{id:`specific-time-${e}`,date:i.date,startTime:t?"09:00am":c(i.start),endTime:t?"05:00pm":c(i.end),isUnavailable:t}}));this.specificDateEntries=i;this.emitValueChanged()}addSpecificTimeAvailability(){const i=new Date;const e=new Date(i);e.setDate(i.getDate()+this.specificDateEntries.length);const t=e.toISOString().split("T")[0];const a={id:`specific-time-${Date.now()}`,date:t,startTime:"09:00am",endTime:"05:00pm",isUnavailable:false};this.specificDateEntries=[...this.specificDateEntries,a];if(this.isInternalsAvailable){this.internals.setValidity({customError:false})}this.emitValueChanged()}removeSpecificTimeAvailability(i){this.specificDateEntries=this.specificDateEntries.filter((e=>e.id!==i));if(this.validationErrors[i]){const e={...this.validationErrors};delete e[i];this.validationErrors=e}this.emitValueChanged()}toggleAvailability(i){this.specificDateEntries=this.specificDateEntries.map((e=>{if(e.id===i){return{...e,isUnavailable:!e.isUnavailable}}return e}));if(this.validationErrors[i]){const e={...this.validationErrors};delete e[i];this.validationErrors=e}this.emitValueChanged()}validateEntry(i){if(!i.date){return l.t("nylasSpecificTimeAvailabilityPicker.errors.dateRequired")}const e=new Date(i.date);if(isNaN(e.getTime())){return l.t("nylasSpecificTimeAvailabilityPicker.errors.invalidDateFormat")}if(i.isUnavailable){return null}if(!i.startTime||!i.endTime){return l.t("nylasSpecificTimeAvailabilityPicker.errors.timesRequired")}const t=p(i.startTime);const a=p(i.endTime);if(t>=a){return l.t("nylasSpecificTimeAvailabilityPicker.errors.startTimeBeforeEndTime")}return null}validateAllEntries(){const i={};let e=false;this.specificDateEntries.forEach((t=>{const a=this.validateEntry(t);if(a){i[t.id]=a;e=true}}));this.validationErrors=i;if(e){const e=this.host.shadowRoot?.querySelector(`[data-entry-id="${Object.keys(i)[0]}"]`);if(this.isInternalsAvailable){this.internals.setValidity({customError:true},"Please fix validation errors",e)}}else{if(this.isInternalsAvailable){this.internals.setValidity({customError:false})}}return!e}handleTimeChange(i){const{key:e,value:t}=i.detail;const[a,s]=e.split("_");this.specificDateEntries=this.specificDateEntries.map((i=>{if(i.id===a){return{...i,[s==="start"?"startTime":"endTime"]:t}}return i}));if(this.validationErrors[a]){const i={...this.validationErrors};delete i[a];this.validationErrors=i}if(this.isInternalsAvailable){this.internals.setValidity({customError:false})}this.emitValueChanged()}setFormError(i){const{key:e,message:t}=i.detail;const[a]=e.split("_");if(t){this.validationErrors={...this.validationErrors,[a]:t};const i=this.host.shadowRoot?.getElementById(e);if(i&&this.isInternalsAvailable){this.internals.setValidity({customError:true},t,i)}}else{const i={...this.validationErrors};delete i[a];this.validationErrors=i;if(this.isInternalsAvailable){this.internals.setValidity({customError:false})}}}handleFormInputChange(i){const{name:e,value:t}=i.detail;if(e.startsWith("date-")&&e.includes("specific-time-")){const i=e.replace("date-","");this.specificDateEntries=this.specificDateEntries.map((e=>{if(e.id===i){return{...e,date:t}}return e}));if(this.validationErrors[i]){const e={...this.validationErrors};delete e[i];this.validationErrors=e}this.emitValueChanged()}}emitValueChanged(){const i=this.validateAllEntries();const e=this.specificDateEntries.filter((i=>i.date&&(i.isUnavailable||i.startTime&&i.endTime))).map((i=>({date:i.date,start:i.isUnavailable?"00:00":o(i.startTime),end:i.isUnavailable?"00:00":o(i.endTime)})));const t=JSON.stringify(e);if(this.isInternalsAvailable&&i){this.internals.setFormValue(t,this.name)}this.valueChanged.emit({value:t,name:this.name})}render(){return t(a,{key:"686401eefb5dbeb49631170b49c028369fa827b8"},t("div",{key:"f0c698b4b90eeae6577b6251212e8e5665ae4f32",class:"nylas-specific-time-availability-picker",part:"nstap"},t("div",{key:"cf083015f165865aa71bf2fa47e430c334f4ee61",class:"content",part:"nstap__content"},t("div",{key:"b0c5d6214cf66ec69b19a3a51eb2ba7c238b9216",class:"header",part:"nstap__header"},t("p",{key:"4db2a444db97282c9460dde577767405138752af",class:"header-description",part:"nstap__header-description"},l.t("nylasSpecificTimeAvailabilityPicker.headerDescription"))),t("div",{key:"d18cbc71db72333b119587c841d1584655caeb10",class:"specific-times",part:"nstap__specific-times"},this.specificDateEntries.length===0?t("div",{class:"empty-state",part:"nstap__empty-state"},t("div",{class:"empty-icon",part:"nstap__empty-icon"},t("calendar-icon",{width:"32",height:"32"})),t("h3",{class:"empty-title",part:"nstap__empty-title"},l.t("nylasSpecificTimeAvailabilityPicker.emptyState.title")),t("p",{class:"empty-subtitle",part:"nstap__empty-subtitle"},l.t("nylasSpecificTimeAvailabilityPicker.emptyState.subtitle"))):this.specificDateEntries.map((i=>t("div",{class:"specific-time-entry",part:"nstap__specific-time-entry",key:i.id,"data-entry-id":i.id},t("div",{class:"entry-content",part:"nstap__entry-content"},t("div",{class:"date-input-container",part:"nstap__date-input-container"},t("nylas-date-component",{name:`date-${i.id}`,defaultValue:i.date,placeholder:"yyyy-mm-dd",part:"nstap__date-input",class:"date-input",themeConfig:this.themeConfig,exportparts:"ic__date: nstap__date-field, ic__input_wrapper: nstap__date-wrapper, ic__label: nstap__date-label"})),i.isUnavailable?t("div",{class:"unavailable-text",part:"nstap__unavailable-text"},t("span",{class:"unavailable-label"},l.t("nylasSpecificTimeAvailabilityPicker.entireDayUnavailable"))):t("div",{class:"time-pickers",part:"nstap__time-pickers"},t("nylas-time-window-picker",{id:`${i.id}_start`,time:i.startTime,name:`${i.id}_start`,key:`${i.id}_start`,language:this.selectedLanguage,hasError:!!this.validationErrors[i.id],themeConfig:this.themeConfig,exportparts:"time-picker: nstap__time-picker-container, time-input: nstap__time-picker-input, times: nstap__time-picker-times"}),t("span",{class:"time-separator"},"-"),t("nylas-time-window-picker",{id:`${i.id}_end`,time:i.endTime,name:`${i.id}_end`,key:`${i.id}_end`,minimumStartTime:i.startTime,language:this.selectedLanguage,hasError:!!this.validationErrors[i.id],themeConfig:this.themeConfig,exportparts:"time-picker: nstap__time-picker-container, time-input: nstap__time-picker-input, times: nstap__time-picker-times"})),t("button",{type:"button",class:{"toggle-button":true,unavailable:i.isUnavailable},part:"nstap__toggle-button",onClick:()=>this.toggleAvailability(i.id),title:i.isUnavailable?l.t("nylasSpecificTimeAvailabilityPicker.markAsAvailable"):l.t("nylasSpecificTimeAvailabilityPicker.markAsUnavailable")},t("calendar-icon",{width:"20",height:"20"})),t("button",{type:"button",class:"remove-button",part:"nstap__remove-button",onClick:()=>this.removeSpecificTimeAvailability(i.id),"aria-label":"Remove specific date"},t("close-icon",{width:"16",height:"16"}))),this.validationErrors[i.id]&&t("div",{class:"error-message",part:"nstap__error-message"},this.validationErrors[i.id]))))),t("div",{key:"a19b81a8b03e9365abc79013f60c71c39e525449",class:"add-button-container",part:"nstap__add-button-container"},t("button-component",{key:"c7a64f0af13a781d69a0535ed546b535eb538849",id:"add-specific-time-open-hour",onClick:()=>this.addSpecificTimeAvailability(),part:"nstap__add-button",variant:"basic"},t("add-circle-icon",{key:"53f911b0a3579039ba64f8444fe465958d17c716",width:"24",height:"24"}),l.t("nylasSpecificTimeAvailabilityPicker.addSpecificTimeAvailability"))))))}static get formAssociated(){return true}get host(){return s(this)}static get watchers(){return{name:["elementNameChangedHandler"],selectedConfiguration:["configChangedHandler"],selectedLanguage:["selectedLanguageChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};m([n({name:"nylas-specific-time-availability-picker",stateToProps:new Map([["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.selectedLanguage","selectedLanguage"],["schedulerConfig.themeConfig","themeConfig"]]),fireRegisterEvent:true}),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",void 0)],f.prototype,"render",null);f.style=d;export{f as nylas_specific_time_availability_picker};
|
|
2
2
|
//# sourceMappingURL=nylas-specific-time-availability-picker.entry.js.map
|