@rocketsearch/vue-uappi 0.1.0 → 0.1.1

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/vue-uappi",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Rocket Search para storefronts Uappi em Vue 3 + Vite + Pinia: busca, autocomplete, vitrines, banners e eventos",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -112,7 +112,7 @@ export function toUappiListing (response, products, rawQuery, options) {
112
112
  if (facet.type !== 'terms' || facet.field === 'hasStock' || !(facet.values || []).length) return;
113
113
  const values = facetValues(facet, query, path);
114
114
  if (facet.field === 'brand.name') marcas.push(...values);
115
- else atributos.push({ id: index + 1, nome: facet.label, tipo: 'texto', valores: values });
115
+ else atributos.push({ id: index + 1, nome: facet.label, tipo: 'texto', campo: facet.field, valores: values });
116
116
  });
117
117
 
118
118
  const ordenacao = ((response && response.sortOptions) || []).map(option => ({
@@ -194,9 +194,13 @@ async function withUappiProducts ($rocket, response, query, opts) {
194
194
  export function mergeIntoUappiPage (base, listing) {
195
195
  const conteudo = (base && base.conteudo) || {};
196
196
  const rocket = listing.conteudo.detalhes;
197
+ // A faceta de categoria da Rocket duplicaria a navegação de (sub)categorias da Uappi, que a página
198
+ // mantém. Sem essa navegação (coleção, por exemplo), ela fica: é o único filtro de categoria ali.
199
+ const nav = (conteudo.detalhes && conteudo.detalhes.categorias) || {};
200
+ const hasCategoryNav = [nav.filhas, nav.niveisAnteriores].some(list => Array.isArray(list) && list.length > 0);
197
201
  const detalhes = Object.assign({}, conteudo.detalhes, {
198
202
  marcas: rocket.marcas,
199
- atributos: rocket.atributos,
203
+ atributos: hasCategoryNav ? rocket.atributos.filter(a => a.campo !== 'category.name') : rocket.atributos,
200
204
  filtrosPreco: rocket.filtrosPreco,
201
205
  ordenacao: rocket.ordenacao,
202
206
  filtros: [],