import React, { useState } from 'react'; import PropTypes from 'prop-types'; import Modal from '../../modal'; import TextField from '../../../ui/text-field'; import Button from '../../../ui/button'; import Typography from '../../../ui/typography'; import { TypographyVariant, FONT_WEIGHT, AlignItems, BLOCK_SIZES, DISPLAY, } from '../../../../helpers/constants/design-system'; import Box from '../../../ui/box'; import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'; import { useI18nContext } from '../../../../hooks/useI18nContext'; import ZENDESK_URLS from '../../../../helpers/constants/zendesk-url'; import { ButtonIcon } from '../../../component-library'; import { ICON_NAMES, ICON_SIZES, } from '../../../component-library/icon/deprecated'; const CustomizeNonce = ({ hideModal, customNonceValue, nextNonce, updateCustomNonce, getNextNonce, }) => { const [customNonce, setCustomNonce] = useState(''); const t = useI18nContext(); return ( { if (customNonce === '') { updateCustomNonce(customNonceValue); } else { updateCustomNonce(customNonce); } getNextNonce(); hideModal(); }} submitText={t('save')} onCancel={() => hideModal()} cancelText={t('cancel')} contentClass="customize-nonce-modal-content" containerClass="customize-nonce-modal-container" >
{t('editNonceField')}
{t('editNonceMessage')} {t('editNonceField')}
{ setCustomNonce(e.target.value); }} fullWidth margin="dense" value={customNonce} id="custom-nonce-id" />
); }; CustomizeNonce.propTypes = { hideModal: PropTypes.func.isRequired, customNonceValue: PropTypes.string, nextNonce: PropTypes.number, updateCustomNonce: PropTypes.func, getNextNonce: PropTypes.func, }; export default withModalProps(CustomizeNonce);