contentoh-components-library 21.6.23 → 21.6.25
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/.env.test +1 -0
- package/dist/_utils/helper.js +47 -2
- package/dist/components/organisms/LinkVariantsModal/index.js +852 -340
- package/dist/components/organisms/LinkVariantsModal/styles.js +40 -18
- package/dist/components/pages/ProviderProductEdition/index.js +193 -110
- package/dist/components/pages/ProviderProductEdition/styles.js +4 -1
- package/package.json +1 -1
- package/src/_utils/helper.js +40 -0
- package/src/components/organisms/LinkVariantsModal/index.js +774 -283
- package/src/components/organisms/LinkVariantsModal/styles.js +228 -72
- package/src/components/pages/ProviderProductEdition/index.js +71 -9
- package/src/components/pages/ProviderProductEdition/styles.js +6 -3
package/.env.test
CHANGED
|
@@ -74,3 +74,4 @@ REACT_APP_ID_AWS=7o2hp8msfl
|
|
|
74
74
|
REACT_APP_ENVIRONMENT=test
|
|
75
75
|
REACT_APP_REGION=us-east-1
|
|
76
76
|
REACT_APP_VARIANTS_ENDPOINT=https://7o2hp8msfl.execute-api.us-east-1.amazonaws.com/test/variants
|
|
77
|
+
REACT_APP_NEW_ARTICLES_ENDPOINT=https://7o2hp8msfl.execute-api.us-east-1.amazonaws.com/test/new-articles
|
package/dist/_utils/helper.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getRetailerPicture = void 0;
|
|
6
|
+
exports.getRetailerPicture = exports.getProductImage = void 0;
|
|
7
7
|
|
|
8
8
|
var _jsBase = require("js-base64");
|
|
9
9
|
|
|
@@ -26,5 +26,50 @@ var getRetailerPicture = function getRetailerPicture(retailerId, width, height)
|
|
|
26
26
|
}
|
|
27
27
|
}));
|
|
28
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* URL servible de una imagen de producto.
|
|
31
|
+
*
|
|
32
|
+
* En base de datos `rel_article_image.src` guarda la KEY dentro del bucket
|
|
33
|
+
* —algo como "id-145246/4/1-e53c705a…"—, no una URL. Puesta tal cual en un
|
|
34
|
+
* <img> el navegador la resuelve contra el host de la app y no carga nada.
|
|
35
|
+
*
|
|
36
|
+
* Se pasa por el redimensionador de CloudFront, igual que getGridImage en la
|
|
37
|
+
* aplicación, para no traer la foto a tamaño completo cuando lo que se muestra
|
|
38
|
+
* es una miniatura.
|
|
39
|
+
*/
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
|
|
42
|
+
exports.getRetailerPicture = getRetailerPicture;
|
|
43
|
+
|
|
44
|
+
var getProductImage = function getProductImage(src) {
|
|
45
|
+
var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 96;
|
|
46
|
+
var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 96;
|
|
47
|
+
if (!src) return ""; // Ya viene absoluta: no hay nada que construir.
|
|
48
|
+
|
|
49
|
+
if (/^https?:\/\//i.test(src)) return src;
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
return "https://d24s337exbt5zr.cloudfront.net/" + _jsBase.Base64.encode(JSON.stringify({
|
|
53
|
+
bucket: process.env.REACT_APP_IMAGES_BUCKET,
|
|
54
|
+
key: src,
|
|
55
|
+
edits: {
|
|
56
|
+
resize: {
|
|
57
|
+
width: width,
|
|
58
|
+
height: height,
|
|
59
|
+
fit: "contain",
|
|
60
|
+
background: {
|
|
61
|
+
r: 255,
|
|
62
|
+
g: 255,
|
|
63
|
+
b: 255,
|
|
64
|
+
alpha: 0
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error("getProductImage: ", error);
|
|
71
|
+
return "";
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.getProductImage = getProductImage;
|