import { Button } from '@wix/design-system';
import React, { useEffect } from 'react';
import { withoutDefaults } from '@wix/bex-core';
import { observer } from 'mobx-react-lite';
import { CustomFieldsPanelEntry } from './CustomFieldsPanelEntry';
import { cairoFiltersPanelUsed } from '@wix/bex-core/bi';
import { SettingsSmall } from '@wix/wix-ui-icons-common';
import { CustomFieldsDisabledTooltip } from '../CustomFields';
export function _ManageFieldsCTAButton({ origin, state, }) {
    const { container: { translate: t }, } = state;
    useEffect(() => {
        state.panels.registerSidePanel('customFields', CustomFieldsPanelEntry);
    }, []);
    return (React.createElement(CustomFieldsDisabledTooltip, { disabled: !state.dataExtension.hasWritePermissions, content: t('cairo.customFields.writePermission.tooltip') },
        React.createElement(Button, { priority: "secondary", dataHook: "manage-fields-button", size: "small", prefixIcon: React.createElement(SettingsSmall, null), onClick: () => {
                const isOpened = state.panels.toggleSidePanel('customFields');
                state.reportBi(withoutDefaults(cairoFiltersPanelUsed)({
                    isOpened,
                    feature: 'Manage custom fields',
                    origin,
                }));
            } }, t('cairo.customFields.manageFields.CTA'))));
}
export const ManageFieldsCTAButton = observer(_ManageFieldsCTAButton);
//# sourceMappingURL=ManageFieldsCTAButton.js.map