@twreporter/redux 7.2.0 → 7.2.2-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.2.2-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@7.2.1...@twreporter/redux@7.2.2-rc.0) (2022-06-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * new bookmark should be fetched when mount ([9bb438f](https://github.com/twreporter/twreporter-npm-packages/commit/9bb438f81bd321fee47f55c872589091d8db8be6))
12
+
13
+
14
+
15
+
16
+
17
+ ## [7.2.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@7.2.1-rc.0...@twreporter/redux@7.2.1) (2022-04-29)
18
+
19
+ **Note:** Version bump only for package @twreporter/redux
20
+
21
+
22
+
23
+
24
+
25
+ ## [7.2.1-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@7.2.0...@twreporter/redux@7.2.1-rc.0) (2022-04-27)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * fix corresponding test ([234b11f](https://github.com/twreporter/twreporter-npm-packages/commit/234b11fa647bfa151657b9112df0e39dc035644a))
31
+ * fix relateds order issue ([cbc3287](https://github.com/twreporter/twreporter-npm-packages/commit/cbc3287f9da820c39411f0bfc07c1365a493a9a8))
32
+ * fix typo ([44fe1d0](https://github.com/twreporter/twreporter-npm-packages/commit/44fe1d05d88f9b9dc326eb2ce12625b83aca471a))
33
+ * remove log ([38a08a1](https://github.com/twreporter/twreporter-npm-packages/commit/38a08a1863d663dbf84cd85034f43ea0e59392a8))
34
+ * rename variable ([2e77a46](https://github.com/twreporter/twreporter-npm-packages/commit/2e77a46067c94a06b2ae22ef41f618bd8ec7c219))
35
+
36
+
37
+
38
+
39
+
6
40
  # [7.2.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@7.2.0-rc.0...@twreporter/redux@7.2.0) (2021-04-19)
7
41
 
8
42
  **Note:** Version bump only for package @twreporter/redux
@@ -20,9 +20,11 @@ var _actionTypes = _interopRequireDefault(require("../constants/action-types"));
20
20
 
21
21
  var _get = _interopRequireDefault(require("lodash/get"));
22
22
 
23
+ var _excluded = ["published_date"];
24
+
23
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
24
26
 
25
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
27
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
26
28
 
27
29
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
28
30
 
@@ -133,7 +135,7 @@ function createSingleBookmark(jwt, userID, bookmarkToBeCreated) {
133
135
  /* go-api takes `published_date` as an unix timestamp (in secs) int */
134
136
  // eslint-disable-next-line camelcase
135
137
  var published_date = bookmarkToBeCreated.published_date,
136
- passedBookmarkProperties = _objectWithoutProperties(bookmarkToBeCreated, ["published_date"]);
138
+ passedBookmarkProperties = _objectWithoutProperties(bookmarkToBeCreated, _excluded);
137
139
  /**
138
140
  * @param {Function} dispatch - Redux store dispatch function
139
141
  * @param {Function} getState - Redux store getState function
@@ -13,7 +13,7 @@ var _merge = _interopRequireDefault(require("lodash/merge"));
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
15
 
16
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
16
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
17
17
 
18
18
  var _ = {
19
19
  get: _get["default"],
@@ -212,9 +212,7 @@ function fetchTopics() {
212
212
  };
213
213
  }
214
214
  /**
215
- * This function fetch the latest topic,
216
- * and three related posts, sorted by `published_date` in descending order,
217
- * of that topic.
215
+ * This function fetch the latest topic, and three related posts of that topic.
218
216
  *
219
217
  * @param {number} [timeout=apiConfig.timeout] - request api timeout
220
218
  * @return {import('../typedef').Thunk} async action creator
@@ -255,17 +253,25 @@ function fetchFeatureTopic() {
255
253
  .then(function (topic) {
256
254
  var allRelatedIds = _.get(topic, 'relateds', []);
257
255
 
258
- var lastThreeRelatedIds = Array.isArray(allRelatedIds) ? allRelatedIds.slice(-3) : [];
256
+ var threeRelatedIds = Array.isArray(allRelatedIds) ? allRelatedIds.slice(0, 3) : [];
259
257
 
260
- if (lastThreeRelatedIds.length > 0) {
258
+ if (threeRelatedIds.length > 0) {
261
259
  var _url = (0, _url2.formURL)(apiOrigin, "/v2/".concat(_apiEndpoints["default"].posts), {
262
- id: lastThreeRelatedIds
260
+ id: threeRelatedIds
263
261
  });
264
262
 
265
263
  return Promise.all([topic, _axios["default"].get(_url, {
266
264
  timeout: timeout
267
265
  }).then(function (res) {
268
- return _.get(res, 'data.data.records', []);
266
+ var relatedPosts = _.get(res, 'data.data.records', []); // Ensure the order of returned related posts is the same with topic landing page's order,
267
+ // since API endpoint /v2/posts will sort the posts automatically by `published_date` in descending order.
268
+
269
+
270
+ return relatedPosts.length < 2 ? relatedPosts : threeRelatedIds.map(function (id) {
271
+ return relatedPosts.find(function (post) {
272
+ return post.id === id;
273
+ });
274
+ });
269
275
  })]);
270
276
  } // return empty response
271
277
 
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -13,11 +15,9 @@ var _reduxStore = _interopRequireDefault(require("../context/redux-store"));
13
15
 
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
17
 
16
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
17
-
18
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
19
 
20
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
22
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
23
 
@@ -25,27 +25,31 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
25
25
 
26
26
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
27
27
 
28
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
28
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
29
+
30
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
31
 
30
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
32
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
33
+
34
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
31
35
 
32
36
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33
37
 
34
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
38
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
35
39
 
36
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
40
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
37
41
 
38
- var Provider =
39
- /*#__PURE__*/
40
- function (_PureComponent) {
42
+ var Provider = /*#__PURE__*/function (_PureComponent) {
41
43
  _inherits(Provider, _PureComponent);
42
44
 
45
+ var _super = _createSuper(Provider);
46
+
43
47
  function Provider(props) {
44
48
  var _this;
45
49
 
46
50
  _classCallCheck(this, Provider);
47
51
 
48
- _this = _possibleConstructorReturn(this, _getPrototypeOf(Provider).call(this, props));
52
+ _this = _super.call(this, props);
49
53
  var store = _this.props.store;
50
54
  _this.state = store.getState();
51
55
  _this.unsubscribe = store.subscribe(_this.saveStoreStateToDetectStateChange.bind(_assertThisInitialized(_this)));
@@ -70,7 +74,7 @@ function (_PureComponent) {
70
74
  // We need to invoke the rerendering of each context consumer.
71
75
  // But the `Context.Consumer` only do shallow compare, and `this.props.store` is the reference of the store object which would always be the same.
72
76
  // So we need to create a new object for it to tell consumer to rerender.
73
- return _react["default"].createElement(_reduxStore["default"].Provider, {
77
+ return /*#__PURE__*/_react["default"].createElement(_reduxStore["default"].Provider, {
74
78
  value: {
75
79
  store: this.props.store
76
80
  }
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
 
12
- var ReduxStoreContext = _react["default"].createContext(null);
12
+ var ReduxStoreContext = /*#__PURE__*/_react["default"].createContext(null);
13
13
 
14
14
  var _default = ReduxStoreContext;
15
15
  exports["default"] = _default;
@@ -17,6 +17,7 @@ var _uniq = _interopRequireDefault(require("lodash/uniq"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
19
 
20
+ // lodash
20
21
  var _ = {
21
22
  assign: _assign["default"],
22
23
  get: _get["default"],
@@ -15,17 +15,25 @@ var _findIndex = _interopRequireDefault(require("lodash/findIndex"));
15
15
 
16
16
  var _uniq = _interopRequireDefault(require("lodash/uniq"));
17
17
 
18
+ var _orderBy = _interopRequireDefault(require("lodash/orderBy"));
19
+
20
+ var _map = _interopRequireDefault(require("lodash/map"));
21
+
18
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
23
 
20
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
24
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
25
+
26
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
27
 
22
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
28
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
29
 
24
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
30
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
25
31
 
26
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
32
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27
33
 
28
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
34
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
35
+
36
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
29
37
 
30
38
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
31
39
 
@@ -35,7 +43,9 @@ var _ = {
35
43
  assign: _assign["default"],
36
44
  findIndex: _findIndex["default"],
37
45
  get: _get["default"],
38
- uniq: _uniq["default"]
46
+ uniq: _uniq["default"],
47
+ orderBy: _orderBy["default"],
48
+ map: _map["default"]
39
49
  };
40
50
  var defaultLimit = 10;
41
51
  var initState = {
@@ -56,7 +66,7 @@ function bookmarks() {
56
66
  case _actionTypes["default"].multipleBookMarks.read.request:
57
67
  case _actionTypes["default"].singleBookmark["delete"].request:
58
68
  {
59
- return _objectSpread({}, state, {
69
+ return _objectSpread(_objectSpread({}, state), {}, {
60
70
  actionType: action.type,
61
71
  isRequesting: true,
62
72
  errorMessage: null
@@ -73,26 +83,22 @@ function bookmarks() {
73
83
  total = meta.total,
74
84
  limit = meta.limit;
75
85
 
76
- var bookmarkIDList = _toConsumableArray(state.bookmarkIDList);
77
-
78
86
  var entities = _objectSpread({}, state.entities); // Push new fetched records to stored ones and push ids to id list
79
87
 
80
88
 
81
89
  fetchedRecords.forEach(function (record) {
82
90
  var id = _.get(record, 'id');
83
91
 
84
- if (id) {
85
- if (!bookmarkIDList.some(function (idInList) {
86
- return idInList === id;
87
- })) {
88
- bookmarkIDList.push(id);
89
- } // prevent duplicate items in list
90
-
91
-
92
- entities["".concat(id)] = record;
92
+ if (!id) {
93
+ return;
93
94
  }
95
+
96
+ entities["".concat(id)] = record;
94
97
  });
95
- return _objectSpread({}, state, {
98
+
99
+ var bookmarkIDList = _.map(_.orderBy(entities, ['added_at'], ['desc']), 'id');
100
+
101
+ return _objectSpread(_objectSpread({}, state), {}, {
96
102
  actionType: action.type,
97
103
  isRequesting: false,
98
104
  bookmarkIDList: bookmarkIDList,
@@ -118,7 +124,7 @@ function bookmarks() {
118
124
  var nextBookmarkIDList = _toConsumableArray(prevBookmarkIDList);
119
125
 
120
126
  if (bookmarkIndexToBeDeleted !== -1) nextBookmarkIDList.splice(bookmarkIndexToBeDeleted, 1);
121
- return _objectSpread({}, state, {
127
+ return _objectSpread(_objectSpread({}, state), {}, {
122
128
  actionType: action.type,
123
129
  isRequesting: false,
124
130
  bookmarkIDList: nextBookmarkIDList,
@@ -130,7 +136,7 @@ function bookmarks() {
130
136
  case _actionTypes["default"].multipleBookMarks.read.failure:
131
137
  case _actionTypes["default"].singleBookmark["delete"].failure:
132
138
  {
133
- return _objectSpread({}, state, {
139
+ return _objectSpread(_objectSpread({}, state), {}, {
134
140
  actionType: action.type,
135
141
  isRequesting: false,
136
142
  errorMessage: _.get(action, 'payload.error.message')
@@ -19,13 +19,13 @@ var _values = _interopRequireDefault(require("lodash/values"));
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
21
 
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
22
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
23
 
24
24
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
25
 
26
26
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
27
 
28
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
28
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
29
29
 
30
30
  var _ = {
31
31
  concat: _concat["default"],
@@ -157,7 +157,7 @@ function entities() {
157
157
  byId = _buildState2.byId,
158
158
  slugToId = _buildState2.slugToId;
159
159
 
160
- return _objectSpread({}, state, {
160
+ return _objectSpread(_objectSpread({}, state), {}, {
161
161
  topics: {
162
162
  allIds: allIds,
163
163
  byId: Object.assign({}, state.topics.byId, byId),
@@ -177,7 +177,7 @@ function entities() {
177
177
  _byId = _buildState3.byId,
178
178
  _slugToId = _buildState3.slugToId;
179
179
 
180
- return _objectSpread({}, state, {
180
+ return _objectSpread(_objectSpread({}, state), {}, {
181
181
  posts: {
182
182
  allIds: _allIds,
183
183
  byId: Object.assign({}, state.posts.byId, _byId),
@@ -197,7 +197,7 @@ function entities() {
197
197
  _byId2 = _buildState4.byId,
198
198
  _slugToId2 = _buildState4.slugToId;
199
199
 
200
- return _objectSpread({}, state, {
200
+ return _objectSpread(_objectSpread({}, state), {}, {
201
201
  topics: {
202
202
  allIds: _allIds2,
203
203
  byId: Object.assign({}, state.topics.byId, _byId2),
@@ -218,7 +218,7 @@ function entities() {
218
218
  _byId3 = _buildState5.byId,
219
219
  _slugToId3 = _buildState5.slugToId;
220
220
 
221
- return _objectSpread({}, state, {
221
+ return _objectSpread(_objectSpread({}, state), {}, {
222
222
  posts: {
223
223
  allIds: _allIds3,
224
224
  byId: Object.assign({}, state.posts.byId, _byId3),
@@ -17,7 +17,7 @@ var _uniq = _interopRequireDefault(require("lodash/uniq"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
19
 
20
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
21
21
 
22
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
23
 
@@ -75,7 +75,7 @@ function relatedPostsOf() {
75
75
  }
76
76
 
77
77
  return Object.assign({}, state, {
78
- byId: _objectSpread({}, state.byId, _defineProperty({}, entityId, {
78
+ byId: _objectSpread(_objectSpread({}, state.byId), {}, _defineProperty({}, entityId, {
79
79
  isFetching: false,
80
80
  error: null,
81
81
  more: more,
@@ -123,7 +123,7 @@ function relatedPostsOf() {
123
123
  }
124
124
 
125
125
  return Object.assign({}, state, {
126
- byId: _objectSpread({}, state.byId, _defineProperty({}, _entityId, {
126
+ byId: _objectSpread(_objectSpread({}, state.byId), {}, _defineProperty({}, _entityId, {
127
127
  isFetching: false,
128
128
  error: null,
129
129
  more: _more,
@@ -172,7 +172,7 @@ function relatedPostsOf() {
172
172
  var _allIds2 = _.get(state, 'allIds', []);
173
173
 
174
174
  return Object.assign({}, state, {
175
- byId: _objectSpread({}, state.byId, _defineProperty({}, targetEntityId, {
175
+ byId: _objectSpread(_objectSpread({}, state.byId), {}, _defineProperty({}, targetEntityId, {
176
176
  isFetching: false,
177
177
  error: null,
178
178
  more: _more2,
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -7,37 +9,39 @@ exports.BadRequestError = exports.NotFoundError = exports.InternalServerError =
7
9
 
8
10
  var _es6Error = _interopRequireDefault(require("es6-error"));
9
11
 
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
13
 
12
14
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
13
15
 
14
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
15
17
 
16
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
17
-
18
18
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
19
 
20
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
20
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
21
21
 
22
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
23
 
24
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
25
25
 
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
26
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
27
27
 
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
28
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
29
+
30
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
31
+
32
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
33
 
30
- var FatalError =
31
- /*#__PURE__*/
32
- function (_ExtendableError) {
34
+ var FatalError = /*#__PURE__*/function (_ExtendableError) {
33
35
  _inherits(FatalError, _ExtendableError);
34
36
 
37
+ var _super = _createSuper(FatalError);
38
+
35
39
  function FatalError() {
36
40
  var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'An error occurs';
37
41
 
38
42
  _classCallCheck(this, FatalError);
39
43
 
40
- return _possibleConstructorReturn(this, _getPrototypeOf(FatalError).call(this, message));
44
+ return _super.call(this, message);
41
45
  }
42
46
 
43
47
  return FatalError;
@@ -45,17 +49,17 @@ function (_ExtendableError) {
45
49
 
46
50
  exports.FatalError = FatalError;
47
51
 
48
- var BadRequestError =
49
- /*#__PURE__*/
50
- function (_FatalError) {
52
+ var BadRequestError = /*#__PURE__*/function (_FatalError) {
51
53
  _inherits(BadRequestError, _FatalError);
52
54
 
55
+ var _super2 = _createSuper(BadRequestError);
56
+
53
57
  function BadRequestError(props) {
54
58
  var _this;
55
59
 
56
60
  _classCallCheck(this, BadRequestError);
57
61
 
58
- _this = _possibleConstructorReturn(this, _getPrototypeOf(BadRequestError).call(this, props));
62
+ _this = _super2.call(this, props);
59
63
  _this.status = 400;
60
64
  return _this;
61
65
  }
@@ -72,17 +76,17 @@ function (_FatalError) {
72
76
 
73
77
  exports.BadRequestError = BadRequestError;
74
78
 
75
- var NotFoundError =
76
- /*#__PURE__*/
77
- function (_FatalError2) {
79
+ var NotFoundError = /*#__PURE__*/function (_FatalError2) {
78
80
  _inherits(NotFoundError, _FatalError2);
79
81
 
82
+ var _super3 = _createSuper(NotFoundError);
83
+
80
84
  function NotFoundError(props) {
81
85
  var _this2;
82
86
 
83
87
  _classCallCheck(this, NotFoundError);
84
88
 
85
- _this2 = _possibleConstructorReturn(this, _getPrototypeOf(NotFoundError).call(this, props));
89
+ _this2 = _super3.call(this, props);
86
90
  _this2.status = 404;
87
91
  return _this2;
88
92
  }
@@ -99,17 +103,17 @@ function (_FatalError2) {
99
103
 
100
104
  exports.NotFoundError = NotFoundError;
101
105
 
102
- var InternalServerError =
103
- /*#__PURE__*/
104
- function (_FatalError3) {
106
+ var InternalServerError = /*#__PURE__*/function (_FatalError3) {
105
107
  _inherits(InternalServerError, _FatalError3);
106
108
 
109
+ var _super4 = _createSuper(InternalServerError);
110
+
107
111
  function InternalServerError(props) {
108
112
  var _this3;
109
113
 
110
114
  _classCallCheck(this, InternalServerError);
111
115
 
112
- _this3 = _possibleConstructorReturn(this, _getPrototypeOf(InternalServerError).call(this, props));
116
+ _this3 = _super4.call(this, props);
113
117
  _this3.status = 500;
114
118
  return _this3;
115
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twreporter/redux",
3
- "version": "7.2.0",
3
+ "version": "7.2.2-rc.0",
4
4
  "description": "redux actions and reducers for twreporter website",
5
5
  "repository": "https://github.com/twreporter/twreporter-npm-packages.git",
6
6
  "author": "twreporter <developer@twreporter.org>",
@@ -43,5 +43,5 @@
43
43
  "files": [
44
44
  "lib"
45
45
  ],
46
- "gitHead": "261c7eb16cf047583b23a69c6cf9b8328446e340"
46
+ "gitHead": "e09f2e6df336ce4eb476ad56c5353a96f32159ac"
47
47
  }