@nylas/web-elements 1.4.2 → 1.4.4

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 (147) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +56 -27
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +4842 -4822
  3. package/dist/cjs/checkmark-icon_15.cjs.entry.js +3 -3
  4. package/dist/cjs/checkmark-icon_15.cjs.entry.js.map +1 -1
  5. package/dist/cjs/google-logo-icon_6.cjs.entry.js +4 -4
  6. package/dist/cjs/input-component.cjs.entry.js +13 -2
  7. package/dist/cjs/input-component.cjs.entry.js.map +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js +40 -11
  10. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js.map +1 -1
  11. package/dist/cjs/nylas-event-calendar_3.cjs.entry.js +53 -24
  12. package/dist/cjs/nylas-event-calendar_3.cjs.entry.js.map +1 -1
  13. package/dist/cjs/nylas-provider.cjs.entry.js +1 -1
  14. package/dist/cjs/nylas-scheduling.cjs.entry.js +3 -3
  15. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  16. package/dist/cjs/{scheduler-store-d6f5cff3.js → scheduler-store-5dcefe7e.js} +2 -2
  17. package/dist/cjs/{scheduler-store-d6f5cff3.js.map → scheduler-store-5dcefe7e.js.map} +1 -1
  18. package/dist/collection/components/design-system/input-component/input-component.js +13 -2
  19. package/dist/collection/components/design-system/input-component/input-component.js.map +1 -1
  20. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +40 -6
  21. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js.map +1 -1
  22. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js +8 -5
  23. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -1
  24. package/dist/collection/components/scheduler-editor/nylas-event-calendar/nylas-event-calendar.js +28 -17
  25. package/dist/collection/components/scheduler-editor/nylas-event-calendar/nylas-event-calendar.js.map +1 -1
  26. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.css +15 -0
  27. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.js +13 -2
  28. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.js.map +1 -1
  29. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.css +1 -1
  30. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.js +12 -4
  31. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.js.map +1 -1
  32. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js +3 -3
  33. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js.map +1 -1
  34. package/dist/components/index.es.js +1 -1
  35. package/dist/components/input-component2.js +13 -2
  36. package/dist/components/input-component2.js.map +1 -1
  37. package/dist/components/nylas-date-picker2.js +38 -8
  38. package/dist/components/nylas-date-picker2.js.map +1 -1
  39. package/dist/components/nylas-editor-tabs-group2.js +2 -2
  40. package/dist/components/nylas-editor-tabs2.js +2 -2
  41. package/dist/components/nylas-event-calendar2.js +29 -18
  42. package/dist/components/nylas-event-calendar2.js.map +1 -1
  43. package/dist/components/nylas-event-capacity2.js +14 -3
  44. package/dist/components/nylas-event-capacity2.js.map +1 -1
  45. package/dist/components/nylas-event-timeslot2.js +14 -6
  46. package/dist/components/nylas-event-timeslot2.js.map +1 -1
  47. package/dist/components/nylas-event-title2.js +3 -3
  48. package/dist/components/nylas-event-title2.js.map +1 -1
  49. package/dist/components/nylas-list-configurations2.js +1 -1
  50. package/dist/components/nylas-locale-switch2.js +1 -1
  51. package/dist/components/nylas-scheduler-editor.js +1 -1
  52. package/dist/components/nylas-scheduling.js +3 -3
  53. package/dist/components/nylas-timeslot-picker2.js +9 -6
  54. package/dist/components/nylas-timeslot-picker2.js.map +1 -1
  55. package/dist/components/scheduler-store.js +2 -2
  56. package/dist/components/utils.js +1 -1
  57. package/dist/esm/calendar-agenda-fill-icon_36.entry.js +2 -2
  58. package/dist/esm/checkmark-icon_15.entry.js +5 -5
  59. package/dist/esm/checkmark-icon_15.entry.js.map +1 -1
  60. package/dist/esm/{feedbackSync-aa8d23d1.js → feedbackSync-57bb471a.js} +2 -2
  61. package/dist/esm/{feedbackSync-aa8d23d1.js.map → feedbackSync-57bb471a.js.map} +1 -1
  62. package/dist/esm/globe-icon_2.entry.js +1 -1
  63. package/dist/esm/google-logo-icon_6.entry.js +7 -7
  64. package/dist/esm/{index.es-6d4b50d5.js → index.es-13ff6710.js} +2 -2
  65. package/dist/esm/{index.es-6d4b50d5.js.map → index.es-13ff6710.js.map} +1 -1
  66. package/dist/esm/index.js +2 -2
  67. package/dist/esm/input-component.entry.js +14 -3
  68. package/dist/esm/input-component.entry.js.map +1 -1
  69. package/dist/esm/input-dropdown_2.entry.js +1 -1
  70. package/dist/esm/loader.js +1 -1
  71. package/dist/esm/multi-select-dropdown_2.entry.js +1 -1
  72. package/dist/esm/{nylas-api-request-c5400df5.js → nylas-api-request-2e5f4c7f.js} +2 -2
  73. package/dist/esm/{nylas-api-request-c5400df5.js.map → nylas-api-request-2e5f4c7f.js.map} +1 -1
  74. package/dist/esm/nylas-booked-event-card_12.entry.js +42 -13
  75. package/dist/esm/nylas-booked-event-card_12.entry.js.map +1 -1
  76. package/dist/esm/nylas-event-calendar_3.entry.js +55 -26
  77. package/dist/esm/nylas-event-calendar_3.entry.js.map +1 -1
  78. package/dist/esm/nylas-form-card.entry.js +2 -2
  79. package/dist/esm/nylas-if-state.entry.js +2 -2
  80. package/dist/esm/nylas-login.entry.js +2 -2
  81. package/dist/esm/nylas-provider.entry.js +3 -3
  82. package/dist/esm/nylas-scheduler-editor.entry.js +3 -3
  83. package/dist/esm/nylas-scheduling.entry.js +6 -6
  84. package/dist/esm/nylas-web-elements.js +1 -1
  85. package/dist/esm/{register-component-238f28de.js → register-component-02a05665.js} +2 -2
  86. package/dist/esm/{register-component-238f28de.js.map → register-component-02a05665.js.map} +1 -1
  87. package/dist/esm/{scheduler-store-82bb212a.js → scheduler-store-fe9e85a4.js} +3 -3
  88. package/dist/esm/{scheduler-store-82bb212a.js.map → scheduler-store-fe9e85a4.js.map} +1 -1
  89. package/dist/esm/textarea-component.entry.js +1 -1
  90. package/dist/esm/{utils-7d962146.js → utils-e27d0e4b.js} +2 -2
  91. package/dist/esm/{utils-7d962146.js.map → utils-e27d0e4b.js.map} +1 -1
  92. package/dist/nylas-web-elements/index.esm.js +1 -1
  93. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  94. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
  95. package/dist/nylas-web-elements/{p-12bf5148.js → p-189b24e6.js} +2 -2
  96. package/dist/nylas-web-elements/p-1cbe8a56.entry.js +2 -0
  97. package/dist/nylas-web-elements/{p-d132fbaa.entry.js.map → p-1cbe8a56.entry.js.map} +1 -1
  98. package/dist/nylas-web-elements/{p-fdc35ad8.entry.js → p-23971057.entry.js} +2 -2
  99. package/dist/nylas-web-elements/{p-ba831977.entry.js → p-2dd05606.entry.js} +2 -2
  100. package/dist/nylas-web-elements/{p-797578de.js → p-388c456c.js} +2 -2
  101. package/dist/nylas-web-elements/{p-cf650f4f.js → p-3ea1c7c9.js} +2 -2
  102. package/dist/nylas-web-elements/{p-de9d8218.entry.js → p-5f683e34.entry.js} +2 -2
  103. package/dist/nylas-web-elements/{p-c2b6e0ca.entry.js → p-68ab7563.entry.js} +2 -2
  104. package/dist/nylas-web-elements/p-68ab7563.entry.js.map +1 -0
  105. package/dist/nylas-web-elements/{p-ec2c12a9.js → p-6b7fb948.js} +2 -2
  106. package/dist/nylas-web-elements/{p-cfd42146.js → p-7477410d.js} +2 -2
  107. package/dist/nylas-web-elements/{p-b62ef1be.js → p-7d9cdd23.js} +2 -2
  108. package/dist/nylas-web-elements/{p-00577fba.entry.js → p-8a7a6947.entry.js} +2 -2
  109. package/dist/nylas-web-elements/p-97f87422.entry.js +2 -0
  110. package/dist/nylas-web-elements/p-97f87422.entry.js.map +1 -0
  111. package/dist/nylas-web-elements/{p-9999c233.entry.js → p-aaf12216.entry.js} +2 -2
  112. package/dist/nylas-web-elements/{p-a452d4ea.entry.js → p-b55a87fa.entry.js} +2 -2
  113. package/dist/nylas-web-elements/p-b55a87fa.entry.js.map +1 -0
  114. package/dist/nylas-web-elements/{p-888d0c66.entry.js → p-c5f86111.entry.js} +2 -2
  115. package/dist/nylas-web-elements/{p-dd98c443.entry.js → p-cc6dbd73.entry.js} +2 -2
  116. package/dist/nylas-web-elements/{p-b59288fd.entry.js → p-d5a2cec8.entry.js} +2 -2
  117. package/dist/nylas-web-elements/{p-83216795.entry.js → p-deb33dfb.entry.js} +2 -2
  118. package/dist/nylas-web-elements/{p-83216795.entry.js.map → p-deb33dfb.entry.js.map} +1 -1
  119. package/dist/nylas-web-elements/{p-2531d4fa.entry.js → p-e2dc32d9.entry.js} +2 -2
  120. package/dist/nylas-web-elements/{p-a263330c.entry.js → p-eedabd6a.entry.js} +2 -2
  121. package/dist/nylas-web-elements/{p-355b34cb.entry.js → p-f57e68b1.entry.js} +2 -2
  122. package/dist/types/components/scheduler/nylas-date-picker/nylas-date-picker.d.ts +4 -0
  123. package/dist/types/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.d.ts +1 -0
  124. package/package.json +4 -5
  125. package/CHANGELOG.md +0 -878
  126. package/dist/nylas-web-elements/p-203beca4.entry.js +0 -2
  127. package/dist/nylas-web-elements/p-203beca4.entry.js.map +0 -1
  128. package/dist/nylas-web-elements/p-a452d4ea.entry.js.map +0 -1
  129. package/dist/nylas-web-elements/p-c2b6e0ca.entry.js.map +0 -1
  130. package/dist/nylas-web-elements/p-d132fbaa.entry.js +0 -2
  131. /package/dist/nylas-web-elements/{p-12bf5148.js.map → p-189b24e6.js.map} +0 -0
  132. /package/dist/nylas-web-elements/{p-fdc35ad8.entry.js.map → p-23971057.entry.js.map} +0 -0
  133. /package/dist/nylas-web-elements/{p-ba831977.entry.js.map → p-2dd05606.entry.js.map} +0 -0
  134. /package/dist/nylas-web-elements/{p-797578de.js.map → p-388c456c.js.map} +0 -0
  135. /package/dist/nylas-web-elements/{p-cf650f4f.js.map → p-3ea1c7c9.js.map} +0 -0
  136. /package/dist/nylas-web-elements/{p-de9d8218.entry.js.map → p-5f683e34.entry.js.map} +0 -0
  137. /package/dist/nylas-web-elements/{p-ec2c12a9.js.map → p-6b7fb948.js.map} +0 -0
  138. /package/dist/nylas-web-elements/{p-cfd42146.js.map → p-7477410d.js.map} +0 -0
  139. /package/dist/nylas-web-elements/{p-b62ef1be.js.map → p-7d9cdd23.js.map} +0 -0
  140. /package/dist/nylas-web-elements/{p-00577fba.entry.js.map → p-8a7a6947.entry.js.map} +0 -0
  141. /package/dist/nylas-web-elements/{p-9999c233.entry.js.map → p-aaf12216.entry.js.map} +0 -0
  142. /package/dist/nylas-web-elements/{p-888d0c66.entry.js.map → p-c5f86111.entry.js.map} +0 -0
  143. /package/dist/nylas-web-elements/{p-dd98c443.entry.js.map → p-cc6dbd73.entry.js.map} +0 -0
  144. /package/dist/nylas-web-elements/{p-b59288fd.entry.js.map → p-d5a2cec8.entry.js.map} +0 -0
  145. /package/dist/nylas-web-elements/{p-2531d4fa.entry.js.map → p-e2dc32d9.entry.js.map} +0 -0
  146. /package/dist/nylas-web-elements/{p-a263330c.entry.js.map → p-eedabd6a.entry.js.map} +0 -0
  147. /package/dist/nylas-web-elements/{p-355b34cb.entry.js.map → p-f57e68b1.entry.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"nylas-date-picker.js","sourceRoot":"","sources":["../../../../src/components/scheduler/nylas-date-picker/nylas-date-picker.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,O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wB,EAAE,wBAAiD,EAAE,EAAE;gBAClG,KAAK,CAAC,mBAAmB,EAAE,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAC3D,CAAC;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;6CAwGD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport {\n addDaysToCurrentDate,\n convertMinutesToHoursAndMinutes,\n getFirstDayOfMonth,\n getLastDayOfMonth,\n isSameDay,\n isSameDayTimezone,\n isSameMonth,\n translateMonth,\n} from '@/utils/utils';\nimport { Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { timeDay } from 'd3-time';\nimport { NylasSchedulerConnector } from '../../..';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { ConfigSettings } from '@/stores/scheduler-store';\nimport i18next from '@/utils/i18n';\nimport { debug } from '@/utils/utils';\nimport { ThemeConfig } from '@nylas/core';\n\n/**\n * The `nylas-date-picker` component is a UI component that allows users to select a date.\n *\n * @part ndp - The date picker host.\n * @part ndp__title - The title.\n * @part ndp__month-header - The month header.\n * @part ndp__month-button - The month button.\n * @part ndp__day - The day.\n * @part ndp__date - The date.\n * @part ndp__date--selected - The selected date.\n * @part ndp__date--current-day - The current day.\n * @part ndp__date--current-month - The dates in the current month.\n * @part ndp__date--disabled - The disabled dates.\n */\n@Component({\n tag: 'nylas-date-picker',\n styleUrl: 'nylas-date-picker.scss',\n shadow: true,\n})\nexport class NylasDatePicker {\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasDatePickerElement;\n\n /**\n * @standalone\n * The dates that are selectable.\n */\n @Prop() selectableDates?: Date[];\n\n /**\n * @standalone\n * The config settings.\n */\n @Prop() configSettings?: ConfigSettings;\n\n /**\n * @standalone\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: any;\n\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n /**\n * The selected date.\n */\n @Prop() selectedDate?: Date;\n\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: string;\n\n /**\n * The loading state.\n */\n @Prop() readonly isLoading?: boolean;\n\n /**\n * The event duration.\n */\n @Prop() readonly eventDuration?: number;\n\n /**\n * The month to display.\n */\n @State() month: Date = this.selectedDate || new Date();\n\n /**\n * The dates to render.\n */\n @State() dates: Date[] = this.getDates();\n\n /**\n * The state to disable the next month button.\n */\n @State() disableNextMonthButton: boolean = false;\n\n /**\n * This event is fired when a date is selected.\n */\n @Event() dateSelected!: EventEmitter<Date>;\n\n /**\n * This event is fired when the month is changed.\n */\n @Event() monthChanged!: EventEmitter<Date>;\n\n @Watch('configSettings')\n configSettingsChanged(newConfigSettings: ConfigSettings) {\n const nextMonth = new Date(this.month.getFullYear(), this.month.getMonth() + 1, 1);\n const availableDaysInFuture = newConfigSettings?.scheduler?.available_days_in_future;\n if (availableDaysInFuture === undefined) {\n return;\n }\n const endDate = addDaysToCurrentDate(new Date(), availableDaysInFuture);\n if (endDate.getTime() < nextMonth.getTime()) {\n this.disableNextMonthButton = true;\n } else {\n this.disableNextMonthButton = false;\n }\n }\n\n @Watch('selectedLanguage')\n selectedLanguageChanged(newLanguage: string) {\n i18next.changeLanguage(newLanguage);\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newThemeConfig: ThemeConfig) {\n this.applyThemeConfig(newThemeConfig);\n }\n\n @Watch('selectedDate')\n selectedDateChanged(newSelectedDate: Date) {\n if (!newSelectedDate || !isSameMonth(newSelectedDate, this.month)) {\n this.month = newSelectedDate || new Date();\n }\n this.dates = this.getDates();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n componentWillLoad() {}\n\n componentDidLoad() {\n debug(`[nylas-date-picker] Component did load`);\n this.applyThemeConfig(this.themeConfig);\n this.month = this.selectedDate || new Date();\n this.dates = this.getDates();\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n /**\n * Get the dates to render, including the days from the previous and next months.\n * @returns The dates to render.\n */\n private getDates() {\n const lastDayOfMonth = getLastDayOfMonth(this.month);\n const firstDayOfMonth = getFirstDayOfMonth(this.month);\n\n return timeDay.range(timeDay.offset(firstDayOfMonth, -firstDayOfMonth.getDay()), timeDay.offset(lastDayOfMonth, 7 - lastDayOfMonth.getDay()));\n }\n\n /**\n * Select a date.\n * @param date The date to select.\n */\n private selectDate(date?: Date) {\n this.dateSelected.emit(date);\n }\n\n /**\n * Change the month.\n * @param change The change in months.\n */\n private changeMonth(change: number) {\n this.month = new Date(this.month.getFullYear(), this.month.getMonth() + change, 1);\n const nextMonth = new Date(this.month.getFullYear(), this.month.getMonth() + 1, 1);\n const availableDaysInFuture = this.configSettings?.scheduler?.available_days_in_future;\n const endDate = addDaysToCurrentDate(new Date(), availableDaysInFuture);\n if (endDate.getTime() < nextMonth.getTime()) {\n this.disableNextMonthButton = true;\n } else {\n this.disableNextMonthButton = false;\n }\n this.dates = this.getDates();\n this.monthChanged.emit(this.month);\n }\n\n private isSelected(date: Date | undefined, selectedDate: Date | undefined, selectableDates: Date[] | undefined) {\n return date && selectedDate && isSameDay(date, selectedDate) && selectableDates && selectableDates?.length > 0;\n }\n\n private isDisabled(date: Date | undefined, selectableDates: Date[] | undefined) {\n return date && selectableDates?.find(d => isSameDayTimezone(d, date, this.selectedTimezone)) === undefined;\n }\n\n @RegisterComponent<NylasDatePicker, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-date-picker',\n stateToProps: new Map([\n ['scheduler.selectableDates', 'selectableDates'],\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.isLoading', 'isLoading'],\n ['scheduler.configSettings', 'configSettings'],\n ['scheduler.eventDuration', 'eventDuration'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.themeConfig', 'themeConfig'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ]),\n eventToProps: {\n dateSelected: async (event: CustomEvent<Date>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-date-picker', 'dateSelected', event.detail);\n nylasSchedulerConnector.scheduler.selectDate(event.detail);\n },\n monthChanged: async (event: CustomEvent<Date>, _nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-date-picker', 'monthChanged', event.detail);\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host part=\"ndp\">\n <div class=\"nylas-date-picker\">\n <div class=\"title\" part=\"ndp__title\">\n {this.configSettings?.name ? (\n <h1>{this.configSettings?.name}</h1>\n ) : (\n this.configSettings?.organizer?.name && (\n <h1>\n <person-icon />\n {this.configSettings?.organizer?.name || 'Organizer'}\n </h1>\n )\n )}\n <p>\n <clock-icon />\n {this.eventDuration ? convertMinutesToHoursAndMinutes(this.eventDuration) : `- ${i18next.t('time.minutes')}`}\n </p>\n </div>\n <div class={'header flex-row'}>\n <h2 part={'ndp__month-header'}>\n <strong>{translateMonth(this.month.toLocaleDateString('en-US', { month: 'long' }).toLowerCase())}</strong>\n &nbsp;\n {this.month.toLocaleDateString(undefined, { year: 'numeric' })}\n </h2>\n <div class={'pagination'}>\n <button\n title=\"Previous month\"\n onClick={() => this.changeMonth(-1)}\n class={{ 'chevron-left': true, 'button': true }}\n disabled={this.month <= new Date()}\n part=\"ndp__month-button\"\n >\n <chevron-icon />\n </button>\n <button\n title=\"Next month\"\n onClick={() => this.changeMonth(1)}\n class={{ 'chevron-right': true, 'button': true }}\n disabled={this.disableNextMonthButton}\n part=\"ndp__month-button\"\n >\n <chevron-icon />\n </button>\n </div>\n </div>\n\n <div class={'dates'}>\n {[\n i18next.t('days.sunday'),\n i18next.t('days.monday'),\n i18next.t('days.tuesday'),\n i18next.t('days.wednesday'),\n i18next.t('days.thursday'),\n i18next.t('days.friday'),\n i18next.t('days.saturday'),\n ].map(day => {\n return (\n <div class={'day'} part=\"ndp__day\">\n {day}\n </div>\n );\n })}\n {this.dates.map((date, i) => {\n const isDisabled = this.isDisabled(date, this.selectableDates);\n\n if (this.isLoading) {\n return (\n <button\n disabled\n class={{\n 'date day-skeleton': true,\n 'current-month': isSameMonth(date, this.month),\n }}\n style={{ animationDelay: `${i * 20}ms` }}\n part={`ndp__date ndp__date--disabled`}\n >\n {date.getDate()}\n </button>\n );\n }\n return (\n <button\n class={{\n 'date': true,\n 'selected': !!(this.selectedDate && isSameDay(date, this.selectedDate) && this.selectableDates && this.selectableDates?.length > 0),\n 'current-day': isSameDay(date, new Date()),\n 'current-month': isSameMonth(date, this.month),\n }}\n aria-label={date.toLocaleDateString(undefined, { dateStyle: 'full' })}\n disabled={isDisabled}\n onClick={() => this.selectDate(date)}\n part={`ndp__date ${this.isSelected(date, this.selectedDate, this.selectableDates) ? 'ndp__date--selected' : ''} ${isSameDay(date, new Date()) ? 'ndp__date--current-day' : ''} ${isSameMonth(date, this.month) ? 'ndp__date--current-month' : ''}`}\n >\n {date.getDate()}\n </button>\n );\n })}\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"nylas-date-picker.js","sourceRoot":"","sources":["../../../../src/components/scheduler/nylas-date-picker/nylas-date-picker.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACrK,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,OAAO,OAAO,MAAM,c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ertMinutesToHoursAndMinutes, getFirstDayOfMonth, getLastDayOfMonth, isSameDay, isSameMonth, translateMonth } from '@/utils/utils';\nimport { Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { timeDay } from 'd3-time';\nimport { NylasSchedulerConnector } from '../../..';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { ConfigSettings } from '@/stores/scheduler-store';\nimport i18next from '@/utils/i18n';\nimport { debug } from '@/utils/utils';\nimport { ThemeConfig } from '@nylas/core';\nimport dayjs from 'dayjs';\nimport timezone from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\n\n// Initialize dayjs plugins needed for timezone handling\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\n/**\n * The `nylas-date-picker` component is a UI component that allows users to select a date.\n *\n * @part ndp - The date picker host.\n * @part ndp__title - The title.\n * @part ndp__month-header - The month header.\n * @part ndp__month-button - The month button.\n * @part ndp__day - The day.\n * @part ndp__date - The date.\n * @part ndp__date--selected - The selected date.\n * @part ndp__date--current-day - The current day.\n * @part ndp__date--current-month - The dates in the current month.\n * @part ndp__date--disabled - The disabled dates.\n */\n@Component({\n tag: 'nylas-date-picker',\n styleUrl: 'nylas-date-picker.scss',\n shadow: true,\n})\nexport class NylasDatePicker {\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasDatePickerElement;\n\n /**\n * @standalone\n * The dates that are selectable.\n */\n @Prop() selectableDates?: Date[];\n\n /**\n * @standalone\n * The config settings.\n */\n @Prop() configSettings?: ConfigSettings;\n\n /**\n * @standalone\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: any;\n\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n /**\n * The selected date.\n */\n @Prop() selectedDate?: Date;\n\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: string;\n\n /**\n * The loading state.\n */\n @Prop() readonly isLoading?: boolean;\n\n /**\n * The event duration.\n */\n @Prop() readonly eventDuration?: number;\n\n /**\n * The month to display.\n */\n @State() month: Date = this.selectedDate || new Date();\n\n /**\n * The dates to render.\n */\n @State() dates: Date[] = this.getDates();\n\n /**\n * The state to disable the next month button.\n */\n @State() disableNextMonthButton: boolean = false;\n\n /**\n * The state to store the selected dates as per the timezone.\n */\n @State() selectableDatesTimezone: Date[] = [];\n\n /**\n * This event is fired when a date is selected.\n */\n @Event() dateSelected!: EventEmitter<Date>;\n\n /**\n * This event is fired when the month is changed.\n */\n @Event() monthChanged!: EventEmitter<Date>;\n\n @Watch('configSettings')\n configSettingsChanged(newConfigSettings: ConfigSettings) {\n const nextMonth = new Date(this.month.getFullYear(), this.month.getMonth() + 1, 1);\n const availableDaysInFuture = newConfigSettings?.scheduler?.available_days_in_future;\n if (availableDaysInFuture === undefined) {\n return;\n }\n const endDate = addDaysToCurrentDate(new Date(), availableDaysInFuture);\n if (endDate.getTime() < nextMonth.getTime()) {\n this.disableNextMonthButton = true;\n } else {\n this.disableNextMonthButton = false;\n }\n }\n\n @Watch('selectedLanguage')\n selectedLanguageChanged(newLanguage: string) {\n i18next.changeLanguage(newLanguage);\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newThemeConfig: ThemeConfig) {\n this.applyThemeConfig(newThemeConfig);\n }\n\n @Watch('selectedDate')\n selectedDateChanged(newSelectedDate: Date) {\n if (!newSelectedDate || !isSameMonth(newSelectedDate, this.month)) {\n this.month = newSelectedDate || new Date();\n }\n this.dates = this.getDates();\n }\n\n /**\n * Helper method to convert dates to the specified timezone, preserving only the date part\n */\n private convertDatesToTimezone(dates: Date[] | undefined, targetTimezone: string): Date[] {\n if (!dates || dates.length === 0) {\n return [];\n }\n\n return dates.map(d => {\n const tzDate = dayjs(d).tz(targetTimezone);\n return new Date(tzDate.year(), tzDate.month(), tzDate.date());\n });\n }\n\n @Watch('selectedTimezone')\n selectedTimezoneChanged(newSelectedTimezone: string) {\n this.selectableDatesTimezone = this.convertDatesToTimezone(this.selectableDates, newSelectedTimezone);\n }\n\n @Watch('selectableDates')\n selectableDatesChanged(newSelectableDates: Date[] | undefined) {\n this.selectableDatesTimezone = this.convertDatesToTimezone(newSelectableDates, this.selectedTimezone);\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n componentWillLoad() {}\n\n componentDidLoad() {\n debug(`[nylas-date-picker] Component did load`);\n this.applyThemeConfig(this.themeConfig);\n this.month = this.selectedDate || new Date();\n this.dates = this.getDates();\n this.selectableDatesTimezone = this.convertDatesToTimezone(this.selectableDates, this.selectedTimezone);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n /**\n * Get the dates to render, including the days from the previous and next months.\n * @returns The dates to render.\n */\n private getDates() {\n const lastDayOfMonth = getLastDayOfMonth(this.month);\n const firstDayOfMonth = getFirstDayOfMonth(this.month);\n\n return timeDay.range(timeDay.offset(firstDayOfMonth, -firstDayOfMonth.getDay()), timeDay.offset(lastDayOfMonth, 7 - lastDayOfMonth.getDay()));\n }\n\n /**\n * Select a date.\n * @param date The date to select.\n */\n private selectDate(date?: Date) {\n this.dateSelected.emit(date);\n }\n\n /**\n * Change the month.\n * @param change The change in months.\n */\n private changeMonth(change: number) {\n this.month = new Date(this.month.getFullYear(), this.month.getMonth() + change, 1);\n const nextMonth = new Date(this.month.getFullYear(), this.month.getMonth() + 1, 1);\n const availableDaysInFuture = this.configSettings?.scheduler?.available_days_in_future;\n const endDate = addDaysToCurrentDate(new Date(), availableDaysInFuture);\n if (endDate.getTime() < nextMonth.getTime()) {\n this.disableNextMonthButton = true;\n } else {\n this.disableNextMonthButton = false;\n }\n this.dates = this.getDates();\n this.monthChanged.emit(this.month);\n }\n\n private isSelected(date: Date | undefined, selectedDate: Date | undefined, selectableDates: Date[] | undefined) {\n return date && selectedDate && isSameDay(date, selectedDate) && selectableDates && selectableDates?.length > 0;\n }\n\n private isDisabled(date: Date | undefined) {\n if (!date || !this.selectableDatesTimezone || this.selectableDatesTimezone.length === 0) {\n return true;\n }\n\n // Compare only the date parts (year, month, day), ignoring time\n return !this.selectableDatesTimezone.some(d => {\n return date.getFullYear() === d.getFullYear() && date.getMonth() === d.getMonth() && date.getDate() === d.getDate();\n });\n }\n\n @RegisterComponent<NylasDatePicker, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-date-picker',\n stateToProps: new Map([\n ['scheduler.selectableDates', 'selectableDates'],\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.isLoading', 'isLoading'],\n ['scheduler.configSettings', 'configSettings'],\n ['scheduler.eventDuration', 'eventDuration'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.themeConfig', 'themeConfig'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ]),\n eventToProps: {\n dateSelected: async (event: CustomEvent<Date>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-date-picker', 'dateSelected', event.detail);\n nylasSchedulerConnector.scheduler.selectDate(event.detail);\n },\n monthChanged: async (event: CustomEvent<Date>, _nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-date-picker', 'monthChanged', event.detail);\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host part=\"ndp\">\n <div class=\"nylas-date-picker\">\n <div class=\"title\" part=\"ndp__title\">\n {this.configSettings?.name ? (\n <h1>{this.configSettings?.name}</h1>\n ) : (\n this.configSettings?.organizer?.name && (\n <h1>\n <person-icon />\n {this.configSettings?.organizer?.name || 'Organizer'}\n </h1>\n )\n )}\n <p>\n <clock-icon />\n {this.eventDuration ? convertMinutesToHoursAndMinutes(this.eventDuration) : `- ${i18next.t('time.minutes')}`}\n </p>\n </div>\n <div class={'header flex-row'}>\n <h2 part={'ndp__month-header'}>\n <strong>{translateMonth(this.month.toLocaleDateString('en-US', { month: 'long' }).toLowerCase())}</strong>\n &nbsp;\n {this.month.toLocaleDateString(undefined, { year: 'numeric' })}\n </h2>\n <div class={'pagination'}>\n <button\n title=\"Previous month\"\n onClick={() => this.changeMonth(-1)}\n class={{ 'chevron-left': true, 'button': true }}\n disabled={this.month <= new Date()}\n part=\"ndp__month-button\"\n >\n <chevron-icon />\n </button>\n <button\n title=\"Next month\"\n onClick={() => this.changeMonth(1)}\n class={{ 'chevron-right': true, 'button': true }}\n disabled={this.disableNextMonthButton}\n part=\"ndp__month-button\"\n >\n <chevron-icon />\n </button>\n </div>\n </div>\n\n <div class={'dates'}>\n {[\n i18next.t('days.sunday'),\n i18next.t('days.monday'),\n i18next.t('days.tuesday'),\n i18next.t('days.wednesday'),\n i18next.t('days.thursday'),\n i18next.t('days.friday'),\n i18next.t('days.saturday'),\n ].map(day => {\n return (\n <div class={'day'} part=\"ndp__day\">\n {day}\n </div>\n );\n })}\n {this.dates.map((date, i) => {\n const isDisabled = this.isDisabled(date);\n\n if (this.isLoading) {\n return (\n <button\n disabled\n class={{\n 'date day-skeleton': true,\n 'current-month': isSameMonth(date, this.month),\n }}\n style={{ animationDelay: `${i * 20}ms` }}\n part={`ndp__date ndp__date--disabled`}\n >\n {date.getDate()}\n </button>\n );\n }\n return (\n <button\n class={{\n 'date': true,\n 'selected': !!(this.selectedDate && isSameDay(date, this.selectedDate) && this.selectableDates && this.selectableDates?.length > 0),\n 'current-day': isSameDay(date, new Date()),\n 'current-month': isSameMonth(date, this.month),\n }}\n aria-label={date.toLocaleDateString(undefined, { dateStyle: 'full' })}\n disabled={isDisabled}\n onClick={() => this.selectDate(date)}\n part={`ndp__date ${this.isSelected(date, this.selectedDate, this.selectableDates) ? 'ndp__date--selected' : ''} ${isSameDay(date, new Date()) ? 'ndp__date--current-day' : ''} ${isSameMonth(date, this.month) ? 'ndp__date--current-month' : ''}`}\n >\n {date.getDate()}\n </button>\n );\n })}\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -89,12 +89,14 @@ export class NylasTimeslotPicker {
89
89
  }
90
90
  }
91
91
  }
92
- getTimeslotId(date, index) {
93
- return `${date.toLocaleDateString()}-${index}`;
92
+ getTimeslotId(timeslot, index) {
93
+ const date = new Date(timeslot.start_time);
94
+ const eventId = timeslot.event_id;
95
+ return `${date.toLocaleDateString()}-${index}${eventId ? `-${eventId}` : ''}`;
94
96
  }
95
97
  onClickSelectTime(timeslot, index) {
96
98
  debug(`[nylas-timeslot-picker] Time selected`, timeslot, index);
97
- this.selectedTimeslotIndex = this.getTimeslotId(timeslot.start_time, index);
99
+ this.selectedTimeslotIndex = this.getTimeslotId(timeslot, index);
98
100
  this.timeslotSelected.emit({
99
101
  start_time: timeslot.start_time,
100
102
  end_time: timeslot.end_time,
@@ -138,10 +140,11 @@ export class NylasTimeslotPicker {
138
140
  return h(Host, null);
139
141
  return (h(Host, { part: "ntp" }, h("div", { class: 'time-picker-wrapper', part: "ntp__time-picker-wrapper" }, h("div", { class: 'timeslots', part: "ntp__timeslots" }, filteredTimes.map((timeslot, index) => {
140
142
  const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;
143
+ const isSelected = this.selectedTimeslotIndex == this.getTimeslotId(timeslot, index);
141
144
  return (h("button", { part: `ntp__timeslot ${this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime() ? 'ntp__timeslot--selected' : ''}`, class: {
142
145
  time: true,
143
- selected: typeof this.selectedTimeslot !== 'undefined' && this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime(),
144
- }, onClick: () => this.onClickSelectTime(timeslot, index), onMouseEnter: () => this.handleMouseEnter(index), onMouseLeave: () => this.handleMouseLeave() }, h("div", { class: "time-label", part: "ntp__time-label" }, this.hoveredTimeslotIndex == index || this.selectedTimeslotIndex == this.getTimeslotId(timeslot.start_time, index)
146
+ selected: typeof this.selectedTimeslot !== 'undefined' && isSelected,
147
+ }, onClick: () => this.onClickSelectTime(timeslot, index), onMouseEnter: () => this.handleMouseEnter(index), onMouseLeave: () => this.handleMouseLeave() }, h("div", { class: "time-label", part: "ntp__time-label" }, this.hoveredTimeslotIndex == index || isSelected
145
148
  ? this.getTimeSlotLabel(timeslot)
146
149
  : timeslot.start_time.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', timeZone: this.selectedTimezone, hour12: this.hour12 }), h("span", { class: "spots" }, showCapacity ? `${timeslot?.capacity} spots left` : null))));
147
150
  })), this.selectedTimeslot && (h("div", { class: 'footer' }, h("button-component", { variant: 'primary', onClick: (event) => this.handleConfirmedTimeslot(event, this.selectedTimeslot), part: "ntp__button-primary" }, h("slot", { name: "timeslot-picker-cta-label" }, i18next.t('nextButton'))))))));
@@ -1 +1 @@
1
- {"version":3,"file":"nylas-timeslot-picker.js","sourceRoot":"","sources":["../../../../src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAK7G,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAkBjE,MAAM,OAAO,mBAAmB;;QAsItB,4BAAuB,GAAG,KAAK,EAAE,KAAY,EAAE,QAA8B,EAAE,EAAE;YACvF,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;YAC5D,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAA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,MAAM,GAAG,MAAM,uBAAuB,CAAC,SAAS,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;oBAC5F,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;wBAChC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,iDAAiD,CAAC;wBAChG,IAAI,YAAY,KAAK,eAAe,EAAE,CAAC;4BACrC,IAAI,CAAC,yBAAyB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;wBACvD,CAAC;6BAAM,CAAC;4BACN,IAAI,CAAC,yBAAyB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;wBACxD,CAAC;oBACH,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,uBAAuB,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;gBAC/D,CAAC;YACH,CAAC;YACD,qBAAqB,EAAE,KAAK,EAAE,KAAqC,EAAE,wBAAiD,EAAE,EAAE;gBACxH,KAAK,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACxE,CAAC;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iDAgFD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { debug, isSameDayTimezone } from '@/utils/utils';\nimport { Component, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerConnector } from '../../..';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { AvailabilityTimeslot } from '@/stores/scheduler-store';\nimport type { ThemeConfig, Timeslot } from '@nylas/core';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE_TO_LOCALE_MAP } from '@/common/constants';\n\n/**\n * The `nylas-timeslot-picker` component is a UI component that allows users to select a timeslot from a list of available timeslots.\n *\n * @slot timeslot-picker-cta-label - The label for the timeslot picker CTA. Default is \"Next\".\n * @part ntp - The timeslot picker component.\n * @part ntp__timeslot - The timeslot button.\n * @part ntp__timeslot--selected - The selected timeslot button.\n * @part ntp__button-primary - The timeslot picker CTA.\n * @part ntp__time-picker-wrapper - The timeslot picker wrapper.\n * @part ntp__timeslots - The timeslot picker timeslots.\n */\n@Component({\n tag: 'nylas-timeslot-picker',\n styleUrl: 'nylas-timeslot-picker.scss',\n shadow: true,\n})\nexport class NylasTimeslotPicker {\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasTimeslotPickerElement;\n /**\n * @standalone\n * The available timeslots.\n */\n @Prop({ attribute: 'availability' }) readonly availability?: AvailabilityTimeslot[];\n /**\n * @standalone\n * The loading state prop. Used to display loading state when fetching availability.\n */\n @Prop({ attribute: 'loading-state' }) readonly isLoading?: boolean;\n /**\n * @standalone\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: any;\n /**\n * The selected timeslot.\n */\n @Prop({ attribute: 'selected-timeslot' }) readonly selectedTimeslot?: Timeslot;\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n /**\n * The selected date.\n */\n @Prop({ attribute: 'selected-date' }) readonly selectedDate?: Date = new Date();\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: string;\n /**\n * The 12-hour time format.\n */\n @Prop() hour12?: boolean;\n\n /**\n * This event is fired when a timeslot is selected.\n */\n @Event() readonly timeslotSelected!: EventEmitter<Timeslot>;\n /**\n * This event is fired when a timeslot is confirmed. By default, this will proceed to the booking form page.\n */\n @Event() readonly timeslotConfirmed!: EventEmitter<{ timeslot: Timeslot; host: HTMLNylasTimeslotPickerElement }>;\n\n @Event() readonly validateTimeslotError!: EventEmitter<{ error: string; type: 'error' | 'info' }>;\n\n @State() times: AvailabilityTimeslot[] = [];\n @State() hoveredTimeslotIndex?: number;\n @State() selectedTimeslotIndex?: string;\n\n @Watch('selectedLanguage')\n selectedLanguageChanged(newLanguage: string) {\n i18next.changeLanguage(newLanguage);\n }\n\n @Watch('selectedDate')\n selectedDateChanged(newVal: Date | null | undefined) {\n debug(`[nylas-timeslot-picker] Selected date changed`, { newVal });\n\n if (newVal) {\n this.selectedTimeslotIndex = '';\n if (typeof newVal !== 'undefined') {\n const availableTimes = this.availability?.filter(timeslot => isSameDayTimezone(timeslot.start_time, newVal, this.selectedTimezone)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n }\n\n @Watch('availability')\n availabilityChanged(newVal: AvailabilityTimeslot[] | undefined) {\n debug(`[nylas-timeslot-picker] Available times changed`, { newVal, selectedDate: this.selectedDate });\n if (typeof newVal !== 'undefined') {\n const availableTimes = newVal\n ?.filter(timeslot => this.selectedDate && isSameDayTimezone(timeslot.start_time, this.selectedDate, this.selectedTimezone))\n .map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newThemeConfig: ThemeConfig) {\n this.applyThemeConfig(newThemeConfig);\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n debug(`[nylas-timeslot-picker] Component will load`, { selectedDate: this.selectedDate, availability: this.availability, times: this.times });\n }\n\n async componentDidLoad() {\n debug(`[nylas-timeslot-picker] Component did load`);\n const availableTimes = this.availability\n ?.filter(timeslot => this.selectedDate && isSameDayTimezone(timeslot.start_time, this.selectedDate, this.selectedTimezone))\n .map(timeslot => timeslot);\n this.times = availableTimes || [];\n this.applyThemeConfig(this.themeConfig);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n private getTimeslotId(date: Date, index: number) {\n return `${date.toLocaleDateString()}-${index}`;\n }\n\n private onClickSelectTime(timeslot: Timeslot, index: number) {\n debug(`[nylas-timeslot-picker] Time selected`, timeslot, index);\n this.selectedTimeslotIndex = this.getTimeslotId(timeslot.start_time, index);\n this.timeslotSelected.emit({\n start_time: timeslot.start_time,\n end_time: timeslot.end_time,\n emails: timeslot.emails,\n capacity: timeslot?.capacity,\n event_id: timeslot?.event_id,\n master_id: timeslot?.master_id,\n calendar_id: timeslot?.calendar_id,\n });\n }\n\n private handleConfirmedTimeslot = async (event: Event, timeslot: Timeslot | undefined) => {\n event.preventDefault();\n debug(`[nylas-timeslot-picker] Confirm timeslot`, timeslot);\n if (timeslot) {\n this.timeslotConfirmed.emit({ timeslot, host: this.host });\n }\n };\n\n @Method()\n async emitValidateTimeslotError(error: string, type: 'error' | 'info') {\n this.validateTimeslotError.emit({ error, type });\n }\n\n private handleMouseEnter = (index: number) => {\n this.hoveredTimeslotIndex = index;\n };\n\n private handleMouseLeave = () => {\n this.hoveredTimeslotIndex = -1;\n };\n\n private getTimeSlotLabel(timeslot: Timeslot) {\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n const timeFormat = new Intl.DateTimeFormat(locale, {\n hour: '2-digit',\n minute: '2-digit',\n timeZone: this.selectedTimezone,\n hour12: this.hour12,\n });\n return `${timeFormat.format(timeslot.start_time)} - ${timeFormat.format(timeslot.end_time)}`;\n }\n\n @RegisterComponent<NylasTimeslotPicker, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-timeslot-picker',\n stateToProps: new Map([\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.availability', 'availability'],\n ['scheduler.selectedTimeslot', 'selectedTimeslot'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.isLoading', 'isLoading'],\n ['scheduler.themeConfig', 'themeConfig'],\n ['scheduler.hour12', 'hour12'],\n ]),\n eventToProps: {\n timeslotSelected: async (event: CustomEvent<Timeslot>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotSelected', event.detail);\n nylasSchedulerConnector.scheduler.selectTime(event.detail);\n },\n timeslotConfirmed: async (event: CustomEvent<{ timeslot: Timeslot; host: HTMLNylasTimeslotPickerElement }>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotConfirmed', event.detail);\n const { timeslot, host } = event.detail;\n if (timeslot && timeslot?.event_id && timeslot?.capacity) {\n const result = await nylasSchedulerConnector.scheduler.validateGroupEventTimeslot(timeslot);\n if (result && 'error' in result) {\n const errorMessage = result.error?.message || 'An error occurred while validating the timeslot';\n if (errorMessage === 'Event is full') {\n host.emitValidateTimeslotError(errorMessage, 'info');\n } else {\n host.emitValidateTimeslotError(errorMessage, 'error');\n }\n }\n } else {\n nylasSchedulerConnector.scheduler.toggleAdditionalData(true);\n }\n },\n validateTimeslotError: async (event: CustomEvent<{ error: string }>, _nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'validateTimeslotError', event.detail);\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n if (this.isLoading) {\n return (\n <Host>\n <div class={'loading'}>\n {new Array(6).fill(0).map((_, i) => (\n <div class={'timeslot-skeleton'} style={{ animationDelay: `${i * 20}ms` }} />\n ))}\n </div>\n </Host>\n );\n }\n\n if (this.availability && this.availability.length === 0) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No dates available</span>\n </div>\n </Host>\n );\n }\n\n const filteredTimes = this.times.filter(timeslot => {\n const groupEvent = timeslot?.event_id || timeslot?.master_id;\n const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;\n return !(groupEvent && !showCapacity);\n });\n\n if ((!this.times || this.times.length === 0 || filteredTimes.length === 0) && !!this.selectedDate) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No time slots available for selected date</span>\n </div>\n </Host>\n );\n }\n\n if (!this.selectedDate) return <Host></Host>;\n\n return (\n <Host part=\"ntp\">\n <div class={'time-picker-wrapper'} part=\"ntp__time-picker-wrapper\">\n <div class={'timeslots'} part=\"ntp__timeslots\">\n {filteredTimes.map((timeslot, index) => {\n const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;\n return (\n <button\n part={`ntp__timeslot ${this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime() ? 'ntp__timeslot--selected' : ''}`}\n class={{\n time: true,\n selected: typeof this.selectedTimeslot !== 'undefined' && this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime(),\n }}\n onClick={() => this.onClickSelectTime(timeslot, index)}\n onMouseEnter={() => this.handleMouseEnter(index)}\n onMouseLeave={() => this.handleMouseLeave()}\n >\n <div class=\"time-label\" part=\"ntp__time-label\">\n {this.hoveredTimeslotIndex == index || this.selectedTimeslotIndex == this.getTimeslotId(timeslot.start_time, index)\n ? this.getTimeSlotLabel(timeslot)\n : timeslot.start_time.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', timeZone: this.selectedTimezone, hour12: this.hour12 })}\n <span class=\"spots\">{showCapacity ? `${timeslot?.capacity} spots left` : null}</span>\n </div>\n </button>\n );\n })}\n </div>\n {this.selectedTimeslot && (\n <div class={'footer'}>\n <button-component variant={'primary'} onClick={(event: Event) => this.handleConfirmedTimeslot(event, this.selectedTimeslot)} part=\"ntp__button-primary\">\n <slot name=\"timeslot-picker-cta-label\">{i18next.t('nextButton')}</slot>\n </button-component>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"nylas-timeslot-picker.js","sourceRoot":"","sources":["../../../../src/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAA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KAAK,CAAC,MAAM,CAAC,CAAC;YACxE,CAAC;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iDAiFD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { debug, isSameDayTimezone } from '@/utils/utils';\nimport { Component, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerConnector } from '../../..';\nimport { NylasScheduling } from '../nylas-scheduling/nylas-scheduling';\nimport { AvailabilityTimeslot } from '@/stores/scheduler-store';\nimport type { ThemeConfig, Timeslot } from '@nylas/core';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE_TO_LOCALE_MAP } from '@/common/constants';\n\n/**\n * The `nylas-timeslot-picker` component is a UI component that allows users to select a timeslot from a list of available timeslots.\n *\n * @slot timeslot-picker-cta-label - The label for the timeslot picker CTA. Default is \"Next\".\n * @part ntp - The timeslot picker component.\n * @part ntp__timeslot - The timeslot button.\n * @part ntp__timeslot--selected - The selected timeslot button.\n * @part ntp__button-primary - The timeslot picker CTA.\n * @part ntp__time-picker-wrapper - The timeslot picker wrapper.\n * @part ntp__timeslots - The timeslot picker timeslots.\n */\n@Component({\n tag: 'nylas-timeslot-picker',\n styleUrl: 'nylas-timeslot-picker.scss',\n shadow: true,\n})\nexport class NylasTimeslotPicker {\n /**\n * The host element.\n * Used to manage the host element of the provider.\n */\n @Element() private host!: HTMLNylasTimeslotPickerElement;\n /**\n * @standalone\n * The available timeslots.\n */\n @Prop({ attribute: 'availability' }) readonly availability?: AvailabilityTimeslot[];\n /**\n * @standalone\n * The loading state prop. Used to display loading state when fetching availability.\n */\n @Prop({ attribute: 'loading-state' }) readonly isLoading?: boolean;\n /**\n * @standalone\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: any;\n /**\n * The selected timeslot.\n */\n @Prop({ attribute: 'selected-timeslot' }) readonly selectedTimeslot?: Timeslot;\n /**\n * The selected timezone.\n */\n @Prop({ attribute: 'selected-timezone' }) readonly selectedTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n /**\n * The selected date.\n */\n @Prop({ attribute: 'selected-date' }) readonly selectedDate?: Date = new Date();\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: string;\n /**\n * The 12-hour time format.\n */\n @Prop() hour12?: boolean;\n\n /**\n * This event is fired when a timeslot is selected.\n */\n @Event() readonly timeslotSelected!: EventEmitter<Timeslot>;\n /**\n * This event is fired when a timeslot is confirmed. By default, this will proceed to the booking form page.\n */\n @Event() readonly timeslotConfirmed!: EventEmitter<{ timeslot: Timeslot; host: HTMLNylasTimeslotPickerElement }>;\n\n @Event() readonly validateTimeslotError!: EventEmitter<{ error: string; type: 'error' | 'info' }>;\n\n @State() times: AvailabilityTimeslot[] = [];\n @State() hoveredTimeslotIndex?: number;\n @State() selectedTimeslotIndex?: string;\n\n @Watch('selectedLanguage')\n selectedLanguageChanged(newLanguage: string) {\n i18next.changeLanguage(newLanguage);\n }\n\n @Watch('selectedDate')\n selectedDateChanged(newVal: Date | null | undefined) {\n debug(`[nylas-timeslot-picker] Selected date changed`, { newVal });\n\n if (newVal) {\n this.selectedTimeslotIndex = '';\n if (typeof newVal !== 'undefined') {\n const availableTimes = this.availability?.filter(timeslot => isSameDayTimezone(timeslot.start_time, newVal, this.selectedTimezone)).map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n }\n\n @Watch('availability')\n availabilityChanged(newVal: AvailabilityTimeslot[] | undefined) {\n debug(`[nylas-timeslot-picker] Available times changed`, { newVal, selectedDate: this.selectedDate });\n if (typeof newVal !== 'undefined') {\n const availableTimes = newVal\n ?.filter(timeslot => this.selectedDate && isSameDayTimezone(timeslot.start_time, this.selectedDate, this.selectedTimezone))\n .map(timeslot => timeslot);\n this.times = availableTimes || [];\n }\n }\n\n @Watch('themeConfig')\n themeConfigChanged(newThemeConfig: ThemeConfig) {\n this.applyThemeConfig(newThemeConfig);\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n debug(`[nylas-timeslot-picker] Component will load`, { selectedDate: this.selectedDate, availability: this.availability, times: this.times });\n }\n\n async componentDidLoad() {\n debug(`[nylas-timeslot-picker] Component did load`);\n const availableTimes = this.availability\n ?.filter(timeslot => this.selectedDate && isSameDayTimezone(timeslot.start_time, this.selectedDate, this.selectedTimezone))\n .map(timeslot => timeslot);\n this.times = availableTimes || [];\n this.applyThemeConfig(this.themeConfig);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.host.style.setProperty(`${key}`, value);\n }\n }\n }\n\n private getTimeslotId(timeslot: Timeslot, index: number) {\n const date = new Date(timeslot.start_time);\n const eventId = timeslot.event_id;\n return `${date.toLocaleDateString()}-${index}${eventId ? `-${eventId}` : ''}`;\n }\n\n private onClickSelectTime(timeslot: Timeslot, index: number) {\n debug(`[nylas-timeslot-picker] Time selected`, timeslot, index);\n this.selectedTimeslotIndex = this.getTimeslotId(timeslot, index);\n this.timeslotSelected.emit({\n start_time: timeslot.start_time,\n end_time: timeslot.end_time,\n emails: timeslot.emails,\n capacity: timeslot?.capacity,\n event_id: timeslot?.event_id,\n master_id: timeslot?.master_id,\n calendar_id: timeslot?.calendar_id,\n });\n }\n\n private handleConfirmedTimeslot = async (event: Event, timeslot: Timeslot | undefined) => {\n event.preventDefault();\n debug(`[nylas-timeslot-picker] Confirm timeslot`, timeslot);\n if (timeslot) {\n this.timeslotConfirmed.emit({ timeslot, host: this.host });\n }\n };\n\n @Method()\n async emitValidateTimeslotError(error: string, type: 'error' | 'info') {\n this.validateTimeslotError.emit({ error, type });\n }\n\n private handleMouseEnter = (index: number) => {\n this.hoveredTimeslotIndex = index;\n };\n\n private handleMouseLeave = () => {\n this.hoveredTimeslotIndex = -1;\n };\n\n private getTimeSlotLabel(timeslot: Timeslot) {\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n const timeFormat = new Intl.DateTimeFormat(locale, {\n hour: '2-digit',\n minute: '2-digit',\n timeZone: this.selectedTimezone,\n hour12: this.hour12,\n });\n return `${timeFormat.format(timeslot.start_time)} - ${timeFormat.format(timeslot.end_time)}`;\n }\n\n @RegisterComponent<NylasTimeslotPicker, NylasSchedulerConnector, Exclude<NylasScheduling['stores'], undefined>>({\n name: 'nylas-timeslot-picker',\n stateToProps: new Map([\n ['scheduler.selectedDate', 'selectedDate'],\n ['scheduler.availability', 'availability'],\n ['scheduler.selectedTimeslot', 'selectedTimeslot'],\n ['scheduler.selectedTimezone', 'selectedTimezone'],\n ['scheduler.selectedLanguage', 'selectedLanguage'],\n ['scheduler.isLoading', 'isLoading'],\n ['scheduler.themeConfig', 'themeConfig'],\n ['scheduler.hour12', 'hour12'],\n ]),\n eventToProps: {\n timeslotSelected: async (event: CustomEvent<Timeslot>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotSelected', event.detail);\n nylasSchedulerConnector.scheduler.selectTime(event.detail);\n },\n timeslotConfirmed: async (event: CustomEvent<{ timeslot: Timeslot; host: HTMLNylasTimeslotPickerElement }>, nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'timeslotConfirmed', event.detail);\n const { timeslot, host } = event.detail;\n if (timeslot && timeslot?.event_id && timeslot?.capacity) {\n const result = await nylasSchedulerConnector.scheduler.validateGroupEventTimeslot(timeslot);\n if (result && 'error' in result) {\n const errorMessage = result.error?.message || 'An error occurred while validating the timeslot';\n if (errorMessage === 'Event is full') {\n host.emitValidateTimeslotError(errorMessage, 'info');\n } else {\n host.emitValidateTimeslotError(errorMessage, 'error');\n }\n }\n } else {\n nylasSchedulerConnector.scheduler.toggleAdditionalData(true);\n }\n },\n validateTimeslotError: async (event: CustomEvent<{ error: string }>, _nylasSchedulerConnector: NylasSchedulerConnector) => {\n debug('nylas-timeslot-picker', 'validateTimeslotError', event.detail);\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const locale = LANGUAGE_CODE_TO_LOCALE_MAP[this.selectedLanguage || 'en'];\n if (this.isLoading) {\n return (\n <Host>\n <div class={'loading'}>\n {new Array(6).fill(0).map((_, i) => (\n <div class={'timeslot-skeleton'} style={{ animationDelay: `${i * 20}ms` }} />\n ))}\n </div>\n </Host>\n );\n }\n\n if (this.availability && this.availability.length === 0) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No dates available</span>\n </div>\n </Host>\n );\n }\n\n const filteredTimes = this.times.filter(timeslot => {\n const groupEvent = timeslot?.event_id || timeslot?.master_id;\n const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;\n return !(groupEvent && !showCapacity);\n });\n\n if ((!this.times || this.times.length === 0 || filteredTimes.length === 0) && !!this.selectedDate) {\n return (\n <Host>\n <div class={'empty'}>\n <span>No time slots available for selected date</span>\n </div>\n </Host>\n );\n }\n\n if (!this.selectedDate) return <Host></Host>;\n\n return (\n <Host part=\"ntp\">\n <div class={'time-picker-wrapper'} part=\"ntp__time-picker-wrapper\">\n <div class={'timeslots'} part=\"ntp__timeslots\">\n {filteredTimes.map((timeslot, index) => {\n const showCapacity = typeof timeslot?.capacity === 'number' && timeslot?.capacity > 0;\n const isSelected = this.selectedTimeslotIndex == this.getTimeslotId(timeslot, index);\n return (\n <button\n part={`ntp__timeslot ${this.selectedTimeslot?.start_time?.getTime() === timeslot.start_time.getTime() ? 'ntp__timeslot--selected' : ''}`}\n class={{\n time: true,\n selected: typeof this.selectedTimeslot !== 'undefined' && isSelected,\n }}\n onClick={() => this.onClickSelectTime(timeslot, index)}\n onMouseEnter={() => this.handleMouseEnter(index)}\n onMouseLeave={() => this.handleMouseLeave()}\n >\n <div class=\"time-label\" part=\"ntp__time-label\">\n {this.hoveredTimeslotIndex == index || isSelected\n ? this.getTimeSlotLabel(timeslot)\n : timeslot.start_time.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', timeZone: this.selectedTimezone, hour12: this.hour12 })}\n <span class=\"spots\">{showCapacity ? `${timeslot?.capacity} spots left` : null}</span>\n </div>\n </button>\n );\n })}\n </div>\n {this.selectedTimeslot && (\n <div class={'footer'}>\n <button-component variant={'primary'} onClick={(event: Event) => this.handleConfirmedTimeslot(event, this.selectedTimeslot)} part=\"ntp__button-primary\">\n <slot name=\"timeslot-picker-cta-label\">{i18next.t('nextButton')}</slot>\n </button-component>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -375,6 +375,17 @@ export class NylasEventCalendar {
375
375
  this.selectedEvent.group_event_info.rrule = recurrence;
376
376
  }
377
377
  }
378
+ if (name === 'event-capacity') {
379
+ const parsedValue = parseInt(value);
380
+ if (parsedValue < 1 || parsedValue > 500 || isNaN(parsedValue)) {
381
+ this.formError = i18next.t('fixFormErrors');
382
+ this.internals.setValidity({ customError: true }, this.formError);
383
+ }
384
+ else {
385
+ this.formError = '';
386
+ this.internals.setValidity({ customError: false }, '');
387
+ }
388
+ }
378
389
  }
379
390
  timeWindowFormErrorHandler(event) {
380
391
  if (event.detail.key === 'event-timeslot') {
@@ -408,21 +419,7 @@ export class NylasEventCalendar {
408
419
  e.preventDefault();
409
420
  e.stopImmediatePropagation();
410
421
  this.showEditOptions = false;
411
- } }, h("close-icon", null))), h("div", { class: "edit-options__content action-options__content" }, h("ul", { tabindex: "-1", role: "listbox", "aria-label": this.name }, this.editOptions.map(option => option.value.toString() ? (h("li", { class: { disabled: !!this.isLoading }, tabindex: "0", key: option.value, id: option.value, onClick: e => this.handleEditOptionSelected(e, option), role: "option" }, this.isLoading && this.loadingOptions.delete === option.value ? `Deleting...` : option.label)) : null)))))), this.showConfirmDiscardUnsavedChangesModal && (h("div", { class: "discard-changes action-options", onClick: () => (this.showUpdateOptions = false) }, h("div", { class: "discard-changes__card action-options__card" }, h("button-component", { tooltip: "Close", id: "close-discard-changes", variant: 'invisible', disabled: this.isLoading, onClick: e => {
412
- e.preventDefault();
413
- e.stopImmediatePropagation();
414
- this.showConfirmDiscardUnsavedChangesModal = false;
415
- } }, h("close-icon", null)), h("div", { class: "discard-changes__content action-options__content" }, h("h3", { slot: "card-title", part: "nfbf__title" }, "Discard unsaved changes?")), h("div", { class: "discard-changes__footer action-options__footer" }, h("button-component", { variant: 'basic', onClick: _e => (this.showConfirmDiscardUnsavedChangesModal = false), part: "nfbf__button-outline nfbf__cancel-cta" }, `${i18next.t('deleteSchedulingPageCancelButton')}`), h("button-component", { variant: 'destructive', onClick: e => {
416
- e.preventDefault();
417
- e.stopImmediatePropagation();
418
- this.showConfirmDiscardUnsavedChangesModal = false;
419
- this.unsavedChanges = false;
420
- this.showEditEventDetails = false;
421
- this.showCreateEventDetails = false;
422
- this.selectedEvent = null;
423
- this.createNewGroupEventTimeslot = null;
424
- this.formError = '';
425
- }, part: "nfbf__button-outline nfbf__reschedule-cta" }, "Discard"))))), this.showUpdateOptions && (h("div", { class: "update-options action-options", onClick: () => (this.showUpdateOptions = false) }, h("div", { class: "update-options__card action-options__card" }, h("button-component", { tooltip: "Close", id: "close-update-options", variant: 'invisible', disabled: this.isLoading, onClick: e => {
422
+ } }, h("close-icon", null))), h("div", { class: "edit-options__content action-options__content" }, h("ul", { tabindex: "-1", role: "listbox", "aria-label": this.name }, this.editOptions.map(option => option.value.toString() ? (h("li", { class: { disabled: !!this.isLoading }, tabindex: "0", key: option.value, id: option.value, onClick: e => this.handleEditOptionSelected(e, option), role: "option" }, this.isLoading && this.loadingOptions.delete === option.value ? `Deleting...` : option.label)) : null)))))), this.showUpdateOptions && (h("div", { class: "update-options action-options", onClick: () => (this.showUpdateOptions = false) }, h("div", { class: "update-options__card action-options__card" }, h("button-component", { tooltip: "Close", id: "close-update-options", variant: 'invisible', disabled: this.isLoading, onClick: e => {
426
423
  e.preventDefault();
427
424
  e.stopImmediatePropagation();
428
425
  this.showUpdateOptions = false;
@@ -498,9 +495,23 @@ export class NylasEventCalendar {
498
495
  this.selectedEvent = null;
499
496
  this.unsavedChanges = false;
500
497
  }
501
- } }, "Cancel"), h("button-component", { variant: 'primary', disabled: this.isLoading, isLoading: this.isLoading, onClick: e => {
498
+ } }, "Cancel"), h("button-component", { variant: 'primary', disabled: this.isLoading || this.formError !== '', isLoading: this.isLoading, onClick: e => {
502
499
  this.handleCreateGroupEvent(e);
503
- } }, "Create")))))))));
500
+ } }, "Create")))))), this.showConfirmDiscardUnsavedChangesModal && (h("div", { class: "discard-changes action-options", onClick: () => (this.showUpdateOptions = false) }, h("div", { class: "discard-changes__card action-options__card" }, h("button-component", { tooltip: "Close", id: "close-discard-changes", variant: 'invisible', disabled: this.isLoading, onClick: e => {
501
+ e.preventDefault();
502
+ e.stopImmediatePropagation();
503
+ this.showConfirmDiscardUnsavedChangesModal = false;
504
+ } }, h("close-icon", null)), h("div", { class: "discard-changes__content action-options__content" }, h("h3", { slot: "card-title", part: "nfbf__title" }, "Discard unsaved changes?")), h("div", { class: "discard-changes__footer action-options__footer" }, h("button-component", { variant: 'basic', onClick: _e => (this.showConfirmDiscardUnsavedChangesModal = false), part: "nfbf__button-outline nfbf__cancel-cta" }, `${i18next.t('deleteSchedulingPageCancelButton')}`), h("button-component", { variant: 'destructive', onClick: e => {
505
+ e.preventDefault();
506
+ e.stopImmediatePropagation();
507
+ this.showConfirmDiscardUnsavedChangesModal = false;
508
+ this.unsavedChanges = false;
509
+ this.showEditEventDetails = false;
510
+ this.showCreateEventDetails = false;
511
+ this.selectedEvent = null;
512
+ this.createNewGroupEventTimeslot = null;
513
+ this.formError = '';
514
+ }, part: "nfbf__button-outline nfbf__reschedule-cta" }, "Discard"))))))));
504
515
  }
505
516
  static get is() { return "nylas-event-calendar"; }
506
517
  static get encapsulation() { return "shadow"; }