@nylas/web-elements 0.0.0-test-20250321141510 → 0.0.0-test-20250327161320
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +10 -11
- package/dist/cjs/calendar-agenda-fill-icon_36.cjs.entry.js +6 -9
- package/dist/cjs/calendar-agenda-fill-icon_36.cjs.entry.js.map +1 -1
- package/dist/cjs/google-logo-icon_6.cjs.entry.js +5 -5
- package/dist/cjs/google-logo-icon_6.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-transcript.cjs.entry.js +4 -4
- package/dist/cjs/nylas-transcript.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-video-player.cjs.entry.js +2 -2
- package/dist/cjs/nylas-video-player.cjs.entry.js.map +1 -1
- package/dist/cjs/scheduler-store-461fd2ff.js.map +1 -1
- package/dist/collection/components/nylas-notebook/nylas-transcript/nylas-transcript.css +5 -0
- package/dist/collection/components/nylas-notebook/nylas-transcript/nylas-transcript.js +3 -3
- package/dist/collection/components/nylas-notebook/nylas-transcript/nylas-transcript.js.map +1 -1
- package/dist/collection/components/nylas-notebook/nylas-video-player/nylas-video-player.css +0 -3
- package/dist/collection/components/nylas-notebook/nylas-video-player/nylas-video-player.js +1 -1
- package/dist/collection/components/nylas-notebook/nylas-video-player/nylas-video-player.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js +1 -1
- package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.js +3 -5
- package/dist/collection/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-editor-tabs-group/nylas-editor-tabs-group.js +5 -5
- package/dist/collection/components/scheduler-editor/nylas-editor-tabs-group/nylas-editor-tabs-group.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-duration/test/nylas-event-duration-with-config-2.spec.js +58 -0
- package/dist/collection/components/scheduler-editor/nylas-event-duration/test/nylas-event-duration-with-config-2.spec.js.map +1 -0
- package/dist/collection/components/scheduler-editor/nylas-event-duration/test/nylas-event-duration-with-config.spec.js +0 -32
- package/dist/collection/components/scheduler-editor/nylas-event-duration/test/nylas-event-duration-with-config.spec.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.js +3 -4
- package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/test/nylas-participants-custom-availability.spec.js +12 -0
- package/dist/collection/components/scheduler-editor/nylas-participants-custom-availability/test/nylas-participants-custom-availability.spec.js.map +1 -1
- package/dist/collection/types/index.js.map +1 -1
- package/dist/components/nylas-booking-form-config2.js +3 -5
- package/dist/components/nylas-booking-form-config2.js.map +1 -1
- package/dist/components/nylas-editor-tabs-group2.js +5 -5
- package/dist/components/nylas-editor-tabs-group2.js.map +1 -1
- package/dist/components/nylas-participants-custom-availability2.js +3 -4
- package/dist/components/nylas-participants-custom-availability2.js.map +1 -1
- package/dist/components/nylas-scheduling.js.map +1 -1
- package/dist/components/nylas-transcript.js +4 -4
- package/dist/components/nylas-transcript.js.map +1 -1
- package/dist/components/nylas-video-player.js +2 -2
- package/dist/components/nylas-video-player.js.map +1 -1
- package/dist/components/scheduler-store.js.map +1 -1
- package/dist/esm/calendar-agenda-fill-icon_36.entry.js +6 -9
- package/dist/esm/calendar-agenda-fill-icon_36.entry.js.map +1 -1
- package/dist/esm/google-logo-icon_6.entry.js +5 -5
- package/dist/esm/google-logo-icon_6.entry.js.map +1 -1
- package/dist/esm/nylas-scheduling.entry.js.map +1 -1
- package/dist/esm/nylas-transcript.entry.js +4 -4
- package/dist/esm/nylas-transcript.entry.js.map +1 -1
- package/dist/esm/nylas-video-player.entry.js +2 -2
- package/dist/esm/nylas-video-player.entry.js.map +1 -1
- package/dist/esm/scheduler-store-755ced0b.js.map +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
- package/dist/nylas-web-elements/p-4b48f29a.entry.js.map +1 -1
- package/dist/nylas-web-elements/{p-f12cd991.entry.js → p-7fcdad32.entry.js} +2 -2
- package/dist/nylas-web-elements/p-7fcdad32.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-b1c57792.entry.js → p-c3f848d7.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-b1c57792.entry.js.map → p-c3f848d7.entry.js.map} +1 -1
- package/dist/nylas-web-elements/p-d1053aa8.entry.js +2 -0
- package/dist/nylas-web-elements/p-d1053aa8.entry.js.map +1 -0
- package/dist/nylas-web-elements/p-d36ad6ef.js.map +1 -1
- package/dist/nylas-web-elements/{p-11d7062d.entry.js → p-f4881c71.entry.js} +2 -2
- package/dist/nylas-web-elements/p-f4881c71.entry.js.map +1 -0
- package/package.json +3 -3
- package/dist/nylas-web-elements/p-11d7062d.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-3d93df74.entry.js +0 -2
- package/dist/nylas-web-elements/p-3d93df74.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-f12cd991.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nylas-participants-custom-availability.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAA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;;;;;;;;;;;;;;;;;;;;;;;CACF;AAtDC;IATC,iBAAiB,CAAyH;QACzI,IAAI,EAAE,wCAAwC;QAC9C,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;YAClE,CAAC,kCAAkC,EAAE,kBAAkB,CAAC;SACzD,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iEAsDD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Configuration, OpenHours, Participant, ParticipantAvailability } from '@nylas/core';\nimport { DEFAULT_OPEN_HOURS } from '@/common/constants';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE } from '@/common/constants';\n\n/**\n * The `nylas-participants-custom-availability` component is a form input for setting custom availability for participants.\n *\n * @part npca - The participants custom availability container\n * @part npca__header - The header of the participants custom availability\n * @part npca__content - The content of the participants custom availability\n * @part npca__participant-container - The participant container\n * @part npca__participant-title - The title of the participant\n * @part npca__participant-toggle--container - The toggle container for the participant\n * @part npca__toggle-label - The label of the toggle\n * @part npca_toggle-input - The input of the toggle\n * @part npca_toggle-slider - The slider of the toggle\n */\n@Component({\n tag: 'nylas-participants-custom-availability',\n styleUrl: 'nylas-participants-custom-availability.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasParticipantsCustomAvailability {\n @Element() host!: HTMLNylasParticipantsCustomAvailabilityElement;\n private participantFormRef!: HTMLFormElement;\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n\n /**\n * @standalone\n * The name of the participants custom availability.\n */\n @Prop() name: string = 'participant-custom-availability';\n\n /**\n * @standalone\n * The participants selected in the add participants section.\n */\n @Prop() participants: Participant[] = this.selectedConfiguration?.participants || [];\n\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: LANGUAGE_CODE;\n\n /**\n * This event is fired when the participants custom availability changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The state to store the custom availability setting for participants.\n */\n @State() selectedParticipants: {\n [key: string]: {\n setCustom: boolean;\n isOpen: boolean;\n openHours: OpenHours[];\n name: string;\n availability?: ParticipantAvailability;\n timezone?: string;\n };\n } = this.setParticipants(this.participants);\n\n // Watchers\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-participants-custom-availability', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('participants')\n participantsChangedHandler(newValue: Participant[], oldValue: Participant[]) {\n debug('nylas-participants-custom-availability', 'participantsChangedHandler', newValue, oldValue);\n if (!newValue || !oldValue || JSON.stringify(newValue) === JSON.stringify(oldValue)) {\n return;\n }\n this.selectedParticipants = this.setParticipants(newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration, oldValue: Configuration) {\n debug('nylas-participants-custom-availability', 'selectedConfigurationChangedHandler', newValue, oldValue);\n if (!newValue || !oldValue || JSON.stringify(newValue) === JSON.stringify(oldValue)) {\n return;\n }\n if (newValue?.participants) {\n this.selectedParticipants = this.setParticipants(newValue?.participants);\n }\n }\n\n @Watch('selectedLanguage')\n selectedLanguageChangedHandler(newVal: LANGUAGE_CODE, oldVal: LANGUAGE_CODE) {\n if (newVal === oldVal) return;\n i18next.changeLanguage(newVal);\n }\n\n // Lifecycle Methods\n connectedCallback() {\n debug('nylas-participants-custom-availability', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-participants-custom-availability', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-participants-custom-availability', 'componentWillLoad');\n }\n\n componentDidLoad() {\n debug('nylas-participants-custom-availability', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedParticipants = this.setParticipants(this.selectedConfiguration?.participants);\n } else {\n this.selectedParticipants = this.setParticipants(this.participants);\n }\n }\n\n // Event Handlers\n @Listen('nylasFormSwitchToggled')\n nylasFormSwitchToggledHandler(event: CustomEvent<{ checked: boolean; name: string; label: boolean }>) {\n debug('nylas-participants-custom-availability', 'nylasFormSwitchToggledHandler', event.detail);\n const existingParticipant = this.selectedConfiguration?.participants.find(participant => participant.email === event.detail.name);\n const existingOpenHours = existingParticipant?.availability?.open_hours || [];\n const openHours = existingOpenHours?.length > 0 ? existingOpenHours : this.selectedConfiguration?.availability?.availability_rules?.default_open_hours || [];\n const timeZone =\n existingOpenHours && existingOpenHours.length > 0\n ? existingParticipant?.timezone\n : this.selectedConfiguration?.availability?.availability_rules?.default_open_hours?.at(0)?.timezone ||\n this.selectedConfiguration?.event_booking?.timezone ||\n window.Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n this.selectedParticipants[event.detail.name]['isOpen'] = event.detail.checked;\n this.selectedParticipants[event.detail.name]['setCustom'] = event.detail.checked;\n this.selectedParticipants[event.detail.name]['openHours'] = event.detail.checked ? (openHours?.length > 0 ? openHours : DEFAULT_OPEN_HOURS) : [];\n this.selectedParticipants[event.detail.name]['timezone'] = event.detail.checked ? timeZone : undefined;\n this.selectedParticipants = { ...this.selectedParticipants };\n this.updateFormValue();\n }\n\n @Listen('valueChanged')\n handleValueChanged(event: CustomEvent) {\n debug('[nylas-editor-tabs]', 'handleValueChanged', event);\n const { name, value } = event.detail;\n if (!name.startsWith('participant-')) {\n return;\n }\n // Validate the form\n if (this.isInternalsAvailable) {\n if (!this.participantFormRef.checkValidity()) {\n this.internals.setValidity({ customError: true }, 'Please fix the overlapping time ranges.');\n return;\n } else {\n this.internals.setValidity({});\n }\n }\n\n const jsonValue = JSON.parse(value);\n\n const key = name.split('-')[2];\n if (!this.selectedParticipants[key]) return;\n const existingOpenHours = jsonValue.openHours || [];\n const openHours = existingOpenHours?.length > 0 ? existingOpenHours : this.selectedConfiguration?.availability?.availability_rules?.default_open_hours || [];\n this.selectedParticipants[key]['openHours'] = openHours;\n this.selectedParticipants = { ...this.selectedParticipants };\n\n this.updateFormValue();\n }\n\n updateFormValue() {\n const participantOpenHours = {};\n const participants = this.selectedConfiguration?.participants || this.participants;\n participants.forEach(participant => {\n participantOpenHours[participant.email] = this.selectedParticipants[participant.email].openHours;\n });\n this.isInternalsAvailable && this.internals.setFormValue(JSON.stringify(participantOpenHours), this.name);\n this.valueChanged.emit({ value: JSON.stringify(participantOpenHours), name: this.name });\n }\n\n setParticipants(participants: Participant[]) {\n const selectedParticipants = {};\n participants?.forEach(participant => {\n selectedParticipants[participant.email] = {\n isOpen: false,\n setCustom: Boolean(participant.availability?.open_hours),\n openHours: participant.availability?.open_hours || [],\n name: participant.name || participant.email,\n availability: participant.availability,\n timezone: participant.timezone,\n };\n });\n return selectedParticipants;\n }\n\n /**\n * This method is essentially a workaround to check if the internals are available because\n * the unit tests in stencil do not support the internals.\n * @returns boolean\n */\n get isInternalsAvailable() {\n return this.internals !== undefined && typeof this.internals.setFormValue === 'function' && typeof this.internals.setValidity === 'function';\n }\n\n @RegisterComponent<NylasParticipantsCustomAvailability, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-participants-custom-availability',\n stateToProps: new Map([\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.selectedLanguage', 'selectedLanguage'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host>\n <div class=\"nylas-participants-custom-availability\" part=\"npca\">\n <div class=\"header\" part=\"npca__header\">\n <h3>{i18next.t('nylasParticipantCustomAvailability.headerTitle')}</h3>\n <p>{i18next.t('nylasParticipantCustomAvailability.headerSubTitle')}</p>\n </div>\n <div class=\"content\" part=\"npca__content\">\n <form ref={el => (this.participantFormRef = el as HTMLFormElement)}>\n {Object.keys(this.selectedParticipants).map((key, index) => {\n const participant = this.selectedParticipants[key];\n const participantOpenHours = participant.availability?.open_hours || [];\n if (!participant || !participant.name || !participant.availability) return;\n return (\n <div class=\"participant-container\" part=\"npca__participant-container\" key={`participant-conatiner-${index}`}>\n <div class=\"participant-title\" part=\"npca__participant-title\">\n <p>{i18next.t('nylasParticipantCustomAvailability.participantOpenHoursTitle', { participantName: participant.name })}</p>\n <div class=\"participant-toggle\" part=\"npca__participant-toggle--container\">\n <toggle-switch\n exportparts=\"ts_label: npca__toggle-label, ts_input: npca_toggle-input, ts_slider: npca_toggle-slider\"\n name={key}\n checked={!!participant?.openHours && participant?.openHours.length > 0}\n />\n <span\n class={`chevron ${participant.isOpen ? 'open' : 'closed'} ${participant.setCustom ? '' : 'disabled'}`}\n onClick={() => {\n if (!participant.setCustom) return;\n this.selectedParticipants[key].isOpen = !participant.isOpen;\n this.selectedParticipants = { ...this.selectedParticipants };\n }}\n >\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n </div>\n {participant.isOpen && (\n <nylas-availability-picker\n key={index}\n name={`participant-${index}-${key}`}\n openHours={participantOpenHours}\n defaultTimezone={participant.timezone}\n hideHeader={true}\n />\n )}\n </div>\n );\n })}\n </form>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nylas-participants-custom-availability.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-participants-custom-availability/nylas-participants-custom-availability.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,M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yH;QACzI,IAAI,EAAE,wCAAwC;QAC9C,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;YAClE,CAAC,kCAAkC,EAAE,kBAAkB,CAAC;SACzD,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;iEAsDD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Configuration, OpenHours, Participant, ParticipantAvailability } from '@nylas/core';\nimport { DEFAULT_OPEN_HOURS } from '@/common/constants';\nimport i18next from '@/utils/i18n';\nimport { LANGUAGE_CODE } from '@/common/constants';\n\n/**\n * The `nylas-participants-custom-availability` component is a form input for setting custom availability for participants.\n *\n * @part npca - The participants custom availability container\n * @part npca__header - The header of the participants custom availability\n * @part npca__content - The content of the participants custom availability\n * @part npca__participant-container - The participant container\n * @part npca__participant-title - The title of the participant\n * @part npca__participant-toggle--container - The toggle container for the participant\n * @part npca__toggle-label - The label of the toggle\n * @part npca_toggle-input - The input of the toggle\n * @part npca_toggle-slider - The slider of the toggle\n */\n@Component({\n tag: 'nylas-participants-custom-availability',\n styleUrl: 'nylas-participants-custom-availability.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasParticipantsCustomAvailability {\n @Element() host!: HTMLNylasParticipantsCustomAvailabilityElement;\n private participantFormRef!: HTMLFormElement;\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n\n /**\n * @standalone\n * The name of the participants custom availability.\n */\n @Prop() name: string = 'participant-custom-availability';\n\n /**\n * @standalone\n * The participants selected in the add participants section.\n */\n @Prop() participants: Participant[] = this.selectedConfiguration?.participants || [];\n\n /**\n * The selected language.\n */\n @Prop() selectedLanguage?: LANGUAGE_CODE;\n\n /**\n * This event is fired when the participants custom availability changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The state to store the custom availability setting for participants.\n */\n @State() selectedParticipants: {\n [key: string]: {\n setCustom: boolean;\n isOpen: boolean;\n openHours: OpenHours[];\n name: string;\n availability?: ParticipantAvailability;\n timezone?: string;\n };\n } = this.setParticipants(this.participants);\n\n // Watchers\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-participants-custom-availability', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('participants')\n participantsChangedHandler(newValue: Participant[], oldValue: Participant[]) {\n debug('nylas-participants-custom-availability', 'participantsChangedHandler', newValue, oldValue);\n if (!newValue || !oldValue || JSON.stringify(newValue) === JSON.stringify(oldValue)) {\n return;\n }\n this.selectedParticipants = this.setParticipants(newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration, oldValue: Configuration) {\n debug('nylas-participants-custom-availability', 'selectedConfigurationChangedHandler', newValue, oldValue);\n if (!newValue || !oldValue || JSON.stringify(newValue) === JSON.stringify(oldValue)) {\n return;\n }\n if (newValue?.participants) {\n this.selectedParticipants = this.setParticipants(newValue?.participants);\n }\n }\n\n @Watch('selectedLanguage')\n selectedLanguageChangedHandler(newVal: LANGUAGE_CODE, oldVal: LANGUAGE_CODE) {\n if (newVal === oldVal) return;\n i18next.changeLanguage(newVal);\n }\n\n // Lifecycle Methods\n connectedCallback() {\n debug('nylas-participants-custom-availability', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-participants-custom-availability', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-participants-custom-availability', 'componentWillLoad');\n }\n\n componentDidLoad() {\n debug('nylas-participants-custom-availability', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedParticipants = this.setParticipants(this.selectedConfiguration?.participants);\n } else {\n this.selectedParticipants = this.setParticipants(this.participants);\n }\n }\n\n // Event Handlers\n @Listen('nylasFormSwitchToggled')\n nylasFormSwitchToggledHandler(event: CustomEvent<{ checked: boolean; name: string; label: boolean }>) {\n debug('nylas-participants-custom-availability', 'nylasFormSwitchToggledHandler', event.detail);\n const existingParticipant = this.selectedConfiguration?.participants.find(participant => participant.email === event.detail.name);\n const existingOpenHours = existingParticipant?.availability?.open_hours || [];\n const openHours = existingOpenHours?.length > 0 ? existingOpenHours : this.selectedConfiguration?.availability?.availability_rules?.default_open_hours || [];\n const timeZone =\n existingOpenHours && existingOpenHours.length > 0\n ? existingParticipant?.timezone\n : this.selectedConfiguration?.availability?.availability_rules?.default_open_hours?.at(0)?.timezone ||\n this.selectedConfiguration?.event_booking?.timezone ||\n window.Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n this.selectedParticipants[event.detail.name]['isOpen'] = event.detail.checked;\n this.selectedParticipants[event.detail.name]['setCustom'] = event.detail.checked;\n this.selectedParticipants[event.detail.name]['openHours'] = event.detail.checked ? (openHours?.length > 0 ? openHours : DEFAULT_OPEN_HOURS) : [];\n this.selectedParticipants[event.detail.name]['timezone'] = event.detail.checked ? timeZone : undefined;\n this.selectedParticipants = { ...this.selectedParticipants };\n this.updateFormValue();\n }\n\n @Listen('valueChanged')\n handleValueChanged(event: CustomEvent) {\n debug('[nylas-editor-tabs]', 'handleValueChanged', event);\n const { name, value } = event.detail;\n if (!name.startsWith('participant-')) {\n return;\n }\n // Validate the form\n if (this.isInternalsAvailable) {\n if (!this.participantFormRef.checkValidity()) {\n this.internals.setValidity({ customError: true }, 'Please fix the overlapping time ranges.');\n return;\n } else {\n this.internals.setValidity({});\n }\n }\n\n const jsonValue = JSON.parse(value);\n\n const key = name.split('-')[2];\n if (!this.selectedParticipants[key]) return;\n const existingOpenHours = jsonValue.openHours || [];\n const openHours = existingOpenHours?.length > 0 ? existingOpenHours : this.selectedConfiguration?.availability?.availability_rules?.default_open_hours || [];\n this.selectedParticipants[key]['openHours'] = openHours;\n this.selectedParticipants = { ...this.selectedParticipants };\n\n this.updateFormValue();\n }\n\n updateFormValue() {\n const participantOpenHours = {};\n Object.keys(this.selectedParticipants).forEach(key => {\n participantOpenHours[key] = this.selectedParticipants[key].openHours;\n });\n\n this.isInternalsAvailable && this.internals.setFormValue(JSON.stringify(participantOpenHours), this.name);\n this.valueChanged.emit({ value: JSON.stringify(participantOpenHours), name: this.name });\n }\n\n setParticipants(participants: Participant[]) {\n const selectedParticipants = {};\n participants?.forEach(participant => {\n selectedParticipants[participant.email] = {\n isOpen: false,\n setCustom: Boolean(participant.availability?.open_hours),\n openHours: participant.availability?.open_hours || [],\n name: participant.name || participant.email,\n availability: participant.availability,\n timezone: participant.timezone,\n };\n });\n return selectedParticipants;\n }\n\n /**\n * This method is essentially a workaround to check if the internals are available because\n * the unit tests in stencil do not support the internals.\n * @returns boolean\n */\n get isInternalsAvailable() {\n return this.internals !== undefined && typeof this.internals.setFormValue === 'function' && typeof this.internals.setValidity === 'function';\n }\n\n @RegisterComponent<NylasParticipantsCustomAvailability, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-participants-custom-availability',\n stateToProps: new Map([\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.selectedLanguage', 'selectedLanguage'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host>\n <div class=\"nylas-participants-custom-availability\" part=\"npca\">\n <div class=\"header\" part=\"npca__header\">\n <h3>{i18next.t('nylasParticipantCustomAvailability.headerTitle')}</h3>\n <p>{i18next.t('nylasParticipantCustomAvailability.headerSubTitle')}</p>\n </div>\n <div class=\"content\" part=\"npca__content\">\n <form ref={el => (this.participantFormRef = el as HTMLFormElement)}>\n {Object.keys(this.selectedParticipants).map((key, index) => {\n const participant = this.selectedParticipants[key];\n const participantOpenHours = participant.availability?.open_hours || [];\n if (!participant || !participant.name || !participant.availability) return;\n return (\n <div class=\"participant-container\" part=\"npca__participant-container\" key={`participant-conatiner-${index}`}>\n <div class=\"participant-title\" part=\"npca__participant-title\">\n <p>{i18next.t('nylasParticipantCustomAvailability.participantOpenHoursTitle', { participantName: participant.name })}</p>\n <div class=\"participant-toggle\" part=\"npca__participant-toggle--container\">\n <toggle-switch\n exportparts=\"ts_label: npca__toggle-label, ts_input: npca_toggle-input, ts_slider: npca_toggle-slider\"\n name={key}\n checked={!!participant?.openHours && participant?.openHours.length > 0}\n />\n <span\n class={`chevron ${participant.isOpen ? 'open' : 'closed'} ${participant.setCustom ? '' : 'disabled'}`}\n onClick={() => {\n if (!participant.setCustom) return;\n this.selectedParticipants[key].isOpen = !participant.isOpen;\n this.selectedParticipants = { ...this.selectedParticipants };\n }}\n >\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n </div>\n {participant.isOpen && (\n <nylas-availability-picker\n key={index}\n name={`participant-${index}-${key}`}\n openHours={participantOpenHours}\n defaultTimezone={participant.timezone}\n hideHeader={true}\n />\n )}\n </div>\n );\n })}\n </form>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -96,6 +96,9 @@ describe('nylas-participants-custom-availability', () => {
|
|
|
96
96
|
});
|
|
97
97
|
await page.waitForChanges();
|
|
98
98
|
const component = page.rootInstance;
|
|
99
|
+
const spy = jest.spyOn(component, 'handleValueChanged');
|
|
100
|
+
const valueChangedSpy = jest.fn();
|
|
101
|
+
page.root?.addEventListener('valueChanged', valueChangedSpy);
|
|
99
102
|
const event = new CustomEvent('nylasFormSwitchToggled', {
|
|
100
103
|
detail: { checked: true, name: config.participants[0].email, label: true },
|
|
101
104
|
});
|
|
@@ -113,6 +116,15 @@ describe('nylas-participants-custom-availability', () => {
|
|
|
113
116
|
},
|
|
114
117
|
]);
|
|
115
118
|
expect(component.selectedParticipants[config.participants[0].email].timezone).toBe('America/Toronto');
|
|
119
|
+
const participantOpenHours = {
|
|
120
|
+
[config.participants[0].email]: component.selectedParticipants[config.participants[0].email].openHours,
|
|
121
|
+
};
|
|
122
|
+
expect(spy).toHaveBeenCalled();
|
|
123
|
+
expect(spy.mock.calls[0][0].detail.value).toEqual(JSON.stringify(participantOpenHours));
|
|
124
|
+
expect(spy.mock.calls[0][0].detail.name).toEqual(component.name);
|
|
125
|
+
expect(valueChangedSpy).toHaveBeenCalled();
|
|
126
|
+
const emittedEvent = valueChangedSpy.mock.calls[0][0];
|
|
127
|
+
expect(emittedEvent.detail).toEqual({ value: JSON.stringify(participantOpenHours), name: component.name });
|
|
116
128
|
});
|
|
117
129
|
});
|
|
118
130
|
//# sourceMappingURL=nylas-participants-custom-availability.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nylas-participants-custom-availability.spec.js","sourceRoot":"","sources":["../../../../../src/components/scheduler-editor/nylas-participants-custom-availability/test/nylas-participants-custom-availability.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,2DAA2D,CAAC;AACpG,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACtD,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,YAAY,GAAG,IAAI,CAAC;QAE1B,MAAM,CAAC,IAAI,GAAG;YACZ,GAAG,YAAY;YACf,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;gBAClD,eAAe,EAAE,GAAG,EAAE,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AY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvF,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1F,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;YACrF;gBACE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBACrB,GAAG,EAAE,OAAO;gBACZ,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,OAAO;gBACd,QAAQ,EAAE,iBAAiB;aAC5B;SACF,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { NylasParticipantsCustomAvailability } from '../nylas-participants-custom-availability';\nimport { NylasAvailabilityPicker } from '../../nylas-availability-picker/nylas-availability-picker';\nimport { h } from '@stencil/core';\nimport { SelectDropdown } from '../../../design-system/select-dropdown/select-dropdown';\nimport { selectedConfiguration } from '@/utils/test-utils';\n\ndescribe('nylas-participants-custom-availability', () => {\n beforeEach(() => {\n const originalIntl = Intl;\n\n global.Intl = {\n ...originalIntl,\n DateTimeFormat: jest.fn().mockImplementation(() => ({\n resolvedOptions: () => ({\n timeZone: 'America/New_York',\n }),\n supportedLocalesOf: jest.fn(),\n })) as any,\n };\n });\n\n afterEach(() => {\n jest.restoreAllMocks();\n });\n\n it('selects default timezone passed as prop', async () => {\n const config = JSON.parse(JSON.stringify(selectedConfiguration));\n config.participants[0].timezone = 'Africa/Accra';\n const page = await newSpecPage({\n components: [NylasParticipantsCustomAvailability, NylasAvailabilityPicker, SelectDropdown],\n template: () => {\n return (\n <form id=\"availability-picker\">\n <nylas-participants-custom-availability name=\"participant-xyx\" selectedConfiguration={config}></nylas-participants-custom-availability>\n </form>\n );\n },\n });\n\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot();\n const form = page.root?.shadowRoot?.querySelector('.nylas-participants-custom-availability .content form');\n const participant1 = form?.querySelector('.participant-container');\n const chevron = participant1?.querySelector('.participant-title .chevron');\n chevron?.dispatchEvent(new Event('click'));\n await page.waitForChanges();\n const availabilityPicker = page.root?.shadowRoot?.querySelector('nylas-availability-picker');\n expect(availabilityPicker).not.toBeNull();\n const timezoneDropdown = availabilityPicker?.shadowRoot?.querySelector('.select-timezone select-dropdown')?.shadowRoot;\n const timezoneButton = timezoneDropdown?.querySelector('button');\n expect(timezoneButton).not.toBeNull();\n expect(timezoneButton?.textContent).toEqual('Africa / Accra');\n });\n\n it('handles nylasFormSwitchToggled event correctly when checked is true', async () => {\n const config = JSON.parse(JSON.stringify(selectedConfiguration));\n config.participants[0].availability = { open_hours: [{ day: 1, start: '09:00', end: '17:00' }] };\n const page = await newSpecPage({\n components: [NylasParticipantsCustomAvailability, NylasAvailabilityPicker, SelectDropdown],\n template: () => {\n return (\n <form id=\"availability-picker\">\n <nylas-participants-custom-availability name=\"participant-xyx\" selectedConfiguration={config}></nylas-participants-custom-availability>\n </form>\n );\n },\n });\n\n await page.waitForChanges();\n const component = page.rootInstance;\n const event = new CustomEvent('nylasFormSwitchToggled', {\n detail: { checked: true, name: config.participants[0].email, label: true },\n });\n component.nylasFormSwitchToggledHandler(event);\n\n await page.waitForChanges();\n expect(component.selectedParticipants[config.participants[0].email].isOpen).toBe(true);\n expect(component.selectedParticipants[config.participants[0].email].setCustom).toBe(true);\n expect(component.selectedParticipants[config.participants[0].email].openHours).toEqual(config.participants[0].availability.open_hours);\n expect(component.selectedParticipants[config.participants[0].email].timezone).toBe(config.participants[0].timezone);\n });\n\n it('handles nylasFormSwitchToggled event correctly when checked is false', async () => {\n const config = JSON.parse(JSON.stringify(selectedConfiguration));\n config.participants[0].availability = { open_hours: [{ day: 1, start: '09:00', end: '17:00' }] };\n const page = await newSpecPage({\n components: [NylasParticipantsCustomAvailability, NylasAvailabilityPicker, SelectDropdown],\n template: () => {\n return (\n <form id=\"availability-picker\">\n <nylas-participants-custom-availability name=\"participant-xyx\" selectedConfiguration={config}></nylas-participants-custom-availability>\n </form>\n );\n },\n });\n\n await page.waitForChanges();\n const component = page.rootInstance;\n const event = new CustomEvent('nylasFormSwitchToggled', {\n detail: { checked: false, name: config.participants[0].email, label: true },\n });\n component.nylasFormSwitchToggledHandler(event);\n\n await page.waitForChanges();\n expect(component.selectedParticipants[config.participants[0].email].isOpen).toBe(false);\n expect(component.selectedParticipants[config.participants[0].email].setCustom).toBe(false);\n expect(component.selectedParticipants[config.participants[0].email].openHours).toEqual([]);\n expect(component.selectedParticipants[config.participants[0].email].timezone).toBeUndefined();\n });\n\n it('toggles the state correctly', async () => {\n const config = JSON.parse(JSON.stringify(selectedConfiguration));\n config.participants[0].availability = { open_hours: [] };\n const page = await newSpecPage({\n components: [NylasParticipantsCustomAvailability, NylasAvailabilityPicker, SelectDropdown],\n template: () => {\n return (\n <form id=\"availability-picker\">\n <nylas-participants-custom-availability name=\"participant-xyx\" selectedConfiguration={config}></nylas-participants-custom-availability>\n </form>\n );\n },\n });\n\n await page.waitForChanges();\n const component = page.rootInstance;\n const event = new CustomEvent('nylasFormSwitchToggled', {\n detail: { checked: true, name: config.participants[0].email, label: true },\n });\n component.nylasFormSwitchToggledHandler(event);\n\n await page.waitForChanges();\n expect(component.selectedParticipants[config.participants[0].email].isOpen).toBe(true);\n expect(component.selectedParticipants[config.participants[0].email].setCustom).toBe(true);\n expect(component.selectedParticipants[config.participants[0].email].openHours).toEqual([\n {\n days: [1, 2, 3, 4, 5],\n end: '17:00',\n exdates: null,\n start: '09:00',\n timezone: 'America/Toronto',\n },\n ]);\n expect(component.selectedParticipants[config.participants[0].email].timezone).toBe('America/Toronto');\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"nylas-participants-custom-availability.spec.js","sourceRoot":"","sources":["../../../../../src/components/scheduler-editor/nylas-participants-custom-availability/test/nylas-participants-custom-availability.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,2DAA2D,CAAC;AACpG,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACtD,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,YAAY,GAAG,IAAI,CAAC;QAE1B,MAAM,CAAC,IAAI,GAAG;YACZ,GAAG,YAAY;YACf,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;gBAClD,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;oBACtB,QAAQ,EAAE,kBAAkB;iBAC7B,CAAC;gBACF,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE;aAC9B,CAAC,CAAQ;SACX,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACvD,MAAM,MAAM,GAAG,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S,CAAC,IAAI,CAAC,CAAC;QAGlF,MAAM,CAAC,eAAe,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7G,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { NylasParticipantsCustomAvailability } from '../nylas-participants-custom-availability';\nimport { NylasAvailabilityPicker } from '../../nylas-availability-picker/nylas-availability-picker';\nimport { h } from '@stencil/core';\nimport { SelectDropdown } from '../../../design-system/select-dropdown/select-dropdown';\nimport { selectedConfiguration } from '@/utils/test-utils';\n\ndescribe('nylas-participants-custom-availability', () => {\n beforeEach(() => {\n const originalIntl = Intl;\n\n global.Intl = {\n ...originalIntl,\n DateTimeFormat: jest.fn().mockImplementation(() => ({\n resolvedOptions: () => ({\n timeZone: 'America/New_York',\n }),\n supportedLocalesOf: jest.fn(),\n })) as any,\n };\n });\n\n afterEach(() => {\n jest.restoreAllMocks();\n });\n\n it('selects default timezone passed as prop', async () => {\n const config = JSON.parse(JSON.stringify(selectedConfiguration));\n config.participants[0].timezone = 'Africa/Accra';\n const page = await newSpecPage({\n components: [NylasParticipantsCustomAvailability, NylasAvailabilityPicker, SelectDropdown],\n template: () => {\n return (\n <form id=\"availability-picker\">\n <nylas-participants-custom-availability name=\"participant-xyx\" selectedConfiguration={config}></nylas-participants-custom-availability>\n </form>\n );\n },\n });\n\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot();\n const form = page.root?.shadowRoot?.querySelector('.nylas-participants-custom-availability .content form');\n const participant1 = form?.querySelector('.participant-container');\n const chevron = participant1?.querySelector('.participant-title .chevron');\n chevron?.dispatchEvent(new Event('click'));\n await page.waitForChanges();\n const availabilityPicker = page.root?.shadowRoot?.querySelector('nylas-availability-picker');\n expect(availabilityPicker).not.toBeNull();\n const timezoneDropdown = availabilityPicker?.shadowRoot?.querySelector('.select-timezone select-dropdown')?.shadowRoot;\n const timezoneButton = timezoneDropdown?.querySelector('button');\n expect(timezoneButton).not.toBeNull();\n expect(timezoneButton?.textContent).toEqual('Africa / Accra');\n });\n\n it('handles nylasFormSwitchToggled event correctly when checked is true', async () => {\n const config = JSON.parse(JSON.stringify(selectedConfiguration));\n config.participants[0].availability = { open_hours: [{ day: 1, start: '09:00', end: '17:00' }] };\n const page = await newSpecPage({\n components: [NylasParticipantsCustomAvailability, NylasAvailabilityPicker, SelectDropdown],\n template: () => {\n return (\n <form id=\"availability-picker\">\n <nylas-participants-custom-availability name=\"participant-xyx\" selectedConfiguration={config}></nylas-participants-custom-availability>\n </form>\n );\n },\n });\n\n await page.waitForChanges();\n const component = page.rootInstance;\n const event = new CustomEvent('nylasFormSwitchToggled', {\n detail: { checked: true, name: config.participants[0].email, label: true },\n });\n component.nylasFormSwitchToggledHandler(event);\n\n await page.waitForChanges();\n expect(component.selectedParticipants[config.participants[0].email].isOpen).toBe(true);\n expect(component.selectedParticipants[config.participants[0].email].setCustom).toBe(true);\n expect(component.selectedParticipants[config.participants[0].email].openHours).toEqual(config.participants[0].availability.open_hours);\n expect(component.selectedParticipants[config.participants[0].email].timezone).toBe(config.participants[0].timezone);\n });\n\n it('handles nylasFormSwitchToggled event correctly when checked is false', async () => {\n const config = JSON.parse(JSON.stringify(selectedConfiguration));\n config.participants[0].availability = { open_hours: [{ day: 1, start: '09:00', end: '17:00' }] };\n const page = await newSpecPage({\n components: [NylasParticipantsCustomAvailability, NylasAvailabilityPicker, SelectDropdown],\n template: () => {\n return (\n <form id=\"availability-picker\">\n <nylas-participants-custom-availability name=\"participant-xyx\" selectedConfiguration={config}></nylas-participants-custom-availability>\n </form>\n );\n },\n });\n\n await page.waitForChanges();\n const component = page.rootInstance;\n const event = new CustomEvent('nylasFormSwitchToggled', {\n detail: { checked: false, name: config.participants[0].email, label: true },\n });\n component.nylasFormSwitchToggledHandler(event);\n\n await page.waitForChanges();\n expect(component.selectedParticipants[config.participants[0].email].isOpen).toBe(false);\n expect(component.selectedParticipants[config.participants[0].email].setCustom).toBe(false);\n expect(component.selectedParticipants[config.participants[0].email].openHours).toEqual([]);\n expect(component.selectedParticipants[config.participants[0].email].timezone).toBeUndefined();\n });\n\n it('toggles the state correctly', async () => {\n const config = JSON.parse(JSON.stringify(selectedConfiguration));\n config.participants[0].availability = { open_hours: [] };\n const page = await newSpecPage({\n components: [NylasParticipantsCustomAvailability, NylasAvailabilityPicker, SelectDropdown],\n template: () => {\n return (\n <form id=\"availability-picker\">\n <nylas-participants-custom-availability name=\"participant-xyx\" selectedConfiguration={config}></nylas-participants-custom-availability>\n </form>\n );\n },\n });\n\n await page.waitForChanges();\n const component = page.rootInstance;\n const spy = jest.spyOn(component, 'handleValueChanged');\n\n // Set up event listener to capture valueChanged event\n const valueChangedSpy = jest.fn();\n page.root?.addEventListener('valueChanged', valueChangedSpy);\n\n const event = new CustomEvent('nylasFormSwitchToggled', {\n detail: { checked: true, name: config.participants[0].email, label: true },\n });\n component.nylasFormSwitchToggledHandler(event);\n\n await page.waitForChanges();\n expect(component.selectedParticipants[config.participants[0].email].isOpen).toBe(true);\n expect(component.selectedParticipants[config.participants[0].email].setCustom).toBe(true);\n expect(component.selectedParticipants[config.participants[0].email].openHours).toEqual([\n {\n days: [1, 2, 3, 4, 5],\n end: '17:00',\n exdates: null,\n start: '09:00',\n timezone: 'America/Toronto',\n },\n ]);\n expect(component.selectedParticipants[config.participants[0].email].timezone).toBe('America/Toronto');\n\n // Define participantOpenHours\n const participantOpenHours = {\n [config.participants[0].email]: component.selectedParticipants[config.participants[0].email].openHours,\n };\n\n expect(spy).toHaveBeenCalled();\n expect((spy.mock.calls[0][0] as CustomEvent).detail.value).toEqual(JSON.stringify(participantOpenHours));\n expect((spy.mock.calls[0][0] as CustomEvent).detail.name).toEqual(component.name);\n\n // Verify valueChanged event was emitted\n expect(valueChangedSpy).toHaveBeenCalled();\n const emittedEvent = valueChangedSpy.mock.calls[0][0];\n expect(emittedEvent.detail).toEqual({ value: JSON.stringify(participantOpenHours), name: component.name });\n });\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AA8FA,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,uCAAmB,CAAA;IACnB,iCAAa,CAAA;IACb,uCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAmWD,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,4BAAW,CAAA;IACX,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAQD,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,qEAA+C,CAAA;IAC/C,yDAAmC,CAAA;IACnC,mEAA6C,CAAA;IAC7C,mEAA6C,CAAA;IAC7C,qDAA+B,CAAA;IAC/B,yCAAmB,CAAA;IACnB,+DAAyC,CAAA;IACzC,2DAAqC,CAAA;IACrC,2DAAqC,CAAA;IACrC,mDAA6B,CAAA;AAC/B,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B","sourcesContent":["export interface NylasResponse<Data = any> {\n request_id: string;\n data?: Data;\n error?: {\n message: string;\n type: string;\n };\n}\n\n// Avaliability\nexport interface OpenHours {\n days: number[];\n exDates: string[];\n timezone: string;\n start: string;\n end: string;\n}\n\nexport interface MeetingBuffer {\n before: number;\n after: number;\n}\n\n// Scheduling\nexport interface UpdateConfiguration extends Omit<Configuration, 'id'> {}\n\nexport interface ParticipantAvailability {\n calendar_ids: string[];\n open_hours?: OpenHours[];\n}\n\nexport type NylasSchedulerBookingParticipant = { name: string; email: string; nameReadOnly?: boolean; emailReadOnly?: boolean };\n\nexport type NylasSchedulerBookingData = {\n primaryParticipant: NylasSchedulerBookingParticipant;\n startTime?: Date;\n endTime?: Date;\n timezone?: string;\n language?: string;\n guests?: NylasSchedulerBookingParticipant[];\n additionalFields?: Record<\n string,\n {\n value: string;\n type?: string;\n readOnly?: boolean;\n }\n >;\n};\n\nexport type OpenHour = {\n days: number[]; // [1, 2, 3, 4, 5]\n start: string; // \"09:00\"\n end: string; // \"17:00\"\n timezone: string; // \"America/Los_Angeles\"\n};\n\nexport type Timeslot = {\n start_time: Date;\n end_time: Date;\n emails?: string[];\n capacity?: number;\n event_id?: string;\n master_id?: string;\n calendar_id?: string;\n};\n\nexport type ThemeConfig = Partial<{\n '--nylas-primary': string;\n '--nylas-info': string;\n '--nylas-success': string;\n '--nylas-warning': string;\n '--nylas-error': string;\n '--nylas-error-pressed': string;\n '--nylas-base-0': string;\n '--nylas-base-25': string;\n '--nylas-base-50': string;\n '--nylas-base-100': string;\n '--nylas-base-200': string;\n '--nylas-base-300': string;\n '--nylas-base-400': string;\n '--nylas-base-500': string;\n '--nylas-base-600': string;\n '--nylas-base-700': string;\n '--nylas-base-800': string;\n '--nylas-base-900': string;\n '--nylas-base-950': string;\n '--nylas-font-family': string;\n '--nylas-font-size': string;\n '--nylas-border-radius': string;\n '--nylas-border-radius-2x': string;\n '--nylas-border-radius-3x': string;\n}>;\n\nexport enum NotificationType {\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n Success = 'success',\n}\n\nexport type Notification = {\n id: string;\n type: NotificationType;\n title: string;\n code?: number;\n category: string;\n description?: string;\n ttl?: number | 'none';\n};\n\nexport type BookingType = 'booking' | 'organizer-confirmation' | 'custom-confirmation';\n\nexport type AvailabilityMethod = 'max-fairness' | 'max-availability' | 'collective';\n\nexport type ConferenceProvider = 'GoogleMeetConferenceProvider' | 'MicrosoftTeamsConferenceProvider' | 'ZoomConferenceProvider' | 'OnlineMeetingProviderMicrosoftTeams';\n\nexport type ReminderMethod = 'email' | 'webhook';\n\nexport interface Rules {\n availability_method: AvailabilityMethod;\n buffer: MeetingBuffer;\n default_open_hours: OpenHours[];\n round_robin_group_id: string;\n}\n\nexport interface ConferenceDetail {\n meeting_code?: string; // zoom, GTM, microsoft teams\n password?: string; // zoom, webex\n url?: string; // zoom, webex, GTM, meet, microsoft teams\n pin?: string; // webex, meet\n phone?: string[]; // GTM, meet, microsoft teams\n}\n\nexport interface Conference {\n provider?: ConferenceProvider;\n details?: ConferenceDetail;\n autocreate?: { [key: string]: any };\n}\n\nexport interface ParticipantBooking {\n calendar_id: string;\n}\n\nexport interface Participant {\n email: string;\n name?: string;\n is_organizer?: boolean;\n availability?: ParticipantAvailability;\n booking?: ParticipantBooking;\n}\n\nexport interface EventReminder {\n type: ReminderMethod;\n minutes_before_event: number;\n recipient?: string;\n email_subject?: string;\n}\n\nexport interface Availability {\n duration_minutes: number;\n interval_minutes?: number;\n round_to?: number;\n availability_rules?: Rules;\n}\n\nexport interface EventBooking {\n title: string;\n description?: string;\n location?: string;\n timezone?: string;\n booking_type: BookingType;\n conferencing?: Conference;\n hide_participants?: boolean;\n disable_emails?: boolean;\n reminders?: EventReminder[];\n}\n\nexport interface Appearance {\n color?: string;\n submit_button_label?: string;\n thank_you_message?: string;\n company_logo_url?: string;\n}\n\nexport interface Scheduler {\n available_days_in_future?: number;\n min_cancellation_notice: number;\n min_booking_notice?: number;\n rescheduling_url?: string;\n cancellation_url?: string;\n organizer_confirmation_url?: string;\n cancellation_policy?: string;\n hide_additional_guests?: boolean;\n hide_cancellation_options?: boolean;\n hide_rescheduling_options?: boolean;\n additional_fields?: Record<string, AdditionalFields>;\n email_template?: EmailTemplate;\n confirmation_redirect_url?: string;\n}\nexport interface AdditionalFields {\n type: string;\n required: boolean;\n order: number;\n options?: string[];\n label?: string;\n default?: string;\n}\n\nexport interface EmailTemplate {\n logo: string;\n booking_confirmed: BookingConfirmed;\n show_nylas_branding: boolean;\n}\n\nexport interface BookingConfirmed {\n title: string;\n body: string;\n}\n\nexport interface Configuration {\n id: string;\n version: string;\n type?: string;\n requires_session_auth?: boolean;\n participants: Participant[];\n availability: Availability;\n event_booking: EventBooking;\n scheduler: Partial<Scheduler>;\n slug: string;\n appearance: Appearance;\n name: string;\n}\n\nexport interface GroupBooking {\n booking_type: BookingType; // Only 'booking' is supported\n disable_emails?: boolean;\n reminders?: EventReminder[];\n conferencing?: Conference;\n calendar_id: string;\n default_capacity: number;\n}\n\nexport interface GroupConfiguration {\n id: string;\n name: string;\n slug: string;\n requires_session_auth?: boolean;\n type: 'group';\n group_booking: GroupBooking;\n scheduler: Scheduler;\n appearance: Appearance;\n}\n\nexport interface Creator {\n name: string;\n email: string;\n}\nexport interface AdditionalParticipant {\n name: string;\n email: string;\n calendars: {\n id: string;\n name: string;\n object?: 'calendar';\n is_primary?: boolean;\n is_owned_by_user?: boolean;\n read_only?: boolean;\n timezone?: string;\n }[];\n}\n\nexport interface GroupEvent {\n id?: string;\n title: string;\n busy: boolean;\n participants: NylasSchedulerBookingParticipant[];\n resources: {\n name: string;\n email: string;\n }[];\n description: string;\n when: {\n start_time: number;\n end_time: number;\n start_timezone?: string;\n end_timezone?: string;\n };\n location: string;\n rrule: string[];\n capacity: number;\n}\n\nexport type RecurrenceUpdateOption = 'this' | 'future' | 'all';\nexport type RecurrenceDeleteOption = 'this' | 'future' | 'all';\n\nexport type Snapshot = {\n busy: boolean;\n calendar_id: string;\n hide_participants: boolean;\n ical_uid: string;\n organizer: {\n name: string;\n email: string;\n };\n participants: {\n email: string;\n status: string;\n }[];\n resources: any[];\n read_only: boolean;\n recurrence: string[];\n reminders: {\n use_default: boolean;\n overrides: any[];\n };\n title: string;\n description?: string;\n location?: string;\n conferencing?: Conference;\n visibility: string;\n creator: {\n name: string;\n email: string;\n };\n html_link: string;\n grant_id: string;\n id: string;\n object: string;\n status: string;\n when: {\n start_timezone: string;\n end_timezone: string;\n object: string;\n start_time: number; // Unix timestamp\n end_time: number; // Unix timestamp\n };\n created_at: number; // Unix timestamp\n updated_at: number; // Unix timestamp\n};\n\nexport interface GroupEventAPIData {\n event: EventDetails;\n group_event_info?: GroupEventInfo;\n}\n\nexport type EventDetails = {\n busy: boolean;\n calendar_id: string;\n conferencing: {\n provider: ConferenceProvider;\n details: {\n meeting_code: string;\n url: string;\n pin: string;\n phone: string[];\n };\n };\n hide_participants: boolean;\n ical_uid: string;\n organizer: {\n name: string;\n email: string;\n };\n participants: Array<{\n email: string;\n status: 'yes' | 'no' | 'noreply';\n comment?: string;\n }>;\n resources: string[];\n read_only: boolean;\n reminders: {\n use_default: boolean;\n overrides: Array<{\n method?: string;\n minutes?: number;\n }>;\n };\n title: string;\n description?: string;\n location?: string;\n visibility: 'default' | 'public' | 'private';\n creator: {\n name: string;\n email: string;\n };\n html_link: string;\n master_event_id: string;\n color_id: string;\n grant_id: string;\n id: string;\n object: 'event';\n status: 'confirmed' | 'tentative' | 'cancelled';\n when: {\n start_timezone: string;\n end_timezone: string;\n object: 'timespan';\n start_time: number;\n end_time: number;\n };\n created_at: number;\n updated_at: number;\n original_start_time: number;\n};\n\nexport type GroupEventInfo = {\n event_id: string;\n calendar_id: string;\n master_id: string;\n config_id: string;\n capacity: number;\n type: 'updated_event' | 'single_event' | 'master_event';\n booked: boolean;\n finished: boolean;\n participants: Array<{\n email: string;\n is_organizer: boolean;\n name: string;\n timezone: string;\n }>;\n snapshot: any | null;\n snapshot_expires_at: number;\n rrule: string[] | null;\n exceptions: {\n event_id: string;\n capacity: number;\n participants: Array<{\n email: string;\n is_organizer: boolean;\n name: string;\n timezone: string;\n }>;\n }[];\n};\n\nexport type ImportGroupEventDetails = {\n event_id: string;\n calendar_id: string;\n capacity: number;\n participants: Participant[];\n organizer: {\n name: string;\n email: string;\n };\n};\n\nexport type ImportGroupEventResponse = {\n imported_events: string[];\n import_failed: {\n event_id: string;\n reason: string;\n }[];\n};\n\nexport enum ErrorCategory {\n Component = 'component',\n Api = 'api',\n Auth = 'auth',\n}\n\nexport interface ErrorDetails {\n title: string;\n message: string;\n category: ErrorCategory;\n}\n\nexport enum ComponentErrorType {\n endtime_not_in_future = 'endtime_not_in_future',\n no_booking_info = 'no_booking_info',\n no_timeslot_selected = 'no_timeslot_selected',\n no_timezone_selected = 'no_timezone_selected',\n no_booking_id = 'no_booking_id',\n no_salt = 'no_salt',\n invalid_start_time = 'invalid_start_time',\n invalid_end_time = 'invalid_end_time',\n invalid_timezone = 'invalid_timezone',\n no_config_id = 'no_config_id',\n}\n\nexport interface KeyPoint {\n time: number;\n text: string;\n active?: boolean;\n}"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AA8FA,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,uCAAmB,CAAA;IACnB,iCAAa,CAAA;IACb,uCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAmWD,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,4BAAW,CAAA;IACX,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAQD,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,qEAA+C,CAAA;IAC/C,yDAAmC,CAAA;IACnC,mEAA6C,CAAA;IAC7C,mEAA6C,CAAA;IAC7C,qDAA+B,CAAA;IAC/B,yCAAmB,CAAA;IACnB,+DAAyC,CAAA;IACzC,2DAAqC,CAAA;IACrC,2DAAqC,CAAA;IACrC,mDAA6B,CAAA;AAC/B,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B","sourcesContent":["export interface NylasResponse<Data = any> {\n request_id: string;\n data?: Data;\n error?: {\n message: string;\n type: string;\n };\n}\n\n// Avaliability\nexport interface OpenHours {\n days: number[];\n exDates: string[];\n timezone: string;\n start: string;\n end: string;\n}\n\nexport interface MeetingBuffer {\n before: number;\n after: number;\n}\n\n// Scheduling\nexport interface UpdateConfiguration extends Omit<Configuration, 'id'> {}\n\nexport interface ParticipantAvailability {\n calendar_ids: string[];\n open_hours?: OpenHours[];\n}\n\nexport type NylasSchedulerBookingParticipant = { name: string; email: string; nameReadOnly?: boolean; emailReadOnly?: boolean };\n\nexport type NylasSchedulerBookingData = {\n primaryParticipant: NylasSchedulerBookingParticipant;\n startTime?: Date;\n endTime?: Date;\n timezone?: string;\n language?: string;\n guests?: NylasSchedulerBookingParticipant[];\n additionalFields?: Record<\n string,\n {\n value: string;\n type?: string;\n readOnly?: boolean;\n }\n >;\n};\n\nexport type OpenHour = {\n days: number[]; // [1, 2, 3, 4, 5]\n start: string; // \"09:00\"\n end: string; // \"17:00\"\n timezone: string; // \"America/Los_Angeles\"\n};\n\nexport type Timeslot = {\n start_time: Date;\n end_time: Date;\n emails?: string[];\n capacity?: number;\n event_id?: string;\n master_id?: string;\n calendar_id?: string;\n};\n\nexport type ThemeConfig = Partial<{\n '--nylas-primary': string;\n '--nylas-info': string;\n '--nylas-success': string;\n '--nylas-warning': string;\n '--nylas-error': string;\n '--nylas-error-pressed': string;\n '--nylas-base-0': string;\n '--nylas-base-25': string;\n '--nylas-base-50': string;\n '--nylas-base-100': string;\n '--nylas-base-200': string;\n '--nylas-base-300': string;\n '--nylas-base-400': string;\n '--nylas-base-500': string;\n '--nylas-base-600': string;\n '--nylas-base-700': string;\n '--nylas-base-800': string;\n '--nylas-base-900': string;\n '--nylas-base-950': string;\n '--nylas-font-family': string;\n '--nylas-font-size': string;\n '--nylas-border-radius': string;\n '--nylas-border-radius-2x': string;\n '--nylas-border-radius-3x': string;\n}>;\n\nexport enum NotificationType {\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n Success = 'success',\n}\n\nexport type Notification = {\n id: string;\n type: NotificationType;\n title: string;\n code?: number;\n category: string;\n description?: string;\n ttl?: number | 'none';\n};\n\nexport type BookingType = 'booking' | 'organizer-confirmation' | 'custom-confirmation';\n\nexport type AvailabilityMethod = 'max-fairness' | 'max-availability' | 'collective';\n\nexport type ConferenceProvider = 'GoogleMeetConferenceProvider' | 'MicrosoftTeamsConferenceProvider' | 'ZoomConferenceProvider' | 'OnlineMeetingProviderMicrosoftTeams';\n\nexport type ReminderMethod = 'email' | 'webhook';\n\nexport interface Rules {\n availability_method: AvailabilityMethod;\n buffer: MeetingBuffer;\n default_open_hours: OpenHours[];\n round_robin_group_id: string;\n}\n\nexport interface ConferenceDetail {\n meeting_code?: string; // zoom, GTM, microsoft teams\n password?: string; // zoom, webex\n url?: string; // zoom, webex, GTM, meet, microsoft teams\n pin?: string; // webex, meet\n phone?: string[]; // GTM, meet, microsoft teams\n}\n\nexport interface Conference {\n provider?: ConferenceProvider;\n details?: ConferenceDetail;\n autocreate?: { [key: string]: any };\n}\n\nexport interface ParticipantBooking {\n calendar_id: string;\n}\n\nexport interface Participant {\n email: string;\n name?: string;\n is_organizer?: boolean;\n availability?: ParticipantAvailability;\n booking?: ParticipantBooking;\n}\n\nexport interface EventReminder {\n type: ReminderMethod;\n minutes_before_event: number;\n recipient?: string;\n email_subject?: string;\n}\n\nexport interface Availability {\n duration_minutes: number;\n interval_minutes?: number;\n round_to?: number;\n availability_rules?: Rules;\n}\n\nexport interface EventBooking {\n title: string;\n description?: string;\n location?: string;\n timezone?: string;\n booking_type: BookingType;\n conferencing?: Conference;\n hide_participants?: boolean;\n disable_emails?: boolean;\n reminders?: EventReminder[];\n}\n\nexport interface Appearance {\n color?: string;\n submit_button_label?: string;\n thank_you_message?: string;\n company_logo_url?: string;\n}\n\nexport interface Scheduler {\n available_days_in_future?: number;\n min_cancellation_notice: number;\n min_booking_notice?: number;\n rescheduling_url?: string;\n cancellation_url?: string;\n organizer_confirmation_url?: string;\n cancellation_policy?: string;\n hide_additional_guests?: boolean;\n hide_cancellation_options?: boolean;\n hide_rescheduling_options?: boolean;\n additional_fields?: Record<string, AdditionalFields>;\n email_template?: EmailTemplate;\n confirmation_redirect_url?: string;\n}\nexport interface AdditionalFields {\n type: string;\n required: boolean;\n order: number;\n options?: string[];\n label?: string;\n default?: string;\n}\n\nexport interface EmailTemplate {\n logo: string;\n booking_confirmed: BookingConfirmed;\n show_nylas_branding: boolean;\n}\n\nexport interface BookingConfirmed {\n title: string;\n body: string;\n}\n\nexport interface Configuration {\n id: string;\n version: string;\n type?: string;\n requires_session_auth?: boolean;\n participants: Participant[];\n availability: Availability;\n event_booking: EventBooking;\n scheduler: Partial<Scheduler>;\n slug: string;\n appearance: Appearance;\n name: string;\n}\n\nexport interface GroupBooking {\n booking_type: BookingType; // Only 'booking' is supported\n disable_emails?: boolean;\n reminders?: EventReminder[];\n conferencing?: Conference;\n calendar_id: string;\n default_capacity: number;\n}\n\nexport interface GroupConfiguration {\n id: string;\n name: string;\n slug: string;\n requires_session_auth?: boolean;\n type: 'group';\n group_booking: GroupBooking;\n scheduler: Scheduler;\n appearance: Appearance;\n}\n\nexport interface Creator {\n name: string;\n email: string;\n}\nexport interface AdditionalParticipant {\n name: string;\n email: string;\n calendars: {\n id: string;\n name: string;\n object?: 'calendar';\n is_primary?: boolean;\n is_owned_by_user?: boolean;\n read_only?: boolean;\n timezone?: string;\n }[];\n}\n\nexport interface GroupEvent {\n id?: string;\n title: string;\n busy: boolean;\n participants: NylasSchedulerBookingParticipant[];\n resources: {\n name: string;\n email: string;\n }[];\n description: string;\n when: {\n start_time: number;\n end_time: number;\n start_timezone?: string;\n end_timezone?: string;\n };\n location: string;\n rrule: string[];\n capacity: number;\n}\n\nexport type RecurrenceUpdateOption = 'this' | 'future' | 'all';\nexport type RecurrenceDeleteOption = 'this' | 'future' | 'all';\n\nexport type Snapshot = {\n busy: boolean;\n calendar_id: string;\n hide_participants: boolean;\n ical_uid: string;\n organizer: {\n name: string;\n email: string;\n };\n participants: {\n email: string;\n status: string;\n }[];\n resources: any[];\n read_only: boolean;\n recurrence: string[];\n reminders: {\n use_default: boolean;\n overrides: any[];\n };\n title: string;\n description?: string;\n location?: string;\n conferencing?: Conference;\n visibility: string;\n creator: {\n name: string;\n email: string;\n };\n html_link: string;\n grant_id: string;\n id: string;\n object: string;\n status: string;\n when: {\n start_timezone: string;\n end_timezone: string;\n object: string;\n start_time: number; // Unix timestamp\n end_time: number; // Unix timestamp\n };\n created_at: number; // Unix timestamp\n updated_at: number; // Unix timestamp\n};\n\nexport interface GroupEventAPIData {\n event: EventDetails;\n group_event_info?: GroupEventInfo;\n}\n\nexport type EventDetails = {\n busy: boolean;\n calendar_id: string;\n conferencing: {\n provider: ConferenceProvider;\n details: {\n meeting_code: string;\n url: string;\n pin: string;\n phone: string[];\n };\n };\n hide_participants: boolean;\n ical_uid: string;\n organizer: {\n name: string;\n email: string;\n };\n participants: Array<{\n email: string;\n status: 'yes' | 'no' | 'noreply';\n comment?: string;\n }>;\n resources: string[];\n read_only: boolean;\n reminders: {\n use_default: boolean;\n overrides: Array<{\n method?: string;\n minutes?: number;\n }>;\n };\n title: string;\n description?: string;\n location?: string;\n visibility: 'default' | 'public' | 'private';\n creator: {\n name: string;\n email: string;\n };\n html_link: string;\n master_event_id: string;\n color_id: string;\n grant_id: string;\n id: string;\n object: 'event';\n status: 'confirmed' | 'tentative' | 'cancelled';\n when: {\n start_timezone: string;\n end_timezone: string;\n object: 'timespan';\n start_time: number;\n end_time: number;\n };\n created_at: number;\n updated_at: number;\n original_start_time: number;\n};\n\nexport type GroupEventInfo = {\n event_id: string;\n calendar_id: string;\n master_id: string;\n config_id: string;\n capacity: number;\n type: 'updated_event' | 'single_event' | 'master_event';\n booked: boolean;\n finished: boolean;\n participants: Array<{\n email: string;\n is_organizer: boolean;\n name: string;\n timezone: string;\n }>;\n snapshot: any | null;\n snapshot_expires_at: number;\n rrule: string[] | null;\n exceptions: {\n event_id: string;\n capacity: number;\n participants: Array<{\n email: string;\n is_organizer: boolean;\n name: string;\n timezone: string;\n }>;\n }[];\n};\n\nexport type ImportGroupEventDetails = {\n event_id: string;\n calendar_id: string;\n capacity: number;\n participants: Participant[];\n organizer: {\n name: string;\n email: string;\n };\n};\n\nexport type ImportGroupEventResponse = {\n imported_events: string[];\n import_failed: {\n event_id: string;\n reason: string;\n }[];\n};\n\nexport enum ErrorCategory {\n Component = 'component',\n Api = 'api',\n Auth = 'auth',\n}\n\nexport interface ErrorDetails {\n title: string;\n message: string;\n category: ErrorCategory;\n}\n\nexport enum ComponentErrorType {\n endtime_not_in_future = 'endtime_not_in_future',\n no_booking_info = 'no_booking_info',\n no_timeslot_selected = 'no_timeslot_selected',\n no_timezone_selected = 'no_timezone_selected',\n no_booking_id = 'no_booking_id',\n no_salt = 'no_salt',\n invalid_start_time = 'invalid_start_time',\n invalid_end_time = 'invalid_end_time',\n invalid_timezone = 'invalid_timezone',\n no_config_id = 'no_config_id',\n}\n\nexport interface KeyPoint {\n time: number;\n text: string;\n active?: boolean;\n}\n"]}
|
|
@@ -2871,9 +2871,7 @@ const NylasBookingFormConfig = proxyCustomElement(class NylasBookingFormConfig e
|
|
|
2871
2871
|
if (name === 'add-field') {
|
|
2872
2872
|
const field = FIELD_TYPES.find(f => f.type === value);
|
|
2873
2873
|
const maxOrder = Math.max(...this.formFields.map(f => f.order));
|
|
2874
|
-
const existingFieldKeys = this.formFields
|
|
2875
|
-
.filter(f => f.type === field.type && f.key !== undefined)
|
|
2876
|
-
.map(f => f.key);
|
|
2874
|
+
const existingFieldKeys = this.formFields.filter(f => f.type === field.type && f.key !== undefined).map(f => f.key);
|
|
2877
2875
|
const next = this.findNextMissingNumber(existingFieldKeys);
|
|
2878
2876
|
const newField = { ...field, label: field.label, key: `${field.type}_${field.label.split(' ').join('-')}_${next}`, order: maxOrder + 1 };
|
|
2879
2877
|
this.formFields = [...this.formFields, newField];
|
|
@@ -3007,13 +3005,13 @@ const NylasBookingFormConfig = proxyCustomElement(class NylasBookingFormConfig e
|
|
|
3007
3005
|
this.formFieldsChangedHandler(this.formFields);
|
|
3008
3006
|
}
|
|
3009
3007
|
render() {
|
|
3010
|
-
return (h(Host, { key: '
|
|
3008
|
+
return (h(Host, { key: 'e0f16996249394ba2712e81a49cf36ea6564ec05' }, h("div", { key: '4dd44f9c72c8d0a3aeee984dfd84f17bff90625a', class: "nylas-booking-form-config", part: "nbfc" }, h("div", { key: '197adcf139b9039a986ddeb041c515094cebfd6c', class: "header", part: "nbfc__header" }, h("div", { key: 'b6c7ee7740f34772de476dd305fed249b44d2de6', class: "header_text" }, h("h3", { key: '47746821f80cde68397416f80082eb7010e7e6f4' }, instance.t('nylasBookingFormConfig.headerTitle')), h("p", { key: 'ca58778afafc99cf229c910c38a6267cb06094c5' }, instance.t('nylasBookingFormConfig.headerSubTitle'))), h("div", { key: '0d1ed1dc651aae41a02f25d4bef8a498a7efea6a', class: "header_action" }, h("select-dropdown", { key: 'be4c11be458c04dae1013cb9f90be5ea60969dd7', name: "add-field", exportparts: "sd_dropdown: nbfc__add_field, sd_dropdown-button: nbfc__add_field-button, sd_dropdown-content: nbfc__add_field-dropdown-content", options: this.fieldTypes, withSearch: false, withChevron: false, dropdownButtonText: instance.t('nylasBookingFormConfig.dropdownButtonText') }, h("span", { key: '2551ed804324718f1a2bf588a331c2c0a651d8c3', slot: "select-icon" }, h("plus-icon", { key: '98cdb1849e4cfa5dd62eb0d25b09018f23d6c55d', width: "15", height: "15" }))))), h("div", { key: 'fe7c1bdba3fc45544f7a9346142051e2626c9f0d', class: "content" }, h("div", { key: 'fd253106a51dd9bdb6745c2775f78d30f8f7a2e1', class: "additional_fields static_fields", part: "nbfc__static_fields" }, this.staticFields.map((field, i) => {
|
|
3011
3009
|
return (h("div", { class: `form-field draggable ${field.readonly && 'fixed'}`, part: "nbfc__form_field", key: i }, h("div", { class: "form-field_header", part: "nbfc__form_field-header" }, h("span", { class: "dragable" }, h("dragable-icon", { width: "24", height: "25" })), h("div", { class: "form-field_header_text" }, h("h4", null, instance.t(`nylasBookingFormConfig.fieldLabel.${field.fieldLabelKey}`)), h("p", null, field.typeLabel)), h("div", { class: "form-field_header_actions" }, h("span", { class: `is-required` }, field.required ? instance.t('required') : instance.t('optional')), h("span", { class: `chevron ${field.isOpen ? 'open' : 'closed'}`, onClick: () => {
|
|
3012
3010
|
this.fieldToggle(i);
|
|
3013
3011
|
} }, h("chevron-icon", { width: "24", height: "24" })))), h("div", { class: `form-field_content ${!field.isOpen && 'hidden'}`, part: "nbfc__form_field-content" }, h("div", { class: "inputs" }, h("input-component", { class: 'label-input', name: `${i}`, key: i, label: instance.t('nylasBookingFormConfig.label'), required: false, readOnly: field.readonly, defaultValue: field.label }, h("div", { class: "required-input", slot: "additional-input" }, h("input", { type: "checkbox", name: `required_${field.order}`, id: `required_${field.order}`, onClick: () => {
|
|
3014
3012
|
this.fieldRequired(i);
|
|
3015
3013
|
}, checked: field.required, disabled: field.readonly }), h("label", { htmlFor: `required_${field.order}`, "aria-label": "Required" }, instance.t('required'))))))));
|
|
3016
|
-
})), h("div", { key: '
|
|
3014
|
+
})), h("div", { key: '825ca08b506c8016f3d8206489bdeeee4b789c82', id: "fields", class: "additional_fields", part: "nbfc__additional_fields" }, this.formFields?.map((field, i) => {
|
|
3017
3015
|
return (h("div", { class: `form-field draggable ${field?.readonly ? 'fixed' : ''}`, part: "nbfc__form_field", key: field.key }, h("div", { class: "form-field_header", part: "nbfc__form_field-header" }, h("span", { class: "dragable" }, h("dragable-icon", { width: "24", height: "25" })), h("div", { class: "form-field_header_text" }, h("h4", null, instance.t(`nylasBookingFormConfig.fieldLabel.${field.fieldLabelKey}`)), h("p", null, field.typeLabel)), h("div", { class: "form-field_header_actions" }, h("span", { class: `is-required` }, field.required ? instance.t('required') : instance.t('optional')), !field.readonly && (h("button", { onClick: () => {
|
|
3018
3016
|
const title = this.watchFields.title;
|
|
3019
3017
|
const description = this.watchFields.description;
|