"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.HEALTHCARE_DEFAULTS = exports.DEFAULTS = void 0;
exports.alertSendsAnalytics = alertSendsAnalytics;
exports.buttonSendsAnalytics = buttonSendsAnalytics;
exports.config = config;
exports.defaultAnalyticsFunction = void 0;
exports.dialogSendsAnalytics = dialogSendsAnalytics;
exports.errorPlacementDefault = errorPlacementDefault;
exports.helpDrawerSendsAnalytics = helpDrawerSendsAnalytics;
exports.setAlertSendsAnalytics = setAlertSendsAnalytics;
exports.setButtonSendsAnalytics = setButtonSendsAnalytics;
exports.setDefaultAnalyticsFunction = setDefaultAnalyticsFunction;
exports.setDialogSendsAnalytics = setDialogSendsAnalytics;
exports.setErrorPlacementDefault = setErrorPlacementDefault;
exports.setHelpDrawerSendsAnalytics = setHelpDrawerSendsAnalytics;
var _analytics = require("./analytics");
const DEFAULTS = Object.freeze({
  errorPlacementDefault: 'top',
  defaultAnalyticsFunction: _analytics.sendLinkEvent,
  alertSendsAnalytics: false,
  buttonSendsAnalytics: false,
  dialogSendsAnalytics: false,
  helpDrawerSendsAnalytics: false,
  headerSendsAnalytics: false
});
exports.DEFAULTS = DEFAULTS;
const HEALTHCARE_DEFAULTS = {
  ...DEFAULTS,
  errorPlacementDefault: 'bottom',
  headerSendsAnalytics: true
};
exports.HEALTHCARE_DEFAULTS = HEALTHCARE_DEFAULTS;
const _config = {
  ...DEFAULTS
};
function config(incomingConfig) {
  Object.assign(_config, incomingConfig);
  return _config;
}
config.DEFAULTS = DEFAULTS;
config.HEALTHCARE_DEFAULTS = HEALTHCARE_DEFAULTS;

// Deprecated stuff

function depWarning(fnName) {
  if (process.env.NODE_ENV !== 'production') {
    console.warn(`The '${fnName}' function is deprecated. Please use the global 'config' function instead.`);
  }
}
function setDefaultAnalyticsFunction(analyticsFunction) {
  depWarning('setDefaultAnalyticsFunction');
  config({
    defaultAnalyticsFunction: analyticsFunction
  });
}
const defaultAnalyticsFunction = config().defaultAnalyticsFunction;
exports.defaultAnalyticsFunction = defaultAnalyticsFunction;
function errorPlacementDefault() {
  depWarning('setDefaultAnalyticsFunction');
  return config().errorPlacementDefault;
}
function setErrorPlacementDefault(value) {
  depWarning('setErrorPlacementDefault');
  config({
    errorPlacementDefault: value
  });
}
function alertSendsAnalytics() {
  depWarning('alertSendsAnalytics');
  return config().alertSendsAnalytics;
}
function setAlertSendsAnalytics(value) {
  depWarning('setAlertSendsAnalytics');
  config({
    alertSendsAnalytics: value
  });
}
function buttonSendsAnalytics() {
  depWarning('buttonSendsAnalytics');
  return config().buttonSendsAnalytics;
}
function setButtonSendsAnalytics(value) {
  depWarning('setButtonSendsAnalytics');
  config({
    buttonSendsAnalytics: value
  });
}
function dialogSendsAnalytics() {
  depWarning('dialogSendsAnalytics');
  return config().dialogSendsAnalytics;
}
function setDialogSendsAnalytics(value) {
  depWarning('setDialogSendsAnalytics');
  config({
    dialogSendsAnalytics: value
  });
}
function helpDrawerSendsAnalytics() {
  depWarning('helpDrawerSendsAnalytics');
  return config().helpDrawerSendsAnalytics;
}
function setHelpDrawerSendsAnalytics(value) {
  depWarning('setHelpDrawerSendsAnalytics');
  config({
    helpDrawerSendsAnalytics: value
  });
}