import { Collapse, FormErrorMessage, FormLabel, IconButton, Input, InputGroup, InputRightElement, Link, Switch, Text, } from '@chakra-ui/react'; import { __ } from '@wordpress/i18n'; import React, { useState } from 'react'; import { useFormContext } from 'react-hook-form'; import { BiHide, BiShow } from 'react-icons/bi'; import CustomAlert from '../../../../../../assets/js/back-end/components/common/CustomAlert'; import FormControlTwoCol from '../../../../../../assets/js/back-end/components/common/FormControlTwoCol'; import ToolTip from '../../../../../../assets/js/back-end/screens/settings/components/ToolTip'; import { MultipleCurrencySettingsSchema } from '../../types/multiCurrency'; interface Props { maxmind: MultipleCurrencySettingsSchema['maxmind']; } const MaxMind: React.FC = (props) => { const { maxmind } = props; const { register, watch, formState: { errors }, } = useFormContext(); const [show, setShow] = useState({ apiKey: false }); const enabledWatch = watch('maxmind.enabled'); return ( <> {__( 'The MaxMind Geolocation integration enables accurate country detection for providing localized currency support to the customers.', 'learning-management-system', )} {__('Learn more', 'learning-management-system')} {__('Enable Geolocation Integration', 'learning-management-system')} {errors?.maxmind?.enabled && errors?.maxmind?.message?.toString()} {__('MaxMind License Key', 'learning-management-system')} {!show.apiKey ? ( setShow({ ...show, apiKey: true })} size="lg" variant="unstyled" aria-label="Show license key." icon={} /> ) : ( setShow({ ...show, apiKey: false })} size="lg" variant="unstyled" aria-label="Hide license key." icon={} /> )} ); }; export default MaxMind;