@rocketsearch/nuxt-uappi 0.2.3 → 0.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocketsearch/nuxt-uappi",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Rocket Search para storefronts Uappi (Nuxt 2): busca, autocomplete, vitrines, banners e eventos",
5
5
  "main": "module.js",
6
6
  "files": [
package/runtime/banner.js CHANGED
@@ -17,6 +17,9 @@ const DEFAULT_ASPECT_RATIO = '3 / 1';
17
17
  // Cada largura distinta é uma variante nova no cache da CF: arredonda num passo.
18
18
  const WIDTH_STEP = 100;
19
19
  const MAX_EXACT_WIDTH = 3840;
20
+ // ROC-690: entrega sem perda: format=webp + quality=100 = WebP lossless na CF (com format=auto
21
+ // o navegador com AVIF recebe AVIF, que é sempre com perda). Mesmo valor em linxecommerce/2.0.0/src/js/rs-banner.js.
22
+ const CDN_RESIZE_OPTS = ',format=webp,quality=100,fit=scale-down';
20
23
 
21
24
  export function clamp01 (n) {
22
25
  if (typeof n !== 'number' || isNaN(n)) return undefined;
@@ -44,7 +47,7 @@ export function cdnResize (url, width, enabled) {
44
47
  try {
45
48
  const abs = new URL(url);
46
49
  if (abs.protocol !== 'https:' && abs.protocol !== 'http:') return url;
47
- return abs.origin + '/cdn-cgi/image/width=' + width + ',format=auto,quality=82,fit=scale-down' + abs.pathname + abs.search;
50
+ return abs.origin + '/cdn-cgi/image/width=' + width + CDN_RESIZE_OPTS + abs.pathname + abs.search;
48
51
  }
49
52
  catch (e) {
50
53
  return url;