<commit_before>import { c } from 'ttag';
import { ImportType } from '@proton/shared/lib/interfaces/EasySwitch';
import {
    Button,
    GoogleButton,
    PrimaryButton,
    FeatureCode,
    ImportAssistantOauthModal,
    Loader,
} from '@proton/components';
import { useAddresses, useFeature, useModals } from '@proton/components/hooks';
import ImportModal from '@proton/components/containers/contacts/import/ImportModal';

interface Props {
    hideEasySwitch: boolean;
    onImportButtonClick?: () => void;
}

const ImportCsvContactButton = ({ hideEasySwitch, onImportButtonClick }: Props) => {
    const { createModal } = useModals();
    const [addresses, loadingAddresses] = useAddresses();

    const easySwitchFeature = useFeature(FeatureCode.EasySwitch);
    const isEasySwitchEnabled = easySwitchFeature.feature?.Value;

    const handleClick = () => {
        createModal(<ImportModal />);
        if (onImportButtonClick !== undefined) {
            onImportButtonClick();
        }
    };

    if (loadingAddresses || easySwitchFeature.loading) {
        return <Loader />;
    }

    return isEasySwitchEnabled && !hideEasySwitch ? (
        <>
            <GoogleButton
                onClick={() => {
                    createModal(
                        <ImportAssistantOauthModal addresses={addresses} defaultCheckedTypes={[ImportType.CONTACTS]} />
                    );<commit_msg>Fix types<commit_after>import { c } from 'ttag';
import { ImportType } from '@proton/shared/lib/interfaces/EasySwitch';
import {
    Button,
    GoogleButton,
    PrimaryButton,
    FeatureCode,
    ImportAssistantOauthModal,
    Loader,
} from '@proton/components';
import { useAddresses, useFeature, useModals } from '@proton/components/hooks';
import ImportModal from '@proton/components/containers/contacts/import/ImportModal';

interface Props {
    hideEasySwitch?: boolean;
    onImportButtonClick?: () => void;
}

const ImportCsvContactButton = ({ hideEasySwitch = false, onImportButtonClick }: Props) => {
    const { createModal } = useModals();
    const [addresses, loadingAddresses] = useAddresses();

    const easySwitchFeature = useFeature(FeatureCode.EasySwitch);
    const isEasySwitchEnabled = easySwitchFeature.feature?.Value;

    const handleClick = () => {
        createModal(<ImportModal />);
        if (onImportButtonClick !== undefined) {
            onImportButtonClick();
        }
    };

    if (loadingAddresses || easySwitchFeature.loading) {
        return <Loader />;
    }

    return isEasySwitchEnabled && !hideEasySwitch ? (
        <>
            <GoogleButton
                onClick={() => {
                    createModal(
                        <ImportAssistantOauthModal addresses={addresses} defaultCheckedTypes={[ImportType.CONTACTS]} />
                    );
{'fraction_non_alphanumeric': 0.11367673179396093, 'fraction_numerical': 0.0, 'mean_word_length': 2.9661971830985916, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2563341', 'n_tokens_mistral': 782, 'n_tokens_neox': 749, 'n_words': 146}