"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.AuthorizeAction = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _reactIntl = require("react-intl");
var _constants = require("../../../constants");
var _messages = require("../../../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
 */
var AuthorizeAction = exports.AuthorizeAction = function AuthorizeAction(onAuthorize, providerName) {
  return {
    appearance: 'primary',
    name: _constants.ActionName.CustomAction,
    content: providerName ? /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, (0, _extends2.default)({}, _messages.messages.connect_unauthorised_account_action, {
      values: {
        context: providerName
      }
    })) : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, _messages.messages.connect_link_account_card),
    onClick: onAuthorize,
    testId: 'smart-action-connect-account'
  };
};