contentoh-components-library 21.5.93 → 21.5.95

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.
Files changed (70) hide show
  1. package/dist/ai/utils/compare-strings.js +45 -0
  2. package/dist/components/atoms/GeneralButton/styles.js +1 -1
  3. package/dist/components/atoms/GeneralInput/index.js +245 -54
  4. package/dist/components/atoms/GeneralInput/styles.js +7 -3
  5. package/dist/components/atoms/InputFormatter/index.js +223 -68
  6. package/dist/components/atoms/InputFormatter/styles.js +20 -4
  7. package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
  8. package/dist/components/molecules/TabsMenu/index.js +13 -12
  9. package/dist/components/molecules/TagAndInput/index.js +361 -24
  10. package/dist/components/molecules/TagAndInput/styles.js +2 -2
  11. package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
  12. package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
  13. package/dist/components/organisms/FullProductNameHeader/index.js +6 -22
  14. package/dist/components/organisms/InputGroup/index.js +22 -18
  15. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +150 -337
  16. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
  17. package/dist/components/pages/ProviderProductEdition/index.js +408 -381
  18. package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
  19. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +179 -196
  20. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
  21. package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +50 -38
  22. package/dist/components/pages/RetailerProductEdition/index.js +1719 -2237
  23. package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
  24. package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
  25. package/dist/contexts/AiProductEdition.js +230 -158
  26. package/dist/global-files/statusDictionary.js +103 -0
  27. package/package.json +4 -2
  28. package/src/ai/utils/compare-strings.js +45 -0
  29. package/src/assets/images/Icons/arrow.png +0 -0
  30. package/src/assets/images/Icons/cancel.png +0 -0
  31. package/src/assets/images/Icons/ia-icon.png +0 -0
  32. package/src/assets/images/Icons/loading.svg +5 -0
  33. package/src/assets/images/Icons/reload.png +0 -0
  34. package/src/components/atoms/GeneralButton/styles.js +4 -0
  35. package/src/components/atoms/GeneralInput/index.js +237 -60
  36. package/src/components/atoms/GeneralInput/styles.js +81 -0
  37. package/src/components/atoms/InputFormatter/index.js +200 -51
  38. package/src/components/atoms/InputFormatter/styles.js +284 -0
  39. package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +10 -0
  40. package/src/components/atoms/RetailerSelector/index.js +3 -0
  41. package/src/components/atoms/RetailerSelector/styles.js +0 -0
  42. package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
  43. package/src/components/molecules/TabsMenu/index.js +12 -11
  44. package/src/components/molecules/TagAndInput/index.js +286 -21
  45. package/src/components/molecules/TagAndInput/styles.js +59 -17
  46. package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
  47. package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
  48. package/src/components/organisms/FullProductNameHeader/index.js +4 -28
  49. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  50. package/src/components/organisms/InputGroup/index.js +12 -4
  51. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +174 -202
  52. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
  53. package/src/components/pages/ProviderProductEdition/index.js +489 -457
  54. package/src/components/pages/ProviderProductEdition/utils.js +2 -2
  55. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +201 -224
  56. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +575 -0
  57. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +62 -0
  58. package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +344 -0
  59. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +155 -0
  60. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +114 -0
  61. package/src/components/pages/RetailerProductEdition/context/reducers/system.js +60 -0
  62. package/src/components/pages/RetailerProductEdition/index.js +1545 -1718
  63. package/src/components/pages/RetailerProductEdition/index_old.js +1979 -0
  64. package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +101 -0
  65. package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +115 -0
  66. package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +174 -0
  67. package/src/components/pages/RetailerProductEdition/styles.js +67 -2
  68. package/src/components/pages/RetailerProductEdition/utils.js +240 -0
  69. package/src/contexts/AiProductEdition.jsx +339 -0
  70. package/src/global-files/statusDictionary.js +103 -0
@@ -0,0 +1,333 @@
1
+ import styled from 'styled-components';
2
+ import { Dialog, Box, Button, TextField, Select, Chip, FormControl } from '@mui/material';
3
+
4
+ export const colors = {
5
+ background: 'rgba(0, 0, 0, 0.4)',
6
+ paper: '#FFFFFF',
7
+ primary: '#E039A7',
8
+ primaryHover: '#C82A91',
9
+ textMain: '#121212',
10
+ textMuted: '#666666',
11
+ border: '#E0E0E0',
12
+ inputBg: '#FFFFFF',
13
+ summaryBg: '#F9F9F9',
14
+ };
15
+
16
+ export const StyledDialog = styled(Dialog)`
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+
21
+ .MuiDialog-container {
22
+ width: 100%;
23
+ display: flex;
24
+ justify-content: center;
25
+ align-items: center;
26
+ }
27
+
28
+ .MuiDialog-paper {
29
+ background-color: ${colors.paper};
30
+ color: ${colors.textMain};
31
+ border-radius: 5px;
32
+ padding: 0;
33
+ max-width: 38.5rem;
34
+ max-height: 90vh;
35
+ display: flex;
36
+ flex-direction: column;
37
+ overflow: hidden;
38
+ width: 100%;
39
+ box-shadow: 0 8px 32px rgba(0,0,0,0.15);
40
+ font-family: "Raleway", sans-serif;
41
+ }
42
+ `;
43
+
44
+ export const ModalHeader = styled(Box)`
45
+ flex-shrink: 0;
46
+ position: relative;
47
+ display: flex;
48
+ align-items: center;
49
+ padding: 20px 24px 16px;
50
+ gap: 1rem;
51
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
52
+ margin-bottom: 0.5rem;
53
+
54
+ .close-icon {
55
+ position: absolute;
56
+ top: 12px;
57
+ right: 12px;
58
+ color: ${colors.primary};
59
+ }
60
+
61
+ h2 {
62
+ font-size: 1.35rem;
63
+ font-weight: 600;
64
+ }
65
+
66
+ p {
67
+ margin: 0;
68
+ color: ${colors.textMuted};
69
+ font-size: 0.8rem;
70
+ }
71
+ `;
72
+
73
+ export const BadgeCircle = styled(Box)`
74
+ width: 40px;
75
+ height: 40px;
76
+ border-radius: 50%;
77
+ border: 2px solid ${colors.primary};
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: center;
81
+ background-color: ${colors.paper};
82
+ color: ${colors.primary};
83
+
84
+ svg {
85
+ font-size: 1.5rem;
86
+ }
87
+ `;
88
+
89
+ export const MainSection = styled(Box)`
90
+ flex: 1;
91
+ overflow-y: auto;
92
+ padding-bottom: 20px;
93
+
94
+ &::-webkit-scrollbar {
95
+ width: 8px;
96
+ }
97
+ &::-webkit-scrollbar-track {
98
+ background: transparent;
99
+ }
100
+ &::-webkit-scrollbar-thumb {
101
+ background: #CCCCCC;
102
+ border-radius: 4px;
103
+ }
104
+ &::-webkit-scrollbar-thumb:hover {
105
+ background: #999999;
106
+ }
107
+ `;
108
+
109
+ export const Section = styled(Box)`
110
+ padding: 10px 32px;
111
+ `;
112
+
113
+ export const SectionTitle = styled.h3`
114
+ font-size: 0.9rem;
115
+ font-family: "Raleway-500", "Raleway", sans-serif;
116
+ color: ${colors.textMuted};
117
+ margin-bottom: 12px;
118
+ `;
119
+
120
+ export const ScopeButtonGroup = styled(Box)`
121
+ display: grid;
122
+ grid-template-columns: repeat(3, 1fr);
123
+ gap: 12px;
124
+ margin-bottom: 8px;
125
+ `;
126
+
127
+ export const ScopeButton = styled(Button)`
128
+ && {
129
+ border-radius: 5px;
130
+ text-transform: none;
131
+ text-wrap: nowrap;
132
+ font-weight: 600;
133
+ font-size: 12px;
134
+ padding: 0.4rem 1rem;
135
+ background-color: ${(props) => (props.active ? colors.primary : 'transparent')};
136
+ color: ${(props) => (props.active ? '#FFFFFF' : colors.textMuted)};
137
+ border: 1px solid ${(props) => (props.active ? colors.primary : colors.border)};
138
+ font-family: "Raleway-500", "Raleway", sans-serif;
139
+
140
+ &:hover {
141
+ background-color: ${(props) => (props.active ? colors.primaryHover : colors.summaryBg)};
142
+ }
143
+
144
+ svg {
145
+ margin-right: 8px;
146
+ font-size: 18px;
147
+ }
148
+ }
149
+ `;
150
+
151
+ export const HelperText = styled.p`
152
+ font-size: 0.8rem;
153
+ color: ${colors.textMuted};
154
+ margin: 8px 0 0;
155
+ font-family: "Raleway", sans-serif;
156
+ `;
157
+
158
+ export const StatusPill = styled(Chip)`
159
+ && {
160
+ background-color: ${(props) => (props.selected ? colors.primary : props.disabled ? '#603888' : 'transparent')};
161
+ color: ${(props) => (props.selected ? '#FFFFFF' : props.disabled ? 'white' : 'rgba(0, 0, 0, 0.45)')};
162
+ border: 1px solid ${(props) => props.selected ? colors.primary : 'rgba(0, 0, 0, 0.25)'};
163
+ font-weight: 600;
164
+ border-radius: 5px;
165
+ opacity: 1 !important;
166
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
167
+ font-family: "Raleway", sans-serif;
168
+
169
+ &:hover {
170
+ background-color: ${(props) =>
171
+ props.disabled
172
+ ? 'transparent'
173
+ : (props.selected ? colors.primaryHover : 'rgba(0, 0, 0, 0.05)')};
174
+ }
175
+ }
176
+ `;
177
+
178
+ export const StatusGrid = styled(Box)`
179
+ display: flex;
180
+ flex-wrap: wrap;
181
+ gap: 12px;
182
+ `;
183
+
184
+ export const StyledTextArea = styled(TextField)`
185
+ && {
186
+ width: 100%;
187
+ background-color: ${colors.inputBg};
188
+ border-radius: 8px;
189
+
190
+ .MuiOutlinedInput-root {
191
+ font-size: 14px;
192
+ font-family: "Raleway", sans-serif;
193
+ color: ${colors.textMain};
194
+ fieldset {
195
+ border-color: ${colors.border};
196
+ }
197
+ &:hover fieldset {
198
+ border-color: #BDBDBD;
199
+ }
200
+ &.Mui-focused fieldset {
201
+ border-color: ${colors.primary};
202
+ }
203
+ }
204
+ }
205
+ `;
206
+
207
+ export const StyledSelect = styled(Select)`
208
+ && {
209
+ width: 100%;
210
+ background-color: ${colors.inputBg};
211
+ border-radius: 5px;
212
+ font-family: "Raleway", sans-serif;
213
+ font-size: 0.85rem;
214
+ margin-bottom: 12px;
215
+
216
+ .MuiSelect-select {
217
+ padding: 8px 12px;
218
+ display: flex;
219
+ align-items: center;
220
+ min-height: auto !important;
221
+ }
222
+
223
+ .MuiOutlinedInput-notchedOutline {
224
+ border-color: ${colors.border};
225
+ }
226
+ &:hover .MuiOutlinedInput-notchedOutline {
227
+ border-color: #BDBDBD;
228
+ }
229
+ &.Mui-focused .MuiOutlinedInput-notchedOutline {
230
+ border-color: ${colors.primary};
231
+ }
232
+
233
+ .MuiSvgIcon-root {
234
+ color: ${colors.textMuted};
235
+ font-size: 1.2rem;
236
+ }
237
+ }
238
+ `;
239
+
240
+ export const StyledFormControl = styled(FormControl)`
241
+ && {
242
+ .MuiInputLabel-root {
243
+ font-family: "Raleway", sans-serif;
244
+ font-size: 0.85rem;
245
+ color: ${colors.textMuted};
246
+ transform: translate(14px, 10px) scale(1);
247
+
248
+ &.MuiInputLabel-shrink {
249
+ transform: translate(14px, -8px) scale(0.75);
250
+ color: ${colors.primary};
251
+ background-color: #fff;
252
+ padding: 0 6px;
253
+ }
254
+ }
255
+ }
256
+ `;
257
+
258
+ export const FooterActions = styled(Box)`
259
+ flex-shrink: 0;
260
+ display: flex;
261
+ justify-content: flex-end;
262
+ gap: 16px;
263
+ padding: 16px 32px;
264
+ background-color: ${colors.paper};
265
+ border-top: 1px solid ${colors.border};
266
+ `;
267
+
268
+ export const ActionButton = styled(Button)`
269
+ && {
270
+ text-transform: none;
271
+ font-family: "Raleway-500", "Raleway", sans-serif;
272
+ padding: 4px 16px;
273
+ border-radius: 5px;
274
+
275
+ &.cancel {
276
+ color: ${colors.textMain};
277
+ border: 1px solid ${colors.border};
278
+ &:hover {
279
+ background-color: ${colors.summaryBg};
280
+ }
281
+ }
282
+
283
+ &.submit {
284
+ background-color: ${colors.primary};
285
+ color: #FFFFFF;
286
+ &:hover {
287
+ background-color: ${colors.primaryHover};
288
+ }
289
+ &:disabled {
290
+ opacity: 0.5;
291
+ background-color: #CCCCCC;
292
+ color: #888888;
293
+ }
294
+ }
295
+ }
296
+ `;
297
+
298
+ export const ImpactSummary = styled(Box)`
299
+ margin: 0 32px 32px;
300
+ padding: 20px;
301
+ background-color: ${colors.summaryBg};
302
+ border: 1px solid ${colors.border};
303
+ border-radius: 12px;
304
+
305
+ .summary-title {
306
+ font-family: "Raleway-500", "Raleway", sans-serif;
307
+ font-size: 0.9rem;
308
+ color: ${colors.textMuted};
309
+ margin-bottom: 16px;
310
+ display: block;
311
+ }
312
+
313
+ .status-flow {
314
+ display: flex;
315
+ align-items: center;
316
+ gap: 12px;
317
+ margin-bottom: 16px;
318
+ color: ${colors.textMain};
319
+ }
320
+
321
+ .impact-counts {
322
+ display: flex;
323
+ gap: 24px;
324
+ color: ${colors.textMuted};
325
+ font-size: 0.85rem;
326
+
327
+ div {
328
+ display: flex;
329
+ align-items: center;
330
+ gap: 8px;
331
+ }
332
+ }
333
+ `;
@@ -27,39 +27,15 @@ export const FullProductNameHeader = ({
27
27
  const [retailerIndex, setRetailerIndex] = useState(null);
28
28
 
29
29
  useEffect(() => {
30
- // necesitamos definir los retailers que se deberan de mostrar en el selecto de retailers
31
- // Si se viene desde la vista de productos se deben usar los de categoryRetailer
32
- // Si se vene desde la vista de tareas entonces se debe trabajar con los retailers que esten en statusByRetailer
33
-
34
- const ifFromTasks = headerData.statusByRetailer;
30
+ const ifFromTasks = headerData.statusByRetailer ? true : false;
35
31
  const categoryRetailer =
36
32
  headerData.categoryRetailer || headerData.article.categoryRetailer;
37
33
 
38
- const categoryRetailerNormalized = categoryRetailer
39
- ? categoryRetailer.map((rel) => ({
40
- id_retailer: rel.id_retailer || rel.retailer_id,
41
- retailer: rel.retailer_name || rel.retailerName || rel.retailer,
42
- name: rel.retailer_name || rel.retailerName || rel.retailer,
43
- id_category: rel.id_category,
44
- category: rel.category_name || rel.categoryName || rel.category,
45
- image: `https://content-management-images.s3.amazonaws.com/retailers/${
46
- rel.id_retailer || rel.retailer_id
47
- }.png`,
48
- }))
49
- : null;
50
-
51
- const retailersIdsFromStatusByRetailer = Object.keys(
52
- headerData.statusByRetailer || {}
53
- ).map((id) => parseInt(id, 10));
54
-
55
34
  if (ifFromTasks) {
56
- const categoryRetailerInOrder = categoryRetailerNormalized.filter((rel) =>
57
- retailersIdsFromStatusByRetailer.includes(rel.id_retailer)
58
- );
59
-
60
- setRetailers(categoryRetailerInOrder);
35
+ setRetailers(headerData.categoryRetailerInOrder);
61
36
  } else {
62
- setRetailers(categoryRetailerNormalized);
37
+ console.log({ categoryRetailer });
38
+ setRetailers(categoryRetailer);
63
39
  }
64
40
  }, [servicesData]);
65
41
 
@@ -1,7 +1,7 @@
1
1
  import { Container } from "./styles";
2
2
  import { TabsMenu } from "../../molecules/TabsMenu/index";
3
3
  import { StatusAsignationInfo } from "../../molecules/StatusAsignationInfo/index";
4
- import { useState } from "react";
4
+ import { useEffect, useState } from "react";
5
5
 
6
6
  export const FullTabsMenu = ({
7
7
  tabsSections,
@@ -179,7 +179,7 @@ export const InputGroup = ({
179
179
  ? "inputs-validation-onboarding"
180
180
  : "inputs-validation"
181
181
  }>
182
- {dataInputs[input]?.isApproved === false && (
182
+ {dataInputs[input]?.isApproved === false && (
183
183
  <InputReviewSection
184
184
  inputId={dataInputs[input]?.id}
185
185
  isApproved={dataInputs[input]?.isApproved}
@@ -219,6 +219,7 @@ export const InputGroup = ({
219
219
  inputPlaceHolder={input?.placeholder}
220
220
  articleId={articleId}
221
221
  isRequired={dataInputs[input]?.required}
222
+ aiGenerated={dataInputs[input]?.ai_generated}
222
223
  updatedDatasheets={updatedDatasheets}
223
224
  setUpdatedDatasheets={setUpdatedDatasheets}
224
225
  maxChar={
@@ -277,6 +278,7 @@ export const InputGroup = ({
277
278
  : input?.value
278
279
  }
279
280
  isRequired={input.required}
281
+ aiGenerated={input?.ai_generated}
280
282
  disabled={input.id===44186||input.id===44187?false:input?.isApproved}
281
283
  maxChar={input.max_chars}
282
284
  inputPlaceHolder={input?.placeholder}
@@ -341,13 +343,18 @@ export const InputGroup = ({
341
343
  (dataInputs[input]?.required ? "*" : "")
342
344
  }
343
345
  value={
344
- compare
345
- ? auditInputs[input]?.value
346
- : dataInputs[input]?.value
346
+ dataInputs[input]?.box ? (
347
+ Object.values(dataInputs[input]?.box)[0]
348
+ ) : (
349
+ compare
350
+ ? auditInputs[input]?.value
351
+ : dataInputs[input]?.value
352
+ )
347
353
  }
348
354
  inputPlaceHolder={input?.placeholder}
349
355
  articleId={articleId}
350
356
  isRequired={dataInputs[input]?.required}
357
+ aiGenerated={dataInputs[input]?.ai_generated}
351
358
  updatedDatasheets={updatedDatasheets}
352
359
  setUpdatedDatasheets={setUpdatedDatasheets}
353
360
  maxChar={
@@ -409,6 +416,7 @@ export const InputGroup = ({
409
416
  : input?.value
410
417
  }
411
418
  isRequired={input.required}
419
+ aiGenerated={input?.ai_generated}
412
420
  maxChar={input.max_chars}
413
421
  inputPlaceHolder={input?.placeholder}
414
422
  updatedDescriptions={updatedDescriptions}