import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { ActionName } from '../../../constants';
import { messages } from '../../../messages';
/**
 * Returns a CustomActionItem with a "Connect to <providerName>" message
 *
 * @see CustomActionItem
 * @param onAuthorize a function that will be called on the click of the button
 * @param providerName a string which is inserted into the message of the button
 */
export var AuthorizeAction = function AuthorizeAction(onAuthorize, providerName) {
  return {
    appearance: 'primary',
    name: ActionName.CustomAction,
    content: providerName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
      values: {
        context: providerName
      }
    })) : /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_link_account_card),
    onClick: onAuthorize,
    testId: 'smart-action-connect-account'
  };
};