@nylas/web-elements 0.0.0-canary-20241015194719 → 0.0.0-canary-20241017103834
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/input-image-url/input-image-url.es.js +365 -365
- package/dist/cdn/nylas-additional-participants/nylas-additional-participants.es.js +46 -48
- package/dist/cdn/nylas-confirmation-email/nylas-confirmation-email.es.js +86 -82
- package/dist/cdn/nylas-custom-booking-flow/nylas-custom-booking-flow.es.js +1 -1
- package/dist/cdn/nylas-editor-tabs/nylas-editor-tabs.es.js +676 -674
- package/dist/cdn/nylas-event-duration/nylas-event-duration.es.js +228 -228
- package/dist/cdn/nylas-event-info/nylas-event-info.es.js +2 -2
- package/dist/cdn/nylas-event-limits/nylas-event-limits.es.js +2 -2
- package/dist/cdn/nylas-form-card/nylas-form-card.es.js +1 -1
- package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +93 -91
- package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +4 -3
- package/dist/cdn/nylas-timeslot-picker/nylas-timeslot-picker.es.js +4 -3
- package/dist/cjs/calendar-agenda-fill-icon_54.cjs.entry.js +37 -26
- package/dist/cjs/calendar-agenda-fill-icon_54.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js +2 -2
- package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-form-card.cjs.entry.js +1 -1
- package/dist/cjs/nylas-web-elements.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/design-system/input-image-url/input-image-url.js +20 -2
- package/dist/collection/components/design-system/input-image-url/input-image-url.js.map +1 -1
- package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js +2 -2
- package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js +12 -16
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/test/nylas-additional-participants.spec.js +106 -0
- package/dist/collection/components/scheduler-editor/nylas-additional-participants/test/nylas-additional-participants.spec.js.map +1 -0
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.js +52 -28
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/test/nylas-confirmation-email.spec.js +33 -0
- package/dist/collection/components/scheduler-editor/nylas-confirmation-email/test/nylas-confirmation-email.spec.js.map +1 -0
- package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js +5 -3
- package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-duration/test/nylas-event-duration.spec.js +55 -0
- package/dist/collection/components/scheduler-editor/nylas-event-duration/test/nylas-event-duration.spec.js.map +1 -0
- package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-form-card/nylas-form-card.js +1 -1
- package/dist/components/input-image-url2.js +6 -2
- package/dist/components/input-image-url2.js.map +1 -1
- package/dist/components/nylas-additional-participants2.js +12 -16
- package/dist/components/nylas-additional-participants2.js.map +1 -1
- package/dist/components/nylas-confirmation-email2.js +14 -5
- package/dist/components/nylas-confirmation-email2.js.map +1 -1
- package/dist/components/nylas-event-duration2.js +5 -3
- package/dist/components/nylas-event-duration2.js.map +1 -1
- package/dist/components/nylas-event-info2.js +1 -1
- package/dist/components/nylas-event-limits2.js +1 -1
- package/dist/components/nylas-form-card2.js +1 -1
- package/dist/components/nylas-timeslot-picker2.js +2 -2
- package/dist/components/nylas-timeslot-picker2.js.map +1 -1
- package/dist/esm/calendar-agenda-fill-icon_54.entry.js +37 -26
- package/dist/esm/calendar-agenda-fill-icon_54.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nylas-booked-event-card_12.entry.js +2 -2
- package/dist/esm/nylas-booked-event-card_12.entry.js.map +1 -1
- package/dist/esm/nylas-form-card.entry.js +1 -1
- package/dist/esm/nylas-web-elements.js +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
- package/dist/nylas-web-elements/{p-698d229c.entry.js → p-7a1d51ab.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-698d229c.entry.js.map → p-7a1d51ab.entry.js.map} +1 -1
- package/dist/nylas-web-elements/p-bbf86b8c.entry.js +2 -0
- package/dist/nylas-web-elements/p-df131a08.entry.js +8 -0
- package/dist/nylas-web-elements/p-df131a08.entry.js.map +1 -0
- package/dist/types/components/design-system/input-image-url/input-image-url.d.ts +4 -0
- package/dist/types/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.d.ts +1 -1
- package/dist/types/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.d.ts +5 -1
- package/dist/types/components.d.ts +18 -6
- package/package.json +3 -3
- package/dist/nylas-web-elements/p-b9a8d404.entry.js +0 -8
- package/dist/nylas-web-elements/p-b9a8d404.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-f4334e3a.entry.js +0 -2
- /package/dist/nylas-web-elements/{p-f4334e3a.entry.js.map → p-bbf86b8c.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nylas-additional-participants.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,MAAM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AiH;QACjI,IAAI,EAAE,+BAA+B;QACrC,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,wCAAwC,EAAE,oBAAoB,CAAC;YAChE,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;YAClE,CAAC,6BAA6B,EAAE,aAAa,CAAC;SAC/C,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;yDAiGD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Host, Prop, State, Watch, h, Element, Listen, EventEmitter } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Event } from '@stencil/core';\nimport { AdditionalParticipant, Configuration } from '@nylas/core';\nimport { User } from '@/common/nylas-api-request';\n\ntype Participant = {\n name?: string;\n email: string;\n is_valid?: boolean;\n is_organizer?: boolean;\n availability?: Availability;\n booking?: Booking;\n};\ntype Availability = {\n calendar_ids: string[];\n};\ntype Booking = {\n calendar_id: string;\n};\n\n/**\n * The `nylas-additional-participants` component is a form input for adding additional participants to an event.\n *\n * @part nap__title - The title of the component.\n * @part nap__subtitle - The subtitle of the component.\n * @part nap__content - The content of the component.\n * @part nap__input_group - The input group of the component.\n * @part nap__input_wrapper - The input wrapper of the component.\n * @part nap__input - The input of the component.\n * @part nap__remove-participant - The remove participant button of the component.\n * @part nap__add-participant - The add participant button of the component.\n *\n */\n@Component({\n tag: 'nylas-additional-participants',\n styleUrl: 'nylas-additional-participants.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasAdditionalParticipants {\n @Element() host!: HTMLNylasAdditionalParticipantsElement;\n /**\n * @standalone\n * The name of the component\n */\n @Prop() name: string = 'participants';\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * @standalone\n * The logged in user\n */\n @Prop() currentUser?: User;\n /**\n * @standalone\n * The additional participants options from the config\n */\n @Prop() participantOptions?: AdditionalParticipant[];\n /**\n * @standalone\n * The event participants\n */\n @Prop() eventParticipants?: Participant[];\n\n @AttachInternals() internals!: ElementInternals;\n @State() participants: Participant[] = this.eventParticipants ?? [];\n @State() participantErrors: { [key: string]: string } = {};\n @State() includeOrganizerAsParticipant: boolean = true;\n @State() isRoundRobinConfig: boolean = this.selectedConfiguration?.availability?.availability_rules?.availability_method !== 'collective';\n @State() error: string = '';\n\n /**\n * This event is fired when the selected participants change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-additional-participants', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-additional-participants', 'selectedConfigurationChangedHandler', newValue);\n this.isRoundRobinConfig = newValue?.availability?.availability_rules?.availability_method !== 'collective';\n this.participants = newValue?.participants || [];\n this.updateOrganizerAsParticipant();\n }\n\n connectedCallback() {\n debug('nylas-additional-participants', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-additional-participants', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-additional-participants', 'componentDidLoad');\n this.isRoundRobinConfig = this.selectedConfiguration?.availability?.availability_rules?.availability_method !== 'collective';\n this.includeOrganizerAsParticipant = this.isRoundRobinConfig && this.participants.find(p => p.email === this.currentUser?.email) ? true : false;\n\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n } else {\n this.updateOrganizerAsParticipant();\n }\n }\n\n disconnectedCallback() {\n debug('nylas-additional-participants', 'disconnectedCallback');\n }\n\n @Listen('inputOptionChanged')\n onInputOptionChanged(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-additional-participants', 'onInputOptionChanged');\n const EMAIL_REGEX = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/;\n const index = event.detail.name;\n const participant = this.participantOptions?.find(participant => participant.email === event.detail.value);\n\n if (!participant && this.isRoundRobinConfig) {\n this.internals.setValidity({ customError: true }, 'For round robin configuration, participant should be selected from the dropdown.');\n this.participantErrors[index] = 'For round robin page, participant should be selected from the dropdown.';\n this.participants[index].is_valid = false;\n this.participants = [...this.participants];\n return;\n } else if (!participant && !EMAIL_REGEX.test(event.detail.value)) {\n this.internals.setValidity({ customError: true }, 'Please enter a valid email address');\n this.participantErrors[index] = 'Please enter a valid email address';\n this.participants[index].is_valid = false;\n this.participants = [...this.participants];\n return;\n } else {\n this.participantErrors[index] = '';\n this.participants[index].is_valid = true;\n this.internals.setValidity({});\n }\n this.participants[index].email = event.detail.value;\n this.participants[index].availability = participant ? { calendar_ids: ['primary'] } : undefined;\n // If round-robin config, set booking calendar to primary for all participants\n this.participants[index].booking = participant && this.isRoundRobinConfig ? { calendar_id: 'primary' } : undefined;\n this.participants[index].name = participant?.name || event.detail.value;\n this.participants = [...this.participants];\n this.updateFormValue();\n }\n\n updateOrganizerAsParticipant() {\n const findCurrentUserInParticipants = this.participants.find(p => p.email === this.currentUser?.email);\n if (this.isRoundRobinConfig && !findCurrentUserInParticipants && this.currentUser?.email) {\n this.participants = [\n {\n name: this.currentUser?.name,\n email: this.currentUser?.email,\n is_organizer: true,\n availability: {\n calendar_ids: ['primary'],\n },\n booking: {\n calendar_id: 'primary',\n },\n },\n ...this.participants,\n ];\n }\n this.updateFormValue();\n }\n\n addParticipant() {\n debug('nylas-additional-participants', 'addParticipant');\n this.participants = [...this.participants, { name: '', email: '', is_organizer: false }];\n this.updateFormValue();\n }\n removeParticipant(index: number) {\n debug('nylas-additional-participants', 'removeParticipant');\n this.participants = this.participants.filter((_, i) => i !== index);\n this.updateFormValue();\n }\n validate(email, index) {\n debug('nylas-additional-participants', 'validate');\n const regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n const valid = regex.test(String(email).toLowerCase());\n this.participants[index].is_valid = valid;\n this.updateFormValue();\n }\n\n updateFormValue() {\n debug('nylas-additional-participants', 'updateFormValue');\n const participants = this.isRoundRobinConfig ? (this.includeOrganizerAsParticipant ? this.participants : this.participants.filter(p => !p.is_organizer)) : this.participants;\n if (participants.length === 0) {\n this.internals.setValidity({ customError: true }, 'Please add at least one participant');\n this.error = 'Please add at least one participant';\n } else {\n this.internals.setValidity({});\n this.error = '';\n this.internals.setFormValue(JSON.stringify(participants), this.name);\n this.valueChanged.emit({ value: JSON.stringify(participants), name: this.name });\n }\n }\n\n // Filter out the participants that are already added\n getArrayDifference(array1: AdditionalParticipant[], array2: Participant[]) {\n const filtered = array1.filter(participant1 => !array2.some(participant2 => participant1.email === participant2.email));\n return filtered.map(participant => {\n return { value: participant.email, label: participant.email };\n });\n }\n\n @RegisterComponent<NylasAdditionalParticipants, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-additional-participants',\n stateToProps: new Map([\n ['schedulerConfig.additionalParticipants', 'participantOptions'],\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.currentUser', 'currentUser'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host part=\"nap\">\n <nylas-form-card>\n <h3 slot=\"header-title\" class=\"nylas-additional-participants__title\" part=\"nap__title\">\n Participants\n </h3>\n <p slot=\"header-subtitle\" class=\"nylas-additional-participants__subtitle\" part=\"nap__subtitle\">\n Add people in your team or organization to join the event.\n </p>\n <div slot=\"content\" class=\"nylas-additional-participants__content\">\n <div>\n {this.participants.map((participant, index) => {\n return (\n <div class={'nylas-additional-participants__input_group'} part=\"nap__input_group\">\n {!participant.is_organizer && <label>{`Participant ${index}`}</label>}\n <div\n part=\"nap__input_wrapper\"\n class={{\n 'nylas-additional-participants__input_wrapper': true,\n 'nylas-additional-participants__input_wrapper_organizer': participant?.is_organizer === true,\n 'nylas-additional-participants__input_wrapper_invalid': participant.is_valid === false,\n 'error': participant.is_valid === false,\n }}\n >\n <div class={{ 'nylas-additional-participants__input': true, 'organizer': participant?.is_organizer === true }} part=\"nap__input\">\n {participant.is_organizer ? (\n <input-component\n class={'label-input'}\n name={`${index}`}\n key={index}\n label=\"Organizer\"\n required={false}\n readOnly={participant.is_organizer}\n defaultValue={participant.email}\n >\n {this.isRoundRobinConfig && (\n <div class=\"required-input\" slot=\"additional-input\">\n <input\n type=\"checkbox\"\n name={`organizer_participant`}\n id={`organizer_participant`}\n onClick={() => {\n this.includeOrganizerAsParticipant = !this.includeOrganizerAsParticipant;\n this.updateFormValue();\n }}\n checked={this.includeOrganizerAsParticipant}\n />\n <label htmlFor={`organizer_participant`} aria-label=\"Include as participant\">\n Participant\n <tooltip-component id=\"organizer_participant_tooltip\">\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">\n <strong>Include Organizer:</strong> The organizer (you) will be included in the round-robin rotation. <br />\n <strong>Exclude Organizer:</strong> The organizer (you) will not be included in the round-robin rotation.\n </span>\n </tooltip-component>\n </label>\n </div>\n )}\n </input-component>\n ) : (\n <input-dropdown\n id={`${index}`}\n name={`${index}`}\n filterable={true}\n inputValue={participant.email}\n options={this.getArrayDifference(this.participantOptions || [], this.participants)}\n />\n )}\n {!participant.is_organizer && (\n <button onClick={() => this.removeParticipant(index)} part=\"nap__remove-participant\">\n <close-icon />\n </button>\n )}\n </div>\n </div>\n {!participant.is_valid && (\n <p class=\"nylas-additional-participants__error\" part=\"nap__error\">\n {this.participantErrors[index]}\n </p>\n )}\n </div>\n );\n })}\n <p class=\"nylas-additional-participants__error\" part=\"nap__error\">\n {this.error}\n </p>\n </div>\n <button class=\"nylas-additional-participants__add\" part=\"nap__add-participant\" onClick={() => this.addParticipant()}>\n <add-circle-icon /> <span>Add {this.participants.length > 1 ? 'another' : 'a'} participant</span>\n </button>\n </div>\n </nylas-form-card>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nylas-additional-participants.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.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,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAEvH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAsCtC,MAAM,OAAO,2BAA2B;;oBAMf,cAAc;;;;;4BAuBE,IAAI,CAAC,iBAAiB,IAAI,EAAE;iCACX,EAAE;6CACR,IAAI;kCACf,IAAI,CAAC,qBAAqB,EAAE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,KAAK,YAAY;qBAChH,EAAE;;IAgB3B,yBAAyB,CAAC,QAAgB;QACxC,KAAK,CAAC,+BAA+B,EAAE,2BAA2B,EAAE,QAAQ,CAAC,CAAC;QAC9E,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAGD,mCAAmC,CAAC,QAAuB;QACzD,KAAK,CAAC,+BAA+B,EAAE,qCAAqC,EAAE,QAAQ,CAAC,CAAC;QACxF,IAAI,CAAC,kBAAkB,GAAG,QA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,CACA;oBACN,+DAAQ,KAAK,EAAC,oCAAoC,EAAC,IAAI,EAAC,sBAAsB,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE;wBACjH,yEAAmB;;wBAAC;;4BAAW,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG;2CAAoB,CAC1F,CACL,CACU,CACb,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAjGC;IAVC,iBAAiB,CAAiH;QACjI,IAAI,EAAE,+BAA+B;QACrC,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,wCAAwC,EAAE,oBAAoB,CAAC;YAChE,CAAC,uCAAuC,EAAE,uBAAuB,CAAC;YAClE,CAAC,6BAA6B,EAAE,aAAa,CAAC;SAC/C,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;yDAiGD","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Host, Prop, State, Watch, h, Element, Listen, EventEmitter } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { Event } from '@stencil/core';\nimport { AdditionalParticipant, Configuration } from '@nylas/core';\nimport { User } from '@/common/nylas-api-request';\n\ntype Participant = {\n name?: string;\n email: string;\n is_valid?: boolean;\n is_organizer?: boolean;\n availability?: Availability;\n booking?: Booking;\n};\ntype Availability = {\n calendar_ids: string[];\n};\ntype Booking = {\n calendar_id: string;\n};\n\n/**\n * The `nylas-additional-participants` component is a form input for adding additional participants to an event.\n *\n * @part nap__title - The title of the component.\n * @part nap__subtitle - The subtitle of the component.\n * @part nap__content - The content of the component.\n * @part nap__input_group - The input group of the component.\n * @part nap__input_wrapper - The input wrapper of the component.\n * @part nap__input - The input of the component.\n * @part nap__remove-participant - The remove participant button of the component.\n * @part nap__add-participant - The add participant button of the component.\n *\n */\n@Component({\n tag: 'nylas-additional-participants',\n styleUrl: 'nylas-additional-participants.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasAdditionalParticipants {\n @Element() host!: HTMLNylasAdditionalParticipantsElement;\n /**\n * @standalone\n * The name of the component\n */\n @Prop() name: string = 'participants';\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * @standalone\n * The logged in user\n */\n @Prop() currentUser?: User;\n /**\n * @standalone\n * The additional participants options from the config\n */\n @Prop() participantOptions?: AdditionalParticipant[];\n /**\n * @standalone\n * The event participants\n */\n @Prop() eventParticipants?: Participant[];\n\n @AttachInternals() internals!: ElementInternals;\n @State() participants: Participant[] = this.eventParticipants ?? [];\n @State() participantErrors: { [key: string]: string } = {};\n @State() includeOrganizerAsParticipant: boolean = true;\n @State() isRoundRobinConfig: boolean = this.selectedConfiguration?.availability?.availability_rules?.availability_method !== 'collective';\n @State() error: string = '';\n\n /**\n * This event is fired when the selected participants change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-additional-participants', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-additional-participants', 'selectedConfigurationChangedHandler', newValue);\n this.isRoundRobinConfig = newValue?.availability?.availability_rules?.availability_method !== 'collective';\n this.participants = newValue?.participants || [];\n this.updateOrganizerAsParticipant();\n }\n\n connectedCallback() {\n debug('nylas-additional-participants', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-additional-participants', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-additional-participants', 'componentDidLoad');\n this.isRoundRobinConfig = this.selectedConfiguration?.availability?.availability_rules?.availability_method !== 'collective';\n this.includeOrganizerAsParticipant = this.isRoundRobinConfig && this.participants.find(p => p.email === this.currentUser?.email) ? true : false;\n\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n } else {\n this.updateOrganizerAsParticipant();\n }\n }\n\n disconnectedCallback() {\n debug('nylas-additional-participants', 'disconnectedCallback');\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 isInternalsAvailable() {\n return this.internals !== undefined && typeof this.internals.setFormValue === 'function' && typeof this.internals.setValidity === 'function';\n }\n\n @Listen('inputOptionChanged')\n onInputOptionChanged(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-additional-participants', 'onInputOptionChanged');\n const EMAIL_REGEX = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;\n const index = event.detail.name;\n const participant = this.participantOptions?.find(participant => participant.email === event.detail.value);\n\n if (!participant && this.isRoundRobinConfig) {\n this.isInternalsAvailable() && this.internals.setValidity({ customError: true }, 'For round robin configuration, participant should be selected from the dropdown.');\n this.participantErrors[index] = 'For round robin page, participant should be selected from the dropdown.';\n this.participants[index].is_valid = false;\n this.participants = [...this.participants];\n return;\n } else if (!participant && !EMAIL_REGEX.test(event.detail.value)) {\n this.isInternalsAvailable() && this.internals.setValidity({ customError: true }, 'Please enter a valid email address');\n this.participantErrors[index] = 'Please enter a valid email address';\n this.participants[index].is_valid = false;\n this.participants = [...this.participants];\n return;\n } else {\n this.participantErrors[index] = '';\n this.participants[index].is_valid = true;\n this.isInternalsAvailable() && this.internals.setValidity({});\n }\n this.participants[index].email = event.detail.value;\n this.participants[index].availability = participant ? { calendar_ids: ['primary'] } : undefined;\n // If round-robin config, set booking calendar to primary for all participants\n this.participants[index].booking = participant && this.isRoundRobinConfig ? { calendar_id: 'primary' } : undefined;\n this.participants[index].name = participant?.name || event.detail.value;\n this.participants = [...this.participants];\n this.updateFormValue();\n }\n\n updateOrganizerAsParticipant() {\n const findCurrentUserInParticipants = this.participants.find(p => p.email === this.currentUser?.email);\n if (this.isRoundRobinConfig && !findCurrentUserInParticipants && this.currentUser?.email) {\n this.participants = [\n {\n name: this.currentUser?.name,\n email: this.currentUser?.email,\n is_organizer: true,\n availability: {\n calendar_ids: ['primary'],\n },\n booking: {\n calendar_id: 'primary',\n },\n },\n ...this.participants,\n ];\n }\n this.updateFormValue();\n }\n\n addParticipant() {\n debug('nylas-additional-participants', 'addParticipant');\n this.participants = [...this.participants, { name: '', email: '', is_organizer: false }];\n this.updateFormValue();\n }\n removeParticipant(index: number) {\n debug('nylas-additional-participants', 'removeParticipant');\n this.participants = this.participants.filter((_, i) => i !== index);\n this.updateFormValue();\n }\n\n updateFormValue() {\n debug('nylas-additional-participants', 'updateFormValue');\n const participants = this.isRoundRobinConfig ? (this.includeOrganizerAsParticipant ? this.participants : this.participants.filter(p => !p.is_organizer)) : this.participants;\n if (participants.length === 0) {\n this.isInternalsAvailable() && this.internals.setValidity({ customError: true }, 'Please add at least one participant');\n this.error = 'Please add at least one participant';\n } else {\n this.isInternalsAvailable() && this.internals.setValidity({});\n this.error = '';\n this.isInternalsAvailable() && this.internals.setFormValue(JSON.stringify(participants), this.name);\n this.valueChanged.emit({ value: JSON.stringify(participants), name: this.name });\n }\n }\n\n // Filter out the participants that are already added\n getArrayDifference(array1: AdditionalParticipant[], array2: Participant[]) {\n const filtered = array1.filter(participant1 => !array2.some(participant2 => participant1.email === participant2.email));\n return filtered.map(participant => {\n return { value: participant.email, label: participant.email };\n });\n }\n\n @RegisterComponent<NylasAdditionalParticipants, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-additional-participants',\n stateToProps: new Map([\n ['schedulerConfig.additionalParticipants', 'participantOptions'],\n ['schedulerConfig.selectedConfiguration', 'selectedConfiguration'],\n ['schedulerConfig.currentUser', 'currentUser'],\n ]),\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host part=\"nap\">\n <nylas-form-card>\n <h3 slot=\"header-title\" class=\"nylas-additional-participants__title\" part=\"nap__title\">\n Participants\n </h3>\n <p slot=\"header-subtitle\" class=\"nylas-additional-participants__subtitle\" part=\"nap__subtitle\">\n Add people in your team or organization to join the event.\n </p>\n <div slot=\"content\" class=\"nylas-additional-participants__content\">\n <div>\n {this.participants.map((participant, index) => {\n return (\n <div class={'nylas-additional-participants__input_group'} part=\"nap__input_group\">\n {!participant.is_organizer && <label>{`Participant ${index}`}</label>}\n <div\n part=\"nap__input_wrapper\"\n class={{\n 'nylas-additional-participants__input_wrapper': true,\n 'nylas-additional-participants__input_wrapper_organizer': participant?.is_organizer === true,\n 'nylas-additional-participants__input_wrapper_invalid': participant.is_valid === false,\n 'error': participant.is_valid === false,\n }}\n >\n <div class={{ 'nylas-additional-participants__input': true, 'organizer': participant?.is_organizer === true }} part=\"nap__input\">\n {participant.is_organizer ? (\n <input-component\n class={'label-input'}\n name={`${index}`}\n key={index}\n label=\"Organizer\"\n required={false}\n readOnly={participant.is_organizer}\n defaultValue={participant.email}\n >\n {this.isRoundRobinConfig && (\n <div class=\"required-input\" slot=\"additional-input\">\n <input\n type=\"checkbox\"\n name={`organizer_participant`}\n id={`organizer_participant`}\n onClick={() => {\n this.includeOrganizerAsParticipant = !this.includeOrganizerAsParticipant;\n this.updateFormValue();\n }}\n checked={this.includeOrganizerAsParticipant}\n />\n <label htmlFor={`organizer_participant`} aria-label=\"Include as participant\">\n Participant\n <tooltip-component id=\"organizer_participant_tooltip\">\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">\n <strong>Include Organizer:</strong> The organizer (you) will be included in the round-robin rotation. <br />\n <strong>Exclude Organizer:</strong> The organizer (you) will not be included in the round-robin rotation.\n </span>\n </tooltip-component>\n </label>\n </div>\n )}\n </input-component>\n ) : (\n <input-dropdown\n id={`${index}`}\n name={`${index}`}\n filterable={true}\n inputValue={participant.email}\n options={this.getArrayDifference(this.participantOptions || [], this.participants)}\n />\n )}\n {!participant.is_organizer && (\n <button onClick={() => this.removeParticipant(index)} part=\"nap__remove-participant\">\n <close-icon />\n </button>\n )}\n </div>\n </div>\n {!participant.is_valid && (\n <p class=\"nylas-additional-participants__error\" part=\"nap__error\">\n {this.participantErrors[index]}\n </p>\n )}\n </div>\n );\n })}\n <p class=\"nylas-additional-participants__error\" part=\"nap__error\">\n {this.error}\n </p>\n </div>\n <button class=\"nylas-additional-participants__add\" part=\"nap__add-participant\" onClick={() => this.addParticipant()}>\n <add-circle-icon /> <span>Add {this.participants.length > 1 ? 'another' : 'a'} participant</span>\n </button>\n </div>\n </nylas-form-card>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
+
import { NylasAdditionalParticipants } from "../nylas-additional-participants";
|
|
3
|
+
import { InputDropdown } from "../../../design-system/input-dropdown/input-dropdown";
|
|
4
|
+
import { NylasFormCard } from "../../nylas-form-card/nylas-form-card";
|
|
5
|
+
import { h } from "@stencil/core";
|
|
6
|
+
import { selectedConfiguration } from "../../../../utils/test-utils";
|
|
7
|
+
describe('nylas-additional-participants', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
jest.clearAllMocks();
|
|
10
|
+
});
|
|
11
|
+
it('renders', async () => {
|
|
12
|
+
const page = await newSpecPage({
|
|
13
|
+
components: [InputDropdown, NylasAdditionalParticipants],
|
|
14
|
+
template: () => {
|
|
15
|
+
return h("nylas-additional-participants", { name: "additionalParticipants" });
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
await page.waitForChanges();
|
|
19
|
+
expect(page.root).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
it('should not error for emails ending with .travel or .museum', async () => {
|
|
22
|
+
let nylasAdditionalParticipant;
|
|
23
|
+
const page = await newSpecPage({
|
|
24
|
+
components: [NylasFormCard, InputDropdown, NylasAdditionalParticipants],
|
|
25
|
+
template: () => {
|
|
26
|
+
return (h("nylas-additional-participants", { name: "additionalParticipants", selectedConfiguration: {
|
|
27
|
+
...selectedConfiguration,
|
|
28
|
+
availability: {
|
|
29
|
+
...selectedConfiguration.availability,
|
|
30
|
+
availability_rules: {
|
|
31
|
+
...selectedConfiguration.availability.availability_rules,
|
|
32
|
+
availability_method: 'collective',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}, participantOptions: [
|
|
36
|
+
{
|
|
37
|
+
name: 'Jane Doe',
|
|
38
|
+
email: 'janedoe@example.com',
|
|
39
|
+
calendars: [
|
|
40
|
+
{
|
|
41
|
+
id: 'janedoe@example.com',
|
|
42
|
+
name: 'Jane Doe',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
] }));
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
nylasAdditionalParticipant = page.rootInstance;
|
|
50
|
+
await page.waitForChanges();
|
|
51
|
+
nylasAdditionalParticipant.addParticipant();
|
|
52
|
+
await page.waitForChanges();
|
|
53
|
+
const inputEvent = new CustomEvent('nylasFormInputChanged', {
|
|
54
|
+
detail: {
|
|
55
|
+
name: '1',
|
|
56
|
+
value: 'newemail@example.travel',
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
nylasAdditionalParticipant.onInputOptionChanged(inputEvent);
|
|
60
|
+
await page.waitForChanges();
|
|
61
|
+
expect(page.root).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
it('should not error for emails ending with .travel or .museum', async () => {
|
|
64
|
+
let nylasAdditionalParticipant;
|
|
65
|
+
const page = await newSpecPage({
|
|
66
|
+
components: [NylasFormCard, InputDropdown, NylasAdditionalParticipants],
|
|
67
|
+
template: () => {
|
|
68
|
+
return (h("nylas-additional-participants", { name: "additionalParticipants", selectedConfiguration: {
|
|
69
|
+
...selectedConfiguration,
|
|
70
|
+
availability: {
|
|
71
|
+
...selectedConfiguration.availability,
|
|
72
|
+
availability_rules: {
|
|
73
|
+
...selectedConfiguration.availability.availability_rules,
|
|
74
|
+
availability_method: 'collective',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
}, participantOptions: [
|
|
78
|
+
{
|
|
79
|
+
name: 'Jane Doe',
|
|
80
|
+
email: 'janedoe@example.com',
|
|
81
|
+
calendars: [
|
|
82
|
+
{
|
|
83
|
+
id: 'janedoe@example.com',
|
|
84
|
+
name: 'Jane Doe',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
] }));
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
nylasAdditionalParticipant = page.rootInstance;
|
|
92
|
+
await page.waitForChanges();
|
|
93
|
+
nylasAdditionalParticipant.addParticipant();
|
|
94
|
+
await page.waitForChanges();
|
|
95
|
+
const inputEvent = new CustomEvent('nylasFormInputChanged', {
|
|
96
|
+
detail: {
|
|
97
|
+
name: '1',
|
|
98
|
+
value: 'abcd',
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
nylasAdditionalParticipant.onInputOptionChanged(inputEvent);
|
|
102
|
+
await page.waitForChanges();
|
|
103
|
+
expect(page.root).toMatchSnapshot();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=nylas-additional-participants.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nylas-additional-participants.spec.js","sourceRoot":"","sources":["../../../../../src/components/scheduler-editor/nylas-additional-participants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AAG,qBAAqB,CAAC,YAAY,CAAC,kBAAkB;gCACxD,mBAAmB,EAAE,YAAY;6BAClC;yBACF;qBACF,EACD,kBAAkB,EAAE;wBAClB;4BACE,IAAI,EAAE,UAAU;4BAChB,KAAK,EAAE,qBAAqB;4BAC5B,SAAS,EAAE;gCACT;oCACE,EAAE,EAAE,qBAAqB;oCACzB,IAAI,EAAE,UAAU;iCACjB;6BACF;yBACF;qBACF,GACD,CACH,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;QACH,0BAA0B,GAAG,IAAI,CAAC,YAAY,CAAC;QAC/C,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,0BAA0B,CAAC,cAAc,EAAE,CAAC;QAC5C,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,uBAAuB,EAAE;YAC1D,MAAM,EAAE;gBACN,IAAI,EAAE,GAAG;gBACT,KAAK,EAAE,MAAM;aACd;SACF,CAAC,CAAC;QACH,0BAA0B,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAC5D,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { NylasAdditionalParticipants } from '../nylas-additional-participants';\nimport { InputDropdown } from '../../../design-system/input-dropdown/input-dropdown';\nimport { NylasFormCard } from '../../nylas-form-card/nylas-form-card';\nimport { h } from '@stencil/core';\nimport { selectedConfiguration } from '@/utils/test-utils';\n\ndescribe('nylas-additional-participants', () => {\n beforeEach(() => {\n // Clear and reset the mock before each test if needed\n jest.clearAllMocks();\n });\n\n it('renders', async () => {\n const page = await newSpecPage({\n components: [InputDropdown, NylasAdditionalParticipants],\n template: () => {\n return <nylas-additional-participants name=\"additionalParticipants\" />;\n },\n });\n\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot();\n });\n\n it('should not error for emails ending with .travel or .museum', async () => {\n let nylasAdditionalParticipant: NylasAdditionalParticipants;\n const page = await newSpecPage({\n components: [NylasFormCard, InputDropdown, NylasAdditionalParticipants],\n template: () => {\n return (\n <nylas-additional-participants\n name=\"additionalParticipants\"\n selectedConfiguration={{\n ...selectedConfiguration,\n availability: {\n ...selectedConfiguration.availability,\n availability_rules: {\n ...selectedConfiguration.availability.availability_rules,\n availability_method: 'collective',\n },\n },\n }}\n participantOptions={[\n {\n name: 'Jane Doe',\n email: 'janedoe@example.com',\n calendars: [\n {\n id: 'janedoe@example.com',\n name: 'Jane Doe',\n },\n ],\n },\n ]}\n />\n );\n },\n });\n nylasAdditionalParticipant = page.rootInstance;\n await page.waitForChanges();\n nylasAdditionalParticipant.addParticipant();\n await page.waitForChanges();\n const inputEvent = new CustomEvent('nylasFormInputChanged', {\n detail: {\n name: '1',\n value: 'newemail@example.travel',\n },\n });\n nylasAdditionalParticipant.onInputOptionChanged(inputEvent);\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot();\n });\n\n it('should not error for emails ending with .travel or .museum', async () => {\n let nylasAdditionalParticipant: NylasAdditionalParticipants;\n const page = await newSpecPage({\n components: [NylasFormCard, InputDropdown, NylasAdditionalParticipants],\n template: () => {\n return (\n <nylas-additional-participants\n name=\"additionalParticipants\"\n selectedConfiguration={{\n ...selectedConfiguration,\n availability: {\n ...selectedConfiguration.availability,\n availability_rules: {\n ...selectedConfiguration.availability.availability_rules,\n availability_method: 'collective',\n },\n },\n }}\n participantOptions={[\n {\n name: 'Jane Doe',\n email: 'janedoe@example.com',\n calendars: [\n {\n id: 'janedoe@example.com',\n name: 'Jane Doe',\n },\n ],\n },\n ]}\n />\n );\n },\n });\n nylasAdditionalParticipant = page.rootInstance;\n await page.waitForChanges();\n nylasAdditionalParticipant.addParticipant();\n await page.waitForChanges();\n const inputEvent = new CustomEvent('nylasFormInputChanged', {\n detail: {\n name: '1',\n value: 'abcd',\n },\n });\n nylasAdditionalParticipant.onInputOptionChanged(inputEvent);\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|
|
@@ -19,9 +19,9 @@ export class NylasConfirmationEmail {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
this.selectedConfiguration = undefined;
|
|
21
21
|
this.confirmationEmailTemplate = {};
|
|
22
|
-
this.isOpen = false;
|
|
23
22
|
this.participants = [];
|
|
24
23
|
this.name = 'confirmation-email-template';
|
|
24
|
+
this.isOpen = false;
|
|
25
25
|
this.confirmationEmail = undefined;
|
|
26
26
|
this.isConfirmationEmailOpen = this.isOpen;
|
|
27
27
|
this.participantsState = this.participants;
|
|
@@ -74,8 +74,17 @@ export class NylasConfirmationEmail {
|
|
|
74
74
|
const { value, name } = event.detail;
|
|
75
75
|
if (name === 'confirmation-email-logo') {
|
|
76
76
|
this.confirmationEmail = { ...this.confirmationEmail, logo: value };
|
|
77
|
-
this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);
|
|
78
77
|
this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });
|
|
78
|
+
if (typeof this.internals.setValidity === 'function' && typeof this.internals.setFormValue === 'function') {
|
|
79
|
+
this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);
|
|
80
|
+
this.internals.setValidity({});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async nylasFormInputImageUrlInvalidHandler(event) {
|
|
85
|
+
const { value, name } = event.detail;
|
|
86
|
+
if (name === 'confirmation-email-logo' && typeof this.internals.setValidity === 'function') {
|
|
87
|
+
this.internals.setValidity({ customError: true }, value || 'Invalid image URL.');
|
|
79
88
|
}
|
|
80
89
|
}
|
|
81
90
|
updateConfirmationFormValue() {
|
|
@@ -95,7 +104,7 @@ export class NylasConfirmationEmail {
|
|
|
95
104
|
render() {
|
|
96
105
|
const organizer = this.participantsState.find(p => p.is_organizer);
|
|
97
106
|
const organizerName = organizer?.name || organizer?.email;
|
|
98
|
-
return (h(Host, { key: '
|
|
107
|
+
return (h(Host, { key: 'bc4803b94f914d083bd33cf4cecd0cac70b0658c' }, h("div", { key: '6445d38b903bffd19b4db004e850f6488ed4c27f', class: "nylas-confirmation-email", part: "nce" }, h("div", { key: '7ce1ccd72ef83717aec42fe0b533902e3a254796', class: "header", part: "nce__header" }, h("div", { key: 'cbceb816c30deebc4e053a7abd1da1c82c171ebe' }, h("h3", { key: '36f5b00d5a98d325341ff06b2bb3ba3cf951e94f' }, this.confirmationEmail?.booking_confirmed?.title ?? `Booking confirmed with ${organizerName ? ` ${organizerName}` : ''}`), h("p", { key: '6f72022d71e5f4e3c03d0f6d07d7f0f5bc0f9686' }, "Booking confirmation email")), this.isConfirmationEmailOpen ? (h("div", { class: "confirmation-email-toggle", part: "nce__confirmation-email-toggle--container" }, h("span", { class: `chevron ${this.isConfirmationEmailOpen ? 'open' : 'closed'} `, onClick: () => this.toggleConfirmationEmail() }, h("chevron-icon", { width: "24", height: "24" })))) : (h("button-component", { variant: 'basic', clickHandler: event => {
|
|
99
108
|
event.preventDefault();
|
|
100
109
|
this.toggleConfirmationEmail();
|
|
101
110
|
} }, h("edit-icon", { width: "16", height: "16" }), "Edit"))), this.isConfirmationEmailOpen ? (h("div", { class: "nylas-confirmation-email__body", part: "nce__body" }, h("div", { class: "nylas-confirmation-email__section" }, h("div", { class: "nylas-confirmation-email__row" }, h("label", null, "Send confirmation email", h("span", { class: "label-icon" }, h("tooltip-component", null, h("info-icon", { slot: "tooltip-icon" }), h("span", { slot: "tooltip-content" }, "You and your guests will receive a confirmation email immediately upon booking.")))), h("span", { class: "selected-value" }, "Immediately upon booking")), h("div", { class: "nylas-confirmation-email__row" }, h("div", { class: "subsection" }, h("div", { class: "input-container" }, h("label", null, "Company logo URL", h("span", { class: "label-icon" }, h("tooltip-component", null, h("info-icon", { slot: "tooltip-icon" }), h("span", { slot: "tooltip-content" }, "This logo appears in the booking confirmation email. The URL must be publicly accessible. The image will be scaled down to a max size of 200px x 100px.")))), this.confirmationEmail && (h("input-image-url", { name: "confirmation-email-logo", exportparts: "iiu__logo-input-textfield: nce__input-image-url", imageUrl: this.confirmationEmail?.logo ?? '' }))))), h("div", { class: "nylas-confirmation-email__row full-width-col" }, h("div", { class: "subsection" }, h("h3", null, "Email message"), h("div", { class: "input-container" }, h("label", { htmlFor: "title" }, "Custom email title", h("span", { class: "label-icon" }, h("tooltip-component", null, h("info-icon", { slot: "tooltip-icon" }), h("span", { slot: "tooltip-content" }, "An email title is a headline within the body of the email. This doesn't change the subject line.")))), h("input-component", { name: "confirmation-email-title", maxLength: 60, placeholder: `Booking confirmed ${organizerName ? `with ${organizerName}` : ''}`, defaultValue: this.confirmationEmail?.booking_confirmed?.title ?? '' })), h("div", { class: "input-container" }, h("textarea-component", { label: "Additional info", name: "confirmation-email-body", id: "confirmation-email-body", placeholder: "Default body", tooltip: "Scheduler adds the content of the box to the email body.", maxLength: 500, defaultValue: this.confirmationEmail?.booking_confirmed?.body ?? '' }))))))) : (h("div", { class: "nylas-confirmation-email__summary", part: "nce__summary" }, h("p", null, h("span", { class: "summary-icon" }, h("person-clipboard-icon", null)), "All host & guests"), h("p", null, h("span", { class: "summary-icon" }, h("clock-icon", null)), "Immediately on booking"))))));
|
|
@@ -133,7 +142,7 @@ export class NylasConfirmationEmail {
|
|
|
133
142
|
"optional": true,
|
|
134
143
|
"docs": {
|
|
135
144
|
"tags": [{
|
|
136
|
-
"name": "
|
|
145
|
+
"name": "standalone",
|
|
137
146
|
"text": "The selected config"
|
|
138
147
|
}],
|
|
139
148
|
"text": ""
|
|
@@ -156,29 +165,14 @@ export class NylasConfirmationEmail {
|
|
|
156
165
|
"required": false,
|
|
157
166
|
"optional": false,
|
|
158
167
|
"docs": {
|
|
159
|
-
"tags": [
|
|
160
|
-
|
|
168
|
+
"tags": [{
|
|
169
|
+
"name": "standalone",
|
|
170
|
+
"text": "The confirmation email template data to display"
|
|
171
|
+
}],
|
|
172
|
+
"text": ""
|
|
161
173
|
},
|
|
162
174
|
"defaultValue": "{} as EmailTemplate"
|
|
163
175
|
},
|
|
164
|
-
"isOpen": {
|
|
165
|
-
"type": "boolean",
|
|
166
|
-
"mutable": false,
|
|
167
|
-
"complexType": {
|
|
168
|
-
"original": "boolean",
|
|
169
|
-
"resolved": "boolean",
|
|
170
|
-
"references": {}
|
|
171
|
-
},
|
|
172
|
-
"required": false,
|
|
173
|
-
"optional": false,
|
|
174
|
-
"docs": {
|
|
175
|
-
"tags": [],
|
|
176
|
-
"text": "Is the confirmation email card open"
|
|
177
|
-
},
|
|
178
|
-
"attribute": "is-open",
|
|
179
|
-
"reflect": false,
|
|
180
|
-
"defaultValue": "false"
|
|
181
|
-
},
|
|
182
176
|
"participants": {
|
|
183
177
|
"type": "unknown",
|
|
184
178
|
"mutable": false,
|
|
@@ -196,8 +190,11 @@ export class NylasConfirmationEmail {
|
|
|
196
190
|
"required": false,
|
|
197
191
|
"optional": false,
|
|
198
192
|
"docs": {
|
|
199
|
-
"tags": [
|
|
200
|
-
|
|
193
|
+
"tags": [{
|
|
194
|
+
"name": "standalone",
|
|
195
|
+
"text": "List of participants"
|
|
196
|
+
}],
|
|
197
|
+
"text": ""
|
|
201
198
|
},
|
|
202
199
|
"defaultValue": "[]"
|
|
203
200
|
},
|
|
@@ -212,12 +209,33 @@ export class NylasConfirmationEmail {
|
|
|
212
209
|
"required": false,
|
|
213
210
|
"optional": false,
|
|
214
211
|
"docs": {
|
|
215
|
-
"tags": [
|
|
216
|
-
|
|
212
|
+
"tags": [{
|
|
213
|
+
"name": "standalone",
|
|
214
|
+
"text": "The name of the component"
|
|
215
|
+
}],
|
|
216
|
+
"text": ""
|
|
217
217
|
},
|
|
218
218
|
"attribute": "name",
|
|
219
219
|
"reflect": false,
|
|
220
220
|
"defaultValue": "'confirmation-email-template'"
|
|
221
|
+
},
|
|
222
|
+
"isOpen": {
|
|
223
|
+
"type": "boolean",
|
|
224
|
+
"mutable": false,
|
|
225
|
+
"complexType": {
|
|
226
|
+
"original": "boolean",
|
|
227
|
+
"resolved": "boolean",
|
|
228
|
+
"references": {}
|
|
229
|
+
},
|
|
230
|
+
"required": false,
|
|
231
|
+
"optional": false,
|
|
232
|
+
"docs": {
|
|
233
|
+
"tags": [],
|
|
234
|
+
"text": "Is the confirmation email card open"
|
|
235
|
+
},
|
|
236
|
+
"attribute": "is-open",
|
|
237
|
+
"reflect": false,
|
|
238
|
+
"defaultValue": "false"
|
|
221
239
|
}
|
|
222
240
|
};
|
|
223
241
|
}
|
|
@@ -274,6 +292,12 @@ export class NylasConfirmationEmail {
|
|
|
274
292
|
"target": undefined,
|
|
275
293
|
"capture": false,
|
|
276
294
|
"passive": false
|
|
295
|
+
}, {
|
|
296
|
+
"name": "nylasFormInputImageUrlInvalid",
|
|
297
|
+
"method": "nylasFormInputImageUrlInvalidHandler",
|
|
298
|
+
"target": undefined,
|
|
299
|
+
"capture": false,
|
|
300
|
+
"passive": false
|
|
277
301
|
}];
|
|
278
302
|
}
|
|
279
303
|
static get attachInternalsMemberName() { return "internals"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nylas-confirmation-email.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAqB9H,MAAM,OAAO,sBAAsB;;;yCAUkB,EAAmB;sBAI5C,KAAK;4BAIO,EAAE;oBAIjB,6BAA6B;;uCAcR,IAAI,CAAC,MAAM;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;gBAEtC,IAAI,YAAY,EAAE,CAAC;oBACjB,YAAY,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;oDA4ID","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug, sanitize } 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, EmailTemplate, Participant } from '@nylas/core';\n\n/**\n * The `nylas-confirmation-email` component is a UI component that allows users to set buffer time before and after an event.\n *\n * @part nce__tab-heading - The nylas-confirmation-email main tab heading\n * @part nce - The nylas-confirmation-email container\n * @part nce__header - The header of the event communication section\n * @part nce__body - The body of the event communication section\n * @part nce__confirmation-email-toggle--container - The confirmation email drawer toggle container\n * @part nce__input-image-url - The input image URL container\n * @part nce__summary - The confirmation card summary container\n */\n@Component({\n tag: 'nylas-confirmation-email',\n styleUrl: 'nylas-confirmation-email.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasConfirmationEmail {\n @Element() host!: HTMLNylasConfirmationEmailElement;\n /**\n * @internal\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * The confirmation email template data to display\n */\n @Prop() confirmationEmailTemplate: EmailTemplate = {} as EmailTemplate;\n /**\n * Is the confirmation email card open\n */\n @Prop() isOpen: boolean = false;\n /**\n * List of participants\n */\n @Prop() participants: Participant[] = [];\n /**\n * The name of the component\n */\n @Prop() name: string = 'confirmation-email-template';\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The confirmation email template state.\n */\n @State() confirmationEmail!: EmailTemplate;\n\n /**\n * The internal state to store the isOpen state.\n */\n @State() isConfirmationEmailOpen: boolean = this.isOpen;\n\n /**\n * The internal state to store the participants.\n */\n @State() participantsState: Participant[] = this.participants;\n\n /**\n * This event is fired when the email reminders change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-confirmation-email', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-confirmation-email', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-confirmation-email', 'componentWillLoad');\n // See comment in the @Watch('name') decorator for more information.\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-confirmation-email', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n } else {\n this.confirmationEmail = this.confirmationEmailTemplate;\n this.isConfirmationEmailOpen = this.isOpen;\n this.participantsState = this.participants;\n }\n }\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-confirmation-email', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-confirmation-email', 'selectedConfigurationChangedHandler', newValue);\n this.confirmationEmail = newValue?.scheduler?.email_template || this.confirmationEmailTemplate;\n this.isConfirmationEmailOpen = !newValue?.event_booking?.reminders?.length;\n this.participantsState = newValue?.participants || this.participants;\n }\n\n @Listen('nylasFormInputChanged')\n async nylasFormInputChangeHandler(event: CustomEvent<{ value: string; name: string; type?: string }>) {\n const { name, value } = event.detail;\n const type = event.detail?.type;\n if (name === 'confirmation-email-title') {\n this.confirmationEmail = { ...this.confirmationEmail, booking_confirmed: { ...(this.confirmationEmail?.booking_confirmed || {}), title: value } };\n this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });\n } else if (name === 'confirmation-email-body' && type === 'multi_line_text') {\n this.handleEmailBodyChange(event);\n }\n }\n\n @Listen('valueChanged')\n valueChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-confirmation-email', 'valueChangedHandler', event.detail);\n const { value, name } = event.detail;\n\n if (name === 'confirmation-email-logo') {\n this.confirmationEmail = { ...this.confirmationEmail, logo: value };\n this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });\n }\n }\n\n updateConfirmationFormValue() {\n debug('nylas-confirmation-email', 'updateConfirmationFormValue');\n this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });\n }\n\n toggleConfirmationEmail() {\n this.isConfirmationEmailOpen = !this.isConfirmationEmailOpen;\n }\n\n handleEmailBodyChange(event) {\n const value = sanitize(event.detail.value);\n this.confirmationEmail = { ...this.confirmationEmail, booking_confirmed: { ...(this.confirmationEmail?.booking_confirmed || {}), body: value } };\n this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });\n }\n\n @RegisterComponent<NylasConfirmationEmail, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-confirmation-email',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\n eventToProps: {\n valueChanged: async (\n event: CustomEvent<{ value: string; name: string; valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void }>,\n _nylasSchedulerConfigConnector: NylasSchedulerConfigConnector,\n ) => {\n const { valueChanged } = event.detail;\n // If a handler is passed, call it.\n if (valueChanged) {\n valueChanged(event);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const organizer = this.participantsState.find(p => p.is_organizer);\n const organizerName = organizer?.name || organizer?.email;\n\n return (\n <Host>\n <div class=\"nylas-confirmation-email\" part=\"nce\">\n <div class=\"header\" part=\"nce__header\">\n <div>\n <h3>{this.confirmationEmail?.booking_confirmed?.title ?? `Booking confirmed with ${organizerName ? ` ${organizerName}` : ''}`}</h3>\n <p>Booking confirmation email</p>\n </div>\n {this.isConfirmationEmailOpen ? (\n <div class=\"confirmation-email-toggle\" part=\"nce__confirmation-email-toggle--container\">\n <span class={`chevron ${this.isConfirmationEmailOpen ? 'open' : 'closed'} `} onClick={() => this.toggleConfirmationEmail()}>\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n ) : (\n <button-component\n variant={'basic'}\n clickHandler={event => {\n event.preventDefault();\n this.toggleConfirmationEmail();\n }}\n >\n <edit-icon width=\"16\" height=\"16\"></edit-icon>\n Edit\n </button-component>\n )}\n </div>\n\n {this.isConfirmationEmailOpen ? (\n <div class=\"nylas-confirmation-email__body\" part=\"nce__body\">\n <div class=\"nylas-confirmation-email__section\">\n <div class=\"nylas-confirmation-email__row\">\n <label>\n Send confirmation email\n <span class=\"label-icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">You and your guests will receive a confirmation email immediately upon booking.</span>\n </tooltip-component>\n </span>\n </label>\n <span class=\"selected-value\">Immediately upon booking</span>\n </div>\n <div class=\"nylas-confirmation-email__row\">\n <div class=\"subsection\">\n <div class=\"input-container\">\n <label>\n Company logo URL\n <span class=\"label-icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">\n This logo appears in the booking confirmation email. The URL must be publicly accessible. The image will be scaled down to a max size of 200px x\n 100px.\n </span>\n </tooltip-component>\n </span>\n </label>\n\n {this.confirmationEmail && (\n <input-image-url\n name=\"confirmation-email-logo\"\n exportparts=\"iiu__logo-input-textfield: nce__input-image-url\"\n imageUrl={this.confirmationEmail?.logo ?? ''}\n />\n )}\n </div>\n </div>\n </div>\n <div class=\"nylas-confirmation-email__row full-width-col\">\n <div class=\"subsection\">\n <h3>Email message</h3>\n <div class=\"input-container\">\n <label htmlFor=\"title\">\n Custom email title\n <span class=\"label-icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">An email title is a headline within the body of the email. This doesn't change the subject line.</span>\n </tooltip-component>\n </span>\n </label>\n <input-component\n name=\"confirmation-email-title\"\n maxLength={60}\n placeholder={`Booking confirmed ${organizerName ? `with ${organizerName}` : ''}`}\n defaultValue={this.confirmationEmail?.booking_confirmed?.title ?? ''}\n ></input-component>\n </div>\n <div class=\"input-container\">\n {/* <label htmlFor=\"title\">Email body</label> */}\n <textarea-component\n label=\"Additional info\"\n name=\"confirmation-email-body\"\n id=\"confirmation-email-body\"\n placeholder=\"Default body\"\n tooltip=\"Scheduler adds the content of the box to the email body.\"\n maxLength={500}\n defaultValue={this.confirmationEmail?.booking_confirmed?.body ?? ''}\n ></textarea-component>\n\n {/* <textarea\n id=\"description\"\n part=\"nrt__textarea\"\n name=\"confirmation-email-body\"\n placeholder='Default body'\n value={this.confirmationEmail?.booking_confirmed?.body ?? ''}\n maxlength=\"500\"\n rows={2}\n onInput={e => this.handleEmailBodyChange(e)}\n ></textarea> */}\n </div>\n </div>\n </div>\n </div>\n </div>\n ) : (\n <div class=\"nylas-confirmation-email__summary\" part=\"nce__summary\">\n <p>\n <span class=\"summary-icon\">\n <person-clipboard-icon></person-clipboard-icon>\n </span>\n All host & guests\n </p>\n <p>\n <span class=\"summary-icon\">\n <clock-icon></clock-icon>\n </span>\n Immediately on booking\n </p>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nylas-confirmation-email.js","sourceRoot":"","sources":["../../../../src/components/scheduler-editor/nylas-confirmation-email/nylas-confirmation-email.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE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0D,EAClE,SAAS,EAAE,GAAG,EACd,YAAY,EAAE,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,IAAI,IAAI,EAAE,GAC/C,CAYlB,CACF,CACF,CACF,CACF,CACP,CAAC,CAAC,CAAC,CACF,WAAK,KAAK,EAAC,mCAAmC,EAAC,IAAI,EAAC,cAAc;oBAChE;wBACE,YAAM,KAAK,EAAC,cAAc;4BACxB,gCAA+C,CAC1C;4CAEL;oBACJ;wBACE,YAAM,KAAK,EAAC,cAAc;4BACxB,qBAAyB,CACpB;iDAEL,CACA,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AA5IC;IAjBC,iBAAiB,CAA4G;QAC5H,IAAI,EAAE,0BAA0B;QAChC,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,uCAAuC,EAAE,uBAAuB,CAAC,CAAC,CAAC;QAC3F,YAAY,EAAE;YACZ,YAAY,EAAE,KAAK,EACjB,KAAiI,EACjI,8BAA6D,EAC7D,EAAE;gBACF,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;gBAEtC,IAAI,YAAY,EAAE,CAAC;oBACjB,YAAY,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;oDA4ID","sourcesContent":["import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug, sanitize } 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, EmailTemplate, Participant } from '@nylas/core';\n\n/**\n * The `nylas-confirmation-email` component is a UI component that allows users to set buffer time before and after an event.\n *\n * @part nce__tab-heading - The nylas-confirmation-email main tab heading\n * @part nce - The nylas-confirmation-email container\n * @part nce__header - The header of the event communication section\n * @part nce__body - The body of the event communication section\n * @part nce__confirmation-email-toggle--container - The confirmation email drawer toggle container\n * @part nce__input-image-url - The input image URL container\n * @part nce__summary - The confirmation card summary container\n */\n@Component({\n tag: 'nylas-confirmation-email',\n styleUrl: 'nylas-confirmation-email.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasConfirmationEmail {\n @Element() host!: HTMLNylasConfirmationEmailElement;\n /**\n * @standalone\n * The selected config\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * @standalone\n * The confirmation email template data to display\n */\n @Prop() confirmationEmailTemplate: EmailTemplate = {} as EmailTemplate;\n /**\n * @standalone\n * List of participants\n */\n @Prop() participants: Participant[] = [];\n /**\n * @standalone\n * The name of the component\n */\n @Prop() name: string = 'confirmation-email-template';\n /**\n * Is the confirmation email card open\n */\n @Prop() isOpen: boolean = false;\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The confirmation email template state.\n */\n @State() confirmationEmail!: EmailTemplate;\n\n /**\n * The internal state to store the isOpen state.\n */\n @State() isConfirmationEmailOpen: boolean = this.isOpen;\n\n /**\n * The internal state to store the participants.\n */\n @State() participantsState: Participant[] = this.participants;\n\n /**\n * This event is fired when the email reminders change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-confirmation-email', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-confirmation-email', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-confirmation-email', 'componentWillLoad');\n // See comment in the @Watch('name') decorator for more information.\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-confirmation-email', 'componentDidLoad');\n if (this.selectedConfiguration) {\n this.selectedConfigurationChangedHandler(this.selectedConfiguration);\n } else {\n this.confirmationEmail = this.confirmationEmailTemplate;\n this.isConfirmationEmailOpen = this.isOpen;\n this.participantsState = this.participants;\n }\n }\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-confirmation-email', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n selectedConfigurationChangedHandler(newValue: Configuration) {\n debug('nylas-confirmation-email', 'selectedConfigurationChangedHandler', newValue);\n this.confirmationEmail = newValue?.scheduler?.email_template || this.confirmationEmailTemplate;\n this.isConfirmationEmailOpen = !newValue?.event_booking?.reminders?.length;\n this.participantsState = newValue?.participants || this.participants;\n }\n\n @Listen('nylasFormInputChanged')\n async nylasFormInputChangeHandler(event: CustomEvent<{ value: string; name: string; type?: string }>) {\n const { name, value } = event.detail;\n const type = event.detail?.type;\n if (name === 'confirmation-email-title') {\n this.confirmationEmail = { ...this.confirmationEmail, booking_confirmed: { ...(this.confirmationEmail?.booking_confirmed || {}), title: value } };\n this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });\n } else if (name === 'confirmation-email-body' && type === 'multi_line_text') {\n this.handleEmailBodyChange(event);\n }\n }\n\n @Listen('valueChanged')\n valueChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-confirmation-email', 'valueChangedHandler', event.detail);\n const { value, name } = event.detail;\n\n if (name === 'confirmation-email-logo') {\n this.confirmationEmail = { ...this.confirmationEmail, logo: value };\n this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });\n if (typeof this.internals.setValidity === 'function' && typeof this.internals.setFormValue === 'function') {\n this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);\n this.internals.setValidity({});\n }\n }\n }\n\n @Listen('nylasFormInputImageUrlInvalid')\n async nylasFormInputImageUrlInvalidHandler(event: CustomEvent<{ value: string; name: string }>) {\n const { value, name } = event.detail;\n if (name === 'confirmation-email-logo' && typeof this.internals.setValidity === 'function') {\n this.internals.setValidity({ customError: true }, value || 'Invalid image URL.');\n }\n }\n\n updateConfirmationFormValue() {\n debug('nylas-confirmation-email', 'updateConfirmationFormValue');\n this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });\n }\n\n toggleConfirmationEmail() {\n this.isConfirmationEmailOpen = !this.isConfirmationEmailOpen;\n }\n\n handleEmailBodyChange(event) {\n const value = sanitize(event.detail.value);\n this.confirmationEmail = { ...this.confirmationEmail, booking_confirmed: { ...(this.confirmationEmail?.booking_confirmed || {}), body: value } };\n this.internals.setFormValue(JSON.stringify(this.confirmationEmail), this.name);\n this.valueChanged.emit({ value: JSON.stringify(this.confirmationEmail), name: this.name });\n }\n\n @RegisterComponent<NylasConfirmationEmail, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-confirmation-email',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\n eventToProps: {\n valueChanged: async (\n event: CustomEvent<{ value: string; name: string; valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void }>,\n _nylasSchedulerConfigConnector: NylasSchedulerConfigConnector,\n ) => {\n const { valueChanged } = event.detail;\n // If a handler is passed, call it.\n if (valueChanged) {\n valueChanged(event);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const organizer = this.participantsState.find(p => p.is_organizer);\n const organizerName = organizer?.name || organizer?.email;\n\n return (\n <Host>\n <div class=\"nylas-confirmation-email\" part=\"nce\">\n <div class=\"header\" part=\"nce__header\">\n <div>\n <h3>{this.confirmationEmail?.booking_confirmed?.title ?? `Booking confirmed with ${organizerName ? ` ${organizerName}` : ''}`}</h3>\n <p>Booking confirmation email</p>\n </div>\n {this.isConfirmationEmailOpen ? (\n <div class=\"confirmation-email-toggle\" part=\"nce__confirmation-email-toggle--container\">\n <span class={`chevron ${this.isConfirmationEmailOpen ? 'open' : 'closed'} `} onClick={() => this.toggleConfirmationEmail()}>\n <chevron-icon width=\"24\" height=\"24\" />\n </span>\n </div>\n ) : (\n <button-component\n variant={'basic'}\n clickHandler={event => {\n event.preventDefault();\n this.toggleConfirmationEmail();\n }}\n >\n <edit-icon width=\"16\" height=\"16\"></edit-icon>\n Edit\n </button-component>\n )}\n </div>\n\n {this.isConfirmationEmailOpen ? (\n <div class=\"nylas-confirmation-email__body\" part=\"nce__body\">\n <div class=\"nylas-confirmation-email__section\">\n <div class=\"nylas-confirmation-email__row\">\n <label>\n Send confirmation email\n <span class=\"label-icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">You and your guests will receive a confirmation email immediately upon booking.</span>\n </tooltip-component>\n </span>\n </label>\n <span class=\"selected-value\">Immediately upon booking</span>\n </div>\n <div class=\"nylas-confirmation-email__row\">\n <div class=\"subsection\">\n <div class=\"input-container\">\n <label>\n Company logo URL\n <span class=\"label-icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">\n This logo appears in the booking confirmation email. The URL must be publicly accessible. The image will be scaled down to a max size of 200px x\n 100px.\n </span>\n </tooltip-component>\n </span>\n </label>\n\n {this.confirmationEmail && (\n <input-image-url\n name=\"confirmation-email-logo\"\n exportparts=\"iiu__logo-input-textfield: nce__input-image-url\"\n imageUrl={this.confirmationEmail?.logo ?? ''}\n />\n )}\n </div>\n </div>\n </div>\n <div class=\"nylas-confirmation-email__row full-width-col\">\n <div class=\"subsection\">\n <h3>Email message</h3>\n <div class=\"input-container\">\n <label htmlFor=\"title\">\n Custom email title\n <span class=\"label-icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">An email title is a headline within the body of the email. This doesn't change the subject line.</span>\n </tooltip-component>\n </span>\n </label>\n <input-component\n name=\"confirmation-email-title\"\n maxLength={60}\n placeholder={`Booking confirmed ${organizerName ? `with ${organizerName}` : ''}`}\n defaultValue={this.confirmationEmail?.booking_confirmed?.title ?? ''}\n ></input-component>\n </div>\n <div class=\"input-container\">\n {/* <label htmlFor=\"title\">Email body</label> */}\n <textarea-component\n label=\"Additional info\"\n name=\"confirmation-email-body\"\n id=\"confirmation-email-body\"\n placeholder=\"Default body\"\n tooltip=\"Scheduler adds the content of the box to the email body.\"\n maxLength={500}\n defaultValue={this.confirmationEmail?.booking_confirmed?.body ?? ''}\n ></textarea-component>\n\n {/* <textarea\n id=\"description\"\n part=\"nrt__textarea\"\n name=\"confirmation-email-body\"\n placeholder='Default body'\n value={this.confirmationEmail?.booking_confirmed?.body ?? ''}\n maxlength=\"500\"\n rows={2}\n onInput={e => this.handleEmailBodyChange(e)}\n ></textarea> */}\n </div>\n </div>\n </div>\n </div>\n </div>\n ) : (\n <div class=\"nylas-confirmation-email__summary\" part=\"nce__summary\">\n <p>\n <span class=\"summary-icon\">\n <person-clipboard-icon></person-clipboard-icon>\n </span>\n All host & guests\n </p>\n <p>\n <span class=\"summary-icon\">\n <clock-icon></clock-icon>\n </span>\n Immediately on booking\n </p>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
+
import { NylasConfirmationEmail } from "../nylas-confirmation-email";
|
|
3
|
+
import { InputImageUrl } from "../../../design-system/input-image-url/input-image-url";
|
|
4
|
+
import { InputComponent } from "../../../design-system/input-component/input-component";
|
|
5
|
+
import { h } from "@stencil/core";
|
|
6
|
+
describe('nylas-confirmation-email', () => {
|
|
7
|
+
let page;
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
page = await newSpecPage({
|
|
10
|
+
components: [InputImageUrl, InputComponent, NylasConfirmationEmail],
|
|
11
|
+
template: () => {
|
|
12
|
+
return h("nylas-confirmation-email", { name: "confirmationEmail", isOpen: true });
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
await page.waitForChanges();
|
|
16
|
+
});
|
|
17
|
+
it('renders', async () => {
|
|
18
|
+
expect(page.root).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
it('should show error message when invalid logo url is entered', async () => {
|
|
21
|
+
const inputImageUrl = page.root.shadowRoot.querySelector('input-image-url');
|
|
22
|
+
const inputEvent = new CustomEvent('nylasFormInputChanged', {
|
|
23
|
+
detail: {
|
|
24
|
+
name: 'confirmation-email-logo',
|
|
25
|
+
value: 'invalid-url',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
inputImageUrl.dispatchEvent(inputEvent);
|
|
29
|
+
await page.waitForChanges();
|
|
30
|
+
expect(page.root).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=nylas-confirmation-email.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nylas-confirmation-email.spec.js","sourceRoot":"","sources":["../../../../../src/components/scheduler-editor/nylas-confirmation-email/test/nylas-confirmation-email.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,IAAI,IAAS,CAAC;IACd,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,IAAI,GAAG,MAAM,WAAW,CAAC;YACvB,UAAU,EAAE,CAAC,aAAa,EAAE,cAAc,EAAE,sBAAsB,CAAC;YACnE,QAAQ,EAAE,GAAG,EAAE;gBACb,OAAO,gCAA0B,IAAI,EAAC,mBAAmB,EAAC,MAAM,EAAE,IAAI,GAAI,CAAC;YAC7E,CAAC;SACF,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QAC1E,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,uBAAuB,EAAE;YAC1D,MAAM,EAAE;gBACN,IAAI,EAAE,yBAAyB;gBAC/B,KAAK,EAAE,aAAa;aACrB;SACF,CAAC,CAAC;QACH,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACxC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { NylasConfirmationEmail } from '../nylas-confirmation-email';\nimport { InputImageUrl } from '../../../design-system/input-image-url/input-image-url';\nimport { InputComponent } from '../../../design-system/input-component/input-component';\nimport { h } from '@stencil/core';\n\ndescribe('nylas-confirmation-email', () => {\n let page: any;\n beforeEach(async () => {\n page = await newSpecPage({\n components: [InputImageUrl, InputComponent, NylasConfirmationEmail],\n template: () => {\n return <nylas-confirmation-email name=\"confirmationEmail\" isOpen={true} />;\n },\n });\n await page.waitForChanges();\n });\n\n it('renders', async () => {\n expect(page.root).toMatchSnapshot();\n });\n\n it('should show error message when invalid logo url is entered', async () => {\n const inputImageUrl = page.root.shadowRoot.querySelector('input-image-url');\n const inputEvent = new CustomEvent('nylasFormInputChanged', {\n detail: {\n name: 'confirmation-email-logo',\n value: 'invalid-url',\n },\n });\n inputImageUrl.dispatchEvent(inputEvent);\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|
package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js
CHANGED
|
@@ -55,7 +55,6 @@ export class NylasEventDuration {
|
|
|
55
55
|
componentWillLoad() {
|
|
56
56
|
debug('nylas-event-duration', 'componentWillLoad');
|
|
57
57
|
this.host.setAttribute('name', this.name);
|
|
58
|
-
this.setDurationMintueOptions();
|
|
59
58
|
}
|
|
60
59
|
componentDidLoad() {
|
|
61
60
|
debug('nylas-event-duration', 'componentDidLoad');
|
|
@@ -65,7 +64,10 @@ export class NylasEventDuration {
|
|
|
65
64
|
this.duration = this.duration ? this.duration : this.eventDurationMinutes ? (this.eventDurationMinutes >= 60 ? this.eventDurationMinutes / 60 : this.eventDurationMinutes) : 30;
|
|
66
65
|
this.durationMinutes = this.durationMinutes ? this.durationMinutes : this.duration ? this.duration : 30;
|
|
67
66
|
this.durationIncrement = this.durationIncrement ? this.durationIncrement : this.duration >= 60 ? 60 : 1;
|
|
68
|
-
this.
|
|
67
|
+
this.setDurationMintueOptions();
|
|
68
|
+
if (typeof this.internals.setFormValue === 'function') {
|
|
69
|
+
this.internals.setFormValue(this.durationMinutes.toString(), 'duration');
|
|
70
|
+
}
|
|
69
71
|
}
|
|
70
72
|
disconnectedCallback() {
|
|
71
73
|
debug('nylas-event-duration', 'disconnectedCallback');
|
|
@@ -115,7 +117,7 @@ export class NylasEventDuration {
|
|
|
115
117
|
{ value: 1, label: 'minute' },
|
|
116
118
|
{ value: 60, label: 'hour' },
|
|
117
119
|
];
|
|
118
|
-
return (h(Host, { key: '
|
|
120
|
+
return (h(Host, { key: 'f6b60528b9c3f2978ac12beae9bf049a9b90fec5' }, h("div", { key: 'f7c778d981fa1d33ceed820d500e6820a4f1223c', class: "nylas-event-duration", part: "ned" }, h("label", { key: 'f461dcfeda616f50820d6cdacb5dfded22ec7aff', htmlFor: "duration" }, "Event duration", h("span", { key: '086d2458ad14f00f718fb9106c45d63576c9f734', class: "required" }, "*")), h("div", { key: 'cf27800dec77fbe74c9428de92fa042a419ddb25', class: "nylas-event-duration__wrapper" }, h("input-dropdown", { key: '06ed64927a69ca96bb9f9cc5cfede6d55c310598', name: 'event-duration', options: this.durationMinutesOptions, inputValue: this.duration.toString(), exportparts: "id_dropdown: ned__input_dropdown, id_dropdown-input: ned__input_dropdown-input, id_dropdown-content: ned__input_dropdown-content", defaultInputOption: this.durationMinutesOptions.find(i => i.value == this.duration) }), this.durationIncrement && (h("select-dropdown", { name: 'event-duration', options: durationOptions, pluralizedLabel: this.duration > 1 ? 's' : '', exportparts: "sd_dropdown: ned__dropdown, sd_dropdown-button: ned__dropdown-button, sd_dropdown-content: ned__dropdown-content", defaultSelectedOption: durationOptions.find(i => i.value == this.durationIncrement), withSearch: false }))))));
|
|
119
121
|
}
|
|
120
122
|
static get is() { return "nylas-event-duration"; }
|
|
121
123
|
static get encapsulation() { return "shadow"; }
|