contentoh-components-library 21.1.96 → 21.1.97

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.
@@ -162,24 +162,31 @@ var reducerImages = function reducerImages(state, action) {
162
162
 
163
163
  case "orderImages":
164
164
  {
165
- var _inputsByRetailer$act;
166
-
167
165
  var _inputsByRetailer = state.inputsByRetailer,
168
166
  valuesInitial = state.valuesInitial,
169
167
  inputsInitial = state.inputsInitial,
170
168
  inputs = state.inputs;
171
- var orderedImages = [];
172
- var imageIdArray = [];
173
- action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
174
- imageIdArray.push(input.id_image);
175
- valuesInitial.forEach(function (value) {
176
- if (value.image_id === input.id_image) orderedImages.push(value);
169
+
170
+ try {
171
+ var _inputsByRetailer$act;
172
+
173
+ var orderedImages = [];
174
+ var imageIdArray = [];
175
+ if (!_inputsByRetailer[action.retailerId]) _inputsByRetailer[action.retailerId] = [];
176
+ action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
177
+ imageIdArray.push(input.id_image);
178
+ valuesInitial.forEach(function (value) {
179
+ if (value.image_id === input.id_image) orderedImages.push(value);
180
+ });
181
+ }));
182
+ inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
183
+ return imageIdArray.includes(input.id);
177
184
  });
178
- }));
179
- inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
180
- return imageIdArray.includes(input.id);
181
- });
182
- values = orderedImages.length > 0 ? orderedImages : [];
185
+ values = orderedImages.length > 0 ? orderedImages : [];
186
+ } catch (error) {
187
+ console.log(error);
188
+ }
189
+
183
190
  return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
184
191
  values: values,
185
192
  inputs: inputs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.1.96",
3
+ "version": "21.1.97",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -83,21 +83,27 @@ const reducerImages = (state, action) => {
83
83
  return { ...state, values };
84
84
  case "orderImages": {
85
85
  let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
86
- const orderedImages = [];
87
- const imageIdArray = [];
88
- action.retailerId &&
89
- inputsByRetailer[action.retailerId]?.filter((input) => {
90
- imageIdArray.push(input.id_image);
91
- valuesInitial.forEach((value) => {
92
- if (value.image_id === input.id_image) orderedImages.push(value);
86
+ try {
87
+ const orderedImages = [];
88
+ const imageIdArray = [];
89
+ if (!inputsByRetailer[action.retailerId])
90
+ inputsByRetailer[action.retailerId] = [];
91
+ action.retailerId &&
92
+ inputsByRetailer[action.retailerId]?.filter((input) => {
93
+ imageIdArray.push(input.id_image);
94
+ valuesInitial.forEach((value) => {
95
+ if (value.image_id === input.id_image) orderedImages.push(value);
96
+ });
93
97
  });
94
- });
95
98
 
96
- inputs = inputsInitial?.filter((input) =>
97
- imageIdArray.includes(input.id)
98
- );
99
+ inputs = inputsInitial?.filter((input) =>
100
+ imageIdArray.includes(input.id)
101
+ );
99
102
 
100
- values = orderedImages.length > 0 ? orderedImages : [];
103
+ values = orderedImages.length > 0 ? orderedImages : [];
104
+ } catch (error) {
105
+ console.log(error);
106
+ }
101
107
  return { ...state, values, inputs };
102
108
  }
103
109
  default: