client/unified-form/detail-tab/action.js

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CLEAR_EDITION_GROUPS = exports.ADD_EDITION_GROUP = void 0;
exports.addEditionGroup = addEditionGroup;
exports.clearEditionGroups = clearEditionGroups;
var ADD_EDITION_GROUP = 'ADD_EDITION_GROUP';
exports.ADD_EDITION_GROUP = ADD_EDITION_GROUP;
var CLEAR_EDITION_GROUPS = 'CLEAR_EDITION_GROUPS';
exports.CLEAR_EDITION_GROUPS = CLEAR_EDITION_GROUPS;
var nextEditionGroupId = 0;

/**
 * Produces an action indicating that new edition group should be added in `EditionGroups`.
 *
 * @param {Object} value - New edition group state.
 * @returns {Action} The resulting ADD_EDITION_GROUP action.
 */
function addEditionGroup() {
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  return {
    payload: {
      id: "eg".concat(nextEditionGroupId),
      value: value
    },
    type: ADD_EDITION_GROUP
  };
}

/**
 * Produces an action indicating that all edition groups should be removed from `EditionGroups`.
 *
 * @returns {Action} The resulting CLEAR_EDITION_GROUPS action.
 */
function clearEditionGroups() {
  return {
    type: CLEAR_EDITION_GROUPS
  };
}
//# sourceMappingURL=action.js.map