@nylas/web-elements 1.1.1 → 1.1.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.
Files changed (118) hide show
  1. package/dist/cdn/nylas-availability-picker/nylas-availability-picker.es.js +202 -191
  2. package/dist/cdn/nylas-booking-calendar-picker/nylas-booking-calendar-picker.es.js +466 -455
  3. package/dist/cdn/nylas-booking-confirmation-redirect/nylas-booking-confirmation-redirect.es.js +299 -288
  4. package/dist/cdn/nylas-booking-confirmation-type/nylas-booking-confirmation-type.es.js +330 -319
  5. package/dist/cdn/nylas-booking-form/nylas-booking-form.es.js +440 -426
  6. package/dist/cdn/nylas-booking-form-config/nylas-booking-form-config.es.js +174 -163
  7. package/dist/cdn/nylas-buffer-time/nylas-buffer-time.es.js +469 -458
  8. package/dist/cdn/nylas-custom-event-slug/nylas-custom-event-slug.es.js +194 -194
  9. package/dist/cdn/nylas-editor-tabs/nylas-editor-tabs.es.js +20 -9
  10. package/dist/cdn/nylas-event-duration/nylas-event-duration.es.js +357 -346
  11. package/dist/cdn/nylas-event-location/nylas-event-location.es.js +502 -491
  12. package/dist/cdn/nylas-limit-future-bookings/nylas-limit-future-bookings.es.js +325 -314
  13. package/dist/cdn/nylas-list-configurations/nylas-list-configurations.es.js +239 -228
  14. package/dist/cdn/nylas-locale-switch/nylas-locale-switch.es.js +235 -224
  15. package/dist/cdn/nylas-min-booking-notice/nylas-min-booking-notice.es.js +325 -314
  16. package/dist/cdn/nylas-min-cancellation-notice/nylas-min-cancellation-notice.es.js +209 -198
  17. package/dist/cdn/nylas-participant-booking-calendars/nylas-participant-booking-calendars.es.js +249 -238
  18. package/dist/cdn/nylas-participants-custom-availability/nylas-participants-custom-availability.es.js +801 -790
  19. package/dist/cdn/nylas-reminder-emails/nylas-reminder-emails.es.js +287 -276
  20. package/dist/cdn/nylas-reminder-time/nylas-reminder-time.es.js +334 -323
  21. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +23 -12
  22. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +587 -559
  23. package/dist/cdn/nylas-scheduling-method/nylas-scheduling-method.es.js +275 -264
  24. package/dist/cdn/nylas-timeslot-interval/nylas-timeslot-interval.es.js +353 -342
  25. package/dist/cdn/select-dropdown/select-dropdown.es.js +108 -97
  26. package/dist/cdn/time-period-selector/time-period-selector.es.js +340 -329
  27. package/dist/cjs/calendar-agenda-fill-icon_48.cjs.entry.js +5 -4
  28. package/dist/cjs/calendar-agenda-fill-icon_48.cjs.entry.js.map +1 -1
  29. package/dist/cjs/chevron-icon_3.cjs.entry.js +14 -1
  30. package/dist/cjs/chevron-icon_3.cjs.entry.js.map +1 -1
  31. package/dist/cjs/loader.cjs.js +1 -1
  32. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js +11 -7
  33. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js.map +1 -1
  34. package/dist/cjs/nylas-booking-form.cjs.entry.js +11 -7
  35. package/dist/cjs/nylas-booking-form.cjs.entry.js.map +1 -1
  36. package/dist/cjs/nylas-custom-event-slug.cjs.entry.js +5 -4
  37. package/dist/cjs/nylas-custom-event-slug.cjs.entry.js.map +1 -1
  38. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +2 -1
  39. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js.map +1 -1
  40. package/dist/cjs/nylas-scheduling.cjs.entry.js +25 -4
  41. package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
  42. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  43. package/dist/cjs/select-dropdown.cjs.entry.js +14 -1
  44. package/dist/cjs/select-dropdown.cjs.entry.js.map +1 -1
  45. package/dist/collection/components/design-system/select-dropdown/select-dropdown.js +33 -1
  46. package/dist/collection/components/design-system/select-dropdown/select-dropdown.js.map +1 -1
  47. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +17 -7
  48. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js.map +1 -1
  49. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js +26 -5
  50. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js.map +1 -1
  51. package/dist/collection/components/scheduler-editor/nylas-custom-event-slug/nylas-custom-event-slug.css +6 -2
  52. package/dist/collection/components/scheduler-editor/nylas-custom-event-slug/nylas-custom-event-slug.js +4 -3
  53. package/dist/collection/components/scheduler-editor/nylas-custom-event-slug/nylas-custom-event-slug.js.map +1 -1
  54. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/ExpressFlow.js +2 -1
  55. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/ExpressFlow.js.map +1 -1
  56. package/dist/components/nylas-booking-form2.js +12 -8
  57. package/dist/components/nylas-booking-form2.js.map +1 -1
  58. package/dist/components/nylas-custom-event-slug2.js +5 -4
  59. package/dist/components/nylas-custom-event-slug2.js.map +1 -1
  60. package/dist/components/nylas-scheduler-editor.js +2 -1
  61. package/dist/components/nylas-scheduler-editor.js.map +1 -1
  62. package/dist/components/nylas-scheduling.js +25 -4
  63. package/dist/components/nylas-scheduling.js.map +1 -1
  64. package/dist/components/select-dropdown2.js +14 -1
  65. package/dist/components/select-dropdown2.js.map +1 -1
  66. package/dist/esm/calendar-agenda-fill-icon_48.entry.js +5 -4
  67. package/dist/esm/calendar-agenda-fill-icon_48.entry.js.map +1 -1
  68. package/dist/esm/chevron-icon_3.entry.js +14 -1
  69. package/dist/esm/chevron-icon_3.entry.js.map +1 -1
  70. package/dist/esm/loader.js +1 -1
  71. package/dist/esm/nylas-booked-event-card_12.entry.js +11 -7
  72. package/dist/esm/nylas-booked-event-card_12.entry.js.map +1 -1
  73. package/dist/esm/nylas-booking-form.entry.js +11 -7
  74. package/dist/esm/nylas-booking-form.entry.js.map +1 -1
  75. package/dist/esm/nylas-custom-event-slug.entry.js +5 -4
  76. package/dist/esm/nylas-custom-event-slug.entry.js.map +1 -1
  77. package/dist/esm/nylas-scheduler-editor.entry.js +2 -1
  78. package/dist/esm/nylas-scheduler-editor.entry.js.map +1 -1
  79. package/dist/esm/nylas-scheduling.entry.js +25 -4
  80. package/dist/esm/nylas-scheduling.entry.js.map +1 -1
  81. package/dist/esm/nylas-web-elements.js +1 -1
  82. package/dist/esm/select-dropdown.entry.js +14 -1
  83. package/dist/esm/select-dropdown.entry.js.map +1 -1
  84. package/dist/nylas-web-elements/nylas-booking-form.entry.js +11 -7
  85. package/dist/nylas-web-elements/nylas-booking-form.entry.js.map +1 -1
  86. package/dist/nylas-web-elements/nylas-custom-event-slug.entry.js +5 -4
  87. package/dist/nylas-web-elements/nylas-custom-event-slug.entry.js.map +1 -1
  88. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js +2 -1
  89. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js.map +1 -1
  90. package/dist/nylas-web-elements/nylas-scheduling.entry.js +25 -4
  91. package/dist/nylas-web-elements/nylas-scheduling.entry.js.map +1 -1
  92. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  93. package/dist/nylas-web-elements/{p-670e4bd1.entry.js → p-795ebe60.entry.js} +2 -2
  94. package/dist/nylas-web-elements/p-795ebe60.entry.js.map +1 -0
  95. package/dist/nylas-web-elements/{p-d32d9a1d.entry.js → p-8dee5c91.entry.js} +2 -2
  96. package/dist/nylas-web-elements/p-8dee5c91.entry.js.map +1 -0
  97. package/dist/nylas-web-elements/p-8fdc5d3d.entry.js +2 -0
  98. package/dist/nylas-web-elements/p-8fdc5d3d.entry.js.map +1 -0
  99. package/dist/nylas-web-elements/p-efa03f8c.entry.js +2 -0
  100. package/dist/nylas-web-elements/p-efa03f8c.entry.js.map +1 -0
  101. package/dist/nylas-web-elements/p-fbec0698.entry.js +2 -0
  102. package/dist/nylas-web-elements/p-fbec0698.entry.js.map +1 -0
  103. package/dist/nylas-web-elements/select-dropdown.entry.js +14 -1
  104. package/dist/nylas-web-elements/select-dropdown.entry.js.map +1 -1
  105. package/dist/types/components/design-system/select-dropdown/select-dropdown.d.ts +6 -0
  106. package/dist/types/components/scheduler/nylas-booking-form/nylas-booking-form.d.ts +6 -0
  107. package/dist/types/components/scheduler/nylas-scheduling/nylas-scheduling.d.ts +1 -0
  108. package/dist/types/components/scheduler-editor/nylas-custom-event-slug/nylas-custom-event-slug.d.ts +0 -1
  109. package/dist/types/components.d.ts +15 -0
  110. package/package.json +1 -1
  111. package/dist/nylas-web-elements/p-14e194b2.entry.js +0 -2
  112. package/dist/nylas-web-elements/p-14e194b2.entry.js.map +0 -1
  113. package/dist/nylas-web-elements/p-169a3f6d.entry.js +0 -2
  114. package/dist/nylas-web-elements/p-169a3f6d.entry.js.map +0 -1
  115. package/dist/nylas-web-elements/p-670e4bd1.entry.js.map +0 -1
  116. package/dist/nylas-web-elements/p-8ad09f72.entry.js +0 -2
  117. package/dist/nylas-web-elements/p-8ad09f72.entry.js.map +0 -1
  118. package/dist/nylas-web-elements/p-d32d9a1d.entry.js.map +0 -1
@@ -200,6 +200,7 @@ const NylasScheduling = class {
200
200
  const settingsResponse = await this.nylasSchedulerConnector?.scheduler.getUISettings();
201
201
  if (!settingsResponse || 'error' in settingsResponse) {
202
202
  this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(settingsResponse?.error) }, host: this.host });
203
+ return;
203
204
  }
204
205
  else {
205
206
  if ('data' in settingsResponse && settingsResponse.data?.appearance) {
@@ -327,25 +328,45 @@ const NylasScheduling = class {
327
328
  }
328
329
  }
329
330
  }
331
+ mapToBookingData(bookingInfo) {
332
+ const timeslot = this.stores?.scheduler.get('selectedTimeslot');
333
+ const language = this.stores?.scheduler.get('selectedLanguage');
334
+ const timezone = this.stores?.scheduler.get('selectedTimezone');
335
+ const startTime = timeslot?.start_time ? new Date(timeslot?.start_time).getTime() / 1000 : '';
336
+ const endTime = timeslot?.end_time ? new Date(timeslot?.end_time).getTime() / 1000 : '';
337
+ return {
338
+ additional_guests: bookingInfo.guests,
339
+ guest: bookingInfo.primaryParticipant,
340
+ additional_fields: bookingInfo.additionalFields,
341
+ start_time: startTime,
342
+ end_time: endTime,
343
+ email_language: language,
344
+ timezone: timezone,
345
+ };
346
+ }
330
347
  async bookButtonClickedHandler(event) {
348
+ const bookingData = event.detail;
349
+ const mappedBookingData = this.mapToBookingData(bookingData);
331
350
  const storeRescheduleId = this.nylasSchedulerConnector?.schedulerStore?.get('rescheduleBookingId');
332
351
  const rescheduleBookingId = storeRescheduleId;
333
352
  if (rescheduleBookingId) {
334
- const result = await this.nylasSchedulerConnector?.scheduler.rescheduleBooking(rescheduleBookingId, event.detail);
353
+ const result = await this.nylasSchedulerConnector?.scheduler.rescheduleBooking(rescheduleBookingId, bookingData);
335
354
  if (!result || 'error' in result) {
336
355
  this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });
337
356
  }
338
- const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result });
357
+ const resultData = result?.data;
358
+ const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result, data: { ...resultData, ...mappedBookingData } });
339
359
  if ('bookedEventInfo' in this.eventOverrides) {
340
360
  await this.eventOverrides.bookedEventInfo(bookedEventInfoEvent, this.nylasSchedulerConnector);
341
361
  }
342
362
  return;
343
363
  }
344
- const result = await this.nylasSchedulerConnector?.scheduler.bookTimeslot(event.detail);
364
+ const result = await this.nylasSchedulerConnector?.scheduler.bookTimeslot(bookingData);
345
365
  if (!result || 'error' in result) {
346
366
  this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });
347
367
  }
348
- const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result });
368
+ const resultData = result?.data;
369
+ const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result, data: { ...resultData, ...mappedBookingData } });
349
370
  if ('bookedEventInfo' in this.eventOverrides) {
350
371
  await this.eventOverrides.bookedEventInfo(bookedEventInfoEvent, this.nylasSchedulerConnector);
351
372
  }
@@ -1 +1 @@
1
- {"file":"nylas-scheduling.entry.cjs.js","m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O,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAiB,EAC1FF,iBAAK,KAAK,EAAC,sBAAsB,EAAC,IAAI,EAAC,sBAAsB,IAC3DA,iBAAK,KAAK,EAAC,YAAY,IACrBA,iBAAK,KAAK,EAAC,SAAS,IAClBA,uCAA2B,WAAW,EAAC,sEAAsE,GAA6B,CACtI,CACF,EACNA,iBAAK,KAAK,EAAE,eAAe,mBAAmB,GAAG,YAAY,GAAG,EAAE,EAAE,IAClEA,gCAAoB,WAAW,EAAC,mPAAmP,GAAsB,CACrS,CACF,CACQ,CACX,EACP;SACH;QAED,QACEA,QAACY,UAAI,QACHZ,qBAAQ,CACH,EACP;KACH;;;;;;;;;;;;;;;","names":["debug","NylaSchedulerAPIConnector","h","Fragment","i18next","NotificationType","ErrorCategory","CreateNylasSchedulerStore","NylasBaseProvider","compactStringToUUIDs","LANGUAGE_CODE","addDaysToCurrentDate","capitalizeFirstLetter","LANGUAGE_CODE_MAP","Host"],"sources":["src/connector/nylas-scheduler-connector/index.ts","src/components/scheduler/nylas-scheduling/scheduler-view.tsx","src/components/scheduler/nylas-scheduling/message-banner.tsx","src/components/scheduler/nylas-scheduling/nylas-scheduling.scss?tag=nylas-scheduling&encapsulation=shadow","src/components/scheduler/nylas-scheduling/nylas-scheduling.tsx"],"sourcesContent":["import { NylasSchedulerStoreType } from '@/stores/scheduler-store';\nimport { debug } from '@/utils/utils';\nimport { NylasSchedulerConnectorInterface } from '../connector-interface';\nimport { NylaSchedulerAPIConnector } from '../shared/api/scheduler';\n\ntype NylasSchedulerConnectorOptions = {\n schedulerAPIURL: string;\n nylasSchedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n slug?: string;\n clientId?: string;\n};\n/**\n * Base class for the Nylas connector.\n */\nexport class NylasSchedulerConnector implements NylasSchedulerConnectorInterface {\n public schedulerAPIURL: string;\n public nylasSchedulerStore: NylasSchedulerStoreType;\n public sessionId: string | undefined;\n public configId: string | undefined;\n public slug: string | undefined;\n public clientId: string | undefined;\n\n private _schedulerAPIConnector: NylaSchedulerAPIConnector | undefined;\n\n constructor({ schedulerAPIURL, nylasSchedulerStore, sessionId, configId, slug, clientId }: NylasSchedulerConnectorOptions) {\n if (!schedulerAPIURL) {\n throw new Error('schedulerAPIURL is required');\n }\n\n if (!nylasSchedulerStore) {\n throw new Error('nylasSchedulerStore is required');\n }\n\n if (!sessionId && !configId && !(slug || clientId)) {\n throw new Error('sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.');\n }\n\n // If the url is only /, then we need to add the base url.\n // We assume that the base url is the same as the current url.\n if (schedulerAPIURL === '/') {\n const url = new URL(window.location.href);\n schedulerAPIURL = url.origin;\n }\n\n this.configId = configId;\n this.sessionId = sessionId;\n this.schedulerAPIURL = schedulerAPIURL;\n this.nylasSchedulerStore = nylasSchedulerStore;\n this.slug = slug;\n this.clientId = clientId;\n }\n\n public init() {\n debug('NylasConnector init');\n }\n\n public get schedulerStore() {\n return this.nylasSchedulerStore;\n }\n\n public get scheduler() {\n if (this._schedulerAPIConnector) {\n return this._schedulerAPIConnector;\n }\n this._schedulerAPIConnector = new NylaSchedulerAPIConnector({\n schedulerAPIURL: this.schedulerAPIURL,\n schedulerStore: this.schedulerStore,\n sessionId: this.sessionId,\n configId: this.configId,\n slug: this.slug,\n clientId: this.clientId,\n });\n return this._schedulerAPIConnector;\n }\n\n public resetStores() {\n this.nylasSchedulerStore.reset();\n }\n}\nexport type PublicMethods<T> = {\n [K in keyof T]: T[K] extends Function ? (string extends K ? never : K) : never;\n}[keyof T];\n\nexport type NylasSchedulerConnectorPublicMethods = PublicMethods<NylasSchedulerConnector>;\n","import { Fragment, FunctionalComponent, h } from '@stencil/core';\n\nexport type SchedulerViewProps = {\n isLoading?: boolean;\n showNotification?: boolean;\n nylasBranding?: boolean;\n};\n\n/**\n * The Scheduler view component.\n */\nexport const SchedulerView: FunctionalComponent<SchedulerViewProps> = (props: SchedulerViewProps, children) => {\n const isLoading = props.isLoading;\n const showNotification = props.showNotification;\n const nylasBranding = props.nylasBranding;\n\n return (\n <Fragment>\n {showNotification && <nylas-notification></nylas-notification>}\n\n {isLoading && (\n <div class={'loading'}>\n <div class={'left'}>\n <div class={'skeleton'} />\n </div>\n <div class={'right'}>\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n </div>\n </div>\n )}\n {!isLoading && children}\n <div class={'footer'}>\n {nylasBranding && (\n <Fragment>\n Powered by&nbsp;\n <nylas-logo />\n </Fragment>\n )}\n </div>\n </Fragment>\n );\n};\n","import { FunctionalComponent, h } from '@stencil/core';\n\nexport type HeaderBannerProps = {};\n\nexport const MessageBanner: FunctionalComponent<HeaderBannerProps> = (_props: HeaderBannerProps, children) => <div class=\"message-banner\">{children}</div>;\n","@import '../../../common/styles/variables.scss';\n\n:host {\n display: flex;\n flex-direction: column;\n overflow: visible;\n border-radius: var(--nylas-border-radius-2x);\n width: fit-content;\n\n @media #{$mobile} {\n width: auto;\n min-width: 325px;\n }\n\n background: var(--nylas-base-0);\n position: relative;\n box-shadow: 0px 4px 8px 2px rgba(0, 0, 0, 0.05),\n 0px 8px 16px -2px rgba(0, 0, 0, 0.1);\n\n @include default-css-variables;\n font-family: var(--nylas-font-family);\n font-optical-sizing: auto;\n font-style: normal;\n font-variation-settings: 'slnt' 0;\n}\n\n:root {\n font-family: inherit;\n}\n\n.error {\n padding: 8rem 12rem;\n color: var(--nylas-base-0);\n background-color: var(--nylas-error);\n margin: 1.5rem;\n border-radius: var(--nylas-border-radius-2x);\n}\n\n.message-banner {\n text-align: right;\n color: var(--nylas-base-800);\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-color-primary-200);\n margin: 0;\n}\n\n.loading {\n margin: 1.5rem;\n display: flex;\n gap: 1rem;\n\n .skeleton {\n border-radius: var(--nylas-border-radius-2x);\n animation: pulsate 1.5s infinite;\n\n &:nth-child(2) {\n animation-delay: -100ms;\n }\n\n &:nth-child(3) {\n animation-delay: -200ms;\n }\n\n &:nth-child(4) {\n animation-delay: -300ms;\n }\n\n &:nth-child(5) {\n animation-delay: -400ms;\n }\n }\n\n .left .skeleton {\n height: 100%;\n width: 400px;\n }\n\n .right .skeleton {\n height: 5rem;\n width: 300px;\n margin-bottom: 1rem;\n\n &:last-child {\n margin-bottom: 0;\n }\n }\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.select-date-page,\n.additional-data-page,\n.booked-event-page,\n.manual-confirmation-page,\n.cancelled-event-page,\n.cancel-flow-page {\n border-top-left-radius: var(--nylas-border-radius-2x);\n border-top-right-radius: var(--nylas-border-radius-2x);\n}\n\n.select-date-page,\n.additional-data-page {\n display: flex;\n\n @media #{$mobile} {\n flex-direction: column;\n }\n}\n\n.booked-event-page,\n.manual-confirmation-page {\n background-color: var(--nylas-base-50);\n}\n\n.cancelled-event-page,\n.manual-confirmation-page,\n.cancel-flow-page {\n padding: 1rem;\n height: 496px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.booked-event-page,\n.manual-confirmation-page,\n.cancelled-event-page,\n.cancel-flow-page {\n min-width: 784px;\n\n @media #{$mobile} {\n min-width: 90%;\n }\n\n background: var(--nylas-base-50);\n}\n\n.left-panel {\n display: flex;\n flex-direction: column;\n min-width: 424px;\n border-top-left-radius: inherit;\n background: var(--nylas-base-0);\n position: relative;\n padding: 1rem 0 0 0;\n height: 624px;\n\n @media #{$mobile} {\n border-top-right-radius: inherit;\n min-width: unset;\n height: auto;\n }\n}\n\n.select-date-page .left-panel {\n @media #{$mobile} {\n padding: 0.5rem 4px 0;\n height: 624px;\n }\n}\n\n.border {\n margin-left: -20px; // Offset left padding\n margin-right: -20px; // Offset right padding\n border-top-width: 1px;\n height: 0.5px;\n background-color: var(--nylas-base-200);\n\n @media #{$mobile} {\n display: none;\n }\n}\n\n.right-panel {\n min-width: 360px;\n width: 360px;\n background-color: var(--nylas-base-50);\n height: 624px;\n padding-top: 16px;\n border-left: 1px solid var(--nylas-base-200);\n border-top-right-radius: inherit;\n\n &.reschedule {\n border-top-right-radius: 0px;\n }\n\n @media #{$mobile} {\n border-top-right-radius: 0px;\n width: inherit;\n min-width: unset;\n height: auto;\n }\n\n h2 {\n display: flex;\n margin: 0;\n height: 48px;\n gap: 0.5rem;\n justify-content: center;\n align-items: center;\n width: auto;\n font-size: 1.125rem;\n line-height: 1.5rem;\n font-weight: 500;\n text-align: center;\n color: var(--nylas-base-800);\n }\n}\n\n.additional-data-page {\n .left-panel {\n background-color: var(--nylas-base-50);\n }\n\n .right-panel {\n background-color: var(--nylas-base-0);\n }\n}\n\nnylas-selected-event-card {\n height: calc(640px - 36px);\n padding: 0 1rem;\n\n @media #{$mobile} {\n height: 250px;\n }\n}\n\n.footer {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n padding: 16px;\n font-size: 14px;\n font-weight: 300;\n color: var(--nylas-base-500);\n border-top: 1px solid var(--nylas-base-200);\n min-height: 24px;\n\n svg {\n fill: var(--nylas-base-500);\n }\n}\n\n.footer svg {\n margin-top: 1px;\n}\n\nnylas-selected-event-card::part(nsec__timezone) {\n position: absolute;\n bottom: 0;\n}\n\nnylas-notification {\n margin: 1.5rem;\n width: -webkit-fill-available;\n width: -moz-available;\n position: absolute;\n}\n\nnylas-locale-switch {\n position: absolute;\n padding: 18px 20px;\n bottom: 0;\n width: -webkit-fill-available;\n width: -moz-available;\n border-top: 1px solid var(--nylas-base-200);\n\n @media #{$mobile} {\n height: auto;\n }\n}\n\nnylas-date-picker {\n padding: 0 20px;\n}","import { NylasBaseProvider } from '@/common/abstract-provider';\nimport { RegisteredComponent } from '@/common/register-component';\nimport type { SchedulerEventOverride } from '@/common/component-types';\nimport { NylasSchedulerConnector } from '@/connector/nylas-scheduler-connector';\nimport { CreateNylasSchedulerStore, NylasSchedulerStoreState, NylasSchedulerStoreType } from '@/stores/scheduler-store';\nimport { NylasSchedulerBookingData, ThemeConfig, Notification, NotificationType, NylasSchedulerErrorResponse, Timeslot, NylasSchedulerResponse } from '@nylas/core';\nimport { Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { addDaysToCurrentDate, capitalizeFirstLetter, compactStringToUUIDs, debug } from '@/utils/utils';\nimport { SchedulerView } from './scheduler-view';\nimport { ErrorCategory } from '@/connector/nylas-scheduler-connector/errors';\nimport { MessageBanner } from './message-banner';\nimport i18next from '@/utils/i18n';\nimport { NylasEvent, UISettingsResponse } from '@/common/types';\nimport { LANGUAGE_CODE, LANGUAGE_CODE_MAP, Locale } from '@/common/constants';\n\nconst genericError = { title: i18next.t('genericErrorTitle'), type: NotificationType.Error, category: ErrorCategory.Component };\n\n/**\n * The `nylas-scheduling` component is used to display the Nylas Scheduling UI.\n *\n * @part ndp - [nylas-date-picker] The date picker host.\n * @part ndp__title - [nylas-date-picker] The title.\n * @part ndp__month-header - [nylas-date-picker] The month header.\n * @part ndp__month-button - [nylas-date-picker] The month button.\n * @part ndp__day - [nylas-date-picker] The day.\n * @part ndp__date - [nylas-date-picker] The date.\n * @part ndp__date--selected - [nylas-date-picker] The selected date.\n * @part ndp__date--current-day - [nylas-date-picker] The current day.\n * @part ndp__date--current-month - [nylas-date-picker] The dates in the current month.\n * @part ndp__date--disabled - [nylas-date-picker] The disabled dates.\n * @part ntp - [nylas-timeslot-picker] The timeslot picker component.\n * @part ntp__timeslot - [nylas-timeslot-picker] The timeslot button.\n * @part ntp__timeslot--selected - [nylas-timeslot-picker] The selected timeslot button.\n * @part ntp__button-primary - [nylas-timeslot-picker] The timeslot picker CTA.\n * @part nsec - [nylas-selected-event-card] The selected event card component.\n * @part nsec__card - [nylas-selected-event-card] The card component.\n * @part nsec__icon - [nylas-selected-event-card] The calendar icon.\n * @part nsec__date - [nylas-selected-event-card] The date selected.\n * @part nsec__time - [nylas-selected-event-card] The timeslot selected.\n * @part nbf - [nylas-booking-form] The booking form host.\n * @part nbf__input-textfield - [nylas-booking-form] The input textfield.\n * @part nbf__button-ghost - [nylas-booking-form] The ghost button.\n * @part nbf__button-outline - [nylas-booking-form] The outline button.\n * @part nbf__button-primary - [nylas-booking-form] The primary button.\n * @part nbf__input-wrapper - [nylas-booking-form] The input wrapper.\n * @part nbf__checkbox-component - [nylas-booking-form] The checkbox component.\n * @part nbf__radio-button-group - [nylas-booking-form] The radio button group.\n * @part nbf__textarea-component - [nylas-booking-form] The textarea component.\n * @part nbf__dropdown - [nylas-booking-form] The dropdown component.\n * @part nbf__dropdown-button - [nylas-booking-form] The dropdown button.\n * @part nbf__dropdown-content - [nylas-booking-form] The dropdown content.\n * @part ncec - [nylas-cancelled-event-card] The cancelled event card host.\n * @part ncec__icon - [nylas-cancelled-event-card] The calendar icon.\n * @part ncec__title - [nylas-cancelled-event-card] The title of the cancelled event card.\n * @part ncec__description - [nylas-cancelled-event-card] The description of the cancelled event card.\n * @part ncec__button-outline - [nylas-cancelled-event-card] The close button CTA.\n * @part ncec__card - [nylas-cancelled-event-card] The cancelled event card.\n * @part nbec - [nylas-booked-event-card] The booked event card host.\n * @part nbec__card - [nylas-booked-event-card] The booked event card.\n * @part nbec__title - [nylas-booked-event-card] The title of the booked event card.\n * @part nbec__description - [nylas-booked-event-card] The description of the booked event card.\n * @part nbec__button-outline - [nylas-booked-event-card] The cancel & reschedule button CTA.\n * @part nbec__cancel-cta - [nylas-booked-event-card] The cancel button CTA.\n * @part nbec__reschedule-cta - [nylas-booked-event-card] The reschedule button CTA.\n * @part nls - [nylas-locale-switch] The locale switch container.\n * @part nls__timezone - [nylas-locale-switch] The timezone select container\n * @part nls__timezone-dropdown - [nylas-locale-switch] The timezone dropdown\n * @part nls__timezone-drop-button - [nylas-locale-switch] The timezone dropdown button\n * @part nls__timezone-drop-button-selected-label - [nylas-locale-switch] The timezone dropdown button selected label\n * @part nls__timezone-drop-content - [nylas-locale-switch] The timezone dropdown content\n * @part nls__timezone-drop-label - [nylas-locale-switch] The timezone dropdown label\n * @part nls__language - [nylas-locale-switch] The language select container\n * @part nls__language-dropdown - [nylas-locale-switch] The language dropdown\n * @part nls__language-drop-button - [nylas-locale-switch] The language dropdown button\n * @part nls__language-drop-content - [nylas-locale-switch] The language dropdown content\n * @part nls__language-drop-label - [nylas-locale-switch] The language dropdown label\n * @part ncbf - [nylas-cancel-booking-form] The cancel booking form container.\n * @part ncbf__icon - [nylas-cancel-booking-form] The calendar icon.\n * @part ncbf__title - [nylas-cancel-booking-form] The title of the cancel booking form.\n * @part ncbf__description - [nylas-cancel-booking-form] The description of the cancel booking form.\n * @part ncbf__reason-textarea - [nylas-cancel-booking-form] The reason textarea.\n * @part ncbf__button-cta - [nylas-cancel-booking-form] The cancel booking form CTA button.\n * @part ncbf__button-outline - [nylas-cancel-booking-form] The cancel booking form outline button.\n * @part ncbf__card - [nylas-cancel-booking-form] The cancel booking form card.\n */\n@Component({\n tag: 'nylas-scheduling',\n styleUrl: 'nylas-scheduling.scss',\n shadow: true,\n})\nexport class NylasScheduling {\n /**\n * Stores to be used by the provider.\n */\n private stores?: { scheduler: NylasSchedulerStoreType };\n\n /**\n * This is a base provide that defines the common methods and properties\n * that all providers should have.\n *\n * Because stencil does not support abstract classes, we have to use a\n * property to store the base provider instance.\n */\n private baseProvider?: NylasBaseProvider<Exclude<typeof this.stores, undefined>>;\n\n /**\n * The Nylas Scheduler Connector instance.\n * The branins of the provider. It manages data fetching and state synchronization.\n */\n private nylasSchedulerConnector?: NylasSchedulerConnector;\n\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasSchedulingElement;\n\n /**\n * This is used to set the mode for the Nylas Scheduler.\n * The mode can be either `app` or `composable`. The default mode is `app`.\n * - `app`: This mode is used to show the default Nylas Scheduler UI.\n * - `composable`: This mode is used to show the composable Nylas Scheduler UI\n * by passing the individual scheduler components as children.\n */\n @Prop() readonly mode: 'app' | 'composable' = 'app';\n\n /**\n * The default scheduler store state.\n * Used to set the initial state of the scheduler store.\n */\n @Prop({ attribute: 'default-scheduler-store-state' }) readonly defaultSchedulerState?: Partial<NylasSchedulerStoreState>;\n\n /**\n * The session ID for the Nylas Scheduler.\n * This is used to authenticate the user.\n */\n @Prop() readonly sessionId?: string;\n\n /**\n * The URL for the Nylas Scheduler API. (staging or production URL)\n */\n @Prop() readonly schedulerApiUrl: string = 'https://api.us.nylas.com';\n\n /**\n * This enables passing the bookingInfo object to the Scheduler UI for direct booking event creation.\n * When used with timeslotConfirmedHandler, it bypasses the additional data page and immediately\n * invokes the handler after booking.\n */\n @Prop() readonly bookingInfo?: NylasSchedulerBookingData;\n\n /**\n * Booking Ref required for rescheduling flow.\n */\n @Prop() readonly rescheduleBookingRef?: string;\n\n /**\n * Booking Ref required for cancelling flow.\n */\n @Prop() readonly cancelBookingRef?: string;\n\n /**\n * Booking Ref required for the manual confirmation flow.\n */\n @Prop() readonly organizerConfirmationBookingRef?: string;\n\n /**\n * The config ID for the Nylas Scheduler. This should be passed in when using a public config,\n * in which case the sessionId is not required.\n */\n @Prop() readonly configurationId?: string;\n\n /**\n * The slug of the configuration (public config) to be used for the Nylas Scheduler. This is used in conjunction with the clientId.\n * When the configurationId is not provided, the slug and clientId are used to make requests to the Scheduler API endpoints.\n * If the configurationId is provided, this prop will be ignored.\n */\n @Prop() readonly slug?: string;\n\n /**\n * The app ID of the configuration (public config) to be used for the Nylas Scheduler. This is used in conjunction with the slug.\n * When the configurationId is not provided, the slug and clientId are used to make requests to the Scheduler API endpoints.\n * If the configurationId is provided, this prop will be ignored.\n */\n @Prop() readonly clientId?: string;\n\n /**\n * This prop lets you hide the Nylas branding.\n * Default is true.\n */\n @Prop() readonly nylasBranding?: boolean = true;\n\n /**\n * This provides an easy way to override the default function of the event emitter.\n * An example of this is the `timeslotConfirmed` event. By default, this event will set the scheduler store state for `showBookingForm` to `true` which will\n * show the booking form. However, if you want to override this behavior, you can pass in the prop `eventOverride` like:\n * ```html\n * <nylas-scheduling eventOverride={{\"timeslotConfirmed\": (event, nylasConnector) => { console.log(\"Timeslot confirmed event fired!\"); } }} />\n * ```\n */\n @Prop({ attribute: 'event-overrides' }) readonly eventOverrides: SchedulerEventOverride = {};\n\n /**\n * The loading state. This is used to set the loading state for the Nylas Scheduler when fetching data.\n */\n @Prop() readonly isLoading?: boolean;\n\n /**\n * Theme config, used to automatically generate a theme with color palette and\n * CSS variables to customize the look and feel of the Nylas Scheduler.\n */\n @Prop() readonly themeConfig?: ThemeConfig;\n\n /**\n * This prop will allow to override the default localization strings for each language.\n * Nylas scheduling page currently support the following language codes: en, es, fr, de, sv, zh, ja, nl.\n */\n @Prop() readonly localization?: Partial<Record<LANGUAGE_CODE, Locale>>;\n\n /*\n * Displays notifications for errors by default. When enabled (`true`), errors\n * automatically appear as notifications. Disabling this feature (`false`) allows\n * the parent application to capture and manage errors by listening to the\n * `nylasSchedulerError` event, providing flexibility in error handling.\n */\n @Prop() readonly showNotification?: boolean = true;\n\n /**\n * Automatically register components that have the `@RegisterComponent` decorator.\n * If this is set to false, you will need to manually register components using the\n * `registerComponent` method.\n * @default true\n */\n @State() automaticComponentRegistration: boolean = true;\n\n /**\n * The selected date label for the Nylas Scheduler.\n * This is used to set the initial date label for the Nylas Scheduler.\n */\n @State() selectedDateLabel: string = new Date().toLocaleDateString(undefined, { dateStyle: 'full' }) || `${i18next.t('noDateSelected')}`;\n\n /**\n * The config id extracted from the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef.\n */\n @State() refConfigId?: string;\n\n /**\n * The selected language for the Nylas Scheduler.\n */\n @State() language: string = navigator.language;\n\n /**\n * This event is fired when the provider is initialized.\n * It can be used to set the initial state of the provider,\n * or to prevent the provider from firing some default behavior.\n */\n @Event({ cancelable: true }) init!: EventEmitter<HTMLNylasSchedulingElement>;\n\n /**\n * This event is fired when the scheduler component enters componentWillLoad lifecycle.\n */\n @Event() schedulerWillLoad!: EventEmitter<HTMLNylasSchedulingElement>;\n\n /**\n * This event is fired when the scheduler component enters componentDidLoad lifecycle.\n */\n @Event() schedulerDidLoad!: EventEmitter<HTMLNylasSchedulingElement>;\n\n @Event({\n eventName: 'nylasSchedulerError',\n })\n nylasSchedulerError!: EventEmitter<{ notification: Notification; host: HTMLElement }>;\n\n @Event({\n eventName: 'configSettingsLoaded',\n })\n configSettingsLoaded!: EventEmitter<{ settings: NylasSchedulerResponse<UISettingsResponse> }>;\n\n /**\n * This event is triggered if either the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef prop\n * is supplied and the component has been attached to the DOM. It emits the configurationId\n * and bookingId derived from the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef. Subscribe to this\n * event to obtain the extracted configurationId, which is necessary to generate the sessionID\n * for configurations that are not public.\n */\n @Event() bookingRefExtracted!: EventEmitter<{ configurationId: string; bookingId: string; salt?: string }>;\n\n /**\n * This event is triggered on successful booking request. It emits the event data.\n */\n @Event() bookedEventInfo!: EventEmitter<NylasSchedulerResponse<NylasEvent>>;\n\n /**\n * This function is called when the component is connected to the DOM.\n * At this point in the component lifecycle, the base provider has not yet\n * been initialized. So avoid using the base provider in this method or stores\n * in this method.\n */\n connectedCallback() {\n debug(`[nylas-scheduler] connectedCallback`);\n }\n\n async componentWillLoad() {\n debug(`[nylas-scheduler] Component will load`);\n\n // Emit the schedulerWillLoad event to allow the parent application to set the initial\n // state of the provider or to prevent the provider from firing some default behavior.\n const schedulerWillLoadEvent = this.schedulerWillLoad.emit(this.host);\n if ('schedulerWillLoad' in this.eventOverrides) {\n await this.eventOverrides.schedulerWillLoad(schedulerWillLoadEvent, this.nylasSchedulerConnector);\n if (schedulerWillLoadEvent.defaultPrevented) {\n return;\n }\n }\n\n this.stores = {\n scheduler: CreateNylasSchedulerStore({\n bookingInfo: this.bookingInfo,\n nylasBranding: this.nylasBranding,\n ...this.defaultSchedulerState,\n }),\n };\n\n this.baseProvider = new NylasBaseProvider(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);\n\n // Set the configId to the reschedule configId if rescheduleBookingRef is provided or\n // Set the configId to the cancel configId if cancelBookingRef is provided\n this.refConfigId = this.configurationId;\n let bookingRefExtractedEvent;\n if (this.rescheduleBookingRef) {\n const [rescheduleConfigId, rescheduleBookingId, _] = compactStringToUUIDs(this.rescheduleBookingRef);\n this.refConfigId = rescheduleConfigId;\n this.stores.scheduler.set('rescheduleBookingId', rescheduleBookingId);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: rescheduleConfigId, bookingId: rescheduleBookingId });\n } else if (this.cancelBookingRef) {\n const [cancelConfigId, cancelBookingId, _] = compactStringToUUIDs(this.cancelBookingRef);\n this.refConfigId = cancelConfigId;\n this.stores.scheduler.set('cancelBookingId', cancelBookingId);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: cancelConfigId, bookingId: cancelBookingId });\n } else if (this.organizerConfirmationBookingRef) {\n const [organizerConfirmationConfigId, organizerConfirmationBookingId, salt] = compactStringToUUIDs(this.organizerConfirmationBookingRef);\n this.refConfigId = organizerConfirmationConfigId;\n this.stores.scheduler.set('organizerConfirmationBookingId', organizerConfirmationBookingId);\n this.stores.scheduler.set('organizerConfirmationSalt', salt);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: organizerConfirmationConfigId, bookingId: organizerConfirmationBookingId, salt: salt });\n }\n\n if ('bookingRefExtracted' in this.eventOverrides) {\n await this.eventOverrides.bookingRefExtracted(bookingRefExtractedEvent, this.nylasSchedulerConnector);\n if (bookingRefExtractedEvent.defaultPrevented) {\n return;\n }\n }\n\n if (!this.checkIfSessionIdOrConfigIdExists()) {\n return;\n }\n\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n this.nylasSchedulerConnector = new NylasSchedulerConnector({\n schedulerAPIURL: this.schedulerApiUrl,\n sessionId: this.sessionId,\n configId: this.refConfigId,\n slug: this.slug,\n clientId: this.clientId,\n nylasSchedulerStore,\n });\n\n const initEvent = this.init.emit(this.host);\n if ('init' in this.eventOverrides) {\n await this.eventOverrides.init(initEvent, this.nylasSchedulerConnector);\n if (initEvent.defaultPrevented) {\n return;\n }\n }\n\n this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector);\n // Override theme\n this.applyThemeConfig(this.themeConfig);\n }\n\n async componentDidLoad() {\n this.baseProvider?.componentDidLoad();\n\n const schedulerDidLoadEvent = this.schedulerDidLoad.emit(this.host);\n if ('schedulerDidLoad' in this.eventOverrides) {\n await this.eventOverrides.schedulerDidLoad(schedulerDidLoadEvent, this.nylasSchedulerConnector);\n if (schedulerDidLoadEvent.defaultPrevented) {\n return;\n }\n }\n\n // If sessionId is not provided, do not fetch availability\n if (!this.checkIfSessionIdOrConfigIdExists()) {\n return;\n }\n this.localizationChanged(this.localization);\n const settingsResponse = await this.nylasSchedulerConnector?.scheduler.getUISettings();\n if (!settingsResponse || 'error' in settingsResponse) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(settingsResponse?.error) }, host: this.host });\n } else {\n if ('data' in settingsResponse && settingsResponse.data?.appearance) {\n console.info(\n '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.',\n );\n }\n const configSettingsLoadedEvent = this.configSettingsLoaded.emit({ settings: settingsResponse });\n if ('configSettingsLoaded' in this.eventOverrides) {\n await this.eventOverrides.configSettingsLoaded(configSettingsLoadedEvent, this.nylasSchedulerConnector);\n if (configSettingsLoadedEvent.defaultPrevented) {\n return;\n }\n }\n }\n\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n const availableDaysInFuture = nylasSchedulerStore?.get('configSettings')?.scheduler?.available_days_in_future;\n const selectedTimeslot = nylasSchedulerStore?.get('selectedTimeslot');\n\n if (selectedTimeslot && selectedTimeslot?.start_time) {\n if (!this.isTimeslotValid(selectedTimeslot)) {\n return;\n }\n\n // If the selected timeslot is already set, do not fetch availability\n if (nylasSchedulerStore?.get('showBookingForm')) {\n nylasSchedulerStore?.set('selectedDate', selectedTimeslot.start_time);\n return;\n }\n }\n\n const selectedDate = nylasSchedulerStore?.get('selectedDate');\n const availability = nylasSchedulerStore?.get('availability');\n let result;\n\n if (availability && availability.length > 0) {\n return;\n }\n\n if (!selectedDate) {\n const today = new Date();\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(today, availableDaysInFuture || 30);\n if (today.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n }\n } else {\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(selectedDate, availableDaysInFuture || 30);\n if (selectedDate.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n }\n }\n\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n\n if (!selectedDate) {\n let _selectedDate = new Date();\n const firstAvailableDate = nylasSchedulerStore?.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n nylasSchedulerStore?.set('selectedDate', _selectedDate);\n }\n }\n\n componentDisconnected() {\n this.baseProvider?.componentDisconnected();\n }\n\n @Watch('bookingInfo')\n bookingInfoChanged(newVal?: NylasSchedulerBookingData) {\n this.stores?.scheduler.set('bookingInfo', newVal);\n }\n\n @Watch('rescheduleBookingRef')\n rescheduleBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('rescheduleBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('cancelBookingRef')\n cancelBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('cancelBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('organizerConfirmationBookingRef')\n organizerConfirmationBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('organizerConfirmationBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('localization')\n localizationChanged(newVal?: Partial<Record<LANGUAGE_CODE, Locale>>) {\n if (!newVal) {\n return;\n }\n\n Object.keys(newVal).forEach(lang => {\n if (!(lang in LANGUAGE_CODE)) {\n return;\n }\n i18next.addResourceBundle(\n lang,\n 'translation',\n newVal[lang],\n false, // Merge with existing translations\n true, // Replace the existing translations with the same key\n );\n this.language = this.language;\n });\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newVal?: ThemeConfig) {\n this.applyThemeConfig(newVal);\n }\n\n @Listen('languageChanged')\n languageChanged(event: CustomEvent<string>) {\n const newLanguage = event.detail;\n this.language = newLanguage;\n i18next.changeLanguage(newLanguage);\n }\n\n /**\n * This is a custom event handler that is used to register a component with the provider.\n * It is used by components that have the `@RegisterComponent` decorator.\n * @param event A custom event that contains the component to register\n * @returns Promise<void>\n */\n @Listen('registerComponent')\n async registerComponentHandler(event: CustomEvent<RegisteredComponent<any, any>>): Promise<void> {\n this.baseProvider?.registerComponent(event.detail);\n }\n\n /**\n * This is a custom event handler that is used to unregister a component with the provider.\n * It is used by components that have the `@RegisterComponent` decorator.\n * @param event A custom event that contains the component to unregister\n * @returns Promise<void>\n */\n @Listen('unregisterComponent')\n async unregisterComponentHandler(event: CustomEvent<RegisteredComponent<any, any>>): Promise<void> {\n this.baseProvider?.unregisterComponent(event.detail);\n }\n\n /**\n * This is a custom event handler that is used to refetch the availability when the month is changed.\n */\n @Listen('monthChanged')\n async monthChangedHandler(event: CustomEvent<Date>) {\n const date = event.detail;\n const availableDaysInFuture = this.nylasSchedulerConnector?.schedulerStore?.get('configSettings')?.scheduler?.available_days_in_future;\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(date, availableDaysInFuture || 30);\n\n if (startTime < endTimeForAvailableDaysInFuture && date.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n const result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const selectableDates = this.stores?.scheduler.get('selectableDates');\n if (selectableDates && selectableDates.length > 0) {\n this.stores?.scheduler.set('selectedDate', selectableDates[0]);\n }\n }\n }\n\n /**\n * This is a custom event handler to book an event.\n */\n @Listen('detailsConfirmed')\n async bookButtonClickedHandler(event: CustomEvent<NylasSchedulerBookingData>) {\n const storeRescheduleId = this.nylasSchedulerConnector?.schedulerStore?.get('rescheduleBookingId');\n const rescheduleBookingId = storeRescheduleId;\n if (rescheduleBookingId) {\n const result = await this.nylasSchedulerConnector?.scheduler.rescheduleBooking(rescheduleBookingId, event.detail);\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result });\n if ('bookedEventInfo' in this.eventOverrides) {\n await this.eventOverrides.bookedEventInfo(bookedEventInfoEvent, this.nylasSchedulerConnector);\n }\n return;\n }\n const result = await this.nylasSchedulerConnector?.scheduler.bookTimeslot(event.detail);\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result });\n if ('bookedEventInfo' in this.eventOverrides) {\n await this.eventOverrides.bookedEventInfo(bookedEventInfoEvent, this.nylasSchedulerConnector);\n }\n }\n\n /**\n * This is a custom event handler to update the selected date label.\n */\n @Listen('dateSelected')\n dateSelectedHandler(event: CustomEvent<Date>) {\n const date = event.detail;\n this.selectedDateLabel = date ? date.toLocaleDateString(undefined, { dateStyle: 'full' }) : `${i18next.t('noDateSelected')}`;\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * cancel booking button is clicked on the cancel booking form.\n */\n @Listen('cancelBookedEventError')\n cancelBookedEventErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n @Listen('cancelBookedEventValidationError')\n cancelBookedEventValidationErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * reschedule button is clicked on the booked event card.\n */\n @Listen('rescheduleBookedEventError')\n rescheduleBookedEventErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * manual confirmation button is clicked on the manual confirmation card.\n */\n @Listen('confirmBookingError')\n confirmBookingErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n /**\n * This method is used to retrieve the NylasScheduler instance\n * @returns The NylasScheduler instance\n */\n @Method()\n async getNylasSchedulerStore(): Promise<NylasSchedulerStoreType | undefined> {\n return this.baseProvider?.getStore('scheduler');\n }\n\n /**\n * This method is used to retrieve the NylasConnector instance\n * @returns The NylasConnector instance\n */\n @Method()\n async getNylasSchedulerConnector() {\n return this.nylasSchedulerConnector;\n }\n\n @Method()\n async getRef() {\n return this.host;\n }\n\n private getErrorObject(error: NylasSchedulerErrorResponse['error']): Notification {\n return {\n title: error?.title || genericError.title,\n category: error?.category || genericError.category,\n type: NotificationType.Error,\n description: error?.message || '',\n id: new Date().getTime().toString(),\n ttl: 'none',\n };\n }\n private checkIfSessionIdOrConfigIdExists(): boolean {\n if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {\n let description = '';\n\n if (!this.sessionId) {\n description += i18next.t('sessionIdRequiredErrorMessage');\n }\n\n if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {\n description = i18next.t('sessionIdRequiredErrorMessage') + ' ' + i18next.t('publicConfigErrorMessage');\n }\n\n this.nylasSchedulerError.emit({\n notification: {\n title: i18next.t('schedulingComponentErrorTitle'),\n category: ErrorCategory.Component,\n type: NotificationType.Error,\n description: description,\n id: new Date().getTime().toString(),\n ttl: 'none',\n },\n host: this.host,\n });\n return false;\n }\n return true;\n }\n\n private isTimeslotValid(timeslot: Timeslot): boolean {\n const selectedDate = new Date(timeslot.start_time);\n if (selectedDate < new Date()) {\n this.nylasSchedulerError.emit({\n notification: {\n title: i18next.t('invalidTimeslotErrorTitle'),\n category: ErrorCategory.Component,\n type: NotificationType.Error,\n description: i18next.t('invalidTimeslotErrorMessage'),\n id: new Date().getTime().toString(),\n ttl: 'none',\n },\n host: this.host,\n });\n return false;\n }\n return true;\n }\n\n private validateAvailableDaysInFuture(\n startDate: Date,\n availableDaysInFuture: number,\n ): {\n startTime: number;\n endTime: number;\n endTimeForAvailableDaysInFuture: number;\n } {\n const today = new Date();\n const startTime = new Date(startDate.getFullYear(), startDate.getMonth(), 1).getTime() / 1000;\n const endTimeForCurrentMonth = new Date(startDate.getFullYear(), startDate.getMonth() + 1, 1).getTime() / 1000;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTime = Math.min(endTimeForAvailableDaysInFuture, endTimeForCurrentMonth);\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n return { startTime: startTimeWithOffset, endTime, endTimeForAvailableDaysInFuture };\n }\n\n private 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 /**\n * @slot timeslot-picker-cta-label - This slot is used to pass a custom label to the timeslot picker CTA. The default label is \"Next\".\n * @slot custom-booking-form - This slot is used to pass a custom booking form to the Nylas Scheduling component.\n * @deprecated Deprecated in favor of using the additional fields defined in the config settings.\n */\n render() {\n const showDefaultScheduler = this.mode === 'app';\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n const eventInfo = nylasSchedulerStore?.get('eventInfo');\n const showBookingForm = nylasSchedulerStore?.get('showBookingForm');\n const cancelledEventInfo = nylasSchedulerStore?.get('cancelledEventInfo');\n const cancelBookingId = nylasSchedulerStore?.get('cancelBookingId');\n const selectedTimeslot = nylasSchedulerStore?.get('selectedTimeslot') as Timeslot;\n const rescheduleBookingId = nylasSchedulerStore?.get('rescheduleBookingId');\n const organizerConfirmationBookingId = nylasSchedulerStore?.get('organizerConfirmationBookingId');\n const rejectBookingId = nylasSchedulerStore?.get('rejectBookingId');\n const confirmedEventInfo = nylasSchedulerStore?.get('confirmedEventInfo');\n const nylasBranding = nylasSchedulerStore?.get('nylasBranding') || this.nylasBranding;\n const selectedDate = nylasSchedulerStore?.get('selectedDate');\n const redirectUrl = nylasSchedulerStore?.get('configSettings')?.scheduler?.confirmation_redirect_url;\n this.selectedDateLabel =\n selectedDate && this.language\n ? capitalizeFirstLetter(selectedDate.toLocaleDateString(LANGUAGE_CODE_MAP[this.language], { dateStyle: 'full' }))\n : `${i18next.t('noDateSelected')}`;\n\n if (showDefaultScheduler && (cancelBookingId || rejectBookingId) && !cancelledEventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancel-flow-page\" part=\"cancel-flow-page\">\n <nylas-cancel-booking-form\n selectedTimeslot={selectedTimeslot}\n cancelBookingId={cancelBookingId}\n rejectBookingId={rejectBookingId}\n exportparts=\"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Manual confirmation page is shown when the event is manually confirmed\n if (showDefaultScheduler && organizerConfirmationBookingId) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"manual-confirmation-page\" part=\"manual-confirmation-page\">\n <nylas-organizer-confirmation-card\n organizerConfirmationBookingId={organizerConfirmationBookingId}\n exportparts=\"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Cancelled event card is shown when the event is cancelled\n if (showDefaultScheduler && cancelledEventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancelled-event-page\" part=\"cancelled-event-page\">\n <nylas-cancelled-event-card\n cancelledEventInfo={cancelledEventInfo}\n exportparts=\"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Confirmed event card is shown when the event is confirmed\n if (showDefaultScheduler && confirmedEventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancelled-event-page\" part=\"confirmed-event-page\">\n <nylas-confirmed-event-card\n confirmedEventInfo={confirmedEventInfo}\n exportparts=\"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Redirected to custom URL when the event is booked and redirect URL is provided\n if (showDefaultScheduler && eventInfo && redirectUrl) {\n window.location.assign(redirectUrl);\n return;\n }\n\n // Booked event card is shown when the event is booked or booking is sent\n if (showDefaultScheduler && eventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"booked-event-page\" part=\"booked-event-page\">\n <nylas-booked-event-card\n selectedTimeslot={selectedTimeslot}\n eventInfo={eventInfo}\n exportparts=\"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n // Date and time picker is shown when the event is not booked and no additional data is shown\n if (showDefaultScheduler && (!eventInfo || !!rescheduleBookingId) && !showBookingForm) {\n const timeslotPickerCTALabel = this.host.querySelector('[slot=\"timeslot-picker-cta-label\"]');\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n {rescheduleBookingId && <MessageBanner>{`${i18next.t('rescheduleTitle')}`}</MessageBanner>}\n <div class=\"select-date-page\" part=\"select-date-page\">\n <div class=\"left-panel\">\n <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\"></nylas-date-picker>\n <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\"></nylas-locale-switch>\n </div>\n <div class={`right-panel ${rescheduleBookingId ? 'reschedule' : ''}`}>\n <h2>\n <calendar-icon></calendar-icon>\n <span id=\"selectedDate\">{this.selectedDateLabel}</span>\n </h2>\n <nylas-timeslot-picker exportparts=\"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary\">\n {timeslotPickerCTALabel && (\n <span slot=\"timeslot-picker-cta-label\">\n <slot name=\"timeslot-picker-cta-label\"></slot>\n </span>\n )}\n </nylas-timeslot-picker>\n </div>\n </div>\n </SchedulerView>\n </Host>\n );\n }\n // Additional data is shown when the time is selected, event is not booked and additional data is shown\n if (showDefaultScheduler && !eventInfo && showBookingForm) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n {rescheduleBookingId && <MessageBanner>{`${i18next.t('rescheduleTitle')}`}</MessageBanner>}\n <div class=\"additional-data-page\" part=\"additional-data-page\">\n <div class=\"left-panel\">\n <div class=\"wrapper\">\n <nylas-selected-event-card exportparts=\"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone\"></nylas-selected-event-card>\n </div>\n </div>\n <div class={`right-panel ${rescheduleBookingId ? 'reschedule' : ''}`}>\n <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\"></nylas-booking-form>\n </div>\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n return (\n <Host>\n <slot />\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"nylas-scheduling.entry.cjs.js","mappings":";;;;;;;;;;;;MAgBa,uBAAuB;IAUlC,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAkC;QACvH,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAChD;QAED,IAAI,CAAC,mBAAmB,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACpD;QAED,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,EAAE;YAClD,MAAM,IAAI,KAAK,CAAC,wIAAwI,CAAC,CAAC;SAC3J;QAID,IAAI,eAAe,KAAK,GAAG,EAAE;YAC3B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC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A+R,GAAuB,CACnV,EACNA,iBAAK,KAAK,EAAE,eAAe,mBAAmB,GAAG,YAAY,GAAG,EAAE,EAAE,IAClEA,oBACEA,8BAA+B,EAC/BA,kBAAM,EAAE,EAAC,cAAc,IAAE,IAAI,CAAC,iBAAiB,CAAQ,CACpD,EACLA,mCAAuB,WAAW,EAAC,kEAAkE,IAClG,sBAAsB,KACrBA,kBAAM,IAAI,EAAC,2BAA2B,IACpCA,kBAAM,IAAI,EAAC,2BAA2B,GAAQ,CACzC,CACR,CACqB,CACpB,CACF,CACQ,CACX,EACP;SACH;QAED,IAAI,oBAAoB,IAAI,CAAC,SAAS,IAAI,eAAe,EAAE;YACzD,QACEA,QAACY,UAAI,QACHZ,QAAC,aAAa,IAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAC5G,mBAAmB,IAAIA,QAAC,aAAa,QAAE,GAAGE,cAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAiB,EAC1FF,iBAAK,KAAK,EAAC,sBAAsB,EAAC,IAAI,EAAC,sBAAsB,IAC3DA,iBAAK,KAAK,EAAC,YAAY,IACrBA,iBAAK,KAAK,EAAC,SAAS,IAClBA,uCAA2B,WAAW,EAAC,sEAAsE,GAA6B,CACtI,CACF,EACNA,iBAAK,KAAK,EAAE,eAAe,mBAAmB,GAAG,YAAY,GAAG,EAAE,EAAE,IAClEA,gCAAoB,WAAW,EAAC,mPAAmP,GAAsB,CACrS,CACF,CACQ,CACX,EACP;SACH;QAED,QACEA,QAACY,UAAI,QACHZ,qBAAQ,CACH,EACP;KACH;;;;;;;;;;;;;;;","names":["debug","NylaSchedulerAPIConnector","h","Fragment","i18next","NotificationType","ErrorCategory","CreateNylasSchedulerStore","NylasBaseProvider","compactStringToUUIDs","LANGUAGE_CODE","addDaysToCurrentDate","capitalizeFirstLetter","LANGUAGE_CODE_MAP","Host"],"sources":["src/connector/nylas-scheduler-connector/index.ts","src/components/scheduler/nylas-scheduling/scheduler-view.tsx","src/components/scheduler/nylas-scheduling/message-banner.tsx","src/components/scheduler/nylas-scheduling/nylas-scheduling.scss?tag=nylas-scheduling&encapsulation=shadow","src/components/scheduler/nylas-scheduling/nylas-scheduling.tsx"],"sourcesContent":["import { NylasSchedulerStoreType } from '@/stores/scheduler-store';\nimport { debug } from '@/utils/utils';\nimport { NylasSchedulerConnectorInterface } from '../connector-interface';\nimport { NylaSchedulerAPIConnector } from '../shared/api/scheduler';\n\ntype NylasSchedulerConnectorOptions = {\n schedulerAPIURL: string;\n nylasSchedulerStore: NylasSchedulerStoreType;\n sessionId?: string;\n configId?: string;\n slug?: string;\n clientId?: string;\n};\n/**\n * Base class for the Nylas connector.\n */\nexport class NylasSchedulerConnector implements NylasSchedulerConnectorInterface {\n public schedulerAPIURL: string;\n public nylasSchedulerStore: NylasSchedulerStoreType;\n public sessionId: string | undefined;\n public configId: string | undefined;\n public slug: string | undefined;\n public clientId: string | undefined;\n\n private _schedulerAPIConnector: NylaSchedulerAPIConnector | undefined;\n\n constructor({ schedulerAPIURL, nylasSchedulerStore, sessionId, configId, slug, clientId }: NylasSchedulerConnectorOptions) {\n if (!schedulerAPIURL) {\n throw new Error('schedulerAPIURL is required');\n }\n\n if (!nylasSchedulerStore) {\n throw new Error('nylasSchedulerStore is required');\n }\n\n if (!sessionId && !configId && !(slug || clientId)) {\n throw new Error('sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.');\n }\n\n // If the url is only /, then we need to add the base url.\n // We assume that the base url is the same as the current url.\n if (schedulerAPIURL === '/') {\n const url = new URL(window.location.href);\n schedulerAPIURL = url.origin;\n }\n\n this.configId = configId;\n this.sessionId = sessionId;\n this.schedulerAPIURL = schedulerAPIURL;\n this.nylasSchedulerStore = nylasSchedulerStore;\n this.slug = slug;\n this.clientId = clientId;\n }\n\n public init() {\n debug('NylasConnector init');\n }\n\n public get schedulerStore() {\n return this.nylasSchedulerStore;\n }\n\n public get scheduler() {\n if (this._schedulerAPIConnector) {\n return this._schedulerAPIConnector;\n }\n this._schedulerAPIConnector = new NylaSchedulerAPIConnector({\n schedulerAPIURL: this.schedulerAPIURL,\n schedulerStore: this.schedulerStore,\n sessionId: this.sessionId,\n configId: this.configId,\n slug: this.slug,\n clientId: this.clientId,\n });\n return this._schedulerAPIConnector;\n }\n\n public resetStores() {\n this.nylasSchedulerStore.reset();\n }\n}\nexport type PublicMethods<T> = {\n [K in keyof T]: T[K] extends Function ? (string extends K ? never : K) : never;\n}[keyof T];\n\nexport type NylasSchedulerConnectorPublicMethods = PublicMethods<NylasSchedulerConnector>;\n","import { Fragment, FunctionalComponent, h } from '@stencil/core';\n\nexport type SchedulerViewProps = {\n isLoading?: boolean;\n showNotification?: boolean;\n nylasBranding?: boolean;\n};\n\n/**\n * The Scheduler view component.\n */\nexport const SchedulerView: FunctionalComponent<SchedulerViewProps> = (props: SchedulerViewProps, children) => {\n const isLoading = props.isLoading;\n const showNotification = props.showNotification;\n const nylasBranding = props.nylasBranding;\n\n return (\n <Fragment>\n {showNotification && <nylas-notification></nylas-notification>}\n\n {isLoading && (\n <div class={'loading'}>\n <div class={'left'}>\n <div class={'skeleton'} />\n </div>\n <div class={'right'}>\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n <div class={'skeleton'} />\n </div>\n </div>\n )}\n {!isLoading && children}\n <div class={'footer'}>\n {nylasBranding && (\n <Fragment>\n Powered by&nbsp;\n <nylas-logo />\n </Fragment>\n )}\n </div>\n </Fragment>\n );\n};\n","import { FunctionalComponent, h } from '@stencil/core';\n\nexport type HeaderBannerProps = {};\n\nexport const MessageBanner: FunctionalComponent<HeaderBannerProps> = (_props: HeaderBannerProps, children) => <div class=\"message-banner\">{children}</div>;\n","@import '../../../common/styles/variables.scss';\n\n:host {\n display: flex;\n flex-direction: column;\n overflow: visible;\n border-radius: var(--nylas-border-radius-2x);\n width: fit-content;\n\n @media #{$mobile} {\n width: auto;\n min-width: 325px;\n }\n\n background: var(--nylas-base-0);\n position: relative;\n box-shadow: 0px 4px 8px 2px rgba(0, 0, 0, 0.05),\n 0px 8px 16px -2px rgba(0, 0, 0, 0.1);\n\n @include default-css-variables;\n font-family: var(--nylas-font-family);\n font-optical-sizing: auto;\n font-style: normal;\n font-variation-settings: 'slnt' 0;\n}\n\n:root {\n font-family: inherit;\n}\n\n.error {\n padding: 8rem 12rem;\n color: var(--nylas-base-0);\n background-color: var(--nylas-error);\n margin: 1.5rem;\n border-radius: var(--nylas-border-radius-2x);\n}\n\n.message-banner {\n text-align: right;\n color: var(--nylas-base-800);\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-color-primary-200);\n margin: 0;\n}\n\n.loading {\n margin: 1.5rem;\n display: flex;\n gap: 1rem;\n\n .skeleton {\n border-radius: var(--nylas-border-radius-2x);\n animation: pulsate 1.5s infinite;\n\n &:nth-child(2) {\n animation-delay: -100ms;\n }\n\n &:nth-child(3) {\n animation-delay: -200ms;\n }\n\n &:nth-child(4) {\n animation-delay: -300ms;\n }\n\n &:nth-child(5) {\n animation-delay: -400ms;\n }\n }\n\n .left .skeleton {\n height: 100%;\n width: 400px;\n }\n\n .right .skeleton {\n height: 5rem;\n width: 300px;\n margin-bottom: 1rem;\n\n &:last-child {\n margin-bottom: 0;\n }\n }\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.select-date-page,\n.additional-data-page,\n.booked-event-page,\n.manual-confirmation-page,\n.cancelled-event-page,\n.cancel-flow-page {\n border-top-left-radius: var(--nylas-border-radius-2x);\n border-top-right-radius: var(--nylas-border-radius-2x);\n}\n\n.select-date-page,\n.additional-data-page {\n display: flex;\n\n @media #{$mobile} {\n flex-direction: column;\n }\n}\n\n.booked-event-page,\n.manual-confirmation-page {\n background-color: var(--nylas-base-50);\n}\n\n.cancelled-event-page,\n.manual-confirmation-page,\n.cancel-flow-page {\n padding: 1rem;\n height: 496px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.booked-event-page,\n.manual-confirmation-page,\n.cancelled-event-page,\n.cancel-flow-page {\n min-width: 784px;\n\n @media #{$mobile} {\n min-width: 90%;\n }\n\n background: var(--nylas-base-50);\n}\n\n.left-panel {\n display: flex;\n flex-direction: column;\n min-width: 424px;\n border-top-left-radius: inherit;\n background: var(--nylas-base-0);\n position: relative;\n padding: 1rem 0 0 0;\n height: 624px;\n\n @media #{$mobile} {\n border-top-right-radius: inherit;\n min-width: unset;\n height: auto;\n }\n}\n\n.select-date-page .left-panel {\n @media #{$mobile} {\n padding: 0.5rem 4px 0;\n height: 624px;\n }\n}\n\n.border {\n margin-left: -20px; // Offset left padding\n margin-right: -20px; // Offset right padding\n border-top-width: 1px;\n height: 0.5px;\n background-color: var(--nylas-base-200);\n\n @media #{$mobile} {\n display: none;\n }\n}\n\n.right-panel {\n min-width: 360px;\n width: 360px;\n background-color: var(--nylas-base-50);\n height: 624px;\n padding-top: 16px;\n border-left: 1px solid var(--nylas-base-200);\n border-top-right-radius: inherit;\n\n &.reschedule {\n border-top-right-radius: 0px;\n }\n\n @media #{$mobile} {\n border-top-right-radius: 0px;\n width: inherit;\n min-width: unset;\n height: auto;\n }\n\n h2 {\n display: flex;\n margin: 0;\n height: 48px;\n gap: 0.5rem;\n justify-content: center;\n align-items: center;\n width: auto;\n font-size: 1.125rem;\n line-height: 1.5rem;\n font-weight: 500;\n text-align: center;\n color: var(--nylas-base-800);\n }\n}\n\n.additional-data-page {\n .left-panel {\n background-color: var(--nylas-base-50);\n }\n\n .right-panel {\n background-color: var(--nylas-base-0);\n }\n}\n\nnylas-selected-event-card {\n height: calc(640px - 36px);\n padding: 0 1rem;\n\n @media #{$mobile} {\n height: 250px;\n }\n}\n\n.footer {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n padding: 16px;\n font-size: 14px;\n font-weight: 300;\n color: var(--nylas-base-500);\n border-top: 1px solid var(--nylas-base-200);\n min-height: 24px;\n\n svg {\n fill: var(--nylas-base-500);\n }\n}\n\n.footer svg {\n margin-top: 1px;\n}\n\nnylas-selected-event-card::part(nsec__timezone) {\n position: absolute;\n bottom: 0;\n}\n\nnylas-notification {\n margin: 1.5rem;\n width: -webkit-fill-available;\n width: -moz-available;\n position: absolute;\n}\n\nnylas-locale-switch {\n position: absolute;\n padding: 18px 20px;\n bottom: 0;\n width: -webkit-fill-available;\n width: -moz-available;\n border-top: 1px solid var(--nylas-base-200);\n\n @media #{$mobile} {\n height: auto;\n }\n}\n\nnylas-date-picker {\n padding: 0 20px;\n}","import { NylasBaseProvider } from '@/common/abstract-provider';\nimport { RegisteredComponent } from '@/common/register-component';\nimport type { SchedulerEventOverride } from '@/common/component-types';\nimport { NylasSchedulerConnector } from '@/connector/nylas-scheduler-connector';\nimport { CreateNylasSchedulerStore, NylasSchedulerStoreState, NylasSchedulerStoreType } from '@/stores/scheduler-store';\nimport {\n NylasSchedulerBookingData,\n ThemeConfig,\n Notification,\n NotificationType,\n NylasSchedulerErrorResponse,\n Timeslot,\n NylasSchedulerResponse,\n NylasSuccessResponse,\n} from '@nylas/core';\nimport { Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { addDaysToCurrentDate, capitalizeFirstLetter, compactStringToUUIDs, debug } from '@/utils/utils';\nimport { SchedulerView } from './scheduler-view';\nimport { ErrorCategory } from '@/connector/nylas-scheduler-connector/errors';\nimport { MessageBanner } from './message-banner';\nimport i18next from '@/utils/i18n';\nimport { NylasEvent, UISettingsResponse } from '@/common/types';\nimport { LANGUAGE_CODE, LANGUAGE_CODE_MAP, Locale } from '@/common/constants';\n\nconst genericError = { title: i18next.t('genericErrorTitle'), type: NotificationType.Error, category: ErrorCategory.Component };\n\n/**\n * The `nylas-scheduling` component is used to display the Nylas Scheduling UI.\n *\n * @part ndp - [nylas-date-picker] The date picker host.\n * @part ndp__title - [nylas-date-picker] The title.\n * @part ndp__month-header - [nylas-date-picker] The month header.\n * @part ndp__month-button - [nylas-date-picker] The month button.\n * @part ndp__day - [nylas-date-picker] The day.\n * @part ndp__date - [nylas-date-picker] The date.\n * @part ndp__date--selected - [nylas-date-picker] The selected date.\n * @part ndp__date--current-day - [nylas-date-picker] The current day.\n * @part ndp__date--current-month - [nylas-date-picker] The dates in the current month.\n * @part ndp__date--disabled - [nylas-date-picker] The disabled dates.\n * @part ntp - [nylas-timeslot-picker] The timeslot picker component.\n * @part ntp__timeslot - [nylas-timeslot-picker] The timeslot button.\n * @part ntp__timeslot--selected - [nylas-timeslot-picker] The selected timeslot button.\n * @part ntp__button-primary - [nylas-timeslot-picker] The timeslot picker CTA.\n * @part nsec - [nylas-selected-event-card] The selected event card component.\n * @part nsec__card - [nylas-selected-event-card] The card component.\n * @part nsec__icon - [nylas-selected-event-card] The calendar icon.\n * @part nsec__date - [nylas-selected-event-card] The date selected.\n * @part nsec__time - [nylas-selected-event-card] The timeslot selected.\n * @part nbf - [nylas-booking-form] The booking form host.\n * @part nbf__input-textfield - [nylas-booking-form] The input textfield.\n * @part nbf__button-ghost - [nylas-booking-form] The ghost button.\n * @part nbf__button-outline - [nylas-booking-form] The outline button.\n * @part nbf__button-primary - [nylas-booking-form] The primary button.\n * @part nbf__input-wrapper - [nylas-booking-form] The input wrapper.\n * @part nbf__checkbox-component - [nylas-booking-form] The checkbox component.\n * @part nbf__radio-button-group - [nylas-booking-form] The radio button group.\n * @part nbf__textarea-component - [nylas-booking-form] The textarea component.\n * @part nbf__dropdown - [nylas-booking-form] The dropdown component.\n * @part nbf__dropdown-button - [nylas-booking-form] The dropdown button.\n * @part nbf__dropdown-content - [nylas-booking-form] The dropdown content.\n * @part ncec - [nylas-cancelled-event-card] The cancelled event card host.\n * @part ncec__icon - [nylas-cancelled-event-card] The calendar icon.\n * @part ncec__title - [nylas-cancelled-event-card] The title of the cancelled event card.\n * @part ncec__description - [nylas-cancelled-event-card] The description of the cancelled event card.\n * @part ncec__button-outline - [nylas-cancelled-event-card] The close button CTA.\n * @part ncec__card - [nylas-cancelled-event-card] The cancelled event card.\n * @part nbec - [nylas-booked-event-card] The booked event card host.\n * @part nbec__card - [nylas-booked-event-card] The booked event card.\n * @part nbec__title - [nylas-booked-event-card] The title of the booked event card.\n * @part nbec__description - [nylas-booked-event-card] The description of the booked event card.\n * @part nbec__button-outline - [nylas-booked-event-card] The cancel & reschedule button CTA.\n * @part nbec__cancel-cta - [nylas-booked-event-card] The cancel button CTA.\n * @part nbec__reschedule-cta - [nylas-booked-event-card] The reschedule button CTA.\n * @part nls - [nylas-locale-switch] The locale switch container.\n * @part nls__timezone - [nylas-locale-switch] The timezone select container\n * @part nls__timezone-dropdown - [nylas-locale-switch] The timezone dropdown\n * @part nls__timezone-drop-button - [nylas-locale-switch] The timezone dropdown button\n * @part nls__timezone-drop-button-selected-label - [nylas-locale-switch] The timezone dropdown button selected label\n * @part nls__timezone-drop-content - [nylas-locale-switch] The timezone dropdown content\n * @part nls__timezone-drop-label - [nylas-locale-switch] The timezone dropdown label\n * @part nls__language - [nylas-locale-switch] The language select container\n * @part nls__language-dropdown - [nylas-locale-switch] The language dropdown\n * @part nls__language-drop-button - [nylas-locale-switch] The language dropdown button\n * @part nls__language-drop-content - [nylas-locale-switch] The language dropdown content\n * @part nls__language-drop-label - [nylas-locale-switch] The language dropdown label\n * @part ncbf - [nylas-cancel-booking-form] The cancel booking form container.\n * @part ncbf__icon - [nylas-cancel-booking-form] The calendar icon.\n * @part ncbf__title - [nylas-cancel-booking-form] The title of the cancel booking form.\n * @part ncbf__description - [nylas-cancel-booking-form] The description of the cancel booking form.\n * @part ncbf__reason-textarea - [nylas-cancel-booking-form] The reason textarea.\n * @part ncbf__button-cta - [nylas-cancel-booking-form] The cancel booking form CTA button.\n * @part ncbf__button-outline - [nylas-cancel-booking-form] The cancel booking form outline button.\n * @part ncbf__card - [nylas-cancel-booking-form] The cancel booking form card.\n */\n@Component({\n tag: 'nylas-scheduling',\n styleUrl: 'nylas-scheduling.scss',\n shadow: true,\n})\nexport class NylasScheduling {\n /**\n * Stores to be used by the provider.\n */\n private stores?: { scheduler: NylasSchedulerStoreType };\n\n /**\n * This is a base provide that defines the common methods and properties\n * that all providers should have.\n *\n * Because stencil does not support abstract classes, we have to use a\n * property to store the base provider instance.\n */\n private baseProvider?: NylasBaseProvider<Exclude<typeof this.stores, undefined>>;\n\n /**\n * The Nylas Scheduler Connector instance.\n * The branins of the provider. It manages data fetching and state synchronization.\n */\n private nylasSchedulerConnector?: NylasSchedulerConnector;\n\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasSchedulingElement;\n\n /**\n * This is used to set the mode for the Nylas Scheduler.\n * The mode can be either `app` or `composable`. The default mode is `app`.\n * - `app`: This mode is used to show the default Nylas Scheduler UI.\n * - `composable`: This mode is used to show the composable Nylas Scheduler UI\n * by passing the individual scheduler components as children.\n */\n @Prop() readonly mode: 'app' | 'composable' = 'app';\n\n /**\n * The default scheduler store state.\n * Used to set the initial state of the scheduler store.\n */\n @Prop({ attribute: 'default-scheduler-store-state' }) readonly defaultSchedulerState?: Partial<NylasSchedulerStoreState>;\n\n /**\n * The session ID for the Nylas Scheduler.\n * This is used to authenticate the user.\n */\n @Prop() readonly sessionId?: string;\n\n /**\n * The URL for the Nylas Scheduler API. (staging or production URL)\n */\n @Prop() readonly schedulerApiUrl: string = 'https://api.us.nylas.com';\n\n /**\n * This enables passing the bookingInfo object to the Scheduler UI for direct booking event creation.\n * When used with timeslotConfirmedHandler, it bypasses the additional data page and immediately\n * invokes the handler after booking.\n */\n @Prop() readonly bookingInfo?: NylasSchedulerBookingData;\n\n /**\n * Booking Ref required for rescheduling flow.\n */\n @Prop() readonly rescheduleBookingRef?: string;\n\n /**\n * Booking Ref required for cancelling flow.\n */\n @Prop() readonly cancelBookingRef?: string;\n\n /**\n * Booking Ref required for the manual confirmation flow.\n */\n @Prop() readonly organizerConfirmationBookingRef?: string;\n\n /**\n * The config ID for the Nylas Scheduler. This should be passed in when using a public config,\n * in which case the sessionId is not required.\n */\n @Prop() readonly configurationId?: string;\n\n /**\n * The slug of the configuration (public config) to be used for the Nylas Scheduler. This is used in conjunction with the clientId.\n * When the configurationId is not provided, the slug and clientId are used to make requests to the Scheduler API endpoints.\n * If the configurationId is provided, this prop will be ignored.\n */\n @Prop() readonly slug?: string;\n\n /**\n * The app ID of the configuration (public config) to be used for the Nylas Scheduler. This is used in conjunction with the slug.\n * When the configurationId is not provided, the slug and clientId are used to make requests to the Scheduler API endpoints.\n * If the configurationId is provided, this prop will be ignored.\n */\n @Prop() readonly clientId?: string;\n\n /**\n * This prop lets you hide the Nylas branding.\n * Default is true.\n */\n @Prop() readonly nylasBranding?: boolean = true;\n\n /**\n * This provides an easy way to override the default function of the event emitter.\n * An example of this is the `timeslotConfirmed` event. By default, this event will set the scheduler store state for `showBookingForm` to `true` which will\n * show the booking form. However, if you want to override this behavior, you can pass in the prop `eventOverride` like:\n * ```html\n * <nylas-scheduling eventOverride={{\"timeslotConfirmed\": (event, nylasConnector) => { console.log(\"Timeslot confirmed event fired!\"); } }} />\n * ```\n */\n @Prop({ attribute: 'event-overrides' }) readonly eventOverrides: SchedulerEventOverride = {};\n\n /**\n * The loading state. This is used to set the loading state for the Nylas Scheduler when fetching data.\n */\n @Prop() readonly isLoading?: boolean;\n\n /**\n * Theme config, used to automatically generate a theme with color palette and\n * CSS variables to customize the look and feel of the Nylas Scheduler.\n */\n @Prop() readonly themeConfig?: ThemeConfig;\n\n /**\n * This prop will allow to override the default localization strings for each language.\n * Nylas scheduling page currently support the following language codes: en, es, fr, de, sv, zh, ja, nl.\n */\n @Prop() readonly localization?: Partial<Record<LANGUAGE_CODE, Locale>>;\n\n /*\n * Displays notifications for errors by default. When enabled (`true`), errors\n * automatically appear as notifications. Disabling this feature (`false`) allows\n * the parent application to capture and manage errors by listening to the\n * `nylasSchedulerError` event, providing flexibility in error handling.\n */\n @Prop() readonly showNotification?: boolean = true;\n\n /**\n * Automatically register components that have the `@RegisterComponent` decorator.\n * If this is set to false, you will need to manually register components using the\n * `registerComponent` method.\n * @default true\n */\n @State() automaticComponentRegistration: boolean = true;\n\n /**\n * The selected date label for the Nylas Scheduler.\n * This is used to set the initial date label for the Nylas Scheduler.\n */\n @State() selectedDateLabel: string = new Date().toLocaleDateString(undefined, { dateStyle: 'full' }) || `${i18next.t('noDateSelected')}`;\n\n /**\n * The config id extracted from the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef.\n */\n @State() refConfigId?: string;\n\n /**\n * The selected language for the Nylas Scheduler.\n */\n @State() language: string = navigator.language;\n\n /**\n * This event is fired when the provider is initialized.\n * It can be used to set the initial state of the provider,\n * or to prevent the provider from firing some default behavior.\n */\n @Event({ cancelable: true }) init!: EventEmitter<HTMLNylasSchedulingElement>;\n\n /**\n * This event is fired when the scheduler component enters componentWillLoad lifecycle.\n */\n @Event() schedulerWillLoad!: EventEmitter<HTMLNylasSchedulingElement>;\n\n /**\n * This event is fired when the scheduler component enters componentDidLoad lifecycle.\n */\n @Event() schedulerDidLoad!: EventEmitter<HTMLNylasSchedulingElement>;\n\n @Event({\n eventName: 'nylasSchedulerError',\n })\n nylasSchedulerError!: EventEmitter<{ notification: Notification; host: HTMLElement }>;\n\n @Event({\n eventName: 'configSettingsLoaded',\n })\n configSettingsLoaded!: EventEmitter<{ settings: NylasSchedulerResponse<UISettingsResponse> }>;\n\n /**\n * This event is triggered if either the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef prop\n * is supplied and the component has been attached to the DOM. It emits the configurationId\n * and bookingId derived from the rescheduleBookingRef or cancelBookingRef or organizerConfirmationBookingRef. Subscribe to this\n * event to obtain the extracted configurationId, which is necessary to generate the sessionID\n * for configurations that are not public.\n */\n @Event() bookingRefExtracted!: EventEmitter<{ configurationId: string; bookingId: string; salt?: string }>;\n\n /**\n * This event is triggered on successful booking request. It emits the event data.\n */\n @Event() bookedEventInfo!: EventEmitter<NylasSchedulerResponse<NylasEvent>>;\n\n /**\n * This function is called when the component is connected to the DOM.\n * At this point in the component lifecycle, the base provider has not yet\n * been initialized. So avoid using the base provider in this method or stores\n * in this method.\n */\n connectedCallback() {\n debug(`[nylas-scheduler] connectedCallback`);\n }\n\n async componentWillLoad() {\n debug(`[nylas-scheduler] Component will load`);\n\n // Emit the schedulerWillLoad event to allow the parent application to set the initial\n // state of the provider or to prevent the provider from firing some default behavior.\n const schedulerWillLoadEvent = this.schedulerWillLoad.emit(this.host);\n if ('schedulerWillLoad' in this.eventOverrides) {\n await this.eventOverrides.schedulerWillLoad(schedulerWillLoadEvent, this.nylasSchedulerConnector);\n if (schedulerWillLoadEvent.defaultPrevented) {\n return;\n }\n }\n\n this.stores = {\n scheduler: CreateNylasSchedulerStore({\n bookingInfo: this.bookingInfo,\n nylasBranding: this.nylasBranding,\n ...this.defaultSchedulerState,\n }),\n };\n\n this.baseProvider = new NylasBaseProvider(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);\n\n // Set the configId to the reschedule configId if rescheduleBookingRef is provided or\n // Set the configId to the cancel configId if cancelBookingRef is provided\n this.refConfigId = this.configurationId;\n let bookingRefExtractedEvent;\n if (this.rescheduleBookingRef) {\n const [rescheduleConfigId, rescheduleBookingId, _] = compactStringToUUIDs(this.rescheduleBookingRef);\n this.refConfigId = rescheduleConfigId;\n this.stores.scheduler.set('rescheduleBookingId', rescheduleBookingId);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: rescheduleConfigId, bookingId: rescheduleBookingId });\n } else if (this.cancelBookingRef) {\n const [cancelConfigId, cancelBookingId, _] = compactStringToUUIDs(this.cancelBookingRef);\n this.refConfigId = cancelConfigId;\n this.stores.scheduler.set('cancelBookingId', cancelBookingId);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: cancelConfigId, bookingId: cancelBookingId });\n } else if (this.organizerConfirmationBookingRef) {\n const [organizerConfirmationConfigId, organizerConfirmationBookingId, salt] = compactStringToUUIDs(this.organizerConfirmationBookingRef);\n this.refConfigId = organizerConfirmationConfigId;\n this.stores.scheduler.set('organizerConfirmationBookingId', organizerConfirmationBookingId);\n this.stores.scheduler.set('organizerConfirmationSalt', salt);\n bookingRefExtractedEvent = this.bookingRefExtracted.emit({ configurationId: organizerConfirmationConfigId, bookingId: organizerConfirmationBookingId, salt: salt });\n }\n\n if ('bookingRefExtracted' in this.eventOverrides) {\n await this.eventOverrides.bookingRefExtracted(bookingRefExtractedEvent, this.nylasSchedulerConnector);\n if (bookingRefExtractedEvent.defaultPrevented) {\n return;\n }\n }\n\n if (!this.checkIfSessionIdOrConfigIdExists()) {\n return;\n }\n\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n this.nylasSchedulerConnector = new NylasSchedulerConnector({\n schedulerAPIURL: this.schedulerApiUrl,\n sessionId: this.sessionId,\n configId: this.refConfigId,\n slug: this.slug,\n clientId: this.clientId,\n nylasSchedulerStore,\n });\n\n const initEvent = this.init.emit(this.host);\n if ('init' in this.eventOverrides) {\n await this.eventOverrides.init(initEvent, this.nylasSchedulerConnector);\n if (initEvent.defaultPrevented) {\n return;\n }\n }\n\n this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector);\n // Override theme\n this.applyThemeConfig(this.themeConfig);\n }\n\n async componentDidLoad() {\n this.baseProvider?.componentDidLoad();\n\n const schedulerDidLoadEvent = this.schedulerDidLoad.emit(this.host);\n if ('schedulerDidLoad' in this.eventOverrides) {\n await this.eventOverrides.schedulerDidLoad(schedulerDidLoadEvent, this.nylasSchedulerConnector);\n if (schedulerDidLoadEvent.defaultPrevented) {\n return;\n }\n }\n\n // If sessionId is not provided, do not fetch availability\n if (!this.checkIfSessionIdOrConfigIdExists()) {\n return;\n }\n this.localizationChanged(this.localization);\n const settingsResponse = await this.nylasSchedulerConnector?.scheduler.getUISettings();\n if (!settingsResponse || 'error' in settingsResponse) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(settingsResponse?.error) }, host: this.host });\n return;\n } else {\n if ('data' in settingsResponse && settingsResponse.data?.appearance) {\n console.info(\n '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.',\n );\n }\n const configSettingsLoadedEvent = this.configSettingsLoaded.emit({ settings: settingsResponse });\n if ('configSettingsLoaded' in this.eventOverrides) {\n await this.eventOverrides.configSettingsLoaded(configSettingsLoadedEvent, this.nylasSchedulerConnector);\n if (configSettingsLoadedEvent.defaultPrevented) {\n return;\n }\n }\n }\n\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n const availableDaysInFuture = nylasSchedulerStore?.get('configSettings')?.scheduler?.available_days_in_future;\n const selectedTimeslot = nylasSchedulerStore?.get('selectedTimeslot');\n\n if (selectedTimeslot && selectedTimeslot?.start_time) {\n if (!this.isTimeslotValid(selectedTimeslot)) {\n return;\n }\n\n // If the selected timeslot is already set, do not fetch availability\n if (nylasSchedulerStore?.get('showBookingForm')) {\n nylasSchedulerStore?.set('selectedDate', selectedTimeslot.start_time);\n return;\n }\n }\n\n const selectedDate = nylasSchedulerStore?.get('selectedDate');\n const availability = nylasSchedulerStore?.get('availability');\n let result;\n\n if (availability && availability.length > 0) {\n return;\n }\n\n if (!selectedDate) {\n const today = new Date();\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(today, availableDaysInFuture || 30);\n if (today.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n }\n } else {\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(selectedDate, availableDaysInFuture || 30);\n if (selectedDate.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n }\n }\n\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n\n if (!selectedDate) {\n let _selectedDate = new Date();\n const firstAvailableDate = nylasSchedulerStore?.get('availability').find((timeslot: any) => new Date(timeslot.start_time) > new Date());\n if (firstAvailableDate) {\n _selectedDate = firstAvailableDate.start_time;\n }\n nylasSchedulerStore?.set('selectedDate', _selectedDate);\n }\n }\n\n componentDisconnected() {\n this.baseProvider?.componentDisconnected();\n }\n\n @Watch('bookingInfo')\n bookingInfoChanged(newVal?: NylasSchedulerBookingData) {\n this.stores?.scheduler.set('bookingInfo', newVal);\n }\n\n @Watch('rescheduleBookingRef')\n rescheduleBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('rescheduleBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('cancelBookingRef')\n cancelBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('cancelBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('organizerConfirmationBookingRef')\n organizerConfirmationBookingRefChanged(newVal?: string) {\n if (newVal) {\n const [configId, bookingId] = compactStringToUUIDs(newVal);\n this.stores?.scheduler.set('organizerConfirmationBookingId', bookingId);\n this.refConfigId = configId;\n this.nylasSchedulerConnector?.scheduler.setConfigId(configId);\n }\n }\n\n @Watch('localization')\n localizationChanged(newVal?: Partial<Record<LANGUAGE_CODE, Locale>>) {\n if (!newVal) {\n return;\n }\n\n Object.keys(newVal).forEach(lang => {\n if (!(lang in LANGUAGE_CODE)) {\n return;\n }\n i18next.addResourceBundle(\n lang,\n 'translation',\n newVal[lang],\n false, // Merge with existing translations\n true, // Replace the existing translations with the same key\n );\n this.language = this.language;\n });\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newVal?: ThemeConfig) {\n this.applyThemeConfig(newVal);\n }\n\n @Listen('languageChanged')\n languageChanged(event: CustomEvent<string>) {\n const newLanguage = event.detail;\n this.language = newLanguage;\n i18next.changeLanguage(newLanguage);\n }\n\n /**\n * This is a custom event handler that is used to register a component with the provider.\n * It is used by components that have the `@RegisterComponent` decorator.\n * @param event A custom event that contains the component to register\n * @returns Promise<void>\n */\n @Listen('registerComponent')\n async registerComponentHandler(event: CustomEvent<RegisteredComponent<any, any>>): Promise<void> {\n this.baseProvider?.registerComponent(event.detail);\n }\n\n /**\n * This is a custom event handler that is used to unregister a component with the provider.\n * It is used by components that have the `@RegisterComponent` decorator.\n * @param event A custom event that contains the component to unregister\n * @returns Promise<void>\n */\n @Listen('unregisterComponent')\n async unregisterComponentHandler(event: CustomEvent<RegisteredComponent<any, any>>): Promise<void> {\n this.baseProvider?.unregisterComponent(event.detail);\n }\n\n /**\n * This is a custom event handler that is used to refetch the availability when the month is changed.\n */\n @Listen('monthChanged')\n async monthChangedHandler(event: CustomEvent<Date>) {\n const date = event.detail;\n const availableDaysInFuture = this.nylasSchedulerConnector?.schedulerStore?.get('configSettings')?.scheduler?.available_days_in_future;\n const { startTime, endTime, endTimeForAvailableDaysInFuture } = this.validateAvailableDaysInFuture(date, availableDaysInFuture || 30);\n\n if (startTime < endTimeForAvailableDaysInFuture && date.getTime() < endTimeForAvailableDaysInFuture * 1000) {\n const result = await this.nylasSchedulerConnector?.scheduler.getAvailability(startTime, endTime);\n\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const selectableDates = this.stores?.scheduler.get('selectableDates');\n if (selectableDates && selectableDates.length > 0) {\n this.stores?.scheduler.set('selectedDate', selectableDates[0]);\n }\n }\n }\n\n mapToBookingData(bookingInfo: NylasSchedulerBookingData): any {\n const timeslot = this.stores?.scheduler.get('selectedTimeslot');\n const language = this.stores?.scheduler.get('selectedLanguage');\n const timezone = this.stores?.scheduler.get('selectedTimezone');\n const startTime = timeslot?.start_time ? new Date(timeslot?.start_time).getTime() / 1000 : '';\n const endTime = timeslot?.end_time ? new Date(timeslot?.end_time).getTime() / 1000 : '';\n return {\n additional_guests: bookingInfo.guests,\n guest: bookingInfo.primaryParticipant,\n additional_fields: bookingInfo.additionalFields,\n start_time: startTime,\n end_time: endTime,\n email_language: language,\n timezone: timezone,\n };\n }\n\n /**\n * This is a custom event handler to book an event.\n */\n @Listen('detailsConfirmed')\n async bookButtonClickedHandler(event: CustomEvent<NylasSchedulerBookingData>) {\n const bookingData = event.detail;\n const mappedBookingData = this.mapToBookingData(bookingData);\n const storeRescheduleId = this.nylasSchedulerConnector?.schedulerStore?.get('rescheduleBookingId');\n const rescheduleBookingId = storeRescheduleId;\n if (rescheduleBookingId) {\n const result = await this.nylasSchedulerConnector?.scheduler.rescheduleBooking(rescheduleBookingId, bookingData);\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const resultData = (result as NylasSuccessResponse<NylasEvent>)?.data;\n const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result, data: { ...resultData, ...mappedBookingData } });\n if ('bookedEventInfo' in this.eventOverrides) {\n await this.eventOverrides.bookedEventInfo(bookedEventInfoEvent, this.nylasSchedulerConnector);\n }\n return;\n }\n const result = await this.nylasSchedulerConnector?.scheduler.bookTimeslot(bookingData);\n if (!result || 'error' in result) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });\n }\n const resultData = (result as NylasSuccessResponse<NylasEvent>)?.data;\n const bookedEventInfoEvent = this.bookedEventInfo.emit({ ...result, data: { ...resultData, ...mappedBookingData } });\n if ('bookedEventInfo' in this.eventOverrides) {\n await this.eventOverrides.bookedEventInfo(bookedEventInfoEvent, this.nylasSchedulerConnector);\n }\n }\n\n /**\n * This is a custom event handler to update the selected date label.\n */\n @Listen('dateSelected')\n dateSelectedHandler(event: CustomEvent<Date>) {\n const date = event.detail;\n this.selectedDateLabel = date ? date.toLocaleDateString(undefined, { dateStyle: 'full' }) : `${i18next.t('noDateSelected')}`;\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * cancel booking button is clicked on the cancel booking form.\n */\n @Listen('cancelBookedEventError')\n cancelBookedEventErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n @Listen('cancelBookedEventValidationError')\n cancelBookedEventValidationErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * reschedule button is clicked on the booked event card.\n */\n @Listen('rescheduleBookedEventError')\n rescheduleBookedEventErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n /**\n * This is an event handler to handle the error (if any) when the\n * manual confirmation button is clicked on the manual confirmation card.\n */\n @Listen('confirmBookingError')\n confirmBookingErrorHandler(event: CustomEvent<NylasSchedulerErrorResponse>) {\n this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(event.detail.error) }, host: this.host });\n }\n\n /**\n * This method is used to retrieve the NylasScheduler instance\n * @returns The NylasScheduler instance\n */\n @Method()\n async getNylasSchedulerStore(): Promise<NylasSchedulerStoreType | undefined> {\n return this.baseProvider?.getStore('scheduler');\n }\n\n /**\n * This method is used to retrieve the NylasConnector instance\n * @returns The NylasConnector instance\n */\n @Method()\n async getNylasSchedulerConnector() {\n return this.nylasSchedulerConnector;\n }\n\n @Method()\n async getRef() {\n return this.host;\n }\n\n private getErrorObject(error: NylasSchedulerErrorResponse['error']): Notification {\n return {\n title: error?.title || genericError.title,\n category: error?.category || genericError.category,\n type: NotificationType.Error,\n description: error?.message || '',\n id: new Date().getTime().toString(),\n ttl: 'none',\n };\n }\n private checkIfSessionIdOrConfigIdExists(): boolean {\n if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {\n let description = '';\n\n if (!this.sessionId) {\n description += i18next.t('sessionIdRequiredErrorMessage');\n }\n\n if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {\n description = i18next.t('sessionIdRequiredErrorMessage') + ' ' + i18next.t('publicConfigErrorMessage');\n }\n\n this.nylasSchedulerError.emit({\n notification: {\n title: i18next.t('schedulingComponentErrorTitle'),\n category: ErrorCategory.Component,\n type: NotificationType.Error,\n description: description,\n id: new Date().getTime().toString(),\n ttl: 'none',\n },\n host: this.host,\n });\n return false;\n }\n return true;\n }\n\n private isTimeslotValid(timeslot: Timeslot): boolean {\n const selectedDate = new Date(timeslot.start_time);\n if (selectedDate < new Date()) {\n this.nylasSchedulerError.emit({\n notification: {\n title: i18next.t('invalidTimeslotErrorTitle'),\n category: ErrorCategory.Component,\n type: NotificationType.Error,\n description: i18next.t('invalidTimeslotErrorMessage'),\n id: new Date().getTime().toString(),\n ttl: 'none',\n },\n host: this.host,\n });\n return false;\n }\n return true;\n }\n\n private validateAvailableDaysInFuture(\n startDate: Date,\n availableDaysInFuture: number,\n ): {\n startTime: number;\n endTime: number;\n endTimeForAvailableDaysInFuture: number;\n } {\n const today = new Date();\n const startTime = new Date(startDate.getFullYear(), startDate.getMonth(), 1).getTime() / 1000;\n const endTimeForCurrentMonth = new Date(startDate.getFullYear(), startDate.getMonth() + 1, 1).getTime() / 1000;\n const endTimeForAvailableDaysInFuture = Math.floor(addDaysToCurrentDate(today, availableDaysInFuture).getTime() / 1000);\n const endTime = Math.min(endTimeForAvailableDaysInFuture, endTimeForCurrentMonth);\n const startTimeWithOffset = startTime < today.getTime() / 1000 ? Math.floor(today.getTime() / 1000) : startTime;\n return { startTime: startTimeWithOffset, endTime, endTimeForAvailableDaysInFuture };\n }\n\n private 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 /**\n * @slot timeslot-picker-cta-label - This slot is used to pass a custom label to the timeslot picker CTA. The default label is \"Next\".\n * @slot custom-booking-form - This slot is used to pass a custom booking form to the Nylas Scheduling component.\n * @deprecated Deprecated in favor of using the additional fields defined in the config settings.\n */\n render() {\n const showDefaultScheduler = this.mode === 'app';\n const nylasSchedulerStore = this.baseProvider?.getStore('scheduler');\n const eventInfo = nylasSchedulerStore?.get('eventInfo');\n const showBookingForm = nylasSchedulerStore?.get('showBookingForm');\n const cancelledEventInfo = nylasSchedulerStore?.get('cancelledEventInfo');\n const cancelBookingId = nylasSchedulerStore?.get('cancelBookingId');\n const selectedTimeslot = nylasSchedulerStore?.get('selectedTimeslot') as Timeslot;\n const rescheduleBookingId = nylasSchedulerStore?.get('rescheduleBookingId');\n const organizerConfirmationBookingId = nylasSchedulerStore?.get('organizerConfirmationBookingId');\n const rejectBookingId = nylasSchedulerStore?.get('rejectBookingId');\n const confirmedEventInfo = nylasSchedulerStore?.get('confirmedEventInfo');\n const nylasBranding = nylasSchedulerStore?.get('nylasBranding') || this.nylasBranding;\n const selectedDate = nylasSchedulerStore?.get('selectedDate');\n const redirectUrl = nylasSchedulerStore?.get('configSettings')?.scheduler?.confirmation_redirect_url;\n this.selectedDateLabel =\n selectedDate && this.language\n ? capitalizeFirstLetter(selectedDate.toLocaleDateString(LANGUAGE_CODE_MAP[this.language], { dateStyle: 'full' }))\n : `${i18next.t('noDateSelected')}`;\n\n if (showDefaultScheduler && (cancelBookingId || rejectBookingId) && !cancelledEventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancel-flow-page\" part=\"cancel-flow-page\">\n <nylas-cancel-booking-form\n selectedTimeslot={selectedTimeslot}\n cancelBookingId={cancelBookingId}\n rejectBookingId={rejectBookingId}\n exportparts=\"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Manual confirmation page is shown when the event is manually confirmed\n if (showDefaultScheduler && organizerConfirmationBookingId) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"manual-confirmation-page\" part=\"manual-confirmation-page\">\n <nylas-organizer-confirmation-card\n organizerConfirmationBookingId={organizerConfirmationBookingId}\n exportparts=\"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Cancelled event card is shown when the event is cancelled\n if (showDefaultScheduler && cancelledEventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancelled-event-page\" part=\"cancelled-event-page\">\n <nylas-cancelled-event-card\n cancelledEventInfo={cancelledEventInfo}\n exportparts=\"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Confirmed event card is shown when the event is confirmed\n if (showDefaultScheduler && confirmedEventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"cancelled-event-page\" part=\"confirmed-event-page\">\n <nylas-confirmed-event-card\n confirmedEventInfo={confirmedEventInfo}\n exportparts=\"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n // Redirected to custom URL when the event is booked and redirect URL is provided\n if (showDefaultScheduler && eventInfo && redirectUrl) {\n window.location.assign(redirectUrl);\n return;\n }\n\n // Booked event card is shown when the event is booked or booking is sent\n if (showDefaultScheduler && eventInfo) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n <div class=\"booked-event-page\" part=\"booked-event-page\">\n <nylas-booked-event-card\n selectedTimeslot={selectedTimeslot}\n eventInfo={eventInfo}\n exportparts=\"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta\"\n />\n </div>\n </SchedulerView>\n </Host>\n );\n }\n // Date and time picker is shown when the event is not booked and no additional data is shown\n if (showDefaultScheduler && (!eventInfo || !!rescheduleBookingId) && !showBookingForm) {\n const timeslotPickerCTALabel = this.host.querySelector('[slot=\"timeslot-picker-cta-label\"]');\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n {rescheduleBookingId && <MessageBanner>{`${i18next.t('rescheduleTitle')}`}</MessageBanner>}\n <div class=\"select-date-page\" part=\"select-date-page\">\n <div class=\"left-panel\">\n <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\"></nylas-date-picker>\n <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\"></nylas-locale-switch>\n </div>\n <div class={`right-panel ${rescheduleBookingId ? 'reschedule' : ''}`}>\n <h2>\n <calendar-icon></calendar-icon>\n <span id=\"selectedDate\">{this.selectedDateLabel}</span>\n </h2>\n <nylas-timeslot-picker exportparts=\"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary\">\n {timeslotPickerCTALabel && (\n <span slot=\"timeslot-picker-cta-label\">\n <slot name=\"timeslot-picker-cta-label\"></slot>\n </span>\n )}\n </nylas-timeslot-picker>\n </div>\n </div>\n </SchedulerView>\n </Host>\n );\n }\n // Additional data is shown when the time is selected, event is not booked and additional data is shown\n if (showDefaultScheduler && !eventInfo && showBookingForm) {\n return (\n <Host>\n <SchedulerView nylasBranding={nylasBranding} isLoading={this.isLoading} showNotification={this.showNotification}>\n {rescheduleBookingId && <MessageBanner>{`${i18next.t('rescheduleTitle')}`}</MessageBanner>}\n <div class=\"additional-data-page\" part=\"additional-data-page\">\n <div class=\"left-panel\">\n <div class=\"wrapper\">\n <nylas-selected-event-card exportparts=\"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone\"></nylas-selected-event-card>\n </div>\n </div>\n <div class={`right-panel ${rescheduleBookingId ? 'reschedule' : ''}`}>\n <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\"></nylas-booking-form>\n </div>\n </div>\n </SchedulerView>\n </Host>\n );\n }\n\n return (\n <Host>\n <slot />\n </Host>\n );\n }\n}\n"],"version":3}