import React, { useState } from 'react'; import PropTypes from 'prop-types'; import Modal from '../../modal'; import TextField from '../../../ui/text-field'; import { TextVariant, AlignItems, BlockSize, Display, } from '../../../../helpers/constants/design-system'; import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'; import { useI18nContext } from '../../../../hooks/useI18nContext'; import ZENDESK_URLS from '../../../../helpers/constants/zendesk-url'; import { Box, ButtonIcon, ButtonIconSize, ButtonLink, IconName, Text, } from '../../../component-library'; 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('learnMoreUpperCase')} {t('editNonceField')} { setCustomNonce(nextNonce); }} > {t('reset')}
{ 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);