libreria-astro-lefebvre 0.1.103 → 0.1.104

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": "libreria-astro-lefebvre",
3
- "version": "0.1.103",
3
+ "version": "0.1.104",
4
4
  "description": "Librería de componentes Astro, React y Vue para Lefebvre",
5
5
  "author": "Equipo web desarrollo Lefebvre",
6
6
  "type": "module",
@@ -9,14 +9,6 @@ export const metadata: ComponentMetadata = {
9
9
  priority: 1,
10
10
  tags: ['footer', 'corporativo', 'rrss', 'legales', 'navegacion', 'prefooter'],
11
11
  fields: [
12
- {
13
- name: 'subdirectory',
14
- type: 'text',
15
- help: 'Ruta base del sitio (p. ej. "/genia-l"). Actualmente no se usa en el renderizado del componente (todos los enlaces son absolutos)',
16
- label: 'Subdirectorio',
17
- mandatory: false,
18
- example_value: '/genia-l'
19
- },
20
12
  {
21
13
  name: 'showPrefooter',
22
14
  type: 'boolean',
@@ -58,24 +50,24 @@ export const metadata: ComponentMetadata = {
58
50
  {
59
51
  name: 'column3ExtraItems',
60
52
  type: 'list',
61
- help: 'Enlaces adicionales que se añaden a los ya existentes en la columna fija "Portales Lefebvre" (GenIA-L, LexON, Formación, ElDerecho.com, Espacioasesoria.com, Derecholocal.es, ESG)',
53
+ help: 'Enlaces adicionales que se añaden a los ya existentes en la columna fija "Portales Lefebvre" (GenIA-L, LexON, Formación, ElDerecho.com, Espacioasesoria.com, Derecholocal.es, ESG). IMPORTANTE: dejar este campo tal cual (sin añadir filas) para que la columna no tenga enlaces extra',
62
54
  label: 'Enlaces extra columna "Portales Lefebvre" (opcional)',
63
55
  mandatory: false,
64
56
  items: {
65
57
  type: 'object',
66
58
  fields: [
67
- { name: 'name', type: 'text', help: 'Texto visible del enlace', label: 'Texto del enlace', example_value: 'Nuevo portal' },
68
- { name: 'link', type: 'text', help: 'URL de destino del enlace', label: 'URL del enlace', example_value: 'https://lefebvre.es/nuevo-portal/' },
59
+ { name: 'name', type: 'text', help: 'Texto visible del enlace', label: 'Texto del enlace' },
60
+ { name: 'link', type: 'text', help: 'URL de destino del enlace', label: 'URL del enlace' },
69
61
  ]
70
62
  }
71
63
  },
72
64
  {
73
65
  name: 'currentUrl',
74
66
  type: 'text',
75
- help: 'URL del portal que está pintando este footer. Si coincide (comparación normalizada, ignorando protocolo, "www." y barra final) con el link de algún item de la columna "Portales Lefebvre" (por defecto o extra), ese item NO se pinta, para no enlazar el portal a sí mismo',
67
+ help: 'URL del portal que está pintando este footer. Si coincide (comparación normalizada, ignorando protocolo, "www." y barra final) con el link de algún item de la columna "Portales Lefebvre" (por defecto o extra), ese item NO se pinta, para no enlazar el portal a sí mismo. IMPORTANTE: dejar vacío si no se quiere excluir ningún item',
76
68
  label: 'URL del portal actual (opcional)',
77
69
  mandatory: false,
78
- example_value: 'https://elderecho.com'
70
+ example_value: ''
79
71
  },
80
72
  {
81
73
  name: 'column4Group1Title',
@@ -102,32 +94,32 @@ export const metadata: ComponentMetadata = {
102
94
  {
103
95
  name: 'column4Group2Title',
104
96
  type: 'text',
105
- help: 'Título del segundo grupo de enlaces de la columna 4 (p. ej. "Atención al cliente"). La visibilidad de este grupo depende únicamente de "column4Group2Items": si ese listado está vacío, el grupo no se pinta aunque aquí se indique un título',
97
+ help: 'Título del segundo grupo de enlaces de la columna 4 (p. ej. "Atención al cliente"). La visibilidad de este grupo depende únicamente de "column4Group2Items": si ese listado está vacío, el grupo no se pinta aunque aquí se indique un título. IMPORTANTE: dejar vacío si no se quiere un segundo grupo',
106
98
  label: 'Título columna 4 - grupo 2 (opcional)',
107
99
  mandatory: false,
108
- example_value: 'Atención al cliente'
100
+ example_value: ''
109
101
  },
110
102
  {
111
103
  name: 'column4Group2Items',
112
104
  type: 'list',
113
- help: 'Enlaces del segundo grupo de la columna 4. Opcional: si se deja vacío, este grupo no se pinta',
105
+ help: 'Enlaces del segundo grupo de la columna 4. Opcional: si se deja vacío, este grupo no se pinta. IMPORTANTE: dejar este campo tal cual (sin añadir filas) para que el grupo 2 no aparezca',
114
106
  label: 'Enlaces columna 4 - grupo 2 (opcional)',
115
107
  mandatory: false,
116
108
  items: {
117
109
  type: 'object',
118
110
  fields: [
119
- { name: 'name', type: 'text', help: 'Texto visible del enlace', label: 'Texto del enlace', example_value: 'Contacto' },
120
- { name: 'link', type: 'text', help: 'URL de destino del enlace', label: 'URL del enlace', example_value: 'https://lefebvre.es/contacto/' },
111
+ { name: 'name', type: 'text', help: 'Texto visible del enlace', label: 'Texto del enlace' },
112
+ { name: 'link', type: 'text', help: 'URL de destino del enlace', label: 'URL del enlace' },
121
113
  ]
122
114
  }
123
115
  },
124
116
  {
125
117
  name: 'column4Html',
126
118
  type: 'textArea',
127
- help: 'Bloque de HTML libre que se pinta al final de la columna 4, después del grupo 1 y del grupo 2 (si existen). Opcional: si se deja vacío, no se pinta nada',
119
+ help: 'Bloque de HTML libre que se pinta al final de la columna 4, después del grupo 1 y del grupo 2 (si existen). Opcional: si se deja vacío, no se pinta nada. IMPORTANTE: dejar vacío si no se quiere HTML libre',
128
120
  label: 'HTML libre columna 4 (opcional)',
129
121
  mandatory: false,
130
- example_value: '<p>Descárgate nuestra app</p>'
122
+ example_value: ''
131
123
  },
132
124
  ]
133
125
  };
@@ -7,20 +7,19 @@ interface FooterLinkItem {
7
7
  }
8
8
 
9
9
  const {
10
- subdirectory = "",
11
10
  // El prefooter (columnas de enlaces) se pinta por defecto: ocultarlo pasando showPrefooter={false}.
12
11
  showPrefooter = true,
13
12
  // "Condiciones de contratación" no se pinta por defecto: activarla pasando showCondicionesContratacion={true}.
14
13
  showCondicionesContratacion = false,
15
14
  // Columna 2: 100% modificable. Si no llega título o items, se pinta el bloque por defecto.
16
- column2Title = 'Soluciones y servicios',
15
+ column2Title: column2TitleProp = '',
17
16
  column2Items: column2ItemsProp = undefined as FooterLinkItem[] | undefined,
18
17
  // Columna 3 ("Portales Lefebvre"): título fijo. Se pueden añadir items extra a los ya existentes.
19
18
  column3ExtraItems: column3ExtraItemsProp = undefined as FooterLinkItem[] | undefined,
20
19
  // URL del portal que consume el componente: si coincide con el link de un item de la columna 3, ese item no se pinta.
21
20
  currentUrl = '',
22
21
  // Columna 4: 100% modificable, hasta 2 grupos (título + items) y un bloque de HTML libre.
23
- column4Group1Title = 'Tienda online',
22
+ column4Group1Title: column4Group1TitleProp = '',
24
23
  column4Group1Items: column4Group1ItemsProp = undefined as FooterLinkItem[] | undefined,
25
24
  column4Group2Title = '',
26
25
  column4Group2Items: column4Group2ItemsProp = undefined as FooterLinkItem[] | undefined,
@@ -30,6 +29,10 @@ const {
30
29
  const normalizeUrl = (url: string) =>
31
30
  url.trim().toLowerCase().replace(/^https?:\/\/(www\.)?/, '').replace(/\/+$/, '');
32
31
 
32
+ // Una cadena vacía o solo espacios se trata igual que "no llega": cae al valor por defecto.
33
+ const resolveText = (value: string | undefined, fallback: string): string =>
34
+ (value && value.trim() !== '') ? value : fallback;
35
+
33
36
  const resolveLinkItems = (items: FooterLinkItem[] | undefined, fallback: FooterLinkItem[] = []): FooterLinkItem[] =>
34
37
  (items && items.length > 0) ? items : fallback;
35
38
 
@@ -56,12 +59,14 @@ const FALLBACK_COLUMN4_GROUP1_ITEMS: FooterLinkItem[] = [
56
59
  { name: 'Nuestros productos', link: 'https://lefebvre.es/tienda/' },
57
60
  ];
58
61
 
62
+ const column2Title = resolveText(column2TitleProp, 'Soluciones y servicios');
59
63
  const column2Items = resolveLinkItems(column2ItemsProp, FALLBACK_COLUMN2_ITEMS);
60
64
 
61
65
  const normalizedCurrentUrl = currentUrl ? normalizeUrl(currentUrl) : '';
62
66
  const column3Items = [...FALLBACK_COLUMN3_ITEMS, ...(column3ExtraItemsProp ?? [])]
63
67
  .filter(item => !normalizedCurrentUrl || normalizeUrl(item.link) !== normalizedCurrentUrl);
64
68
 
69
+ const column4Group1Title = resolveText(column4Group1TitleProp, 'Tienda online');
65
70
  const column4Group1Items = resolveLinkItems(column4Group1ItemsProp, FALLBACK_COLUMN4_GROUP1_ITEMS);
66
71
  const column4Group2Items = resolveLinkItems(column4Group2ItemsProp);
67
72