contentoh-components-library 21.6.57 → 21.6.59
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/.claude/settings.local.json +7 -0
- package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +90 -135
- package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +148 -162
- package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +16 -0
- package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +1 -0
- package/dist/components/pages/CreatorsProductEdition/sections/ImageGallery.js +433 -0
- package/dist/components/pages/CreatorsProductEdition/sections/NoticeDialog.js +155 -0
- package/dist/components/pages/CreatorsProductEdition/sections/RejectDialog.js +201 -0
- package/dist/components/pages/CreatorsProductEdition/sections/VersionDrawer.js +615 -0
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +3 -31
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +55 -30
- package/dist/components/pages/CreatorsProductEdition/stories/products.js +923 -0
- package/dist/components/pages/CreatorsProductEdition/styles.js +27 -7
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -1
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +325 -10
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.reducer.js +12 -2
- package/dist/components/pages/ProviderProductEdition/index.js +486 -231
- package/dist/index.js +13 -0
- package/package.json +1 -1
- package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +777 -0
- package/src/components/pages/CreatorsProductEdition/constants.js +21 -0
- package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +2238 -0
- package/src/components/pages/CreatorsProductEdition/index.js +19 -0
- package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +357 -0
- package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +144 -0
- package/src/components/pages/CreatorsProductEdition/sections/CommentBox.jsx +183 -0
- package/src/components/pages/CreatorsProductEdition/sections/ImageGallery.jsx +269 -0
- package/src/components/pages/CreatorsProductEdition/sections/ImagePanel.jsx +332 -0
- package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +385 -0
- package/src/components/pages/CreatorsProductEdition/sections/NoticeDialog.jsx +111 -0
- package/src/components/pages/CreatorsProductEdition/sections/ProductHeader.jsx +305 -0
- package/src/components/pages/CreatorsProductEdition/sections/ProductMedia.jsx +101 -0
- package/src/components/pages/CreatorsProductEdition/sections/RejectDialog.jsx +125 -0
- package/src/components/pages/CreatorsProductEdition/sections/RetailerMenu.jsx +129 -0
- package/src/components/pages/CreatorsProductEdition/sections/ServiceActions.jsx +382 -0
- package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +37 -0
- package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +187 -0
- package/src/components/pages/CreatorsProductEdition/sections/VariantsPanel.jsx +311 -0
- package/src/components/pages/CreatorsProductEdition/sections/VersionDrawer.jsx +357 -0
- package/src/components/pages/CreatorsProductEdition/sections/tokens.js +63 -0
- package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +111 -0
- package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +85 -0
- package/src/components/pages/CreatorsProductEdition/stories/products.js +966 -0
- package/src/components/pages/CreatorsProductEdition/styles.js +178 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +1 -0
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +201 -0
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.reducer.js +12 -0
- package/src/components/pages/ProviderProductEdition/index.js +228 -7
- package/src/index.js +1 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FontFamily, GlobalColors } from "../../../../global-files/variables";
|
|
2
|
+
import { STATUS_DICTIONARY } from "../../../../global-files/statusDictionary";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Colores y tipografía de la edición de producto, en un solo lugar para las
|
|
6
|
+
secciones hechas con MUI. Son los mismos de los componentes originales
|
|
7
|
+
(Status, FeatureTag, TabSection, ScreenHeader...): el diseño no cambia.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const COLORS = GlobalColors;
|
|
11
|
+
export const FONTS = FontFamily;
|
|
12
|
+
|
|
13
|
+
/** Color de fondo de la etiqueta de estatus, como en `atoms/Status/styles.js`. */
|
|
14
|
+
const STATUS_COLORS = {
|
|
15
|
+
CA: GlobalColors.in_progress,
|
|
16
|
+
IE: GlobalColors.in_progress,
|
|
17
|
+
GLD: GlobalColors.in_progress,
|
|
18
|
+
R: GlobalColors.reception,
|
|
19
|
+
AS: GlobalColors.reception,
|
|
20
|
+
SAC: GlobalColors.reception,
|
|
21
|
+
PA: GlobalColors.reception,
|
|
22
|
+
AA: GlobalColors.finished,
|
|
23
|
+
AP: GlobalColors.finished,
|
|
24
|
+
AC: GlobalColors.finished,
|
|
25
|
+
AAC: GlobalColors.finished,
|
|
26
|
+
ACA: GlobalColors.finished,
|
|
27
|
+
RA: GlobalColors.rejected_status,
|
|
28
|
+
RC: GlobalColors.rejected_status,
|
|
29
|
+
RP: GlobalColors.rejected_status,
|
|
30
|
+
RAC: GlobalColors.rejected_status,
|
|
31
|
+
RCA: GlobalColors.rejected_status,
|
|
32
|
+
Dat: GlobalColors.s4,
|
|
33
|
+
Dsc: GlobalColors.s4,
|
|
34
|
+
Imgs: GlobalColors.s4,
|
|
35
|
+
FAP: GlobalColors.exported,
|
|
36
|
+
Ex: GlobalColors.exported,
|
|
37
|
+
DDI: GlobalColors.original_purpura,
|
|
38
|
+
TAB: GlobalColors.deep_gray,
|
|
39
|
+
Pt: GlobalColors.s2,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** "RA/AS" se pinta con el color de la primera parte, igual que el original. */
|
|
43
|
+
export const statusColor = (status) =>
|
|
44
|
+
STATUS_COLORS[String(status ?? "").replace(/\/.*/, "")] ?? GlobalColors.s3;
|
|
45
|
+
|
|
46
|
+
/** Nombre legible: "RA/AS" → "Rechazado Auditor / Asignado". */
|
|
47
|
+
export const statusName = (status) => {
|
|
48
|
+
if (!status) return null;
|
|
49
|
+
const names = String(status)
|
|
50
|
+
.split("/")
|
|
51
|
+
.map((key) => STATUS_DICTIONARY[key]?.name)
|
|
52
|
+
.filter(Boolean);
|
|
53
|
+
return names.length > 0 ? names.join(" / ") : null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const retailerImage = (retailer) =>
|
|
57
|
+
retailer?.image ||
|
|
58
|
+
`https://content-management-images.s3.amazonaws.com/retailers/${
|
|
59
|
+
retailer?.id ?? retailer?.id_retailer
|
|
60
|
+
}.png`;
|
|
61
|
+
|
|
62
|
+
/** El id de una cadena llega como `id` o como `id_retailer` según el origen. */
|
|
63
|
+
export const retailerId = (retailer) => retailer?.id ?? retailer?.id_retailer;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { CreatorsProductEdition } from "../index";
|
|
2
|
+
import { withMockApi } from "../mocks/mockApi";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Historias con datos locales: no le pegan a ninguna API, así que funcionan
|
|
6
|
+
siempre, sin token ni producto vivo en dev. Las respuestas están en
|
|
7
|
+
`mocks/api.fixtures.js`. Guardar, aprobar o rechazar se acepta sin hacer
|
|
8
|
+
nada (queda en la consola como `[mock API]`).
|
|
9
|
+
|
|
10
|
+
El producto y los usuarios salen de las historias de RetailerProductEdition
|
|
11
|
+
para que las dos vistas se comparen con lo mismo. El token va solo porque la
|
|
12
|
+
pantalla lo exige: aquí no sale a ningún lado.
|
|
13
|
+
*/
|
|
14
|
+
import { ImageEditor } from "../../RetailerProductEdition/stories/ImageEditor.stories";
|
|
15
|
+
import { TextEditor } from "../../RetailerProductEdition/stories/TextEditor.stories";
|
|
16
|
+
import { Auditor } from "../../RetailerProductEdition/stories/Auditor.stories";
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
title: "Components/pages/CreatorsProductEdition",
|
|
20
|
+
component: CreatorsProductEdition,
|
|
21
|
+
decorators: [withMockApi()],
|
|
22
|
+
parameters: { layout: "fullscreen" },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Como en la app: la pantalla vive en una caja de altura fija que no se
|
|
26
|
+
// desplaza. El scroll tiene que darlo la propia pantalla, en todos los tamaños.
|
|
27
|
+
const Template = (args) => (
|
|
28
|
+
<div style={{ height: "100vh", display: "flex", overflow: "hidden" }}>
|
|
29
|
+
<CreatorsProductEdition {...args} />
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const base = {
|
|
34
|
+
token: ImageEditor.args.token,
|
|
35
|
+
productSelected: ImageEditor.args.productSelected,
|
|
36
|
+
enableDigitalAssets: true,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const TODAS_LAS_PESTAÑAS = {
|
|
40
|
+
Descripción: true,
|
|
41
|
+
"Ficha técnica": true,
|
|
42
|
+
Imágenes: true,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const celular = { viewport: { defaultViewport: "mobile2" } };
|
|
46
|
+
|
|
47
|
+
// --- Especialista de edición (rol 8): pestaña de imágenes -------------------
|
|
48
|
+
|
|
49
|
+
export const EspecialistaImagenes = Template.bind({});
|
|
50
|
+
EspecialistaImagenes.args = {
|
|
51
|
+
...base,
|
|
52
|
+
tabsSections: ImageEditor.args.tabsSections,
|
|
53
|
+
user: ImageEditor.args.user,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const EspecialistaImagenesCelular = Template.bind({});
|
|
57
|
+
EspecialistaImagenesCelular.args = EspecialistaImagenes.args;
|
|
58
|
+
EspecialistaImagenesCelular.parameters = celular;
|
|
59
|
+
|
|
60
|
+
// --- Especialista de textos (rol 7): descripción ----------------------------
|
|
61
|
+
|
|
62
|
+
export const EspecialistaTextos = Template.bind({});
|
|
63
|
+
EspecialistaTextos.args = {
|
|
64
|
+
...base,
|
|
65
|
+
tabsSections: TextEditor.args.tabsSections,
|
|
66
|
+
user: TextEditor.args.user,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const EspecialistaTextosCelular = Template.bind({});
|
|
70
|
+
EspecialistaTextosCelular.args = EspecialistaTextos.args;
|
|
71
|
+
EspecialistaTextosCelular.parameters = celular;
|
|
72
|
+
|
|
73
|
+
// --- Auditor QA (rol 6): las tres pestañas ----------------------------------
|
|
74
|
+
|
|
75
|
+
export const AuditorQA = Template.bind({});
|
|
76
|
+
AuditorQA.args = {
|
|
77
|
+
...base,
|
|
78
|
+
tabsSections: TODAS_LAS_PESTAÑAS,
|
|
79
|
+
user: Auditor.args.user,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const AuditorQACelular = Template.bind({});
|
|
83
|
+
AuditorQACelular.args = AuditorQA.args;
|
|
84
|
+
AuditorQACelular.parameters = celular;
|
|
85
|
+
|
|
86
|
+
// Del Sol en "AC": el auditor asignado ve el botón para validar o rechazar.
|
|
87
|
+
export const AuditorPorEvaluar = Template.bind({});
|
|
88
|
+
AuditorPorEvaluar.args = AuditorQA.args;
|
|
89
|
+
AuditorPorEvaluar.decorators = [withMockApi({ delSolStatus: "AC" })];
|
|
90
|
+
|
|
91
|
+
// --- Variantes ---------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
// Padre con dos hijos y en un grupo de variantes.
|
|
94
|
+
export const ConVariantes = Template.bind({});
|
|
95
|
+
ConVariantes.args = EspecialistaTextos.args;
|
|
96
|
+
ConVariantes.decorators = [withMockApi({ familia: "padre", grupo: true })];
|
|
97
|
+
|
|
98
|
+
// Hijo de otro producto: no ofrece ligar ni agrupar.
|
|
99
|
+
export const HijoDeOtro = Template.bind({});
|
|
100
|
+
HijoDeOtro.args = EspecialistaTextos.args;
|
|
101
|
+
HijoDeOtro.decorators = [withMockApi({ familia: "hijo" })];
|
|
102
|
+
|
|
103
|
+
// --- Casos límite -----------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
export const SinImagenes = Template.bind({});
|
|
106
|
+
SinImagenes.args = EspecialistaImagenes.args;
|
|
107
|
+
SinImagenes.decorators = [withMockApi({ images: false })];
|
|
108
|
+
|
|
109
|
+
export const ErrorAlCargar = Template.bind({});
|
|
110
|
+
ErrorAlCargar.args = EspecialistaImagenes.args;
|
|
111
|
+
ErrorAlCargar.decorators = [withMockApi({ failLoad: true })];
|
package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { CreatorsProductEdition } from "../index";
|
|
2
|
+
import { withRealApi } from "../mocks/mockApi";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Historias contra la API real de dev. El token y los usuarios se importan de
|
|
6
|
+
las historias de RetailerProductEdition para no duplicarlos; los productos
|
|
7
|
+
reales están en `products.js`.
|
|
8
|
+
|
|
9
|
+
Dependen de que el token siga sirviendo y el producto exista en dev: si una
|
|
10
|
+
falla al cargar, revisar primero eso. Las historias con datos locales, que no
|
|
11
|
+
dependen de nada, están en `CreatorsProductEdition.stories.js`.
|
|
12
|
+
*/
|
|
13
|
+
import { ImageEditor } from "../../RetailerProductEdition/stories/ImageEditor.stories";
|
|
14
|
+
import { Auditor } from "../../RetailerProductEdition/stories/Auditor.stories";
|
|
15
|
+
import { TextEditor } from "../../RetailerProductEdition/stories/TextEditor.stories";
|
|
16
|
+
import { CAMISA_WALMART_MG, RELOJ_CUATRO_CADENAS, VENTILADOR_THD } from "./products";
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
title: "Components/pages/CreatorsProductEdition/API real",
|
|
20
|
+
component: CreatorsProductEdition,
|
|
21
|
+
// Por si se llega desde una historia con datos locales: la API real.
|
|
22
|
+
decorators: [withRealApi],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const Template = (args) => <CreatorsProductEdition {...args} />;
|
|
26
|
+
|
|
27
|
+
// Una historia por producto y rol. Para verla en tablet o celular, usar el
|
|
28
|
+
// selector de viewport de la barra de Storybook.
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
Producto por omisión: el ventilador de The Home Depot Golden. El token es el
|
|
32
|
+
de las historias de RetailerProductEdition; los usuarios también, así que no
|
|
33
|
+
son los asignados a este producto y la pantalla puede mostrar menos botones
|
|
34
|
+
de los que vería el especialista o el auditor real.
|
|
35
|
+
*/
|
|
36
|
+
const base = {
|
|
37
|
+
token: ImageEditor.args.token,
|
|
38
|
+
productSelected: VENTILADOR_THD,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Imagenes = Template.bind({});
|
|
42
|
+
Imagenes.args = {
|
|
43
|
+
...base,
|
|
44
|
+
tabsSections: ImageEditor.args.tabsSections,
|
|
45
|
+
user: ImageEditor.args.user,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Textos = Template.bind({});
|
|
49
|
+
Textos.args = {
|
|
50
|
+
...base,
|
|
51
|
+
tabsSections: TextEditor.args.tabsSections,
|
|
52
|
+
user: TextEditor.args.user,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const AuditorQA = Template.bind({});
|
|
56
|
+
AuditorQA.args = {
|
|
57
|
+
...base,
|
|
58
|
+
tabsSections: Auditor.args.tabsSections,
|
|
59
|
+
user: Auditor.args.user,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// --- Otros productos --------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
// Camisa de Walmart MG: solo imágenes; ficha técnica y descripciones "NS".
|
|
65
|
+
export const CamisaSoloImagenes = Template.bind({});
|
|
66
|
+
CamisaSoloImagenes.args = {
|
|
67
|
+
...Imagenes.args,
|
|
68
|
+
productSelected: CAMISA_WALMART_MG,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Reloj con cuatro cadenas en el artículo, pero su orden solo trae Sanborns:
|
|
72
|
+
// el selector muestra únicamente las cadenas de la orden.
|
|
73
|
+
export const RelojCuatroCadenas = Template.bind({});
|
|
74
|
+
RelojCuatroCadenas.args = {
|
|
75
|
+
...Imagenes.args,
|
|
76
|
+
productSelected: RELOJ_CUATRO_CADENAS,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Yogurt de Del Sol y Oxxo (dos cadenas), el producto de ImageEditor.
|
|
80
|
+
export const YogurtDosCadenas = Template.bind({});
|
|
81
|
+
YogurtDosCadenas.args = { ...ImageEditor.args };
|
|
82
|
+
|
|
83
|
+
// Maceta de The Home Depot Golden con el auditor, como en Auditor.stories.
|
|
84
|
+
export const MacetaAuditor = Template.bind({});
|
|
85
|
+
MacetaAuditor.args = { ...Auditor.args };
|