import React from 'react'; import { toBase64 } from '../util'; import { EmailTemplate3Config } from './email-template-3'; function setHostSetting< P1 extends keyof EmailTemplate3Config['hosts_settings'], P2 extends keyof EmailTemplate3Config['hosts_settings'][P1] >( setConfig: React.Dispatch>, [p1, p2]: [P1, P2], value: EmailTemplate3Config['hosts_settings'][P1][P2] ) { setConfig((v) => { console.log(v, { ...v, hosts_settings: { ...v.hosts_settings, [p1]: { ...v.hosts_settings[p2], [p2]: value, }, }, }); return { ...v, hosts_settings: { ...v.hosts_settings, [p1]: { ...v.hosts_settings[p1], [p2]: value, }, }, }; }); } export default function EmailTemplate3Controls({ config, setConfig, }: { config: EmailTemplate3Config; setConfig: React.Dispatch>; }): JSX.Element { const p = config.pronoun; return (
{config.policy_readable !== 'null' ? (
{Object.entries(config.hosts_settings).map(([id, settings]) => (
{id}

Cele przetwarzania danych przez właściciela domeny {id}{' '}

{!['not_mentioned', 'null'].includes(settings.presence) ? (

Wskazana przez administratora podstawa prawna dla{' '} tego konkretnego celu{' '}

) : ( '' )} {!['not_mentioned', 'null'].includes(settings.legal_basis_type) ? (
dodatkowe pytania
) : ( '' )}
))}
) : ( '' )}
{config.popup_type !== 'none' ? (
{ const popup_screenshot_base64 = await toBase64(e.target.files[0]); setConfig((v) => ({ ...v, popup_screenshot_base64, })); }, }} />
) : ( '' )} {config.popup_type === 'consent' ? (
setConfig((v) => ({ ...v, popup_accept_all_text: e.target.value, })), }} />
) : ( '' )}
{config.popup_action === 'closed' ? (
setConfig((v) => ({ ...v, popup_closed_how: e.target.value, })) } />
) : ( '' )} {config.popup_type !== 'none' ? (
setConfig((v) => ({ ...v, popup_mentions_passive_consent: e.target.checked, })) } />
) : ( '' )} {config.popup_mentions_passive_consent ? (
setConfig((v) => ({ ...v, popup_passive_consent_text: e.target.value, })) } />
) : ( '' )}
); }