import { useLingui } from '../../../../../../node_modules/@lingui/react/dist/index.mjs';
import React__default from 'react';
import { ButtonAnchor } from '../atoms/Button.mjs';
import { usePresentation } from '../PresentationConfig.mjs';

const emailProviderInfo = {
    gmail: {
        messageDescriptor: {
            id: "link.openInGmail",
            message: "Open in Gmail"
        },
        icon: 'gmail',
        getUrl: (emailDomain)=>{
            const gmailQuery = encodeURIComponent(emailDomain ? `from:@${emailDomain} in:anywhere` : 'in:anywhere');
            return `https://mail.google.com/mail/u/0/#search/${gmailQuery}`;
        }
    },
    yahoo: {
        messageDescriptor: {
            id: "link.openInYahoo",
            message: "Open in Yahoo"
        },
        icon: 'yahoo',
        getUrl: (emailDomain)=>{
            return !emailDomain ? 'https://mail.yahoo.com/d/search/referrer=unread' : `https://mail.yahoo.com/d/search/keyword=${emailDomain}`;
        }
    },
    outlook: {
        messageDescriptor: {
            id: "link.openInOutlook",
            message: "Open in Outlook"
        },
        icon: 'outlook',
        getUrl: ()=>`https://outlook.office.com/mail/0/inbox`
    }
};
const EmailProviderLink = ({ providerInfo: { icon, messageDescriptor, getUrl }, emailDomain })=>{
    const { i18n: $__i18n, _: $__ } = useLingui();
    const href = getUrl(emailDomain);
    const { iconRegistry } = usePresentation();
    const Icon = iconRegistry[icon];
    return /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
        variant: "outline",
        href: href,
        target: "_blank",
        rel: "noopener noreferrer",
        icon: /*#__PURE__*/ React__default.createElement(Icon, null)
    }, $__i18n._(messageDescriptor));
};

export { EmailProviderLink, emailProviderInfo };
//# sourceMappingURL=EmailProviderLink.mjs.map
