@jjlmoya/utils-pets 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 (41) hide show
  1. package/package.json +60 -0
  2. package/src/category/i18n/en.ts +48 -0
  3. package/src/category/i18n/es.ts +48 -0
  4. package/src/category/i18n/fr.ts +48 -0
  5. package/src/category/index.ts +13 -0
  6. package/src/category/seo.astro +14 -0
  7. package/src/components/PreviewNavSidebar.astro +115 -0
  8. package/src/components/PreviewToolbar.astro +142 -0
  9. package/src/data.ts +15 -0
  10. package/src/env.d.ts +4 -0
  11. package/src/index.ts +20 -0
  12. package/src/layouts/PreviewLayout.astro +116 -0
  13. package/src/pages/[locale]/[slug].astro +148 -0
  14. package/src/pages/[locale].astro +270 -0
  15. package/src/pages/index.astro +3 -0
  16. package/src/tests/faq_count.test.ts +23 -0
  17. package/src/tests/mocks/astro_mock.js +1 -0
  18. package/src/tests/seo_length.test.ts +54 -0
  19. package/src/tests/tool_validation.test.ts +139 -0
  20. package/src/tool/petAge/bibliography.astro +14 -0
  21. package/src/tool/petAge/component.astro +267 -0
  22. package/src/tool/petAge/handlers.ts +142 -0
  23. package/src/tool/petAge/i18n/en.ts +160 -0
  24. package/src/tool/petAge/i18n/es.ts +160 -0
  25. package/src/tool/petAge/i18n/fr.ts +160 -0
  26. package/src/tool/petAge/index.ts +64 -0
  27. package/src/tool/petAge/logic.ts +59 -0
  28. package/src/tool/petAge/seo.astro +61 -0
  29. package/src/tool/petAge/style.css +649 -0
  30. package/src/tool/petRation/bibliography.astro +14 -0
  31. package/src/tool/petRation/component.astro +181 -0
  32. package/src/tool/petRation/handlers.ts +139 -0
  33. package/src/tool/petRation/i18n/en.ts +161 -0
  34. package/src/tool/petRation/i18n/es.ts +161 -0
  35. package/src/tool/petRation/i18n/fr.ts +161 -0
  36. package/src/tool/petRation/index.ts +63 -0
  37. package/src/tool/petRation/logic.ts +44 -0
  38. package/src/tool/petRation/seo.astro +61 -0
  39. package/src/tool/petRation/style.css +427 -0
  40. package/src/tools.ts +13 -0
  41. package/src/types.ts +71 -0
@@ -0,0 +1,160 @@
1
+ import type { WithContext, SoftwareApplication } from 'schema-dts';
2
+ import type { PetAgeUI, PetAgeLocaleContent } from '../index';
3
+
4
+ const slug = 'calculadora-edad-mascotas';
5
+ const title = 'Calculadora de Edad de Mascotas | Perros y Gatos a Años Humanos';
6
+ const description = 'Descubre la edad real de tu perro o gato en años humanos. Olvida la regla de multiplicar por 7. Usa nuestra calculadora basada en ciencia veterinaria actual.';
7
+
8
+ const ui: PetAgeUI = {
9
+ toolTitle: 'Calculadora de Edad',
10
+ toolSubtitle: '¿Cuántos años humanos tiene realmente tu peludo?',
11
+ petNameLabel: 'Nombre (Opcional)',
12
+ petNamePlaceholder: 'Ej. Toby',
13
+ petTypeDog: 'Perro',
14
+ petTypeCat: 'Gato',
15
+ sizeSmall: 'Peque',
16
+ sizeMedium: 'Med',
17
+ sizeLarge: 'Grande',
18
+ sizeGiant: 'Gigante',
19
+ birthYearLabel: 'Año de nacimiento',
20
+ humanAgeLabel: 'La edad humana de',
21
+ humanAgeUnit: 'años',
22
+ humanAgeYears: 'años',
23
+ lifeStageLabel: 'Etapa Vital',
24
+ milestoneLabel: 'Próximo Hito',
25
+ shareBtn: 'Compartir Resultado',
26
+ shareSuccess: '¡Copiado! Abriendo tarjeta...',
27
+ humanAgeTitle: 'Edad Mágica',
28
+ recalculateBtn: 'Calcular otra edad',
29
+ realAgeLabel: 'Edad Real',
30
+ defaultPetName: 'Tu mascota',
31
+ stageDogPuppy: 'Cachorro Juguetón',
32
+ stageDogTeen: 'Adolescencia Rebelde',
33
+ stageDogAdult: 'Adultez Plena',
34
+ stageDogMature: 'Madurez Distinguida',
35
+ stageDogSenior: 'Sabiduría Senior',
36
+ stageCatKitten: 'Curiosidad Infantil',
37
+ stageCatYouth: 'Juventud Felina',
38
+ stageCatReign: 'Reinado Doméstico',
39
+ stageCatVeteran: 'Veteranía Consentida',
40
+ stageCatVenerable: 'Venerable Felino',
41
+ };
42
+
43
+ const faq: PetAgeLocaleContent['faq'] = [
44
+ {
45
+ question: '¿Es cierto que un año de perro equivale a 7 años humanos?',
46
+ answer: 'No. Esa es una regla simplificada que la ciencia veterinaria moderna ha desmentido. Los perros maduran muy rápido en sus dos primeros años y luego el proceso se ralentiza, variando mucho según el peso y la raza.',
47
+ },
48
+ {
49
+ question: '¿Por qué los perros grandes envejecen antes?',
50
+ answer: 'Los perros de razas grandes tienen un metabolismo y un crecimiento más acelerado, lo que provoca un estrés oxidativo mayor en sus células. Esto hace que su esperanza de vida sea menor que la de perros pequeños.',
51
+ },
52
+ {
53
+ question: '¿Cómo envejecen los gatos comparados con los humanos?',
54
+ answer: 'Un gato termina su infancia al mes de vida, su adolescencia a los 6 meses y alcanza la mayoría de edad (equiv. 24 años humanos) a los 2 años. A partir de ahí, cada año gatuno equivale a unos 4 años humanos.',
55
+ },
56
+ {
57
+ question: '¿A qué edad se considera a una mascota como Senior?',
58
+ answer: 'Generalmente, un perro se considera senior cuando ha cumplido el 75% de su esperanza de vida esperada. En gatos, suele ser a partir de los 7-11 años, dependiendo de su estado de salud.',
59
+ },
60
+ ];
61
+
62
+ const howTo: PetAgeLocaleContent['howTo'] = [
63
+ { name: 'Elegir tipo de mascota', text: 'Selecciona si tienes un perro o un gato para aplicar la fórmula biológica correcta.' },
64
+ { name: 'Introducir tamaño (solo perros)', text: 'En perros, el peso es fundamental. Indica si es pequeño (hasta 10kg), mediano (10-25kg), grande (25-45kg) o gigante (+45kg).' },
65
+ { name: 'Indicar año de nacimiento', text: 'Introduce el año de nacimiento de tu mascota para calcular su edad cronológica.' },
66
+ { name: 'Analizar etapa vital', text: 'Consulta el resultado para saber si tu mascota está en etapa infantil, joven, adulta o senior en comparación con un humano.' },
67
+ ];
68
+
69
+ const bibliography: PetAgeLocaleContent['bibliography'] = [
70
+ { name: 'AAHA Senior Care Guidelines for Dogs and Cats', url: 'https://www.aaha.org/wp-content/uploads/globalassets/02-guidelines/2023-aaha-senior-care-guidelines-for-dogs-and-cats/resources/2023-aaha-senior-care-guidelines-for-dogs-and-cats.pdf' },
71
+ { name: 'AKC: How to Calculate Dog Years to Human Years', url: 'https://www.akc.org/expert-advice/health/how-to-calculate-dog-years-to-human-years/' },
72
+ ];
73
+
74
+ const seo: PetAgeLocaleContent['seo'] = [
75
+ {
76
+ type: 'summary',
77
+ title: 'Lo Que Debes Saber Sobre el Envejecimiento de las Mascotas',
78
+ items: [
79
+ 'La regla del "por 7" es un mito: los perros maduran de forma exponencial los primeros 2 años.',
80
+ 'Un perro de 1 año equivale a 15 años humanos; uno de 2 años, a 24 años humanos.',
81
+ 'Los perros grandes envejecen más rápido que los pequeños tras los 2 años.',
82
+ 'Los gatos siguen una curva más lineal: cada año felino equivale a 4 años humanos después de los 2.',
83
+ ],
84
+ },
85
+ { type: 'title', text: 'La Verdad Científica Sobre la Edad de tu Mascota', level: 2 },
86
+ {
87
+ type: 'paragraph',
88
+ html: '¿Sabías que un gato de 2 años ya tiene la madurez de una persona de 24? Descubre por qué la regla de multiplicar por 7 es un mito. El viejo mito de "1 año de perro equivale a 7 años humanos" es una simplificación excesiva. La realidad biológica es mucho más fascinante: las mascotas maduran a una velocidad vertiginosa durante sus dos primeros años, alcanzando la madurez sexual y física muy rápido. Después, esta curva de envejecimiento se aplana y ralentiza.',
89
+ },
90
+ { type: 'title', text: 'La Ciencia tras el Cálculo', level: 3 },
91
+ {
92
+ type: 'paragraph',
93
+ html: 'Esta herramienta utiliza las directrices oficiales de la <strong>Asociación Americana de Hospitales Médicos Veterinarios (AAHA)</strong> y los últimos estudios sobre metilación del ADN canino para ofrecerte la estimación más precisa posible.',
94
+ },
95
+ {
96
+ type: 'table',
97
+ headers: ['Especie', 'Año 1', 'Año 2', 'Año 3+'],
98
+ rows: [
99
+ ['Gato', '15 años humanos', '24 años humanos', '+4 años por año'],
100
+ ['Perro pequeño', '15 años humanos', '24 años humanos', '+5 años por año'],
101
+ ['Perro mediano', '15 años humanos', '24 años humanos', '+6 años por año'],
102
+ ['Perro grande', '15 años humanos', '24 años humanos', '+7 años por año'],
103
+ ['Perro gigante', '15 años humanos', '24 años humanos', '+8 años por año'],
104
+ ],
105
+ },
106
+ { type: 'title', text: 'Etapas de Vida: ¿Qué esperar?', level: 3 },
107
+ {
108
+ type: 'paragraph',
109
+ html: 'Saber la edad real te ayuda a entender las necesidades médicas y emocionales de tu compañero en cada fase.',
110
+ },
111
+ {
112
+ type: 'card',
113
+ title: 'Cachorro / Junior (0 - 1 año)',
114
+ icon: 'mdi:star-shooting',
115
+ html: 'Es la etapa de crecimiento explosivo. Sus huesos crecen, sus dientes cambian y su cerebro absorbe información como una esponja. La vacunación y la socialización temprana son críticas aquí.',
116
+ },
117
+ {
118
+ type: 'card',
119
+ title: 'Adulto (2 - 6 años)',
120
+ icon: 'mdi:shield-check',
121
+ html: 'Plenitud física y mental. Ya tienen su personalidad definida. Es el momento dorado para disfrutar de actividades físicas intensas y mantener su peso ideal para prevenir enfermedades futuras.',
122
+ },
123
+ {
124
+ type: 'card',
125
+ title: 'Senior (+7 años)',
126
+ icon: 'mdi:heart-pulse',
127
+ html: 'Empiezan a aparecer canas en el hocico y duermen más. El metabolismo se ralentiza. A partir de aquí, los chequeos veterinarios deben ser cada 6 meses. Atención a artritis y salud dental.',
128
+ },
129
+ {
130
+ type: 'tip',
131
+ title: 'Consejo Veterinario',
132
+ html: 'La edad calculada es una estimación biológica promedio. Factores como la raza, la genética y el estilo de vida pueden influir en el envejecimiento real de tu mascota. Consulta siempre con tu veterinario.',
133
+ },
134
+ ];
135
+
136
+ const schemas: PetAgeLocaleContent['schemas'] = [
137
+ {
138
+ '@context': 'https://schema.org',
139
+ '@type': 'SoftwareApplication',
140
+ name: title,
141
+ description: description,
142
+ applicationCategory: 'UtilityApplication',
143
+ operatingSystem: 'Web',
144
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
145
+ } as WithContext<SoftwareApplication>,
146
+ ];
147
+
148
+ export const content: PetAgeLocaleContent = {
149
+ slug,
150
+ title,
151
+ description,
152
+ ui,
153
+ seo,
154
+ faqTitle: 'Preguntas Frecuentes',
155
+ faq,
156
+ bibliographyTitle: 'Referencias Bibliográficas',
157
+ bibliography,
158
+ howTo,
159
+ schemas,
160
+ };
@@ -0,0 +1,160 @@
1
+ import type { WithContext, SoftwareApplication } from 'schema-dts';
2
+ import type { PetAgeUI, PetAgeLocaleContent } from '../index';
3
+
4
+ const slug = 'calculatrice-age-animaux';
5
+ const title = 'Calculatrice d\'Âge des Animaux | Chiens et Chats en Années Humaines';
6
+ const description = 'Découvrez l\'âge réel de votre chien ou chat en années humaines. Oubliez la règle de multiplier par 7. Utilisez notre calculatrice basée sur la science vétérinaire actuelle.';
7
+
8
+ const ui: PetAgeUI = {
9
+ toolTitle: 'Calculatrice d\'Âge',
10
+ toolSubtitle: 'Combien d\'années humaines a vraiment votre compagnon ?',
11
+ petNameLabel: 'Nom (Optionnel)',
12
+ petNamePlaceholder: 'Ex. Fido',
13
+ petTypeDog: 'Chien',
14
+ petTypeCat: 'Chat',
15
+ sizeSmall: 'Petit',
16
+ sizeMedium: 'Moyen',
17
+ sizeLarge: 'Grand',
18
+ sizeGiant: 'Géant',
19
+ birthYearLabel: 'Année de naissance',
20
+ humanAgeLabel: 'L\'âge humain de',
21
+ humanAgeUnit: 'ans',
22
+ humanAgeYears: 'ans',
23
+ lifeStageLabel: 'Stade de Vie',
24
+ milestoneLabel: 'Prochain Jalon',
25
+ shareBtn: 'Partager le Résultat',
26
+ shareSuccess: 'Copié ! Ouverture de la carte...',
27
+ humanAgeTitle: 'Âge Magique',
28
+ recalculateBtn: 'Calculer un autre âge',
29
+ realAgeLabel: 'Âge Réel',
30
+ defaultPetName: 'Votre animal',
31
+ stageDogPuppy: 'Chiot Joueur',
32
+ stageDogTeen: 'Adolescence Rebelle',
33
+ stageDogAdult: 'Âge Adulte',
34
+ stageDogMature: 'Maturité Distinguée',
35
+ stageDogSenior: 'Sagesse Senior',
36
+ stageCatKitten: 'Curiosité Enfantine',
37
+ stageCatYouth: 'Jeunesse Féline',
38
+ stageCatReign: 'Règne Domestique',
39
+ stageCatVeteran: 'Vétéran Choyé',
40
+ stageCatVenerable: 'Félin Vénérable',
41
+ };
42
+
43
+ const faq: PetAgeLocaleContent['faq'] = [
44
+ {
45
+ question: 'Est-il vrai qu\'une année de chien équivaut à 7 années humaines ?',
46
+ answer: 'Non. C\'est une règle simplifiée que la science vétérinaire moderne a démystifiée. Les chiens mûrissent très vite au cours de leurs deux premières années, puis le processus ralentit, variant beaucoup selon le poids et la race.',
47
+ },
48
+ {
49
+ question: 'Pourquoi les grands chiens vieillissent-ils plus vite ?',
50
+ answer: 'Les chiens de grandes races ont un métabolisme et une croissance plus rapides, ce qui provoque un stress oxydatif plus important dans leurs cellules. Cela signifie que leur espérance de vie est plus courte que celle des petits chiens.',
51
+ },
52
+ {
53
+ question: 'Comment les chats vieillissent-ils par rapport aux humains ?',
54
+ answer: 'Un chat termine son enfance à un mois, son adolescence à 6 mois et atteint la maturité (équivalent à 24 ans humains) à 2 ans. Après cela, chaque année de chat équivaut à environ 4 ans humains.',
55
+ },
56
+ {
57
+ question: 'À quel âge un animal est-il considéré comme Senior ?',
58
+ answer: 'Généralement, un chien est considéré comme senior lorsqu\'il a atteint 75 % de son espérance de vie prévue. Pour les chats, c\'est généralement à partir de 7-11 ans, selon leur état de santé.',
59
+ },
60
+ ];
61
+
62
+ const howTo: PetAgeLocaleContent['howTo'] = [
63
+ { name: 'Choisir le type d\'animal', text: 'Sélectionnez si vous avez un chien ou un chat pour appliquer la bonne formule biologique.' },
64
+ { name: 'Entrer la taille (chiens uniquement)', text: 'Pour les chiens, le poids est essentiel. Indiquez s\'il est petit (jusqu\'à 10 kg), moyen (10-25 kg), grand (25-45 kg) ou géant (+45 kg).' },
65
+ { name: 'Indiquer l\'année de naissance', text: 'Entrez l\'année de naissance de votre animal pour calculer son âge chronologique.' },
66
+ { name: 'Analyser le stade de vie', text: 'Consultez le résultat pour savoir si votre animal est au stade enfant, jeune, adulte ou senior par rapport à un humain.' },
67
+ ];
68
+
69
+ const bibliography: PetAgeLocaleContent['bibliography'] = [
70
+ { name: 'AAHA Senior Care Guidelines for Dogs and Cats', url: 'https://www.aaha.org/wp-content/uploads/globalassets/02-guidelines/2023-aaha-senior-care-guidelines-for-dogs-and-cats/resources/2023-aaha-senior-care-guidelines-for-dogs-and-cats.pdf' },
71
+ { name: 'AKC: How to Calculate Dog Years to Human Years', url: 'https://www.akc.org/expert-advice/health/how-to-calculate-dog-years-to-human-years/' },
72
+ ];
73
+
74
+ const seo: PetAgeLocaleContent['seo'] = [
75
+ {
76
+ type: 'summary',
77
+ title: 'Ce que Vous Devez Savoir sur le Vieillissement des Animaux',
78
+ items: [
79
+ 'La règle "fois 7" est un mythe : les chiens mûrissent de façon exponentielle les 2 premières années.',
80
+ 'Un chien d\'1 an équivaut à 15 ans humains ; un de 2 ans équivaut à 24 ans humains.',
81
+ 'Les grands chiens vieillissent plus vite que les petits après 2 ans.',
82
+ 'Les chats suivent une courbe plus linéaire : chaque année féline équivaut à 4 ans humains après 2 ans.',
83
+ ],
84
+ },
85
+ { type: 'title', text: 'La Vérité Scientifique sur l\'Âge de votre Animal', level: 2 },
86
+ {
87
+ type: 'paragraph',
88
+ html: 'Saviez-vous qu\'un chat de 2 ans a déjà la maturité d\'une personne de 24 ans ? Découvrez pourquoi la règle de multiplier par 7 est un mythe. Le vieux mythe selon lequel "1 an de chien équivaut à 7 ans humains" est une simplification excessive. La réalité biologique est beaucoup plus fascinante : les animaux mûrissent à une vitesse vertigineuse durant leurs deux premières années de vie. Après cela, cette courbe de vieillissement s\'aplatit et ralentit.',
89
+ },
90
+ { type: 'title', text: 'La Science derrière le Calcul', level: 3 },
91
+ {
92
+ type: 'paragraph',
93
+ html: 'Cet outil utilise les directives officielles de l\'<strong>American Animal Hospital Association (AAHA)</strong> et les dernières études sur la méthylation de l\'ADN canin pour vous donner l\'estimation la plus précise possible.',
94
+ },
95
+ {
96
+ type: 'table',
97
+ headers: ['Espèce', 'Année 1', 'Année 2', 'Année 3+'],
98
+ rows: [
99
+ ['Chat', '15 ans humains', '24 ans humains', '+4 ans par an'],
100
+ ['Petit chien', '15 ans humains', '24 ans humains', '+5 ans par an'],
101
+ ['Chien moyen', '15 ans humains', '24 ans humains', '+6 ans par an'],
102
+ ['Grand chien', '15 ans humains', '24 ans humains', '+7 ans par an'],
103
+ ['Chien géant', '15 ans humains', '24 ans humains', '+8 ans par an'],
104
+ ],
105
+ },
106
+ { type: 'title', text: 'Stades de Vie : À Quoi s\'Attendre ?', level: 3 },
107
+ {
108
+ type: 'paragraph',
109
+ html: 'Connaître l\'âge réel de votre animal vous aide à comprendre ses besoins médicaux et émotionnels à chaque phase.',
110
+ },
111
+ {
112
+ type: 'card',
113
+ title: 'Chiot / Junior (0 - 1 an)',
114
+ icon: 'mdi:star-shooting',
115
+ html: 'C\'est la phase de croissance explosive. Ses os grandissent, ses dents changent et son cerveau absorbe les informations comme une éponge. La vaccination et la socialisation précoce sont essentielles ici.',
116
+ },
117
+ {
118
+ type: 'card',
119
+ title: 'Adulte (2 - 6 ans)',
120
+ icon: 'mdi:shield-check',
121
+ html: 'Plénitude physique et mentale. Sa personnalité est maintenant définie. C\'est le moment idéal pour profiter d\'activités physiques intenses et maintenir son poids idéal.',
122
+ },
123
+ {
124
+ type: 'card',
125
+ title: 'Senior (+7 ans)',
126
+ icon: 'mdi:heart-pulse',
127
+ html: 'Des cheveux gris commencent à apparaître sur le museau et il dort plus. Le métabolisme ralentit. À partir de là, les contrôles vétérinaires doivent être tous les 6 mois. Attention à l\'arthrite et à la santé dentaire.',
128
+ },
129
+ {
130
+ type: 'tip',
131
+ title: 'Conseil Vétérinaire',
132
+ html: 'L\'âge calculé est une estimation biologique moyenne. Des facteurs tels que la race, la génétique et le mode de vie peuvent influencer le vieillissement réel de votre animal. Consultez toujours votre vétérinaire.',
133
+ },
134
+ ];
135
+
136
+ const schemas: PetAgeLocaleContent['schemas'] = [
137
+ {
138
+ '@context': 'https://schema.org',
139
+ '@type': 'SoftwareApplication',
140
+ name: title,
141
+ description: description,
142
+ applicationCategory: 'UtilityApplication',
143
+ operatingSystem: 'Web',
144
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
145
+ } as WithContext<SoftwareApplication>,
146
+ ];
147
+
148
+ export const content: PetAgeLocaleContent = {
149
+ slug,
150
+ title,
151
+ description,
152
+ ui,
153
+ seo,
154
+ faqTitle: 'Questions Fréquentes',
155
+ faq,
156
+ bibliographyTitle: 'Références Bibliographiques',
157
+ bibliography,
158
+ howTo,
159
+ schemas,
160
+ };
@@ -0,0 +1,64 @@
1
+ import type { PetToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
+ import PetAgeCalculator from './component.astro';
3
+ import PetAgeSEO from './seo.astro';
4
+ import PetAgeBibliography from './bibliography.astro';
5
+
6
+ export interface PetAgeUI {
7
+ [key: string]: string;
8
+ toolTitle: string;
9
+ toolSubtitle: string;
10
+ petNameLabel: string;
11
+ petNamePlaceholder: string;
12
+ petTypeDog: string;
13
+ petTypeCat: string;
14
+ sizeSmall: string;
15
+ sizeMedium: string;
16
+ sizeLarge: string;
17
+ sizeGiant: string;
18
+ birthYearLabel: string;
19
+ humanAgeLabel: string;
20
+ humanAgeUnit: string;
21
+ lifeStageLabel: string;
22
+ milestoneLabel: string;
23
+ shareBtn: string;
24
+ shareSuccess: string;
25
+ humanAgeTitle: string;
26
+ humanAgeYears: string;
27
+ recalculateBtn: string;
28
+ realAgeLabel: string;
29
+ defaultPetName: string;
30
+ stageDogPuppy: string;
31
+ stageDogTeen: string;
32
+ stageDogAdult: string;
33
+ stageDogMature: string;
34
+ stageDogSenior: string;
35
+ stageCatKitten: string;
36
+ stageCatYouth: string;
37
+ stageCatReign: string;
38
+ stageCatVeteran: string;
39
+ stageCatVenerable: string;
40
+ }
41
+
42
+ export type PetAgeLocaleContent = ToolLocaleContent<PetAgeUI>;
43
+
44
+ export const petAge: PetToolEntry<PetAgeUI> = {
45
+ id: 'pet-age',
46
+ icons: {
47
+ bg: 'mdi:paw',
48
+ fg: 'mdi:cake-variant',
49
+ },
50
+ i18n: {
51
+ es: () => import('./i18n/es').then((m) => m.content),
52
+ en: () => import('./i18n/en').then((m) => m.content),
53
+ fr: () => import('./i18n/fr').then((m) => m.content),
54
+ },
55
+ };
56
+
57
+ export { PetAgeCalculator, PetAgeSEO, PetAgeBibliography };
58
+
59
+ export const PET_AGE_TOOL: ToolDefinition = {
60
+ entry: petAge,
61
+ Component: PetAgeCalculator,
62
+ SEOComponent: PetAgeSEO,
63
+ BibliographyComponent: PetAgeBibliography,
64
+ };
@@ -0,0 +1,59 @@
1
+ export type PetSpecies = 'dog' | 'cat';
2
+ export type DogSize = 'small' | 'medium' | 'large' | 'giant';
3
+
4
+ const DOG_SIZE_MULTIPLIERS: Record<DogSize, number> = {
5
+ small: 5,
6
+ medium: 6,
7
+ large: 7,
8
+ giant: 8,
9
+ };
10
+
11
+ export function calculateDogHumanAge(chronologicalAge: number, size: DogSize): number {
12
+ if (chronologicalAge <= 0) return 0;
13
+ if (chronologicalAge === 1) return 15;
14
+ if (chronologicalAge === 2) return 24;
15
+ return Math.floor(24 + (chronologicalAge - 2) * DOG_SIZE_MULTIPLIERS[size]);
16
+ }
17
+
18
+ export function calculateCatHumanAge(chronologicalAge: number): number {
19
+ if (chronologicalAge <= 0) return 0;
20
+ if (chronologicalAge === 1) return 15;
21
+ if (chronologicalAge === 2) return 24;
22
+ return 24 + (chronologicalAge - 2) * 4;
23
+ }
24
+
25
+ export function calculatePetHumanAge(species: PetSpecies, chronologicalAge: number, dogSize: DogSize = 'medium'): number {
26
+ if (species === 'cat') return calculateCatHumanAge(chronologicalAge);
27
+ return calculateDogHumanAge(chronologicalAge, dogSize);
28
+ }
29
+
30
+ export type DogStageKey = 'stageDogPuppy' | 'stageDogTeen' | 'stageDogAdult' | 'stageDogMature' | 'stageDogSenior';
31
+ export type CatStageKey = 'stageCatKitten' | 'stageCatYouth' | 'stageCatReign' | 'stageCatVeteran' | 'stageCatVenerable';
32
+
33
+ export function getDogStageKey(humanAge: number): DogStageKey {
34
+ if (humanAge < 15) return 'stageDogPuppy';
35
+ if (humanAge < 24) return 'stageDogTeen';
36
+ if (humanAge < 60) return 'stageDogAdult';
37
+ if (humanAge < 80) return 'stageDogMature';
38
+ return 'stageDogSenior';
39
+ }
40
+
41
+ export function getCatStageKey(humanAge: number): CatStageKey {
42
+ if (humanAge < 15) return 'stageCatKitten';
43
+ if (humanAge < 24) return 'stageCatYouth';
44
+ if (humanAge < 60) return 'stageCatReign';
45
+ if (humanAge < 80) return 'stageCatVeteran';
46
+ return 'stageCatVenerable';
47
+ }
48
+
49
+ export function getDogMilestone(chronologicalAge: number): string {
50
+ if (chronologicalAge < 1) return 'Vacunación y Microchip';
51
+ if (chronologicalAge < 7) return 'Chequeo Anual y Limpieza Dental';
52
+ return 'Chequeo Geriátrico Semestral';
53
+ }
54
+
55
+ export function getCatMilestone(chronologicalAge: number): string {
56
+ if (chronologicalAge < 1) return 'Esterilización y Vacunas';
57
+ if (chronologicalAge < 10) return 'Control de Peso y Salud Dental';
58
+ return 'Perfil Renal y Chequeo Senior';
59
+ }
@@ -0,0 +1,61 @@
1
+ ---
2
+ import {
3
+ SEOTitle,
4
+ SEOCard,
5
+ SEOStats,
6
+ SEOTip,
7
+ SEOArticle,
8
+ SEOTable,
9
+ SEOProsCons,
10
+ SEOSummary,
11
+ SEOGlossary,
12
+ SEODiagnostic,
13
+ } from '@jjlmoya/utils-shared';
14
+ import { petAge } from './index';
15
+ import type { KnownLocale } from '../../types';
16
+
17
+ interface Props {
18
+ locale?: KnownLocale;
19
+ }
20
+
21
+ const { locale = 'es' } = Astro.props;
22
+ const content = await petAge.i18n[locale]?.();
23
+ if (!content) return null;
24
+
25
+ const { seo } = content;
26
+ ---
27
+
28
+ <SEOArticle>
29
+ {seo.map((section: any) => {
30
+ switch (section.type) {
31
+ case 'summary':
32
+ return <SEOSummary title={section.title} items={section.items} />;
33
+ case 'title':
34
+ return <SEOTitle title={section.text} level={section.level || 2} />;
35
+ case 'paragraph':
36
+ return <p set:html={section.html} />;
37
+ case 'stats':
38
+ return <SEOStats stats={section.items} columns={section.columns} />;
39
+ case 'card':
40
+ return <SEOCard title={section.title} icon={section.icon}><Fragment set:html={section.html} /></SEOCard>;
41
+ case 'tip':
42
+ return <SEOTip title={section.title}><Fragment set:html={section.html} /></SEOTip>;
43
+ case 'table':
44
+ return (
45
+ <SEOTable headers={section.headers}>
46
+ {section.rows.map((row: string[]) => (
47
+ <tr>{row.map((cell: string) => <td set:html={cell} />)}</tr>
48
+ ))}
49
+ </SEOTable>
50
+ );
51
+ case 'proscons':
52
+ return <SEOProsCons title={section.title} items={section.items} />;
53
+ case 'diagnostic':
54
+ return <SEODiagnostic title={section.title} icon={section.icon} type={section.variant} badge={section.badge}><Fragment set:html={section.html} /></SEODiagnostic>;
55
+ case 'glossary':
56
+ return <SEOGlossary items={section.items} />;
57
+ default:
58
+ return null;
59
+ }
60
+ })}
61
+ </SEOArticle>