contentoh-components-library 21.6.58 → 21.6.60

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 (42) hide show
  1. package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +90 -135
  2. package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +148 -162
  3. package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +16 -0
  4. package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +1 -0
  5. package/dist/components/pages/CreatorsProductEdition/sections/ImageGallery.js +433 -0
  6. package/dist/components/pages/CreatorsProductEdition/sections/NoticeDialog.js +155 -0
  7. package/dist/components/pages/CreatorsProductEdition/sections/RejectDialog.js +201 -0
  8. package/dist/components/pages/CreatorsProductEdition/sections/VersionDrawer.js +615 -0
  9. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +3 -31
  10. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +55 -30
  11. package/dist/components/pages/CreatorsProductEdition/stories/products.js +923 -0
  12. package/dist/components/pages/CreatorsProductEdition/styles.js +27 -7
  13. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +2 -2
  14. package/dist/index.js +13 -0
  15. package/package.json +1 -1
  16. package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +777 -0
  17. package/src/components/pages/CreatorsProductEdition/constants.js +21 -0
  18. package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +2238 -0
  19. package/src/components/pages/CreatorsProductEdition/index.js +19 -0
  20. package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +357 -0
  21. package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +144 -0
  22. package/src/components/pages/CreatorsProductEdition/sections/CommentBox.jsx +183 -0
  23. package/src/components/pages/CreatorsProductEdition/sections/ImageGallery.jsx +269 -0
  24. package/src/components/pages/CreatorsProductEdition/sections/ImagePanel.jsx +332 -0
  25. package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +385 -0
  26. package/src/components/pages/CreatorsProductEdition/sections/NoticeDialog.jsx +111 -0
  27. package/src/components/pages/CreatorsProductEdition/sections/ProductHeader.jsx +305 -0
  28. package/src/components/pages/CreatorsProductEdition/sections/ProductMedia.jsx +101 -0
  29. package/src/components/pages/CreatorsProductEdition/sections/RejectDialog.jsx +125 -0
  30. package/src/components/pages/CreatorsProductEdition/sections/RetailerMenu.jsx +129 -0
  31. package/src/components/pages/CreatorsProductEdition/sections/ServiceActions.jsx +382 -0
  32. package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +37 -0
  33. package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +187 -0
  34. package/src/components/pages/CreatorsProductEdition/sections/VariantsPanel.jsx +311 -0
  35. package/src/components/pages/CreatorsProductEdition/sections/VersionDrawer.jsx +357 -0
  36. package/src/components/pages/CreatorsProductEdition/sections/tokens.js +63 -0
  37. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +111 -0
  38. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +85 -0
  39. package/src/components/pages/CreatorsProductEdition/stories/products.js +966 -0
  40. package/src/components/pages/CreatorsProductEdition/styles.js +178 -0
  41. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +6 -2
  42. package/src/index.js +1 -0
@@ -0,0 +1,178 @@
1
+ import styled, { createGlobalStyle } from "styled-components";
2
+ import { Footer as PropagateFooter } from "../../organisms/PropagateChangesModal/styles";
3
+ import { Footer as GroupFooter } from "../../organisms/VariantGroupModal/styles";
4
+ import { Footer as LinkFooter } from "../../organisms/LinkVariantsModal/styles";
5
+ import { Footer as UnlinkFooter } from "../../organisms/UnlinkVariantModal/styles";
6
+ import {
7
+ StyledDialog as ChangeStatusDialog,
8
+ ScopeButtonGroup,
9
+ FooterActions as ChangeStatusFooter,
10
+ } from "../../organisms/ChangeStatusModal/styles";
11
+
12
+ /*
13
+ Estilos de la edición de producto de Creators.
14
+
15
+ Parte de `RetailerProductEdition/styles.js` (mismo diseño) y agrega lo que la
16
+ hace responsiva. Tres tamaños, los mismos que usa MUI por omisión:
17
+
18
+ - celular (< 600px): una columna, un solo scroll para toda la pantalla.
19
+ - tablet (600-899px): igual, con más aire.
20
+ - desktop (>= 900px): las dos columnas de siempre, cada una con su scroll.
21
+
22
+ Varios hijos (ImagePreviewer, ImageDataTable, InputGroup...) traen anchos fijos
23
+ y la regla es no tocarlos. Donde estorban se ajustan DESDE AQUÍ, con selectores
24
+ acotados a esta página. Las fases siguientes los van reemplazando por MUI y
25
+ estos ajustes desaparecen con ellos.
26
+ */
27
+
28
+ export const BREAKPOINTS = {
29
+ tablet: 600,
30
+ desktop: 900,
31
+ };
32
+
33
+ const mobile = `@media (max-width: ${BREAKPOINTS.tablet - 1}px)`;
34
+ const belowDesktop = `@media (max-width: ${BREAKPOINTS.desktop - 1}px)`;
35
+
36
+ export const Container = styled.div`
37
+ display: flex;
38
+ flex-direction: column;
39
+ height: 100%;
40
+ flex: 1;
41
+ min-width: 0;
42
+ overflow: auto;
43
+ box-sizing: border-box;
44
+
45
+ /* El scroll lo lleva SIEMPRE este contenedor, como en la vista original: en
46
+ la app la pantalla vive dentro de un layout de altura fija, y si se dejara
47
+ al documento, en celular no habría nada que desplazar. */
48
+ ${belowDesktop} {
49
+ overflow-x: hidden;
50
+ overflow-y: auto;
51
+ -webkit-overflow-scrolling: touch;
52
+ /* Sin overscroll-behavior: contain. Al llegar al final, el scroll tiene
53
+ que poder pasar al contenedor de afuera (el lienzo de Storybook, o la
54
+ página si la app la mete en algo que se desplaza); con contain se queda
55
+ atorado y no hay forma de ver lo que está debajo. */
56
+ }
57
+
58
+ .data-container {
59
+ display: flex;
60
+ flex: 0%;
61
+ gap: 16px;
62
+ min-width: 0;
63
+ height: calc(100% - ${({ headerTop }) => headerTop}px);
64
+ padding: 0 12px 12px;
65
+ box-sizing: border-box;
66
+
67
+ ${belowDesktop} {
68
+ flex-direction: column;
69
+ flex: none;
70
+ height: auto;
71
+ }
72
+
73
+ ${mobile} {
74
+ padding: 0 8px 12px;
75
+ gap: 12px;
76
+ }
77
+
78
+ .image-data-panel {
79
+ flex: 0 0 clamp(280px, 30%, 360px);
80
+ min-width: 0;
81
+
82
+ ${belowDesktop} {
83
+ flex: 0 0 auto;
84
+ width: 100%;
85
+ }
86
+
87
+ ${mobile} {
88
+ max-width: 480px;
89
+ align-self: center;
90
+ }
91
+ }
92
+
93
+ .product-information {
94
+ flex: 1;
95
+ min-width: 0;
96
+ height: 100%;
97
+ display: flex;
98
+ flex-direction: column;
99
+
100
+ ${belowDesktop} {
101
+ height: auto;
102
+ }
103
+
104
+ /* Cabecera, pestañas y grupos de inputs: que puedan encogerse en vez de
105
+ empujar la página hacia los lados. */
106
+ & > * {
107
+ min-width: 0;
108
+ max-width: 100%;
109
+ }
110
+
111
+ .services-information-container {
112
+ height: 100%;
113
+ min-width: 0;
114
+ overflow: auto;
115
+
116
+ ${belowDesktop} {
117
+ height: auto;
118
+ overflow: visible;
119
+ }
120
+ }
121
+
122
+ }
123
+ }
124
+
125
+ /* Modales de variantes (se reutilizan tal cual). Su pie pone el resumen y
126
+ tres botones en una sola fila; en celular no cabe y el botón principal se
127
+ sale del panel. Aquí el resumen va en su propia fila y los botones se
128
+ reparten el ancho. */
129
+ ${mobile} {
130
+ ${PropagateFooter}, ${GroupFooter}, ${LinkFooter}, ${UnlinkFooter} {
131
+ flex-wrap: wrap;
132
+ padding: 12px 16px;
133
+
134
+ .resumen,
135
+ .summary {
136
+ flex: 1 1 100%;
137
+ }
138
+
139
+ .actions {
140
+ flex: 1 1 100%;
141
+ margin-left: 0;
142
+ }
143
+
144
+ button {
145
+ flex: 1 1 0;
146
+ min-width: 0;
147
+ height: auto;
148
+ min-height: 38px;
149
+ padding: 6px 10px;
150
+ }
151
+ }
152
+ }
153
+ `;
154
+
155
+ /*
156
+ Ajustes en celular para `ChangeStatusModal`, que se reutiliza tal cual. Es un
157
+ Dialog de MUI y se pinta en un portal, fuera de `Container`, así que no lo
158
+ alcanzan los selectores de arriba: va como estilo global, que solo existe
159
+ mientras esta pantalla está montada. Los tres botones de «Alcance del cambio»
160
+ no caben en una fila y se encimaban.
161
+ */
162
+ export const ReusedModalsStyles = createGlobalStyle`
163
+ ${mobile} {
164
+ ${ChangeStatusDialog} .MuiDialog-paper {
165
+ margin: 16px;
166
+ max-height: calc(100% - 32px);
167
+ }
168
+
169
+ ${ChangeStatusDialog} ${ScopeButtonGroup} {
170
+ grid-template-columns: 1fr;
171
+ gap: 8px;
172
+ }
173
+
174
+ ${ChangeStatusDialog} ${ChangeStatusFooter} {
175
+ padding: 12px 16px;
176
+ }
177
+ }
178
+ `;
@@ -261,8 +261,12 @@ export const ProviderProductEditionProvider = ({ children }) => {
261
261
  const updateImages = async (token) => {
262
262
  // Imágenes/videos recién agregados a la galería (aún sin id en BD).
263
263
  const newImages = state.images_values?.values?.filter((e) => !e.id) || [];
264
- // Salir solo si no hay nada que crear ni que actualizar.
265
- if (state.updated_images_values.length === 0 && newImages.length === 0)
264
+ // Salir solo si no hay nada que crear, actualizar, ni atributos de imagen pendientes.
265
+ if (
266
+ state.updated_images_values.length === 0 &&
267
+ newImages.length === 0 &&
268
+ state.updated_attr_for_imgs.length === 0
269
+ )
266
270
  return;
267
271
  const updatedImages = state.updated_images_values;
268
272
 
package/src/index.js CHANGED
@@ -115,6 +115,7 @@ export * from "./components/pages/OnboardPlan";
115
115
  export * from "./components/pages/RegistrationLoginSecondStep";
116
116
  export * from "./components/pages/RegistrationLoginThirdStep";
117
117
  export * from "./components/pages/RetailerProductEdition";
118
+ export * from "./components/pages/CreatorsProductEdition";
118
119
  export * from "./components/pages/ProviderProductEdition";
119
120
  export * from "./components/pages/VerificationCodeResetPassword";
120
121
  export * from "./components/pages/MultipleEdition";