import labels from '../labels'; import formState from '../state'; /** * Get the html markup for the confirm and send section of the modal. * * @since 4.5.3 * * @returns {string} Section html markup. */ export default function confirmAndSendSection() { return `
${formState.get('option') === 'email' ? '3' : '4'}

${labels.confirm_and_send}

${getSectionContent(formState.get('option'))}
`; } /** * External icon SVG markup. * * @returns {string} Icon markup. */ function externalIconSvg() { return ` `; } /** * Envelope icon SVG markup. * * @returns {string} Icon markup. */ function envelopeIconSvg() { return ` `; } /** * PushEngage icon SVG markup. * * @returns {string} Icon markup. */ function pushEngageIconSvg() { return ` `; } /** * Get the HTML markup for the "confirm and send" section of the modal. * * @since 4.6.x * * @param {string} option The option to pass to the section renderer. * @returns {string} Section HTML markup. */ function getSectionContent(option: string) { switch (option) { case 'email': var isDisabled = !formState.get('name') || !formState.get('email') ? 'disabled' : ''; return `

${labels.email.customer}: ${formState.get('name') ?? ''} ${formState.get('email') ? `<${formState.get('email')}>` : ''}

${ labels.email.preview_email } ${externalIconSvg()}

`; case 'pushengage': var isDisabled = !formState.get('title') || !formState.get('message') || !formState.get('url') ? 'disabled' : ''; if ('subscribers' === formState.get('send_to')) { isDisabled = isDisabled || formState.get('subscriber_ids') == 0 ? 'disabled' : ''; } return `

${ 'subscribers' === formState.get('send_to') ? labels.pushengage.subscribers : labels.pushengage.segments }: ${ 'subscribers' === formState.get('send_to') ? formState.get('subscribers') : formState.get('segments') }

${ labels.pushengage.preview_pushengage } ${pushEngageIconSvg()}

`; } return ''; }