@nylas/web-elements 2.0.1 → 2.0.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/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +191 -95
- package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +10418 -10260
- package/dist/cjs/{abstract-provider-ca4f7e4f.js → abstract-provider-f84a6735.js} +2 -2
- package/dist/cjs/{abstract-provider-ca4f7e4f.js.map → abstract-provider-f84a6735.js.map} +1 -1
- package/dist/cjs/calendar-agenda-fill-icon_36.cjs.entry.js +36 -21
- package/dist/cjs/calendar-agenda-fill-icon_36.cjs.entry.js.map +1 -1
- package/dist/cjs/{calendar-check-icon_2.cjs.entry.js → calendar-check-icon.cjs.entry.js} +3 -19
- package/dist/cjs/calendar-check-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/checkbox-component_2.cjs.entry.js +1 -1
- package/dist/cjs/checkbox-group_4.cjs.entry.js +3 -3
- package/dist/cjs/checkmark-circle-icon.cjs.entry.js +24 -0
- package/dist/cjs/checkmark-circle-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/checkmark-icon_15.cjs.entry.js +11 -7
- package/dist/cjs/checkmark-icon_15.cjs.entry.js.map +1 -1
- package/dist/cjs/{customParseFormat-bb3a23c5.js → customParseFormat-95790293.js} +2 -2
- package/dist/cjs/{customParseFormat-bb3a23c5.js.map → customParseFormat-95790293.js.map} +1 -1
- package/dist/cjs/{feedbackSync-1c5ec9aa.js → feedbackSync-4ed99749.js} +2 -2
- package/dist/cjs/{feedbackSync-1c5ec9aa.js.map → feedbackSync-4ed99749.js.map} +1 -1
- package/dist/cjs/globe-icon_2.cjs.entry.js +2 -2
- package/dist/cjs/google-logo-icon_6.cjs.entry.js +8 -8
- package/dist/cjs/index-e07e3a7e.js +6 -2
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{index.es-c563f3ba.js → index.es-62161daa.js} +2 -2
- package/dist/cjs/{index.es-c563f3ba.js.map → index.es-62161daa.js.map} +1 -1
- package/dist/cjs/input-component.cjs.entry.js +1 -1
- package/dist/cjs/input-dropdown_2.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/multi-select-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/{nylas-api-request-4d148ff1.js → nylas-api-request-03d7f604.js} +2 -2
- package/dist/cjs/{nylas-api-request-4d148ff1.js.map → nylas-api-request-03d7f604.js.map} +1 -1
- package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js +82 -25
- package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-form-card.cjs.entry.js +2 -2
- package/dist/cjs/nylas-notification_2.cjs.entry.js +1 -1
- package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +6 -6
- package/dist/cjs/nylas-scheduling.cjs.entry.js +42 -14
- package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-web-elements.cjs.js +1 -1
- package/dist/cjs/{register-component-70744713.js → register-component-f4ad9751.js} +2 -2
- package/dist/cjs/{register-component-70744713.js.map → register-component-f4ad9751.js.map} +1 -1
- package/dist/cjs/textarea-component.cjs.entry.js +1 -1
- package/dist/cjs/{utils-dd3b6f4c.js → utils-03b13826.js} +154 -55
- package/dist/cjs/utils-03b13826.js.map +1 -0
- package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js +11 -3
- package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +49 -4
- package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-booking-form/test/nylas-booking-form.spec.js +3 -3
- package/dist/collection/components/scheduler/nylas-booking-form/test/nylas-booking-form.spec.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-cancel-booking-form/nylas-cancel-booking-form.js +37 -1
- package/dist/collection/components/scheduler/nylas-cancel-booking-form/nylas-cancel-booking-form.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js +34 -2
- package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-confirmed-event-card/nylas-confirmed-event-card.css +1 -1
- package/dist/collection/components/scheduler/nylas-confirmed-event-card/nylas-confirmed-event-card.js +34 -1
- package/dist/collection/components/scheduler/nylas-confirmed-event-card/nylas-confirmed-event-card.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +10 -4
- package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-organizer-confirmation-card/nylas-organizer-confirmation-card.js +10 -2
- package/dist/collection/components/scheduler/nylas-organizer-confirmation-card/nylas-organizer-confirmation-card.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.css +13 -0
- package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js +66 -7
- package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-scheduling/test/nylas-scheduling.spec.js +33 -0
- package/dist/collection/components/scheduler/nylas-scheduling/test/nylas-scheduling.spec.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.js +20 -5
- package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js +12 -6
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-booking-confirmation-redirect/nylas-booking-confirmation-redirect.js +12 -6
- package/dist/collection/components/scheduler-editor/nylas-booking-confirmation-redirect/nylas-booking-confirmation-redirect.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.js +6 -3
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-custom-event-slug/nylas-custom-event-slug.js +14 -8
- package/dist/collection/components/scheduler-editor/nylas-custom-event-slug/nylas-custom-event-slug.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-reminder-emails/nylas-reminder-emails.js +8 -4
- package/dist/collection/components/scheduler-editor/nylas-reminder-emails/nylas-reminder-emails.js.map +1 -1
- package/dist/components/nylas-additional-participants2.js +12 -6
- package/dist/components/nylas-additional-participants2.js.map +1 -1
- package/dist/components/nylas-booked-event-card2.js +13 -6
- package/dist/components/nylas-booked-event-card2.js.map +1 -1
- package/dist/components/nylas-booking-confirmation-redirect2.js +12 -6
- package/dist/components/nylas-booking-confirmation-redirect2.js.map +1 -1
- package/dist/components/nylas-booking-form2.js +28 -6
- package/dist/components/nylas-booking-form2.js.map +1 -1
- package/dist/components/nylas-cancel-booking-form2.js +13 -3
- package/dist/components/nylas-cancel-booking-form2.js.map +1 -1
- package/dist/components/nylas-cancelled-event-card2.js +12 -3
- package/dist/components/nylas-cancelled-event-card2.js.map +1 -1
- package/dist/components/nylas-confirmation-email2.js +6 -3
- package/dist/components/nylas-confirmation-email2.js.map +1 -1
- package/dist/components/nylas-confirmed-event-card2.js +18 -8
- package/dist/components/nylas-confirmed-event-card2.js.map +1 -1
- package/dist/components/nylas-custom-event-slug2.js +15 -9
- package/dist/components/nylas-custom-event-slug2.js.map +1 -1
- package/dist/components/nylas-date-picker2.js +1 -1
- package/dist/components/nylas-date-picker2.js.map +1 -1
- package/dist/components/nylas-editor-tabs-group2.js +2 -2
- package/dist/components/nylas-editor-tabs2.js +2 -2
- package/dist/components/nylas-organizer-confirmation-card2.js +12 -5
- package/dist/components/nylas-organizer-confirmation-card2.js.map +1 -1
- package/dist/components/nylas-reminder-emails2.js +8 -4
- package/dist/components/nylas-reminder-emails2.js.map +1 -1
- package/dist/components/nylas-scheduler-editor.js +2 -2
- package/dist/components/nylas-scheduling.js +42 -12
- package/dist/components/nylas-scheduling.js.map +1 -1
- package/dist/components/nylas-selected-event-card2.js +12 -5
- package/dist/components/nylas-selected-event-card2.js.map +1 -1
- package/dist/components/nylas-timeslot-picker2.js.map +1 -1
- package/dist/components/utils.js +153 -54
- package/dist/components/utils.js.map +1 -1
- package/dist/esm/{abstract-provider-efe136bd.js → abstract-provider-bdb7d9b4.js} +2 -2
- package/dist/esm/{abstract-provider-efe136bd.js.map → abstract-provider-bdb7d9b4.js.map} +1 -1
- package/dist/esm/calendar-agenda-fill-icon_36.entry.js +36 -21
- package/dist/esm/calendar-agenda-fill-icon_36.entry.js.map +1 -1
- package/dist/esm/{calendar-check-icon_2.entry.js → calendar-check-icon.entry.js} +4 -19
- package/dist/esm/calendar-check-icon.entry.js.map +1 -0
- package/dist/esm/checkbox-component_2.entry.js +1 -1
- package/dist/esm/checkbox-group_4.entry.js +3 -3
- package/dist/esm/checkmark-circle-icon.entry.js +20 -0
- package/dist/esm/checkmark-circle-icon.entry.js.map +1 -0
- package/dist/esm/checkmark-icon_15.entry.js +11 -7
- package/dist/esm/checkmark-icon_15.entry.js.map +1 -1
- package/dist/esm/{customParseFormat-edc38d83.js → customParseFormat-f0d21eb3.js} +2 -2
- package/dist/esm/{customParseFormat-edc38d83.js.map → customParseFormat-f0d21eb3.js.map} +1 -1
- package/dist/esm/{feedbackSync-e4378c0b.js → feedbackSync-b9c9e719.js} +2 -2
- package/dist/esm/{feedbackSync-e4378c0b.js.map → feedbackSync-b9c9e719.js.map} +1 -1
- package/dist/esm/globe-icon_2.entry.js +2 -2
- package/dist/esm/google-logo-icon_6.entry.js +8 -8
- package/dist/esm/index-091600eb.js +6 -2
- package/dist/esm/{index.es-6a9d55cf.js → index.es-ccb2a286.js} +2 -2
- package/dist/esm/{index.es-6a9d55cf.js.map → index.es-ccb2a286.js.map} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/input-component.entry.js +1 -1
- package/dist/esm/input-dropdown_2.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/multi-select-dropdown.entry.js +1 -1
- package/dist/esm/{nylas-api-request-f2e4e9b6.js → nylas-api-request-7d702661.js} +2 -2
- package/dist/esm/{nylas-api-request-f2e4e9b6.js.map → nylas-api-request-7d702661.js.map} +1 -1
- package/dist/esm/nylas-booked-event-card_11.entry.js +82 -25
- package/dist/esm/nylas-booked-event-card_11.entry.js.map +1 -1
- package/dist/esm/nylas-form-card.entry.js +2 -2
- package/dist/esm/nylas-notification_2.entry.js +1 -1
- package/dist/esm/nylas-scheduler-editor.entry.js +6 -6
- package/dist/esm/nylas-scheduling.entry.js +43 -15
- package/dist/esm/nylas-scheduling.entry.js.map +1 -1
- package/dist/esm/nylas-web-elements.js +1 -1
- package/dist/esm/{register-component-a1c3d7b4.js → register-component-9d4ceee5.js} +2 -2
- package/dist/esm/{register-component-a1c3d7b4.js.map → register-component-9d4ceee5.js.map} +1 -1
- package/dist/esm/textarea-component.entry.js +1 -1
- package/dist/esm/{utils-b7f9cbcc.js → utils-fb8a9ce4.js} +154 -55
- package/dist/esm/utils-fb8a9ce4.js.map +1 -0
- package/dist/nylas-web-elements/index.esm.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/{p-3ce8e281.js → p-094be30f.js} +2 -2
- package/dist/nylas-web-elements/p-18c58ea1.entry.js +2 -0
- package/dist/nylas-web-elements/p-18c58ea1.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-c12c18b2.entry.js → p-1dbaf879.entry.js} +2 -2
- package/dist/nylas-web-elements/p-2830522f.entry.js +2 -0
- package/dist/nylas-web-elements/p-2830522f.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-35297f33.entry.js → p-3b56d656.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-8e7882a1.js → p-3c8b7ba1.js} +2 -2
- package/dist/nylas-web-elements/{p-3204882f.entry.js → p-3f5e1e6b.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-5aae729f.js → p-4c1fafb4.js} +2 -2
- package/dist/nylas-web-elements/p-522270a2.entry.js +2 -0
- package/dist/nylas-web-elements/p-522270a2.entry.js.map +1 -0
- package/dist/nylas-web-elements/p-67e936ce.entry.js +2 -0
- package/dist/nylas-web-elements/p-67e936ce.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-9e11eb2c.js → p-6d8e2c6b.js} +2 -2
- package/dist/nylas-web-elements/{p-3362cf82.entry.js → p-8f82f281.entry.js} +2 -2
- package/dist/nylas-web-elements/p-920812bd.entry.js +8 -0
- package/dist/nylas-web-elements/p-920812bd.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-b40f7a77.entry.js → p-a42f41f7.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-8340d845.entry.js → p-aad611b4.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-6e56eb3f.js → p-ab88518b.js} +2 -2
- package/dist/nylas-web-elements/{p-5cf6301e.entry.js → p-b3500bf1.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-4d8f9740.entry.js → p-b6d863e0.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-50c255fa.entry.js → p-b8cf836f.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-996c827d.entry.js → p-bf37be06.entry.js} +2 -2
- package/dist/nylas-web-elements/p-de4b01ac.entry.js +2 -0
- package/dist/nylas-web-elements/p-de4b01ac.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-308e7adb.entry.js → p-f42e87c6.entry.js} +3 -3
- package/dist/nylas-web-elements/{p-dea32251.js → p-f4825eb1.js} +2 -2
- package/dist/nylas-web-elements/p-faa30369.js +14 -0
- package/dist/nylas-web-elements/{p-59e4ab2d.js.map → p-faa30369.js.map} +1 -1
- package/dist/types/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.d.ts +2 -0
- package/dist/types/components/scheduler/nylas-booking-form/nylas-booking-form.d.ts +7 -0
- package/dist/types/components/scheduler/nylas-cancel-booking-form/nylas-cancel-booking-form.d.ts +3 -0
- package/dist/types/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.d.ts +3 -1
- package/dist/types/components/scheduler/nylas-confirmed-event-card/nylas-confirmed-event-card.d.ts +3 -1
- package/dist/types/components/scheduler/nylas-date-picker/nylas-date-picker.d.ts +2 -1
- package/dist/types/components/scheduler/nylas-organizer-confirmation-card/nylas-organizer-confirmation-card.d.ts +2 -0
- package/dist/types/components/scheduler/nylas-scheduling/nylas-scheduling.d.ts +6 -0
- package/dist/types/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.d.ts +3 -1
- package/dist/types/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.d.ts +2 -1
- package/dist/types/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.d.ts +2 -0
- package/dist/types/components/scheduler-editor/nylas-booking-confirmation-redirect/nylas-booking-confirmation-redirect.d.ts +2 -0
- package/dist/types/components/scheduler-editor/nylas-custom-event-slug/nylas-custom-event-slug.d.ts +2 -0
- package/dist/types/components.d.ts +46 -6
- package/package.json +1 -1
- package/dist/cjs/calendar-check-icon_2.cjs.entry.js.map +0 -1
- package/dist/cjs/utils-dd3b6f4c.js.map +0 -1
- package/dist/esm/calendar-check-icon_2.entry.js.map +0 -1
- package/dist/esm/utils-b7f9cbcc.js.map +0 -1
- package/dist/nylas-web-elements/p-2b52b854.entry.js +0 -2
- package/dist/nylas-web-elements/p-2b52b854.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-59e4ab2d.js +0 -14
- package/dist/nylas-web-elements/p-8a3965ba.entry.js +0 -2
- package/dist/nylas-web-elements/p-8a3965ba.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-97128be4.entry.js +0 -8
- package/dist/nylas-web-elements/p-97128be4.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-d69f9d47.entry.js +0 -2
- package/dist/nylas-web-elements/p-d69f9d47.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-dcc8ca35.entry.js +0 -2
- package/dist/nylas-web-elements/p-dcc8ca35.entry.js.map +0 -1
- /package/dist/nylas-web-elements/{p-3ce8e281.js.map → p-094be30f.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-c12c18b2.entry.js.map → p-1dbaf879.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-35297f33.entry.js.map → p-3b56d656.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-8e7882a1.js.map → p-3c8b7ba1.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-3204882f.entry.js.map → p-3f5e1e6b.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-5aae729f.js.map → p-4c1fafb4.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-9e11eb2c.js.map → p-6d8e2c6b.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-3362cf82.entry.js.map → p-8f82f281.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-b40f7a77.entry.js.map → p-a42f41f7.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-8340d845.entry.js.map → p-aad611b4.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-6e56eb3f.js.map → p-ab88518b.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-5cf6301e.entry.js.map → p-b3500bf1.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-4d8f9740.entry.js.map → p-b6d863e0.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-50c255fa.entry.js.map → p-b8cf836f.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-996c827d.entry.js.map → p-bf37be06.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-308e7adb.entry.js.map → p-f42e87c6.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-dea32251.js.map → p-f4825eb1.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { R as RegisterComponent } from './register-component.js';
|
|
3
|
-
import { a as debug, n as capitalizeFirstLetter, o as formatBookedEventDate } from './utils.js';
|
|
3
|
+
import { b as instance, a as debug, n as capitalizeFirstLetter, o as formatBookedEventDate } from './utils.js';
|
|
4
4
|
import { a as LANGUAGE_CODE_TO_LOCALE_MAP, T as TIMEZONE_MAP } from './constants.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './calendar.js';
|
|
6
6
|
import { d as defineCustomElement$1 } from './globe.js';
|
|
@@ -39,6 +39,11 @@ const NylasSelectedEventCard = proxyCustomElement(class NylasSelectedEventCard e
|
|
|
39
39
|
themeConfigChanged(newThemeConfig) {
|
|
40
40
|
this.applyThemeConfig(newThemeConfig);
|
|
41
41
|
}
|
|
42
|
+
selectedLanguageChangedHandler(newVal, oldVal) {
|
|
43
|
+
if (newVal === oldVal)
|
|
44
|
+
return;
|
|
45
|
+
instance.changeLanguage(newVal);
|
|
46
|
+
}
|
|
42
47
|
connectedCallback() { }
|
|
43
48
|
disconnectedCallback() { }
|
|
44
49
|
async componentWillLoad() {
|
|
@@ -71,13 +76,14 @@ const NylasSelectedEventCard = proxyCustomElement(class NylasSelectedEventCard e
|
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
78
|
render() {
|
|
74
|
-
return (h(Host, { key: '
|
|
79
|
+
return (h(Host, { key: '94fd07366e885e81fb62049c5a44fe6679897aba', part: "nsec" }, h("div", { key: '8ca223250ff59a898eae64b4eaf1ad24e690d3a7', class: "event-card", part: "nsec__card" }, h("div", { key: '77c0fbd4495f0811e5bb05ea95f59d4b2bad90af', class: "calendar-icon", part: "nsec__icon" }, h("calendar-icon", { key: '3c1a395ec15145153c3d0d4b4986aea9a7943ddf' })), h("div", { key: '1c5ed82612ce165f89bd240b21482c916dbf166b', class: "nylas-selected-event-card__date", part: "nsec__date" }, this.selectedDate
|
|
75
80
|
? capitalizeFirstLetter(formatBookedEventDate(this.selectedTimeslot?.start_time, this.selectedTimezone, LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en']))
|
|
76
|
-
: '-'), h("div", { key: '
|
|
81
|
+
: '-'), h("div", { key: 'e62af1aba1c260d178f1cc95f3405e94448cdf29', class: "nylas-selected-event-card__time", part: "nsec__time" }, this.startTime, " - ", this.endTime)), h("div", { key: '6eea1eca90bde0bb49a747ad8ed3a5ca57971db4', class: "event-timezone", part: "nsec__timezone" }, h("globe-icon", { key: 'feac1b95d2177a39f84648ec0e8356026ebc9ef7' }), TIMEZONE_MAP[this.selectedTimezone])));
|
|
77
82
|
}
|
|
78
83
|
get host() { return this; }
|
|
79
84
|
static get watchers() { return {
|
|
80
|
-
"themeConfig": ["themeConfigChanged"]
|
|
85
|
+
"themeConfig": ["themeConfigChanged"],
|
|
86
|
+
"selectedLanguage": ["selectedLanguageChangedHandler"]
|
|
81
87
|
}; }
|
|
82
88
|
static get style() { return NylasSelectedEventCardStyle0; }
|
|
83
89
|
}, [1, "nylas-selected-event-card", {
|
|
@@ -90,7 +96,8 @@ const NylasSelectedEventCard = proxyCustomElement(class NylasSelectedEventCard e
|
|
|
90
96
|
"startTime": [32],
|
|
91
97
|
"endTime": [32]
|
|
92
98
|
}, undefined, {
|
|
93
|
-
"themeConfig": ["themeConfigChanged"]
|
|
99
|
+
"themeConfig": ["themeConfigChanged"],
|
|
100
|
+
"selectedLanguage": ["selectedLanguageChangedHandler"]
|
|
94
101
|
}]);
|
|
95
102
|
__decorate([
|
|
96
103
|
RegisterComponent({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nylas-selected-event-card2.js","mappings":";;;;;;;AAAA,MAAM,yBAAyB,GAAG,+uGAA+uG,CAAC;AAClxG,qCAAe,yBAAyB;;;;;;;;;;;;;;;;
|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iB,CAAiG;QACjH,IAAI,EAAE,2BAA2B;QACjC,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,wBAAwB,EAAE,cAAc,CAAC;YAC1C,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;YAClD,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;YAClD,CAAC,4BAA4B,EAAE,kBAAkB,CAAC;YAClD,CAAC,uBAAuB,EAAE,aAAa,CAAC;YACxC,CAAC,kBAAkB,EAAE,QAAQ,CAAC;SAC/B,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;oDAyBD;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.scss?tag=nylas-selected-event-card&encapsulation=shadow","src/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n @include default-css-variables;\n display: block;\n position: relative;\n height: inherit;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n font-family: var(--nylas-font-family);\n}\n\n.event-card {\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 4px;\n width: calc(100% - 3rem);\n background-color: var(--nylas-base-0);\n color: var(--nylas-base-800);\n border-radius: var(--nylas-border-radius-2x);\n padding: 3rem 1.5rem 1.5rem 1.5rem;\n position: relative;\n box-shadow:\n 0px 1px 3px 0px rgba(0, 0, 0, 0.1),\n 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n\n @media #{$mobile} {\n margin-bottom: 2rem;\n }\n}\n\n.nylas-selected-event-card__date {\n font-size: min(max(16px, 3vw), 18px);\n font-weight: 600;\n}\n\n.nylas-selected-event-card__time {\n font-size: 16px;\n font-weight: 500;\n}\n\n.calendar-icon {\n width: 3rem;\n height: 3rem;\n border-radius: 50%;\n position: absolute;\n top: -1.25rem;\n left: 50%;\n transform: translateX(-50%);\n background-color: var(--nylas-base-0);\n border: 1px solid var(--nylas-base-200);\n}\n\ncalendar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n\n.event-timezone {\n display: flex;\n color: var(--nylas-base-600);\n margin-bottom: 8px;\n\n @media #{$mobile} {\n margin-bottom: 16px;\n }\n\n gap: 4px;\n align-items: center;\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport type { NylasSchedulerConnector } from '../../..';\nimport type { ThemeConfig, Timeslot } from '@nylas/core';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { capitalizeFirstLetter, debug, formatBookedEventDate } from '@/utils/utils';\nimport { LANGUAGE_CODE, LANGUAGE_CODE_TO_LOCALE_MAP, TIMEZONE_MAP } from '@/common/constants';\nimport i18next from '@/utils/i18n';\n\n/**\n * The `nylas-selected-event-card` component is a UI component that displays the selected event card.\n *\n * @part nsec - The selected event card component.\n * @part nsec__card - The card component.\n * @part nsec__icon - The calendar icon.\n * @part nsec__date - The date selected.\n * @part nsec__time - The timeslot selected.\n * @part nsec__timezone - The timezone selected.\n */\n@Component({\n tag: 'nylas-selected-event-card',\n styleUrl: 'nylas-selected-event-card.scss',\n shadow: true,\n})\nexport class NylasSelectedEventCard {\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasSelectedEventCardElement;\n\n /**\n * @standalone\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: any;\n\n /**\n * The selected date.\n */\n @Prop({ attribute: 'selected-date' }) readonly selectedDate?: Date;\n\n /**\n * The selected time.\n */\n @Prop({ attribute: 'selected-timeslot' }) readonly selectedTimeslot?: Timeslot;\n\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n /**\n * The selected language.\n */\n @Prop({ attribute: 'selected-language' }) readonly selectedLanguage?: LANGUAGE_CODE;\n /**\n * The 12-hour time format.\n */\n @Prop() hour12?: boolean;\n\n @State() startTime: string = '';\n @State() endTime: string = '';\n\n @Watch('themeConfig')\n themeConfigChanged(newThemeConfig: ThemeConfig) {\n this.applyThemeConfig(newThemeConfig);\n }\n\n @Watch('selectedLanguage')\n selectedLanguageChangedHandler(newVal: LANGUAGE_CODE, oldVal: LANGUAGE_CODE) {\n if (newVal === oldVal) return;\n i18next.changeLanguage(newVal);\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n debug(`[nylas-selected-event-card] Component will load`);\n }\n\n async componentDidLoad() {\n debug(`[nylas-selected-event-card] Component did load`);\n if (!this.selectedDate) {\n console.warn('[nylas-selected-event-card] \"selectedDate\" prop is not provided.');\n }\n if (!this.selectedTimeslot) {\n console.warn('[nylas-selected-event-card] \"selectedTimeslot\" prop is not provided.');\n }\n this.applyThemeConfig(this.themeConfig);\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n const timeFormat = new Intl.DateTimeFormat(locale, {\n hour: '2-digit',\n minute: '2-digit',\n timeZone: this.selectedTimezone,\n hour12: this.hour12,\n });\n\n this.startTime = timeFormat.format(new Date(this.selectedTimeslot?.start_time as Date));\n this.endTime = timeFormat.format(new Date(this.selectedTimeslot?.end_time as Date));\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n @RegisterComponent<NylasSelectedEventCard, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-selected-event-card',\n stateToProps: new Map([\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.selectedTimeslot', 'selectedTimeslot'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.themeConfig', 'themeConfig'],\n ['scheduler.hour12', 'hour12'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host part=\"nsec\">\n <div class=\"event-card\" part=\"nsec__card\">\n <div class=\"calendar-icon\" part=\"nsec__icon\">\n <calendar-icon />\n </div>\n <div class=\"nylas-selected-event-card__date\" part=\"nsec__date\">\n {this.selectedDate\n ? capitalizeFirstLetter(\n formatBookedEventDate(this.selectedTimeslot?.start_time as Date, this.selectedTimezone, LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en']),\n )\n : '-'}\n </div>\n <div class=\"nylas-selected-event-card__time\" part=\"nsec__time\">\n {this.startTime} - {this.endTime}\n </div>\n </div>\n <div class=\"event-timezone\" part=\"nsec__timezone\">\n <globe-icon></globe-icon>\n {TIMEZONE_MAP[this.selectedTimezone]}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nylas-timeslot-picker2.js","mappings":";;;;;;;AAAA,MAAM,sBAAsB,GAAG,40HAA40H,CAAC;AAC52H,kCAAe,sBAAsB;;;;;;;;;;;;;;;;MCyBxB,mBAAmB;;;;;;;;QAwItB,4BAAuB,GAAG,OAAO,KAAY,EAAE,QAA8B;YACnF,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;YAC5D,IAAI,QAAQ,EAAE;gBACZ,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;aAC5D;SACF,CAAC;QAOM,qBAAgB,GAAG,CAAC,KAAa;YACvC,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;SACnC,CAAC;QAEM,qBAAgB,GAAG;YACzB,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC;SAChC,CAAC;;;;;gCA/H4E,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,C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QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;gBACxC,IAAI,QAAQ,IAAI,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAAE,QAAQ,EAAE;oBACxD,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,SAAS,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;oBAC5F,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,EAAE;wBAC/B,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,iDAAiD,CAAC;wBAChG,IAAI,YAAY,KAAK,eAAe,EAAE;4BACpC,IAAI,CAAC,yBAAyB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;yBACtD;6BAAM;4BACL,IAAI,CAAC,yBAAyB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;yBACvD;qBACF;iBACF;qBAAM;oBACL,uBAAuB,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;iBAC9D;aACF;YACD,qBAAqB,EAAE,OAAO,KAAqC,EAAE,wBAAiD;gBACpH,KAAK,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;aACvE;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iDAiFD;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.scss?tag=nylas-timeslot-picker&encapsulation=shadow","src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n height: calc(100% - 48px); //48px is the height of the header\n @include default-css-variables;\n}\n\n.time-picker-wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.timeslots {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.75rem;\n align-items: center;\n overflow-y: scroll;\n padding: 0.5rem 1.5rem 1.5rem;\n flex: 1;\n}\n\n.time {\n /* Frame 12 */\n box-sizing: border-box;\n\n /* Auto layout */\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 4px 12px;\n gap: 0.5rem;\n font-size: 16px;\n font-weight: 500;\n font-family: inherit;\n\n width: 100%;\n height: 48px;\n\n color: var(--nylas-base-800);\n background: var(--nylas-base-0);\n border: none;\n outline: 1.5px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n\n flex: none;\n order: 4;\n align-self: stretch;\n flex-grow: 0;\n\n cursor: pointer;\n\n &:hover,\n &:focus {\n color: var(--nylas-primary);\n outline-color: var(--nylas-primary);\n }\n\n &.selected {\n font-weight: 600;\n color: var(--nylas-primary);\n outline: 2px solid var(--nylas-primary);\n border-color: transparent;\n box-shadow: 0 0 0 2px var(--nylas-primary);\n }\n\n .time-label {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n\n span.spots {\n font-size: 14px;\n font-family: var(--nylas-font-family);\n font-weight: 400;\n color: var(--nylas-base-600);\n }\n }\n}\n\n.empty {\n text-align: center;\n padding: 0 1.5rem;\n color: var(--nylas-base-600);\n font-size: min(max(12px, 2vw), 14px);\n height: 450px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n@keyframes pulsate {\n 0% {\n background-color: var(--nylas-base-50);\n }\n\n 50% {\n background-color: var(--nylas-base-100);\n }\n\n 100% {\n background-color: var(--nylas-base-50);\n }\n}\n\n.loading {\n padding: 0 1.5rem;\n\n .timeslot-skeleton {\n width: 100%;\n height: 4rem;\n background-color: var(--nylas-base-50);\n margin-bottom: 0.5rem;\n border-radius: var(--nylas-border-radius-2x);\n animation: pulsate 1.5s infinite ease-in-out;\n }\n}\n\n.footer {\n width: 100%;\n padding: 14px;\n box-sizing: border-box;\n border-top: 1px solid var(--nylas-base-200);\n}","import { RegisterComponent } from '@/common/register-component';\nimport { debug, isSameDayTimezone } from '@/utils/utils';\nimport { Component, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerConnector } from '../../..';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { AvailabilityTimeslot } from '@/stores/scheduler-store';\nimport type { ThemeConfig, Timeslot } from '@nylas/core';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE_TO_LOCALE_MAP } from '@/common/constants';\n\n/**\n * The `nylas-timeslot-picker` component is a UI component that allows users to select a timeslot from a list of available timeslots.\n *\n * @slot timeslot-picker-cta-label - The label for the timeslot picker CTA. Default is \"Next\".\n * @part ntp - The timeslot picker component.\n * @part ntp__timeslot - The timeslot button.\n * @part ntp__timeslot--selected - The selected timeslot button.\n * @part ntp__button-primary - The timeslot picker CTA.\n * @part ntp__time-picker-wrapper - The timeslot picker wrapper.\n * @part ntp__timeslots - The timeslot picker timeslots.\n */\n@Component({\n tag: 'nylas-timeslot-picker',\n styleUrl: 'nylas-timeslot-picker.scss',\n shadow: true,\n})\nexport class NylasTimeslotPicker {\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasTimeslotPickerElement;\n /**\n * @standalone\n * The available timeslots.\n */\n @Prop({ attribute: 'availability' }) readonly availability?: AvailabilityTimeslot[];\n /**\n * @standalone\n * The loading state prop. Used to display loading state when fetching availability.\n */\n @Prop({ attribute: 'loading-state' }) readonly isLoading?: boolean;\n /**\n * @standalone\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: any;\n /**\n * The selected timeslot.\n */\n @Prop({ attribute: 'selected-timeslot' }) readonly selectedTimeslot?: Timeslot;\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n /**\n * The selected date.\n */\n @Prop({ attribute: 'selected-date' }) readonly selectedDate?: Date = new Date();\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: string;\n /**\n * The 12-hour time format.\n */\n @Prop() hour12?: boolean;\n\n /**\n * This event is fired when a timeslot is selected.\n */\n @Event() readonly timeslotSelected!: EventEmitter<Timeslot>;\n /**\n * This event is fired when a timeslot is confirmed. By default, this will proceed to the booking form page.\n */\n @Event() readonly timeslotConfirmed!: EventEmitter<{ timeslot: Timeslot; host: HTMLNylasTimeslotPickerElement }>;\n\n @Event() readonly validateTimeslotError!: EventEmitter<{ error: string; type: 'error' | 'info' }>;\n\n @State() times: AvailabilityTimeslot[] = [];\n @State() hoveredTimeslotIndex?: number;\n @State() selectedTimeslotIndex?: string;\n\n @Watch('selectedLanguage')\n selectedLanguageChanged(newLanguage: string) {\n i18next.changeLanguage(newLanguage);\n }\n\n @Watch('selectedDate')\n selectedDateChanged(newVal: Date | null | undefined) {\n debug(`[nylas-timeslot-picker] Selected date changed`, { newVal });\n\n if (newVal) {\n this.selectedTimeslotIndex = '';\n if (typeof newVal !== 'undefined') {\n const availableTimes = this.availability?.filter(timeslot => isSameDayTimezone(timeslot.start_time, newVal, this.selectedTimezone)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n }\n\n @Watch('availability')\n availabilityChanged(newVal: AvailabilityTimeslot[] | undefined) {\n debug(`[nylas-timeslot-picker] Available times changed`, { newVal, selectedDate: this.selectedDate });\n if (typeof newVal !== 'undefined') {\n const availableTimes = newVal\n ?.filter(timeslot => this.selectedDate && isSameDayTimezone(timeslot.start_time, this.selectedDate, this.selectedTimezone))\n .map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newThemeConfig: ThemeConfig) {\n this.applyThemeConfig(newThemeConfig);\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n debug(`[nylas-timeslot-picker] Component will load`, { selectedDate: this.selectedDate, availability: this.availability, times: this.times });\n }\n\n async componentDidLoad() {\n debug(`[nylas-timeslot-picker] Component did load`);\n const availableTimes = this.availability\n ?.filter(timeslot => this.selectedDate && isSameDayTimezone(timeslot.start_time, this.selectedDate, this.selectedTimezone))\n .map(timeslot => timeslot);\n this.times = availableTimes || [];\n this.applyThemeConfig(this.themeConfig);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n private getTimeslotId(timeslot: Timeslot, index: number) {\n const date = new Date(timeslot.start_time);\n const eventId = timeslot.event_id;\n return `${date.toLocaleDateString()}-${index}${eventId ? `-${eventId}` : ''}`;\n }\n\n private onClickSelectTime(timeslot: Timeslot, index: number) {\n debug(`[nylas-timeslot-picker] Time selected`, timeslot, index);\n this.selectedTimeslotIndex = this.getTimeslotId(timeslot, index);\n this.timeslotSelected.emit({\n start_time: timeslot.start_time,\n end_time: timeslot.end_time,\n emails: timeslot.emails,\n capacity: timeslot?.capacity,\n event_id: timeslot?.event_id,\n master_id: timeslot?.master_id,\n calendar_id: timeslot?.calendar_id,\n });\n }\n\n private handleConfirmedTimeslot = async (event: Event, timeslot: Timeslot | undefined) => {\n event.preventDefault();\n debug(`[nylas-timeslot-picker] Confirm timeslot`, timeslot);\n if (timeslot) {\n this.timeslotConfirmed.emit({ timeslot, host: this.host });\n }\n };\n\n @Method()\n async emitValidateTimeslotError(error: string, type: 'error' | 'info') {\n this.validateTimeslotError.emit({ error, type });\n }\n\n private handleMouseEnter = (index: number) => {\n this.hoveredTimeslotIndex = index;\n };\n\n private handleMouseLeave = () => {\n this.hoveredTimeslotIndex = -1;\n };\n\n private getTimeSlotLabel(timeslot: Timeslot) {\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n const timeFormat = new Intl.DateTimeFormat(locale, {\n hour: '2-digit',\n minute: '2-digit',\n timeZone: this.selectedTimezone,\n hour12: this.hour12,\n });\n return `${timeFormat.format(timeslot.start_time)} - ${timeFormat.format(timeslot.end_time)}`;\n }\n\n @RegisterComponent<NylasTimeslotPicker, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-timeslot-picker',\n stateToProps: new Map([\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.availability', 'availability'],\n ['scheduler.selectedTimeslot', 'selectedTimeslot'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.isLoading', 'isLoading'],\n ['scheduler.themeConfig', 'themeConfig'],\n ['scheduler.hour12', 'hour12'],\n ]),\n eventToProps: {\n timeslotSelected: async (event: CustomEvent<Timeslot>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotSelected', event.detail);\n nylasSchedulerConnector.scheduler.selectTime(event.detail);\n },\n timeslotConfirmed: async (event: CustomEvent<{ timeslot: Timeslot; host: HTMLNylasTimeslotPickerElement }>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotConfirmed', event.detail);\n const { timeslot, host } = event.detail;\n if (timeslot && timeslot?.event_id && timeslot?.capacity) {\n const result = await nylasSchedulerConnector.scheduler.validateGroupEventTimeslot(timeslot);\n if (result && 'error' in result) {\n const errorMessage = result.error?.message || 'An error occurred while validating the timeslot';\n if (errorMessage === 'Event is full') {\n host.emitValidateTimeslotError(errorMessage, 'info');\n } else {\n host.emitValidateTimeslotError(errorMessage, 'error');\n }\n }\n } else {\n nylasSchedulerConnector.scheduler.toggleAdditionalData(true);\n }\n },\n validateTimeslotError: async (event: CustomEvent<{ error: string }>, _nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'validateTimeslotError', event.detail);\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n if (this.isLoading) {\n return (\n <Host>\n <div class={'loading'}>\n {new Array(6).fill(0).map((_, i) => (\n <div class={'timeslot-skeleton'} style={{ animationDelay: `${i * 20}ms` }} />\n ))}\n </div>\n </Host>\n );\n }\n\n if (this.availability && this.availability.length === 0) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No dates available</span>\n </div>\n </Host>\n );\n }\n\n const filteredTimes = this.times.filter(timeslot => {\n const groupEvent = timeslot?.event_id || timeslot?.master_id;\n const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;\n return !(groupEvent && !showCapacity);\n });\n\n if ((!this.times || this.times.length === 0 || filteredTimes.length === 0) && !!this.selectedDate) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No time slots available for selected date</span>\n </div>\n </Host>\n );\n }\n\n if (!this.selectedDate) return <Host></Host>;\n\n return (\n <Host part=\"ntp\">\n <div class={'time-picker-wrapper'} part=\"ntp__time-picker-wrapper\">\n <div class={'timeslots'} part=\"ntp__timeslots\">\n {filteredTimes.map((timeslot, index) => {\n const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;\n const isSelected = this.selectedTimeslotIndex == this.getTimeslotId(timeslot, index);\n return (\n <button\n part={`ntp__timeslot ${this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime() ? 'ntp__timeslot--selected' : ''}`}\n class={{\n time: true,\n selected: typeof this.selectedTimeslot !== 'undefined' && isSelected,\n }}\n onClick={() => this.onClickSelectTime(timeslot, index)}\n onMouseEnter={() => this.handleMouseEnter(index)}\n onMouseLeave={() => this.handleMouseLeave()}\n >\n <div class=\"time-label\" part=\"ntp__time-label\">\n {this.hoveredTimeslotIndex == index || isSelected\n ? this.getTimeSlotLabel(timeslot)\n : timeslot.start_time.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', timeZone: this.selectedTimezone, hour12: this.hour12 })}\n <span class=\"spots\">{showCapacity ? i18next.t('spotsLeft', { count: timeslot?.capacity }) : null}</span>\n </div>\n </button>\n );\n })}\n </div>\n {this.selectedTimeslot && (\n <div class={'footer'}>\n <button-component variant={'primary'} onClick={(event: Event) => this.handleConfirmedTimeslot(event, this.selectedTimeslot)} part=\"ntp__button-primary\">\n <slot name=\"timeslot-picker-cta-label\">{i18next.t('nextButton')}</slot>\n </button-component>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"nylas-timeslot-picker2.js","mappings":";;;;;;;AAAA,MAAM,sBAAsB,GAAG,40HAA40H,CAAC;AAC52H,kCAAe,sBAAsB;;;;;;;;;;;;;;;;MCyBxB,mBAAmB;;;;;;;;QAwItB,4BAAuB,GAAG,OAAO,KAAY,EAAE,QAA8B;YACnF,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;YAC5D,IAAI,QAAQ,EAAE;gBACZ,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;aAC5D;SACF,CAAC;QAOM,qBAAgB,GAAG,CAAC,KAAa;YACvC,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;SACnC,CAAC;QAEM,qBAAgB,GAAG;YACzB,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC;SAChC,CAAC;;;;;gCA/H4E,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ;4BAIzD,IAAI,IAAI,EAAE;;;qBAqBtC,EAAE;;;;IAK3C,uBAAuB,CAAC,WAA0B;QAChDA,QAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;KACrC;IAGD,mBAAmB,CAAC,MAA+B;QACjD,KAAK,CAAC,+CAA+C,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAEnE,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;YAChC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;gBACjC,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,IAAI,iBAAiB,CAAC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AE,MAAM,CAAC,CAAC;yBACtD;6BAAM;4BACL,IAAI,CAAC,yBAAyB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;yBACvD;qBACF;iBACF;qBAAM;oBACL,uBAAuB,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;iBAC9D;aACF;YACD,qBAAqB,EAAE,OAAO,KAAqC,EAAE,wBAAiD;gBACpH,KAAK,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;aACvE;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iDAiFD;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.scss?tag=nylas-timeslot-picker&encapsulation=shadow","src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n height: calc(100% - 48px); //48px is the height of the header\n @include default-css-variables;\n}\n\n.time-picker-wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.timeslots {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.75rem;\n align-items: center;\n overflow-y: scroll;\n padding: 0.5rem 1.5rem 1.5rem;\n flex: 1;\n}\n\n.time {\n /* Frame 12 */\n box-sizing: border-box;\n\n /* Auto layout */\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 4px 12px;\n gap: 0.5rem;\n font-size: 16px;\n font-weight: 500;\n font-family: inherit;\n\n width: 100%;\n height: 48px;\n\n color: var(--nylas-base-800);\n background: var(--nylas-base-0);\n border: none;\n outline: 1.5px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n\n flex: none;\n order: 4;\n align-self: stretch;\n flex-grow: 0;\n\n cursor: pointer;\n\n &:hover,\n &:focus {\n color: var(--nylas-primary);\n outline-color: var(--nylas-primary);\n }\n\n &.selected {\n font-weight: 600;\n color: var(--nylas-primary);\n outline: 2px solid var(--nylas-primary);\n border-color: transparent;\n box-shadow: 0 0 0 2px var(--nylas-primary);\n }\n\n .time-label {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n\n span.spots {\n font-size: 14px;\n font-family: var(--nylas-font-family);\n font-weight: 400;\n color: var(--nylas-base-600);\n }\n }\n}\n\n.empty {\n text-align: center;\n padding: 0 1.5rem;\n color: var(--nylas-base-600);\n font-size: min(max(12px, 2vw), 14px);\n height: 450px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n@keyframes pulsate {\n 0% {\n background-color: var(--nylas-base-50);\n }\n\n 50% {\n background-color: var(--nylas-base-100);\n }\n\n 100% {\n background-color: var(--nylas-base-50);\n }\n}\n\n.loading {\n padding: 0 1.5rem;\n\n .timeslot-skeleton {\n width: 100%;\n height: 4rem;\n background-color: var(--nylas-base-50);\n margin-bottom: 0.5rem;\n border-radius: var(--nylas-border-radius-2x);\n animation: pulsate 1.5s infinite ease-in-out;\n }\n}\n\n.footer {\n width: 100%;\n padding: 14px;\n box-sizing: border-box;\n border-top: 1px solid var(--nylas-base-200);\n}","import { RegisterComponent } from '@/common/register-component';\nimport { debug, isSameDayTimezone } from '@/utils/utils';\nimport { Component, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerConnector } from '../../..';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { AvailabilityTimeslot } from '@/stores/scheduler-store';\nimport type { ThemeConfig, Timeslot } from '@nylas/core';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE, LANGUAGE_CODE_TO_LOCALE_MAP } from '@/common/constants';\n\n/**\n * The `nylas-timeslot-picker` component is a UI component that allows users to select a timeslot from a list of available timeslots.\n *\n * @slot timeslot-picker-cta-label - The label for the timeslot picker CTA. Default is \"Next\".\n * @part ntp - The timeslot picker component.\n * @part ntp__timeslot - The timeslot button.\n * @part ntp__timeslot--selected - The selected timeslot button.\n * @part ntp__button-primary - The timeslot picker CTA.\n * @part ntp__time-picker-wrapper - The timeslot picker wrapper.\n * @part ntp__timeslots - The timeslot picker timeslots.\n */\n@Component({\n tag: 'nylas-timeslot-picker',\n styleUrl: 'nylas-timeslot-picker.scss',\n shadow: true,\n})\nexport class NylasTimeslotPicker {\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasTimeslotPickerElement;\n /**\n * @standalone\n * The available timeslots.\n */\n @Prop({ attribute: 'availability' }) readonly availability?: AvailabilityTimeslot[];\n /**\n * @standalone\n * The loading state prop. Used to display loading state when fetching availability.\n */\n @Prop({ attribute: 'loading-state' }) readonly isLoading?: boolean;\n /**\n * @standalone\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: any;\n /**\n * The selected timeslot.\n */\n @Prop({ attribute: 'selected-timeslot' }) readonly selectedTimeslot?: Timeslot;\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n /**\n * The selected date.\n */\n @Prop({ attribute: 'selected-date' }) readonly selectedDate?: Date = new Date();\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: string;\n /**\n * The 12-hour time format.\n */\n @Prop() hour12?: boolean;\n\n /**\n * This event is fired when a timeslot is selected.\n */\n @Event() readonly timeslotSelected!: EventEmitter<Timeslot>;\n /**\n * This event is fired when a timeslot is confirmed. By default, this will proceed to the booking form page.\n */\n @Event() readonly timeslotConfirmed!: EventEmitter<{ timeslot: Timeslot; host: HTMLNylasTimeslotPickerElement }>;\n\n @Event() readonly validateTimeslotError!: EventEmitter<{ error: string; type: 'error' | 'info' }>;\n\n @State() times: AvailabilityTimeslot[] = [];\n @State() hoveredTimeslotIndex?: number;\n @State() selectedTimeslotIndex?: string;\n\n @Watch('selectedLanguage')\n selectedLanguageChanged(newLanguage: LANGUAGE_CODE) {\n i18next.changeLanguage(newLanguage);\n }\n\n @Watch('selectedDate')\n selectedDateChanged(newVal: Date | null | undefined) {\n debug(`[nylas-timeslot-picker] Selected date changed`, { newVal });\n\n if (newVal) {\n this.selectedTimeslotIndex = '';\n if (typeof newVal !== 'undefined') {\n const availableTimes = this.availability?.filter(timeslot => isSameDayTimezone(timeslot.start_time, newVal, this.selectedTimezone)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n }\n\n @Watch('availability')\n availabilityChanged(newVal: AvailabilityTimeslot[] | undefined) {\n debug(`[nylas-timeslot-picker] Available times changed`, { newVal, selectedDate: this.selectedDate });\n if (typeof newVal !== 'undefined') {\n const availableTimes = newVal\n ?.filter(timeslot => this.selectedDate && isSameDayTimezone(timeslot.start_time, this.selectedDate, this.selectedTimezone))\n .map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newThemeConfig: ThemeConfig) {\n this.applyThemeConfig(newThemeConfig);\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n debug(`[nylas-timeslot-picker] Component will load`, { selectedDate: this.selectedDate, availability: this.availability, times: this.times });\n }\n\n async componentDidLoad() {\n debug(`[nylas-timeslot-picker] Component did load`);\n const availableTimes = this.availability\n ?.filter(timeslot => this.selectedDate && isSameDayTimezone(timeslot.start_time, this.selectedDate, this.selectedTimezone))\n .map(timeslot => timeslot);\n this.times = availableTimes || [];\n this.applyThemeConfig(this.themeConfig);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n private getTimeslotId(timeslot: Timeslot, index: number) {\n const date = new Date(timeslot.start_time);\n const eventId = timeslot.event_id;\n return `${date.toLocaleDateString()}-${index}${eventId ? `-${eventId}` : ''}`;\n }\n\n private onClickSelectTime(timeslot: Timeslot, index: number) {\n debug(`[nylas-timeslot-picker] Time selected`, timeslot, index);\n this.selectedTimeslotIndex = this.getTimeslotId(timeslot, index);\n this.timeslotSelected.emit({\n start_time: timeslot.start_time,\n end_time: timeslot.end_time,\n emails: timeslot.emails,\n capacity: timeslot?.capacity,\n event_id: timeslot?.event_id,\n master_id: timeslot?.master_id,\n calendar_id: timeslot?.calendar_id,\n });\n }\n\n private handleConfirmedTimeslot = async (event: Event, timeslot: Timeslot | undefined) => {\n event.preventDefault();\n debug(`[nylas-timeslot-picker] Confirm timeslot`, timeslot);\n if (timeslot) {\n this.timeslotConfirmed.emit({ timeslot, host: this.host });\n }\n };\n\n @Method()\n async emitValidateTimeslotError(error: string, type: 'error' | 'info') {\n this.validateTimeslotError.emit({ error, type });\n }\n\n private handleMouseEnter = (index: number) => {\n this.hoveredTimeslotIndex = index;\n };\n\n private handleMouseLeave = () => {\n this.hoveredTimeslotIndex = -1;\n };\n\n private getTimeSlotLabel(timeslot: Timeslot) {\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n const timeFormat = new Intl.DateTimeFormat(locale, {\n hour: '2-digit',\n minute: '2-digit',\n timeZone: this.selectedTimezone,\n hour12: this.hour12,\n });\n return `${timeFormat.format(timeslot.start_time)} - ${timeFormat.format(timeslot.end_time)}`;\n }\n\n @RegisterComponent<NylasTimeslotPicker, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-timeslot-picker',\n stateToProps: new Map([\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.availability', 'availability'],\n ['scheduler.selectedTimeslot', 'selectedTimeslot'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.isLoading', 'isLoading'],\n ['scheduler.themeConfig', 'themeConfig'],\n ['scheduler.hour12', 'hour12'],\n ]),\n eventToProps: {\n timeslotSelected: async (event: CustomEvent<Timeslot>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotSelected', event.detail);\n nylasSchedulerConnector.scheduler.selectTime(event.detail);\n },\n timeslotConfirmed: async (event: CustomEvent<{ timeslot: Timeslot; host: HTMLNylasTimeslotPickerElement }>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotConfirmed', event.detail);\n const { timeslot, host } = event.detail;\n if (timeslot && timeslot?.event_id && timeslot?.capacity) {\n const result = await nylasSchedulerConnector.scheduler.validateGroupEventTimeslot(timeslot);\n if (result && 'error' in result) {\n const errorMessage = result.error?.message || 'An error occurred while validating the timeslot';\n if (errorMessage === 'Event is full') {\n host.emitValidateTimeslotError(errorMessage, 'info');\n } else {\n host.emitValidateTimeslotError(errorMessage, 'error');\n }\n }\n } else {\n nylasSchedulerConnector.scheduler.toggleAdditionalData(true);\n }\n },\n validateTimeslotError: async (event: CustomEvent<{ error: string }>, _nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'validateTimeslotError', event.detail);\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n if (this.isLoading) {\n return (\n <Host>\n <div class={'loading'}>\n {new Array(6).fill(0).map((_, i) => (\n <div class={'timeslot-skeleton'} style={{ animationDelay: `${i * 20}ms` }} />\n ))}\n </div>\n </Host>\n );\n }\n\n if (this.availability && this.availability.length === 0) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No dates available</span>\n </div>\n </Host>\n );\n }\n\n const filteredTimes = this.times.filter(timeslot => {\n const groupEvent = timeslot?.event_id || timeslot?.master_id;\n const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;\n return !(groupEvent && !showCapacity);\n });\n\n if ((!this.times || this.times.length === 0 || filteredTimes.length === 0) && !!this.selectedDate) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No time slots available for selected date</span>\n </div>\n </Host>\n );\n }\n\n if (!this.selectedDate) return <Host></Host>;\n\n return (\n <Host part=\"ntp\">\n <div class={'time-picker-wrapper'} part=\"ntp__time-picker-wrapper\">\n <div class={'timeslots'} part=\"ntp__timeslots\">\n {filteredTimes.map((timeslot, index) => {\n const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;\n const isSelected = this.selectedTimeslotIndex == this.getTimeslotId(timeslot, index);\n return (\n <button\n part={`ntp__timeslot ${this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime() ? 'ntp__timeslot--selected' : ''}`}\n class={{\n time: true,\n selected: typeof this.selectedTimeslot !== 'undefined' && isSelected,\n }}\n onClick={() => this.onClickSelectTime(timeslot, index)}\n onMouseEnter={() => this.handleMouseEnter(index)}\n onMouseLeave={() => this.handleMouseLeave()}\n >\n <div class=\"time-label\" part=\"ntp__time-label\">\n {this.hoveredTimeslotIndex == index || isSelected\n ? this.getTimeSlotLabel(timeslot)\n : timeslot.start_time.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', timeZone: this.selectedTimezone, hour12: this.hour12 })}\n <span class=\"spots\">{showCapacity ? i18next.t('spotsLeft', { count: timeslot?.capacity }) : null}</span>\n </div>\n </button>\n );\n })}\n </div>\n {this.selectedTimeslot && (\n <div class={'footer'}>\n <button-component variant={'primary'} onClick={(event: Event) => this.handleConfirmedTimeslot(event, this.selectedTimeslot)} part=\"ntp__button-primary\">\n <slot name=\"timeslot-picker-cta-label\">{i18next.t('nextButton')}</slot>\n </button-component>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|