@jjlmoya/utils-home 1.1.0

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 (77) hide show
  1. package/package.json +62 -0
  2. package/src/category/i18n/en.ts +24 -0
  3. package/src/category/i18n/es.ts +24 -0
  4. package/src/category/i18n/fr.ts +24 -0
  5. package/src/category/index.ts +12 -0
  6. package/src/category/seo.astro +15 -0
  7. package/src/components/PreviewNavSidebar.astro +116 -0
  8. package/src/components/PreviewToolbar.astro +143 -0
  9. package/src/data.ts +11 -0
  10. package/src/env.d.ts +5 -0
  11. package/src/index.ts +26 -0
  12. package/src/layouts/PreviewLayout.astro +117 -0
  13. package/src/pages/[locale]/[slug].astro +146 -0
  14. package/src/pages/[locale].astro +251 -0
  15. package/src/pages/index.astro +4 -0
  16. package/src/tests/faq_count.test.ts +19 -0
  17. package/src/tests/locale_completeness.test.ts +42 -0
  18. package/src/tests/mocks/astro_mock.js +2 -0
  19. package/src/tests/no_h1_in_components.test.ts +48 -0
  20. package/src/tests/seo_length.test.ts +22 -0
  21. package/src/tests/tool_validation.test.ts +17 -0
  22. package/src/tool/dewPointCalculator/bibliography.astro +14 -0
  23. package/src/tool/dewPointCalculator/component.astro +443 -0
  24. package/src/tool/dewPointCalculator/i18n/en.ts +183 -0
  25. package/src/tool/dewPointCalculator/i18n/es.ts +183 -0
  26. package/src/tool/dewPointCalculator/i18n/fr.ts +183 -0
  27. package/src/tool/dewPointCalculator/index.ts +34 -0
  28. package/src/tool/dewPointCalculator/logic.ts +16 -0
  29. package/src/tool/dewPointCalculator/seo.astro +14 -0
  30. package/src/tool/dewPointCalculator/ui.ts +13 -0
  31. package/src/tool/ledSavingCalculator/bibliography.astro +14 -0
  32. package/src/tool/ledSavingCalculator/component.astro +520 -0
  33. package/src/tool/ledSavingCalculator/i18n/en.ts +217 -0
  34. package/src/tool/ledSavingCalculator/i18n/es.ts +217 -0
  35. package/src/tool/ledSavingCalculator/i18n/fr.ts +217 -0
  36. package/src/tool/ledSavingCalculator/index.ts +34 -0
  37. package/src/tool/ledSavingCalculator/logic.ts +31 -0
  38. package/src/tool/ledSavingCalculator/seo.astro +14 -0
  39. package/src/tool/ledSavingCalculator/ui.ts +32 -0
  40. package/src/tool/projectorCalculator/bibliography.astro +14 -0
  41. package/src/tool/projectorCalculator/component.astro +569 -0
  42. package/src/tool/projectorCalculator/i18n/en.ts +181 -0
  43. package/src/tool/projectorCalculator/i18n/es.ts +181 -0
  44. package/src/tool/projectorCalculator/i18n/fr.ts +181 -0
  45. package/src/tool/projectorCalculator/index.ts +34 -0
  46. package/src/tool/projectorCalculator/logic.ts +21 -0
  47. package/src/tool/projectorCalculator/seo.astro +14 -0
  48. package/src/tool/projectorCalculator/ui.ts +16 -0
  49. package/src/tool/qrGenerator/bibliography.astro +14 -0
  50. package/src/tool/qrGenerator/component.astro +499 -0
  51. package/src/tool/qrGenerator/i18n/en.ts +233 -0
  52. package/src/tool/qrGenerator/i18n/es.ts +233 -0
  53. package/src/tool/qrGenerator/i18n/fr.ts +233 -0
  54. package/src/tool/qrGenerator/index.ts +34 -0
  55. package/src/tool/qrGenerator/logic.ts +27 -0
  56. package/src/tool/qrGenerator/seo.astro +14 -0
  57. package/src/tool/qrGenerator/ui.ts +23 -0
  58. package/src/tool/solarCalculator/bibliography.astro +14 -0
  59. package/src/tool/solarCalculator/component.astro +532 -0
  60. package/src/tool/solarCalculator/i18n/en.ts +176 -0
  61. package/src/tool/solarCalculator/i18n/es.ts +176 -0
  62. package/src/tool/solarCalculator/i18n/fr.ts +176 -0
  63. package/src/tool/solarCalculator/index.ts +34 -0
  64. package/src/tool/solarCalculator/logic.ts +31 -0
  65. package/src/tool/solarCalculator/seo.astro +14 -0
  66. package/src/tool/solarCalculator/ui.ts +11 -0
  67. package/src/tool/tariffComparator/bibliography.astro +14 -0
  68. package/src/tool/tariffComparator/component.astro +595 -0
  69. package/src/tool/tariffComparator/i18n/en.ts +192 -0
  70. package/src/tool/tariffComparator/i18n/es.ts +192 -0
  71. package/src/tool/tariffComparator/i18n/fr.ts +192 -0
  72. package/src/tool/tariffComparator/index.ts +34 -0
  73. package/src/tool/tariffComparator/logic.ts +47 -0
  74. package/src/tool/tariffComparator/seo.astro +14 -0
  75. package/src/tool/tariffComparator/ui.ts +25 -0
  76. package/src/tools.ts +9 -0
  77. package/src/types.ts +72 -0
@@ -0,0 +1,192 @@
1
+ import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { TariffComparatorUI } from '../ui';
4
+
5
+ const slug = 'electricity-tariff-comparator';
6
+ const title = 'Electricity Tariff Comparator: Fixed vs Variable Price';
7
+ const description =
8
+ 'Find out which electricity tariff suits you best. Compare the regulated market (PVPC) vs the free market based on your consumption and save hundreds of euros on your electricity bill.';
9
+
10
+ const faqData = [
11
+ {
12
+ question: 'What is better nowadays, the free market or the regulated market?',
13
+ answer:
14
+ 'Historically, the regulated market (PVPC) has been cheaper, but it is volatile. The free market offers stability with fixed prices. Our calculator helps you decide based on how much electricity you use per year.',
15
+ },
16
+ {
17
+ question: 'Can I go back to the regulated market if I switch to the free market?',
18
+ answer:
19
+ 'Yes, you can return to the regulated market (PVPC) at any time as long as your contracted power is less than 10 kW. You just need to contact a reference electricity supplier.',
20
+ },
21
+ {
22
+ question: 'How do I know how much power I have contracted?',
23
+ answer:
24
+ 'You can find this information on your electricity bill, usually identified as "Power term" or "Contracted power", expressed in kW. The standard is usually between 3.3 kW and 5.5 kW.',
25
+ },
26
+ {
27
+ question: 'What happens if I exceed my contracted power?',
28
+ answer:
29
+ 'If you have a digital meter, the ICP will temporarily cut the power. You will need to disconnect an appliance and reset the electrical panel.',
30
+ },
31
+ ];
32
+
33
+ const howToData = [
34
+ {
35
+ name: 'Check your bill',
36
+ text: 'Look for the annual consumption in kWh and contracted power in kW on your latest electricity bill.',
37
+ },
38
+ {
39
+ name: 'Adjust the values',
40
+ text: 'Move the sliders to match your real consumption and power data.',
41
+ },
42
+ {
43
+ name: 'Compare results',
44
+ text: 'Observe the difference in estimated annual cost between the regulated market and the free market.',
45
+ },
46
+ {
47
+ name: 'Make a decision',
48
+ text: 'Choose the option that gives you the most savings or the one that offers you more peace of mind.',
49
+ },
50
+ ];
51
+
52
+ const faqSchema: WithContext<FAQPage> = {
53
+ '@context': 'https://schema.org',
54
+ '@type': 'FAQPage',
55
+ mainEntity: faqData.map((item) => ({
56
+ '@type': 'Question',
57
+ name: item.question,
58
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
59
+ })),
60
+ };
61
+
62
+ const howToSchema: WithContext<HowTo> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'HowTo',
65
+ name: title,
66
+ description,
67
+ step: howToData.map((step) => ({
68
+ '@type': 'HowToStep',
69
+ name: step.name,
70
+ text: step.text,
71
+ })),
72
+ };
73
+
74
+ const appSchema: WithContext<SoftwareApplication> = {
75
+ '@context': 'https://schema.org',
76
+ '@type': 'SoftwareApplication',
77
+ name: title,
78
+ description,
79
+ applicationCategory: 'UtilityApplication',
80
+ operatingSystem: 'All',
81
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
82
+ inLanguage: 'en',
83
+ };
84
+
85
+ export const content: ToolLocaleContent<TariffComparatorUI> = {
86
+ slug,
87
+ title,
88
+ description,
89
+ faqTitle: 'Frequently Asked Questions',
90
+ faq: faqData,
91
+ bibliographyTitle: 'Bibliography',
92
+ bibliography: [
93
+ { name: 'Red Eléctrica de España (REE) — ESIOS: PVPC tracking', url: 'https://www.esios.ree.es/es' },
94
+ { name: 'CNMC: Energy offers comparison portal', url: 'https://comparador.cnmc.gob.es/' },
95
+ { name: 'MITECO: Social Bonus and energy legislation', url: 'https://www.miteco.gob.es/' },
96
+ { name: 'IDAE: Practical guides on savings and self-consumption', url: 'https://www.idae.es/' },
97
+ { name: 'OMIE: Hourly prices of the daily electricity market', url: 'https://www.omie.es/' },
98
+ ],
99
+ howTo: howToData,
100
+ schemas: [faqSchema, howToSchema, appSchema],
101
+ seo: [
102
+ {
103
+ type: 'title',
104
+ text: 'Electricity Tariff Comparator: Free Market vs Regulated',
105
+ level: 2,
106
+ },
107
+ {
108
+ type: 'paragraph',
109
+ html: 'Understanding the electricity bill in Spain has become a real challenge. With the volatility of energy prices, the choice between the <strong>Regulated Market (PVPC)</strong> and the <strong>Free Market</strong> can make a difference of hundreds of euros per year. Our tool uses updated power and energy cost data to help you decide.',
110
+ },
111
+ {
112
+ type: 'stats',
113
+ items: [
114
+ { value: 'PVPC', label: 'Dynamic hourly price', icon: 'mdi:clock-fast' },
115
+ { value: 'Free', label: 'Fixed annual price', icon: 'mdi:shield-check' },
116
+ { value: '≈150€', label: 'Typical annual difference', icon: 'mdi:currency-eur' },
117
+ ],
118
+ columns: 3,
119
+ },
120
+ {
121
+ type: 'comparative',
122
+ items: [
123
+ {
124
+ title: 'PVPC — Regulated Market',
125
+ description: 'The energy price changes every hour according to the wholesale market. On days with high renewable generation, it can drop to very low levels.',
126
+ icon: 'mdi:lightning-bolt',
127
+ points: ['No lock-in, free to switch', 'Access to Social Bonus for vulnerable consumers', 'Peak/Off-peak/Valley time-of-use pricing'],
128
+ },
129
+ {
130
+ title: 'Free Market — Fixed Price',
131
+ description: 'Energy suppliers set a price per kWh that remains stable throughout the year, regardless of the wholesale market.',
132
+ icon: 'mdi:tag-outline',
133
+ points: ['Stability and predictability', 'No surprises on the bill', 'May include additional services'],
134
+ },
135
+ ],
136
+ columns: 2,
137
+ },
138
+ {
139
+ type: 'title',
140
+ text: 'The Three Time-of-Use Periods',
141
+ level: 3,
142
+ },
143
+ {
144
+ type: 'paragraph',
145
+ html: '<strong>Peak (most expensive):</strong> Mon–Fri 10:00–14:00 and 18:00–22:00. <strong>Standard (mid-price):</strong> Mon–Fri 08:00–10:00, 14:00–18:00 and 22:00–00:00. <strong>Off-peak (cheapest):</strong> Mon–Fri 00:00–08:00 and all day on Saturdays, Sundays and public holidays. Scheduling washing machines, dishwashers and electric car charging during off-peak hours is the key to extreme savings.',
146
+ },
147
+ {
148
+ type: 'diagnostic',
149
+ variant: 'warning',
150
+ title: 'The Discount Trap',
151
+ icon: 'mdi:alert',
152
+ badge: 'Warning',
153
+ html: '<p>Many free market offers promise a "20% discount". Make sure to ask <strong>on what base price</strong> that discount applies. Sometimes the base price is so inflated that, even with the discount, it ends up being more expensive than a standard tariff.</p>',
154
+ },
155
+ {
156
+ type: 'summary',
157
+ title: 'Key Factors to Decide',
158
+ items: [
159
+ 'If your consumption is high and mostly during off-peak hours, PVPC is usually more advantageous.',
160
+ 'If you value stability and do not want to watch the clock, choose a fixed price.',
161
+ 'With solar panels, PVPC allows you to offset surplus at the hourly market price.',
162
+ 'Reducing contracted power is often the fastest way to lower your bill.',
163
+ 'PVPC has no lock-in: you can switch back at any time.',
164
+ ],
165
+ },
166
+ ],
167
+ ui: {
168
+ labelConsumption: 'Annual Consumption',
169
+ unitKwhYear: 'kWh/year',
170
+ labelPower: 'Contracted Power',
171
+ unitKw: 'kW',
172
+ labelMarket: 'Regulated Market (PVPC)',
173
+ labelFree: 'Free Market (Fixed Price)',
174
+ labelAnnualEst: 'Annual estimate',
175
+ labelPowerTerm: 'Power (Fixed)',
176
+ labelEnergyTerm: 'Energy (Variable)',
177
+ labelDashboard: 'Energy Dashboard',
178
+ labelMaxPower: 'Peak Meter',
179
+ labelMaxPowerEst: 'Peak estimate',
180
+ labelCo2: 'CO₂ Footprint',
181
+ labelCo2Est: 'Annual estimate',
182
+ labelSimulator: 'Scenario Simulator',
183
+ labelSolar: 'Solar Self-Consumption',
184
+ labelSolarDesc: 'Simulate savings with solar panels (30% consumption reduction)',
185
+ labelShift: 'Off-Peak Shift',
186
+ labelShiftDesc: 'Consumption moved to cheap hours:',
187
+ badgeBetter: 'Cheapest option',
188
+ badgeWorseYear: 'year',
189
+ currencySign: '$',
190
+ monthLabels: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec',
191
+ },
192
+ };
@@ -0,0 +1,192 @@
1
+ import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { TariffComparatorUI } from '../ui';
4
+
5
+ const slug = 'comparador-tarifas-luz';
6
+ const title = 'Comparador de Tarifas de Luz: Mercado Libre vs PVPC';
7
+ const description =
8
+ 'Descubre qué tarifa de luz te conviene más. Compara el mercado regulado PVPC vs mercado libre según tu consumo y ahorra cientos de euros en tu factura eléctrica.';
9
+
10
+ const faqData = [
11
+ {
12
+ question: '¿Qué es mejor hoy en día, mercado libre o regulado?',
13
+ answer:
14
+ 'Históricamente, el mercado regulado (PVPC) ha sido más barato, pero es volátil. El mercado libre ofrece estabilidad con precios fijos. Nuestra calculadora te ayuda a decidir según cuánta luz gastas al año.',
15
+ },
16
+ {
17
+ question: '¿Puedo volver al mercado regulado si me paso al libre?',
18
+ answer:
19
+ 'Sí, puedes volver al mercado regulado (PVPC) en cualquier momento siempre que tu potencia contratada sea inferior a 10 kW. Solo tienes que contactar con una comercializadora de referencia.',
20
+ },
21
+ {
22
+ question: '¿Cómo sé cuánta potencia tengo contratada?',
23
+ answer:
24
+ 'Puedes encontrar este dato en tu factura de la luz, normalmente identificado como "Término de potencia" o "Potencia contratada", expresado en kW. El estándar suele estar entre 3.3 kW y 5.5 kW.',
25
+ },
26
+ {
27
+ question: '¿Qué pasa si supero la potencia contratada?',
28
+ answer:
29
+ 'Si tienes un contador digital, el ICP cortará la luz momentáneamente. Deberás desconectar algún aparato y rearmar el cuadro eléctrico.',
30
+ },
31
+ ];
32
+
33
+ const howToData = [
34
+ {
35
+ name: 'Consulta tu factura',
36
+ text: 'Busca el consumo anual en kWh y la potencia contratada en kW en tu última factura eléctrica.',
37
+ },
38
+ {
39
+ name: 'Ajusta los valores',
40
+ text: 'Mueve los selectores para que coincidan con tus datos reales de consumo y potencia.',
41
+ },
42
+ {
43
+ name: 'Compara resultados',
44
+ text: 'Observa la diferencia de coste anual estimado entre el mercado regulado y el mercado libre.',
45
+ },
46
+ {
47
+ name: 'Toma una decisión',
48
+ text: 'Elige la opción que más ahorro te proporcione o la que te ofrezca más tranquilidad.',
49
+ },
50
+ ];
51
+
52
+ const faqSchema: WithContext<FAQPage> = {
53
+ '@context': 'https://schema.org',
54
+ '@type': 'FAQPage',
55
+ mainEntity: faqData.map((item) => ({
56
+ '@type': 'Question',
57
+ name: item.question,
58
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
59
+ })),
60
+ };
61
+
62
+ const howToSchema: WithContext<HowTo> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'HowTo',
65
+ name: title,
66
+ description,
67
+ step: howToData.map((step) => ({
68
+ '@type': 'HowToStep',
69
+ name: step.name,
70
+ text: step.text,
71
+ })),
72
+ };
73
+
74
+ const appSchema: WithContext<SoftwareApplication> = {
75
+ '@context': 'https://schema.org',
76
+ '@type': 'SoftwareApplication',
77
+ name: title,
78
+ description,
79
+ applicationCategory: 'UtilityApplication',
80
+ operatingSystem: 'All',
81
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
82
+ inLanguage: 'es',
83
+ };
84
+
85
+ export const content: ToolLocaleContent<TariffComparatorUI> = {
86
+ slug,
87
+ title,
88
+ description,
89
+ faqTitle: 'Preguntas Frecuentes',
90
+ faq: faqData,
91
+ bibliographyTitle: 'Bibliografía',
92
+ bibliography: [
93
+ { name: 'Red Eléctrica de España (REE) — ESIOS: Seguimiento del PVPC', url: 'https://www.esios.ree.es/es' },
94
+ { name: 'CNMC: Portal de comparación de ofertas de energía', url: 'https://comparador.cnmc.gob.es/' },
95
+ { name: 'MITECO: Bono Social y legislación energética', url: 'https://www.miteco.gob.es/' },
96
+ { name: 'IDAE: Guías prácticas de ahorro y autoconsumo', url: 'https://www.idae.es/' },
97
+ { name: 'OMIE: Precios horarios del mercado diario de electricidad', url: 'https://www.omie.es/' },
98
+ ],
99
+ howTo: howToData,
100
+ schemas: [faqSchema, howToSchema, appSchema],
101
+ seo: [
102
+ {
103
+ type: 'title',
104
+ text: 'Comparador de Tarifas Eléctricas: Mercado Libre vs Regulado',
105
+ level: 2,
106
+ },
107
+ {
108
+ type: 'paragraph',
109
+ html: 'Entender la factura de la luz en España se ha convertido en un auténtico desafío. Con la volatilidad de los precios energéticos, la decisión entre el <strong>Mercado Regulado (PVPC)</strong> y el <strong>Mercado Libre</strong> puede suponer una diferencia de cientos de euros al año. Nuestra herramienta usa datos actualizados de costes de potencia y energía para ayudarte a decidir.',
110
+ },
111
+ {
112
+ type: 'stats',
113
+ items: [
114
+ { value: 'PVPC', label: 'Precio dinámico por hora', icon: 'mdi:clock-fast' },
115
+ { value: 'Libre', label: 'Precio fijo anual', icon: 'mdi:shield-check' },
116
+ { value: '≈150€', label: 'Diferencia típica anual', icon: 'mdi:currency-eur' },
117
+ ],
118
+ columns: 3,
119
+ },
120
+ {
121
+ type: 'comparative',
122
+ items: [
123
+ {
124
+ title: 'PVPC — Mercado Regulado',
125
+ description: 'El precio de la energía cambia cada hora según el mercado mayorista. En días de mucha generación renovable, puede caer a niveles muy bajos.',
126
+ icon: 'mdi:lightning-bolt',
127
+ points: ['Sin permanencia, cambio libre', 'Acceso al Bono Social para vulnerables', 'Discriminación horaria Punta/Llano/Valle'],
128
+ },
129
+ {
130
+ title: 'Mercado Libre — Precio Fijo',
131
+ description: 'Las comercializadoras fijan un precio por kWh que se mantiene durante el año, independientemente del mercado mayorista.',
132
+ icon: 'mdi:tag-outline',
133
+ points: ['Estabilidad y previsibilidad', 'Sin sorpresas en la factura', 'Puede incluir servicios adicionales'],
134
+ },
135
+ ],
136
+ columns: 2,
137
+ },
138
+ {
139
+ type: 'title',
140
+ text: 'Los Tres Tramos Horarios',
141
+ level: 3,
142
+ },
143
+ {
144
+ type: 'paragraph',
145
+ html: '<strong>Punta (más caro):</strong> L-V de 10:00–14:00 y 18:00–22:00. <strong>Llano (intermedio):</strong> L-V de 08:00–10:00, 14:00–18:00 y 22:00–00:00. <strong>Valle (más barato):</strong> L-V de 00:00–08:00 y las 24h de sábados, domingos y festivos. Planificar lavadoras, lavavajillas y carga del coche eléctrico en horas valle es la clave del ahorro extremo.',
146
+ },
147
+ {
148
+ type: 'diagnostic',
149
+ variant: 'warning',
150
+ title: 'La Trampa de los Descuentos',
151
+ icon: 'mdi:alert',
152
+ badge: 'Atención',
153
+ html: '<p>Muchas ofertas del mercado libre prometen un "20% de descuento". Asegúrate de preguntar <strong>sobre qué precio base</strong> se aplica ese descuento. A veces el precio base está tan inflado que, incluso con el descuento, resulta más caro que una tarifa estándar.</p>',
154
+ },
155
+ {
156
+ type: 'summary',
157
+ title: 'Claves para Decidir',
158
+ items: [
159
+ 'Si tu consumo es alto y en horas valle, el PVPC suele ser más ventajoso.',
160
+ 'Si valoras la estabilidad y no quieres estar pendiente del reloj, elige precio fijo.',
161
+ 'Con placas solares, el PVPC permite compensar excedentes al precio horario del mercado.',
162
+ 'Reducir la potencia contratada es, a menudo, la forma más rápida de bajar la factura.',
163
+ 'El PVPC no tiene permanencia: puedes volver en cualquier momento.',
164
+ ],
165
+ },
166
+ ],
167
+ ui: {
168
+ labelConsumption: 'Consumo Anual',
169
+ unitKwhYear: 'kWh/año',
170
+ labelPower: 'Potencia Contratada',
171
+ unitKw: 'kW',
172
+ labelMarket: 'PVPC (Mercado Regulado)',
173
+ labelFree: 'Mercado Libre (Precio Fijo)',
174
+ labelAnnualEst: 'Estimación anual',
175
+ labelPowerTerm: 'Potencia (Fijo)',
176
+ labelEnergyTerm: 'Consumo (Variable)',
177
+ labelDashboard: 'Dashboard Energético',
178
+ labelMaxPower: 'Maxímetro (Pico)',
179
+ labelMaxPowerEst: 'Estimación de pico',
180
+ labelCo2: 'Huella de CO₂',
181
+ labelCo2Est: 'Estimación anual',
182
+ labelSimulator: 'Simulador de Escenarios',
183
+ labelSolar: 'Autoconsumo Solar',
184
+ labelSolarDesc: 'Simular ahorro con placas solares (30% reducción de consumo)',
185
+ labelShift: 'Desplazamiento a Valle',
186
+ labelShiftDesc: 'Consumo movido a horas baratas:',
187
+ badgeBetter: 'Opción más barata',
188
+ badgeWorseYear: 'año',
189
+ currencySign: '€',
190
+ monthLabels: 'Ene,Feb,Mar,Abr,May,Jun,Jul,Ago,Sep,Oct,Nov,Dic',
191
+ },
192
+ };
@@ -0,0 +1,192 @@
1
+ import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { TariffComparatorUI } from '../ui';
4
+
5
+ const slug = 'comparateur-tarifs-electricite';
6
+ const title = 'Comparateur de Tarifs d\'Électricité : Prix Fixe vs Prix Variable';
7
+ const description =
8
+ 'Découvrez quel tarif d\'électricité vous convient le mieux. Comparez le marché régulé (PVPC) et le marché libre selon votre consommation et économisez des centaines d\'euros sur votre facture.';
9
+
10
+ const faqData = [
11
+ {
12
+ question: 'Qu\'est-ce qui est préférable aujourd\'hui, le marché libre ou le marché régulé ?',
13
+ answer:
14
+ 'Historiquement, le marché régulé (PVPC) a été moins cher, mais il est volatil. Le marché libre offre une stabilité avec des prix fixes. Notre calculateur vous aide à décider en fonction de votre consommation annuelle d\'électricité.',
15
+ },
16
+ {
17
+ question: 'Puis-je revenir au marché régulé si je passe au marché libre ?',
18
+ answer:
19
+ 'Oui, vous pouvez revenir au marché régulé (PVPC) à tout moment, tant que votre puissance souscrite est inférieure à 10 kW. Il vous suffit de contacter un fournisseur de référence.',
20
+ },
21
+ {
22
+ question: 'Comment savoir quelle puissance j\'ai souscrite ?',
23
+ answer:
24
+ 'Vous pouvez trouver cette information sur votre facture d\'électricité, généralement identifiée comme "Terme de puissance" ou "Puissance souscrite", exprimée en kW. La valeur standard se situe généralement entre 3,3 kW et 5,5 kW.',
25
+ },
26
+ {
27
+ question: 'Que se passe-t-il si je dépasse la puissance souscrite ?',
28
+ answer:
29
+ 'Si vous avez un compteur numérique, le disjoncteur coupera momentanément l\'électricité. Vous devrez débrancher un appareil et réarmer le tableau électrique.',
30
+ },
31
+ ];
32
+
33
+ const howToData = [
34
+ {
35
+ name: 'Consultez votre facture',
36
+ text: 'Recherchez la consommation annuelle en kWh et la puissance souscrite en kW sur votre dernière facture d\'électricité.',
37
+ },
38
+ {
39
+ name: 'Ajustez les valeurs',
40
+ text: 'Déplacez les curseurs pour qu\'ils correspondent à vos données réelles de consommation et de puissance.',
41
+ },
42
+ {
43
+ name: 'Comparez les résultats',
44
+ text: 'Observez la différence de coût annuel estimé entre le marché régulé et le marché libre.',
45
+ },
46
+ {
47
+ name: 'Prenez une décision',
48
+ text: 'Choisissez l\'option qui vous offre le plus d\'économies ou celle qui vous apporte le plus de tranquillité d\'esprit.',
49
+ },
50
+ ];
51
+
52
+ const faqSchema: WithContext<FAQPage> = {
53
+ '@context': 'https://schema.org',
54
+ '@type': 'FAQPage',
55
+ mainEntity: faqData.map((item) => ({
56
+ '@type': 'Question',
57
+ name: item.question,
58
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
59
+ })),
60
+ };
61
+
62
+ const howToSchema: WithContext<HowTo> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'HowTo',
65
+ name: title,
66
+ description,
67
+ step: howToData.map((step) => ({
68
+ '@type': 'HowToStep',
69
+ name: step.name,
70
+ text: step.text,
71
+ })),
72
+ };
73
+
74
+ const appSchema: WithContext<SoftwareApplication> = {
75
+ '@context': 'https://schema.org',
76
+ '@type': 'SoftwareApplication',
77
+ name: title,
78
+ description,
79
+ applicationCategory: 'UtilityApplication',
80
+ operatingSystem: 'All',
81
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
82
+ inLanguage: 'fr',
83
+ };
84
+
85
+ export const content: ToolLocaleContent<TariffComparatorUI> = {
86
+ slug,
87
+ title,
88
+ description,
89
+ faqTitle: 'Questions Fréquentes',
90
+ faq: faqData,
91
+ bibliographyTitle: 'Bibliographie',
92
+ bibliography: [
93
+ { name: 'Red Eléctrica de España (REE) — ESIOS : Suivi du PVPC', url: 'https://www.esios.ree.es/es' },
94
+ { name: 'CNMC : Portail de comparaison des offres d\'énergie', url: 'https://comparador.cnmc.gob.es/' },
95
+ { name: 'MITECO : Bonus Social et législation énergétique', url: 'https://www.miteco.gob.es/' },
96
+ { name: 'IDAE : Guides pratiques d\'économies et d\'autoconsommation', url: 'https://www.idae.es/' },
97
+ { name: 'OMIE : Prix horaires du marché journalier de l\'électricité', url: 'https://www.omie.es/' },
98
+ ],
99
+ howTo: howToData,
100
+ schemas: [faqSchema, howToSchema, appSchema],
101
+ seo: [
102
+ {
103
+ type: 'title',
104
+ text: 'Comparateur de Tarifs Électriques : Marché Libre vs Marché Régulé',
105
+ level: 2,
106
+ },
107
+ {
108
+ type: 'paragraph',
109
+ html: 'Comprendre la facture d\'électricité en Espagne est devenu un véritable défi. Avec la volatilité des prix de l\'énergie, le choix entre le <strong>Marché Régulé (PVPC)</strong> et le <strong>Marché Libre</strong> peut représenter une différence de plusieurs centaines d\'euros par an. Notre outil utilise des données actualisées sur les coûts de puissance et d\'énergie pour vous aider à décider.',
110
+ },
111
+ {
112
+ type: 'stats',
113
+ items: [
114
+ { value: 'PVPC', label: 'Prix dynamique par heure', icon: 'mdi:clock-fast' },
115
+ { value: 'Libre', label: 'Prix fixe annuel', icon: 'mdi:shield-check' },
116
+ { value: '≈150€', label: 'Différence annuelle typique', icon: 'mdi:currency-eur' },
117
+ ],
118
+ columns: 3,
119
+ },
120
+ {
121
+ type: 'comparative',
122
+ items: [
123
+ {
124
+ title: 'PVPC — Marché Régulé',
125
+ description: 'Le prix de l\'énergie change chaque heure selon le marché de gros. Les jours de forte production renouvelable, il peut descendre à des niveaux très bas.',
126
+ icon: 'mdi:lightning-bolt',
127
+ points: ['Sans engagement, changement libre', 'Accès au Bonus Social pour les personnes vulnérables', 'Tarification horaire Pointe/Standard/Creuses'],
128
+ },
129
+ {
130
+ title: 'Marché Libre — Prix Fixe',
131
+ description: 'Les fournisseurs d\'énergie fixent un prix par kWh qui reste stable tout au long de l\'année, indépendamment du marché de gros.',
132
+ icon: 'mdi:tag-outline',
133
+ points: ['Stabilité et prévisibilité', 'Pas de mauvaises surprises sur la facture', 'Peut inclure des services supplémentaires'],
134
+ },
135
+ ],
136
+ columns: 2,
137
+ },
138
+ {
139
+ type: 'title',
140
+ text: 'Les Trois Plages Horaires',
141
+ level: 3,
142
+ },
143
+ {
144
+ type: 'paragraph',
145
+ html: '<strong>Pointe (plus cher) :</strong> Lun–Ven de 10h00 à 14h00 et de 18h00 à 22h00. <strong>Standard (intermédiaire) :</strong> Lun–Ven de 08h00 à 10h00, de 14h00 à 18h00 et de 22h00 à 00h00. <strong>Heures creuses (moins cher) :</strong> Lun–Ven de 00h00 à 08h00 et toute la journée le samedi, dimanche et jours fériés. Planifier les machines à laver, lave-vaisselle et la recharge de voiture électrique aux heures creuses est la clé des économies maximales.',
146
+ },
147
+ {
148
+ type: 'diagnostic',
149
+ variant: 'warning',
150
+ title: 'Le Piège des Remises',
151
+ icon: 'mdi:alert',
152
+ badge: 'Attention',
153
+ html: '<p>De nombreuses offres du marché libre promettent une "remise de 20%". Assurez-vous de demander <strong>sur quel prix de base</strong> cette remise s\'applique. Parfois, le prix de base est tellement gonflé que, même avec la remise, cela revient plus cher qu\'un tarif standard.</p>',
154
+ },
155
+ {
156
+ type: 'summary',
157
+ title: 'Points Clés pour Décider',
158
+ items: [
159
+ 'Si votre consommation est élevée et principalement aux heures creuses, le PVPC est généralement plus avantageux.',
160
+ 'Si vous appréciez la stabilité et ne voulez pas surveiller l\'horloge, choisissez un prix fixe.',
161
+ 'Avec des panneaux solaires, le PVPC permet de compenser les surplus au prix horaire du marché.',
162
+ 'Réduire la puissance souscrite est souvent le moyen le plus rapide de diminuer la facture.',
163
+ 'Le PVPC n\'a pas d\'engagement : vous pouvez revenir à tout moment.',
164
+ ],
165
+ },
166
+ ],
167
+ ui: {
168
+ labelConsumption: 'Consommation Annuelle',
169
+ unitKwhYear: 'kWh/an',
170
+ labelPower: 'Puissance Souscrite',
171
+ unitKw: 'kW',
172
+ labelMarket: 'Marché Régulé (PVPC)',
173
+ labelFree: 'Marché Libre (Prix Fixe)',
174
+ labelAnnualEst: 'Estimation annuelle',
175
+ labelPowerTerm: 'Puissance (Fixe)',
176
+ labelEnergyTerm: 'Énergie (Variable)',
177
+ labelDashboard: 'Tableau de Bord Énergétique',
178
+ labelMaxPower: 'Maxomètre (Pic)',
179
+ labelMaxPowerEst: 'Estimation de pic',
180
+ labelCo2: 'Empreinte CO₂',
181
+ labelCo2Est: 'Estimation annuelle',
182
+ labelSimulator: 'Simulateur de Scénarios',
183
+ labelSolar: 'Autoconsommation Solaire',
184
+ labelSolarDesc: 'Simuler les économies avec des panneaux solaires (30% de réduction)',
185
+ labelShift: 'Report aux Heures Creuses',
186
+ labelShiftDesc: 'Consommation déplacée aux heures bon marché :',
187
+ badgeBetter: 'Option la moins chère',
188
+ badgeWorseYear: 'an',
189
+ currencySign: '€',
190
+ monthLabels: 'Jan,Fév,Mar,Avr,Mai,Jun,Jul,Aoû,Sep,Oct,Nov,Déc',
191
+ },
192
+ };
@@ -0,0 +1,34 @@
1
+ import type { HomeToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
+ import TariffComparatorComponent from './component.astro';
3
+ import TariffComparatorSEO from './seo.astro';
4
+ import TariffComparatorBibliography from './bibliography.astro';
5
+
6
+ import type { TariffComparatorUI } from './ui';
7
+
8
+ export type TariffComparatorLocaleContent = ToolLocaleContent<TariffComparatorUI>;
9
+
10
+ import { content as es } from './i18n/es';
11
+ import { content as en } from './i18n/en';
12
+ import { content as fr } from './i18n/fr';
13
+
14
+ export const tariffComparator: HomeToolEntry<TariffComparatorUI> = {
15
+ id: 'tariff-comparator',
16
+ icons: {
17
+ bg: 'mdi:lightning-bolt',
18
+ fg: 'mdi:compare',
19
+ },
20
+ i18n: {
21
+ es: async () => es,
22
+ en: async () => en,
23
+ fr: async () => fr,
24
+ },
25
+ };
26
+
27
+ export { TariffComparatorComponent, TariffComparatorSEO, TariffComparatorBibliography };
28
+
29
+ export const TARIFF_COMPARATOR_TOOL: ToolDefinition = {
30
+ entry: tariffComparator,
31
+ Component: TariffComparatorComponent,
32
+ SEOComponent: TariffComparatorSEO,
33
+ BibliographyComponent: TariffComparatorBibliography,
34
+ };
@@ -0,0 +1,47 @@
1
+ export const SEASONAL_WEIGHTS = [1.2, 1.1, 0.9, 0.8, 0.7, 0.8, 1.3, 1.4, 0.9, 0.8, 1.0, 1.1];
2
+
3
+ const PRICES = {
4
+ market: { power: 32.5, energy: 0.145 },
5
+ free: { power: 38.0, energy: 0.165 },
6
+ };
7
+
8
+ export interface TariffInput {
9
+ consumptionKwh: number;
10
+ powerKw: number;
11
+ solarReduction: boolean;
12
+ shiftPercent: number;
13
+ }
14
+
15
+ export interface TariffResult {
16
+ effectiveConsumption: number;
17
+ marketTotal: number;
18
+ marketPower: number;
19
+ marketEnergy: number;
20
+ freeTotal: number;
21
+ freePower: number;
22
+ freeEnergy: number;
23
+ maxPowerKw: number;
24
+ co2Kg: number;
25
+ monthlyData: number[];
26
+ }
27
+
28
+ export function calculateTariffs(input: TariffInput): TariffResult {
29
+ const eff = input.solarReduction ? input.consumptionKwh * 0.7 : input.consumptionKwh;
30
+ const shift = input.shiftPercent / 100;
31
+ const mp = input.powerKw * PRICES.market.power;
32
+ const me = eff * (PRICES.market.energy * (1 - shift * 0.2));
33
+ const fp = input.powerKw * PRICES.free.power;
34
+ const fe = eff * PRICES.free.energy;
35
+ return {
36
+ effectiveConsumption: eff,
37
+ marketTotal: mp + me,
38
+ marketPower: mp,
39
+ marketEnergy: me,
40
+ freeTotal: fp + fe,
41
+ freePower: fp,
42
+ freeEnergy: fe,
43
+ maxPowerKw: input.powerKw * 0.9,
44
+ co2Kg: Math.round(eff * 0.19),
45
+ monthlyData: SEASONAL_WEIGHTS.map(w => (eff / 12) * w),
46
+ };
47
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ import { SEORenderer } from '@jjlmoya/utils-shared';
3
+ import { tariffComparator } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'es' } = Astro.props;
11
+ const content = await tariffComparator.i18n[locale]?.();
12
+ if (!content) return null;
13
+ ---
14
+ <SEORenderer content={{ locale: locale as string, sections: content.seo }} />