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

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.UPDATE_TYPE = exports.UPDATE_END_DATE = exports.UPDATE_ENDED = exports.UPDATE_BEGIN_DATE = exports.UPDATE_AREA = void 0;
exports.debouncedUpdateBeginDate = debouncedUpdateBeginDate;
exports.debouncedUpdateEndDate = debouncedUpdateEndDate;
exports.updateArea = updateArea;
exports.updateEnded = updateEnded;
exports.updateType = updateType;
/*
 * Copyright (C) 2017  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_AREA = 'UPDATE_AREA';
exports.UPDATE_AREA = UPDATE_AREA;
var UPDATE_TYPE = 'UPDATE_TYPE';
exports.UPDATE_TYPE = UPDATE_TYPE;
var UPDATE_BEGIN_DATE = 'UPDATE_BEGIN_DATE';
exports.UPDATE_BEGIN_DATE = UPDATE_BEGIN_DATE;
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 area for the publisher being edited
 * should be updated with the provided value.
 *
 * @param {number} newArea - The new value to be used for the publisher area
 *                 ID.
 * @returns {Action} The resulting UPDATE_AREA action.
 */
function updateArea(newArea) {
  return {
    payload: newArea,
    type: UPDATE_AREA
  };
}

/**
 * Produces an action indicating that the publisher type for the publisher
 * being edited should be updated with the provided value.
 *
 * @param {number} newTypeId - The new value to be used for the publisher 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 publisher 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 end date for the publisher 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 ended flag for the publisher 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