contentoh-components-library 21.5.91 → 21.5.93
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/dist/components/atoms/GeneralButton/styles.js +1 -1
- package/dist/components/atoms/GeneralInput/index.js +54 -245
- package/dist/components/atoms/GeneralInput/styles.js +3 -7
- package/dist/components/atoms/InputFormatter/index.js +68 -223
- package/dist/components/atoms/InputFormatter/styles.js +4 -20
- package/dist/components/molecules/StatusAsignationInfo/index.js +1 -11
- package/dist/components/molecules/TabsMenu/index.js +12 -13
- package/dist/components/molecules/TagAndInput/index.js +24 -361
- package/dist/components/molecules/TagAndInput/styles.js +2 -2
- package/dist/components/organisms/FullProductNameHeader/index.js +22 -6
- package/dist/components/organisms/InputGroup/index.js +18 -22
- package/dist/components/pages/ProviderProductEdition/index.js +47 -34
- package/dist/components/pages/ProviderProductEdition/utils.js +0 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +196 -179
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +260 -59
- package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +38 -50
- package/dist/components/pages/RetailerProductEdition/index.js +2234 -1715
- package/dist/components/pages/RetailerProductEdition/styles.js +2 -4
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -251
- package/dist/contexts/AiProductEdition.js +157 -234
- package/package.json +2 -4
- package/src/components/atoms/GeneralButton/styles.js +0 -4
- package/src/components/atoms/GeneralInput/index.js +60 -237
- package/src/components/atoms/GeneralInput/styles.js +0 -81
- package/src/components/atoms/InputFormatter/index.js +51 -200
- package/src/components/atoms/InputFormatter/styles.js +0 -284
- package/src/components/molecules/StatusAsignationInfo/index.js +1 -9
- package/src/components/molecules/TabsMenu/index.js +11 -12
- package/src/components/molecules/TagAndInput/index.js +21 -286
- package/src/components/molecules/TagAndInput/styles.js +17 -59
- package/src/components/organisms/FullProductNameHeader/index.js +28 -4
- package/src/components/organisms/FullTabsMenu/index.js +1 -1
- package/src/components/organisms/InputGroup/index.js +4 -12
- package/src/components/pages/ProviderProductEdition/index.js +69 -51
- package/src/components/pages/ProviderProductEdition/utils.js +2 -2
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +224 -201
- package/src/components/pages/RetailerProductEdition/index.js +1718 -1546
- package/src/components/pages/RetailerProductEdition/styles.js +2 -67
- package/src/components/pages/RetailerProductEdition/utils.js +0 -240
- package/dist/ai/utils/compare-strings.js +0 -45
- package/dist/components/organisms/ChangeStatusModal/index.js +0 -531
- package/dist/components/organisms/ChangeStatusModal/styles.js +0 -85
- package/dist/global-files/statusDictionary.js +0 -103
- package/src/ai/utils/compare-strings.js +0 -45
- package/src/assets/images/Icons/arrow.png +0 -0
- package/src/assets/images/Icons/cancel.png +0 -0
- package/src/assets/images/Icons/ia-icon.png +0 -0
- package/src/assets/images/Icons/loading.svg +0 -5
- package/src/assets/images/Icons/reload.png +0 -0
- package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +0 -10
- package/src/components/atoms/RetailerSelector/index.js +0 -3
- package/src/components/atoms/RetailerSelector/styles.js +0 -0
- package/src/components/organisms/ChangeStatusModal/index.jsx +0 -488
- package/src/components/organisms/ChangeStatusModal/styles.js +0 -333
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +0 -575
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +0 -62
- package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +0 -344
- package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +0 -155
- package/src/components/pages/RetailerProductEdition/context/reducers/product.js +0 -114
- package/src/components/pages/RetailerProductEdition/context/reducers/system.js +0 -60
- package/src/components/pages/RetailerProductEdition/index_old.js +0 -1979
- package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +0 -101
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +0 -115
- package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +0 -174
- package/src/contexts/AiProductEdition.jsx +0 -344
- package/src/global-files/statusDictionary.js +0 -103
|
@@ -42,7 +42,6 @@ import errorIcon from "../../../assets/images/genericModal/errorModal.svg";
|
|
|
42
42
|
import warningIcon from "../../../assets/images/genericModal/genericModalWarning.svg";
|
|
43
43
|
|
|
44
44
|
import { Container } from "./styles";
|
|
45
|
-
import { AiProductEditionProvider } from "../../../contexts/AiProductEdition";
|
|
46
45
|
|
|
47
46
|
const ProviderProductEditionView = ({
|
|
48
47
|
tabsSections,
|
|
@@ -149,13 +148,30 @@ const ProviderProductEditionView = ({
|
|
|
149
148
|
|
|
150
149
|
const productNormalized = normalizeProduct(product);
|
|
151
150
|
|
|
151
|
+
console.log({ productNormalized });
|
|
152
|
+
|
|
152
153
|
dispatch({
|
|
153
154
|
type: "SET_PRODUCT",
|
|
154
155
|
payload: productNormalized,
|
|
155
156
|
});
|
|
156
157
|
dispatch({
|
|
157
158
|
type: "SET_ACTIVE_RETAILER",
|
|
158
|
-
payload: productNormalized.
|
|
159
|
+
payload: productNormalized.categoryRetailerInOrder[0],
|
|
160
|
+
});
|
|
161
|
+
const firstRetailerStatus =
|
|
162
|
+
productNormalized.statusByRetailer[
|
|
163
|
+
productNormalized.categoryRetailerInOrder[0].id_retailer
|
|
164
|
+
];
|
|
165
|
+
const initialTab = firstRetailerStatus.description
|
|
166
|
+
? "Descripción"
|
|
167
|
+
: firstRetailerStatus.datasheet
|
|
168
|
+
? "Ficha técnica"
|
|
169
|
+
: firstRetailerStatus.images
|
|
170
|
+
? "Imágenes"
|
|
171
|
+
: "Imágenes";
|
|
172
|
+
dispatch({
|
|
173
|
+
type: "SET_ACTIVE_TAB",
|
|
174
|
+
payload: initialTab,
|
|
159
175
|
});
|
|
160
176
|
} catch (error) {
|
|
161
177
|
console.log("Error setting product data: ", error);
|
|
@@ -200,7 +216,7 @@ const ProviderProductEditionView = ({
|
|
|
200
216
|
id_category,
|
|
201
217
|
version,
|
|
202
218
|
token,
|
|
203
|
-
id_retailer
|
|
219
|
+
id_retailer,
|
|
204
220
|
),
|
|
205
221
|
getPercentage({ data, headers }),
|
|
206
222
|
getServicesData({
|
|
@@ -247,7 +263,7 @@ const ProviderProductEditionView = ({
|
|
|
247
263
|
dispatch({
|
|
248
264
|
type: "SET_ACTIVE_PERCENTAGES",
|
|
249
265
|
payload: percentages.find(
|
|
250
|
-
({ id_retailer: rId }) => rId === id_retailer
|
|
266
|
+
({ id_retailer: rId }) => rId === id_retailer,
|
|
251
267
|
),
|
|
252
268
|
});
|
|
253
269
|
} catch (error) {
|
|
@@ -267,46 +283,51 @@ const ProviderProductEditionView = ({
|
|
|
267
283
|
console.log("Actualizar inputs del retailer activo");
|
|
268
284
|
const updateInputsActiveRetailer = () => {
|
|
269
285
|
if (!state.services) return;
|
|
286
|
+
if (state.services.datasheets) {
|
|
287
|
+
const retailerDatasheets =
|
|
288
|
+
state.services.datasheets[state.active_retailer.id_retailer];
|
|
270
289
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
...retailerDatasheets,
|
|
276
|
-
data: Object.values(retailerDatasheets.data),
|
|
277
|
-
};
|
|
290
|
+
const datasheetsActiveRetailer = {
|
|
291
|
+
...retailerDatasheets,
|
|
292
|
+
data: Object.values(retailerDatasheets.data),
|
|
293
|
+
};
|
|
278
294
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
295
|
+
dispatch({
|
|
296
|
+
type: "SET_DATASHEETS_INPUTS",
|
|
297
|
+
payload: [datasheetsActiveRetailer, state.services.datasheets.inputs],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
282
300
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
(input) =>
|
|
287
|
-
input.id_retailer === state.active_retailer.id_retailer &&
|
|
288
|
-
input.id_image === value.image_id
|
|
289
|
-
)
|
|
301
|
+
if (state.services.descriptions) {
|
|
302
|
+
const descriptionsActiveRetailer = state.services.descriptions.filter(
|
|
303
|
+
(item) => item.id === state.active_retailer.id_retailer,
|
|
290
304
|
);
|
|
291
|
-
});
|
|
292
305
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
306
|
+
dispatch({
|
|
307
|
+
type: "SET_DESCRIPTIONS_INPUTS",
|
|
308
|
+
payload: descriptionsActiveRetailer,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
297
311
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
312
|
+
if (state.services.images) {
|
|
313
|
+
const filteredValues = state.services.images.values.filter((value) => {
|
|
314
|
+
return state.services.images.inputsByRetailer.some((retailerInput) =>
|
|
315
|
+
retailerInput.some(
|
|
316
|
+
(input) =>
|
|
317
|
+
input.id_retailer === state.active_retailer.id_retailer &&
|
|
318
|
+
input.id_image === value.image_id,
|
|
319
|
+
),
|
|
320
|
+
);
|
|
321
|
+
});
|
|
302
322
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
323
|
+
dispatch({
|
|
324
|
+
type: "SET_IMAGES_VALUES",
|
|
325
|
+
payload: {
|
|
326
|
+
...state.services.images,
|
|
327
|
+
values: filteredValues,
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
}
|
|
310
331
|
};
|
|
311
332
|
|
|
312
333
|
updateInputsActiveRetailer();
|
|
@@ -378,7 +399,7 @@ const ProviderProductEditionView = ({
|
|
|
378
399
|
name: e?.name,
|
|
379
400
|
required: e?.required,
|
|
380
401
|
active: state.images_values?.values?.some(
|
|
381
|
-
(value) => value?.image_id === e?.id
|
|
402
|
+
(value) => value?.image_id === e?.id,
|
|
382
403
|
),
|
|
383
404
|
}));
|
|
384
405
|
const imageType = state.images_values?.imageType?.map((e) => ({
|
|
@@ -389,7 +410,7 @@ const ProviderProductEditionView = ({
|
|
|
389
410
|
(e) => ({
|
|
390
411
|
value: e?.id,
|
|
391
412
|
name: e?.name,
|
|
392
|
-
})
|
|
413
|
+
}),
|
|
393
414
|
);
|
|
394
415
|
|
|
395
416
|
return state.images_values?.values?.map((image, index) => (
|
|
@@ -644,7 +665,7 @@ const ProviderProductEditionView = ({
|
|
|
644
665
|
headers: {
|
|
645
666
|
Authorization: token,
|
|
646
667
|
},
|
|
647
|
-
}
|
|
668
|
+
},
|
|
648
669
|
);
|
|
649
670
|
|
|
650
671
|
const newStatuses = JSON.parse(res.data.body);
|
|
@@ -892,7 +913,7 @@ const ProviderProductEditionView = ({
|
|
|
892
913
|
headers: {
|
|
893
914
|
Authorization: token,
|
|
894
915
|
},
|
|
895
|
-
})
|
|
916
|
+
}),
|
|
896
917
|
);
|
|
897
918
|
});
|
|
898
919
|
|
|
@@ -937,7 +958,7 @@ const ProviderProductEditionView = ({
|
|
|
937
958
|
ArticleId: updatedProduct.id_article,
|
|
938
959
|
idCategory: updatedProduct.id_category,
|
|
939
960
|
product: updatedProduct,
|
|
940
|
-
})
|
|
961
|
+
}),
|
|
941
962
|
);
|
|
942
963
|
|
|
943
964
|
// Mostrar modal de éxito
|
|
@@ -1004,6 +1025,7 @@ const ProviderProductEditionView = ({
|
|
|
1004
1025
|
|
|
1005
1026
|
return (
|
|
1006
1027
|
<Container headerTop={headerTop}>
|
|
1028
|
+
{/* <button onClick={() => console.log(state)}>log</button> */}
|
|
1007
1029
|
{showVersionSelector && (
|
|
1008
1030
|
<VersionSelector
|
|
1009
1031
|
modalId={"version-selector"}
|
|
@@ -1099,7 +1121,7 @@ const ProviderProductEditionView = ({
|
|
|
1099
1121
|
size={12}
|
|
1100
1122
|
onClick={async () => {
|
|
1101
1123
|
const elements = document.querySelectorAll(
|
|
1102
|
-
"#modal-message-box .ql-container .ql-editor > p"
|
|
1124
|
+
"#modal-message-box .ql-container .ql-editor > p",
|
|
1103
1125
|
);
|
|
1104
1126
|
|
|
1105
1127
|
if (!elements || elements.length === 0) {
|
|
@@ -1114,7 +1136,7 @@ const ProviderProductEditionView = ({
|
|
|
1114
1136
|
|
|
1115
1137
|
if (isMessageEmpty) {
|
|
1116
1138
|
const container = document.querySelector(
|
|
1117
|
-
".container-customComponent"
|
|
1139
|
+
".container-customComponent",
|
|
1118
1140
|
);
|
|
1119
1141
|
const existingAlert = container.querySelector(".alert-error");
|
|
1120
1142
|
|
|
@@ -1146,7 +1168,7 @@ const ProviderProductEditionView = ({
|
|
|
1146
1168
|
.join("")
|
|
1147
1169
|
.replace(/<br\s*\/?>/gi, "\n");
|
|
1148
1170
|
|
|
1149
|
-
await createComment(fullMessage
|
|
1171
|
+
await createComment(fullMessage);
|
|
1150
1172
|
|
|
1151
1173
|
rejectAll
|
|
1152
1174
|
? handleOnEvaluateAll("R")
|
|
@@ -1309,7 +1331,7 @@ const ProviderProductEditionView = ({
|
|
|
1309
1331
|
handleOnUpdateApprovedInputs // No se usa?
|
|
1310
1332
|
}
|
|
1311
1333
|
/>
|
|
1312
|
-
)
|
|
1334
|
+
),
|
|
1313
1335
|
)}
|
|
1314
1336
|
</>
|
|
1315
1337
|
) : (
|
|
@@ -1413,11 +1435,7 @@ const ProviderProductEditionView = ({
|
|
|
1413
1435
|
export const ProviderProductEdition = (props) => {
|
|
1414
1436
|
return (
|
|
1415
1437
|
<ProviderProductEditionProvider>
|
|
1416
|
-
<
|
|
1417
|
-
isCreatorsEdition={false}
|
|
1418
|
-
>
|
|
1419
|
-
<ProviderProductEditionView {...props} />
|
|
1420
|
-
</AiProductEditionProvider>
|
|
1438
|
+
<ProviderProductEditionView {...props} />
|
|
1421
1439
|
</ProviderProductEditionProvider>
|
|
1422
1440
|
);
|
|
1423
1441
|
};
|
|
@@ -9,7 +9,6 @@ export const normalizeProduct = (product) => {
|
|
|
9
9
|
? categoryRetailer.map((rel) => ({
|
|
10
10
|
id_retailer: rel.id_retailer || rel.retailer_id,
|
|
11
11
|
retailer: rel.retailer_name || rel.retailerName,
|
|
12
|
-
name: rel.retailer_name || rel.retailerName,
|
|
13
12
|
id_category: rel.id_category,
|
|
14
13
|
category: rel.category_name || rel.categoryName,
|
|
15
14
|
image: `https://content-management-images.s3.amazonaws.com/retailers/${
|
|
@@ -54,7 +53,8 @@ export const normalizeProduct = (product) => {
|
|
|
54
53
|
id_datasheet_especialist: article.id_datasheet_especialist || 0,
|
|
55
54
|
id_datasheet_facilitator: article.id_datasheet_facilitator || null,
|
|
56
55
|
id_description_especialist: article.id_description_especialist || 0,
|
|
57
|
-
id_description_facilitator:
|
|
56
|
+
id_description_facilitator:
|
|
57
|
+
article.id_description_facilitator || null,
|
|
58
58
|
id_images_especialist: article.id_images_especialist || 0,
|
|
59
59
|
id_images_facilitator: article.id_images_facilitator || null,
|
|
60
60
|
id_auditor: article.id_auditor || 0,
|