client/entity-editor/author-section/actions.js

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.UPDATE_TYPE = exports.UPDATE_GENDER = exports.UPDATE_END_DATE = exports.UPDATE_END_AREA = exports.UPDATE_ENDED = exports.UPDATE_BEGIN_DATE = exports.UPDATE_BEGIN_AREA = void 0;
exports.debouncedUpdateBeginDate = debouncedUpdateBeginDate;
exports.debouncedUpdateEndDate = debouncedUpdateEndDate;
exports.updateBeginArea = updateBeginArea;
exports.updateEndArea = updateEndArea;
exports.updateEnded = updateEnded;
exports.updateGender = updateGender;
exports.updateType = updateType;
/*
 * Copyright (C) 2016  Ben Ockmore
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

var UPDATE_GENDER = 'UPDATE_GENDER';
exports.UPDATE_GENDER = UPDATE_GENDER;
var UPDATE_TYPE = 'UPDATE_TYPE';
exports.UPDATE_TYPE = UPDATE_TYPE;
var UPDATE_BEGIN_AREA = 'UPDATE_BEGIN_AREA';
exports.UPDATE_BEGIN_AREA = UPDATE_BEGIN_AREA;
var UPDATE_BEGIN_DATE = 'UPDATE_BEGIN_DATE';
exports.UPDATE_BEGIN_DATE = UPDATE_BEGIN_DATE;
var UPDATE_END_AREA = 'UPDATE_END_AREA';
exports.UPDATE_END_AREA = UPDATE_END_AREA;
var UPDATE_END_DATE = 'UPDATE_END_DATE';
exports.UPDATE_END_DATE = UPDATE_END_DATE;
var UPDATE_ENDED = 'UPDATE_ENDED';
exports.UPDATE_ENDED = UPDATE_ENDED;
/**
 * Produces an action indicating that the gender for the author being edited
 * should be updated with the provided value.
 *
 * @param {number} newGenderId - The new value to be used for the gender ID.
 * @returns {Action} The resulting UPDATE_GENDER action.
 */
function updateGender(newGenderId) {
  return {
    payload: newGenderId,
    type: UPDATE_GENDER
  };
}

/**
 * Produces an action indicating that the author type for the author being
 * edited should be updated with the provided value.
 *
 * @param {number} newTypeId - The new value to be used for the author type ID.
 * @returns {Action} The resulting UPDATE_TYPE action.
 */
function updateType(newTypeId) {
  return {
    payload: newTypeId,
    type: UPDATE_TYPE
  };
}

/**
 * Produces an action indicating that the begin date for the author being
 * edited should be updated with the provided value. The action is marked to be
 * debounced by the keystroke debouncer defined for redux-debounce.
 *
 * @param {string} newBeginDate - The new value to be used for the begin date.
 * @returns {Action} The resulting UPDATE_BEGIN_DATE action.
 */
function debouncedUpdateBeginDate(newBeginDate) {
  return {
    meta: {
      debounce: 'keystroke'
    },
    payload: newBeginDate,
    type: UPDATE_BEGIN_DATE
  };
}

/**
 * Produces an action indicating that the begin area for the author being
 * edited should be updated with the provided value.
 *
 * @param {Area} newBeginArea - The new value to be used for the begin area.
 * @returns {Action} The resulting UPDATE_BEGIN_AREA action.
 */
function updateBeginArea(newBeginArea) {
  return {
    payload: newBeginArea,
    type: UPDATE_BEGIN_AREA
  };
}

/**
 * Produces an action indicating that the end date for the author being
 * edited should be updated with the provided value. The action is marked to be
 * debounced by the keystroke debouncer defined for redux-debounce.
 *
 * @param {string} newEndDate - The new value to be used for the end date.
 * @returns {Action} The resulting UPDATE_END_DATE action.
 */
function debouncedUpdateEndDate(newEndDate) {
  return {
    meta: {
      debounce: 'keystroke'
    },
    payload: newEndDate,
    type: UPDATE_END_DATE
  };
}

/**
 * Produces an action indicating that the end area for the author being
 * edited should be updated with the provided value.
 *
 * @param {Area} newEndArea - The new value to be used for the end area.
 * @returns {Action} The resulting UPDATE_END_AREA action.
 */
function updateEndArea(newEndArea) {
  return {
    payload: newEndArea,
    type: UPDATE_END_AREA
  };
}

/**
 * Produces an action indicating that the ended flag for the author being
 * edited should be updated with the provided value.
 *
 * @param {boolean} newEnded - The new value to be used for the ended flag.
 * @returns {Action} The resulting UPDATE_ENDED action.
 */
function updateEnded(newEnded) {
  return {
    payload: newEnded,
    type: UPDATE_ENDED
  };
}
//# sourceMappingURL=actions.js.map