/* eslint-disable i18next/no-literal-string */ import React, { useState } from 'react'; import { observer } from 'mobx-react-lite'; import { useStore } from 'App/mstore'; import { Checkbox } from 'UI'; import cn from 'classnames'; import Select from 'Shared/Select'; import styles from './projectCodeSnippet.module.css'; import CodeSnippet from '../../CodeSnippet'; import { useTranslation } from 'react-i18next'; const inputModeOptionsMap = {}; inputModeOptions.forEach((o, i) => (inputModeOptionsMap[o.value] = i)); function ProjectCodeSnippet(props) { const { projectsStore } = useStore(); const { site } = props; const { gdpr } = site; const saveGdpr = projectsStore.saveGDPR; const editGdpr = projectsStore.editGDPR; const [changed, setChanged] = useState(false); const { t } = useTranslation(); const inputModeOptions = [ { label: t('Record all inputs'), value: 'plain' }, { label: t('Obscure all inputs'), value: 'hidden' }, { label: t('Ignore all inputs'), value: 'obscured' }, ]; const saveGDPR = () => { setChanged(true); void saveGdpr(site.id); }; const onChangeSelect = ({ name, value }) => { editGdpr({ [name]: value }); saveGDPR(); }; const onChangeOption = ({ target: { name, checked } }) => { editGdpr({ [name]: checked }); saveGDPR(); }; return (