### Manage Global State with Zustand
Source: https://context7.com/aricanomx/numerology/llms.txt
Demonstrates how to use the Zustand store for persistent state management. It handles user parameters, navigation tabs, and calculation preferences with hydration checks.
```typescript
import { useNumerologyStore } from '@/store/numerologyStore';
function AppComponent() {
const params = useNumerologyStore(state => state.currentParams);
const activeTab = useNumerologyStore(state => state.activeTab);
const yearMethod = useNumerologyStore(state => state.yearCalculationMethod);
const hasHydrated = useNumerologyStore(state => state._hasHydrated);
const setParams = useNumerologyStore(state => state.setParams);
const setActiveTab = useNumerologyStore(state => state.setActiveTab);
const setYearMethod = useNumerologyStore(state => state.setYearMethod);
const clearParams = useNumerologyStore(state => state.clearParams);
if (!hasHydrated) return ;
const handleSave = (formData) => {
setParams({
fullName: formData.name,
apellidoPaterno: formData.lastName1,
apellidoMaterno: formData.lastName2,
birthDateIso: formData.birthDate.toISOString()
});
};
const toggleMethod = () => {
setYearMethod(yearMethod === 'ROOT' ? 'REDUCED' : 'ROOT');
};
const navigateToSection = (section: string) => {
setActiveTab(section);
};
const handleLogout = () => {
clearParams();
};
}
```
--------------------------------
### Implement Google Authentication with Firebase
Source: https://context7.com/aricanomx/numerology/llms.txt
Handles Google Sign-In flows and authentication state subscriptions. Includes error handling for common authentication failures.
```typescript
import { AuthService } from '@/services/authService';
async function loginFlow() {
const { user, error } = await AuthService.loginWithGoogle();
if (error) {
switch (error) {
case 'auth/cancelled':
console.log('User closed the popup');
break;
case 'auth/network-error':
console.log('Network connection failed');
break;
default:
console.log('Unknown error');
}
return;
}
if (user) {
console.log('Logged in:', user.displayName, user.email, user.uid);
}
}
async function logoutFlow() {
await AuthService.logout();
}
const unsubscribe = AuthService.subscribeToAuthChanges((user) => {
if (user) {
console.log('User signed in:', user.uid);
} else {
console.log('User signed out');
}
});
unsubscribe();
```
--------------------------------
### Calculate Synastry Compatibility
Source: https://context7.com/aricanomx/numerology/llms.txt
Calculates the vibrational compatibility between two individuals using their core numerology numbers. It returns relationship purpose, soul affinity, and personality friction values.
```typescript
import { calculateSynastry, SynastryResult } from '@/utils/numerology';
const misionA = 5;
const almaA = 3;
const personaA = 7;
const misionB = 7;
const almaB = 6;
const personaB = 4;
const synastry: SynastryResult = calculateSynastry(
misionA, misionB,
almaA, almaB,
personaA, personaB
);
console.log(synastry);
```
--------------------------------
### Use Daily Energy Hook
Source: https://context7.com/aricanomx/numerology/llms.txt
Calculates daily universal and personal energies. It also detects portal events such as symmetric or master dates based on the user's personal year and name.
```typescript
import { useDailyEnergy } from '@/hooks/sections/useDailyEnergy';
function DailyDashboard() {
const energy = useDailyEnergy({
personalYear: 7,
fullName: "Maria Garcia"
});
return (
Hello, {energy.firstName}!
Universal: {energy.universalRaw.final}
Personal: {energy.personalRaw.final}
Synergy: {energy.synergyRaw.final}
{energy.isPortalActive && (
{energy.isSymmetricDate && Symmetric Portal!}
{energy.isMasterDate && Master Portal!}
)}
);
}
```
--------------------------------
### Use Numerology Profile Hook
Source: https://context7.com/aricanomx/numerology/llms.txt
A React hook that orchestrates the calculation of a complete numerological profile, including life path, destiny, soul, personality, and heritage numbers. It optionally accepts partner data to compute synastry results.
```typescript
import { useNumerologyProfile } from '@/hooks/core/useNumerologyProfile';
function ProfileScreen() {
const params = {
fullName: "Maria Elena Garcia Rodriguez",
apellidoPaterno: "Garcia",
apellidoMaterno: "Rodriguez",
birthDateIso: "1990-07-15",
partnerFullName: "Carlos Alberto Perez",
partnerBirthDateIso: "1988-03-22"
};
const profile = useNumerologyProfile(params);
if (!profile) return Invalid data;
return (
Life Path: {profile.misionVida.value}
Destiny: {profile.destino.value}
Soul: {profile.alma.value}
Personality: {profile.personalidad.value}
Heritage: {profile.herencia.value}
Current Year: {profile.añosPersonales.current.value}
Age: {profile.edadActual}
Pinnacle A: {profile.pinnacles.a.value}
Challenge A: {profile.challenges.a.value}
{profile.synastry && (
<>
Relationship Purpose: {profile.synastry.proposito.value}
Soul Affinity: {profile.synastry.afinidadAlma.value}
>
)}
);
}
```
--------------------------------
### Configure Section Routing
Source: https://context7.com/aricanomx/numerology/llms.txt
Manages application navigation by mapping section identifiers to their respective components using a centralized configuration.
```typescript
import { getActiveSection, SECTIONS_MAP } from '@/config/sections.config';
const sections = Object.keys(SECTIONS_MAP);
const activeComponent = getActiveSection('matrix');
const defaultComponent = getActiveSection('unknown');
```
--------------------------------
### Validate Numerology Engine Core Logic with Jest
Source: https://context7.com/aricanomx/numerology/llms.txt
This test suite verifies the accuracy of the numerology calculation engine. It ensures that master numbers are preserved during reduction and that life path and destiny calculations return expected numerical values.
```typescript
import {
reduceNumber,
calculateMisionVida,
calculateDestino,
calculatePersonalYears,
} from '@/utils/numerology';
describe('Numerology Engine Core', () => {
test('reduceNumber preserves master numbers', () => {
expect(reduceNumber(11).final).toBe(11);
expect(reduceNumber(22).final).toBe(22);
expect(reduceNumber(33).final).toBe(33);
});
test('reduceNumber reduces normal numbers', () => {
expect(reduceNumber(28).final).toBe(1); // 2+8=10, 1+0=1
expect(reduceNumber(47).final).toBe(11); // 4+7=11 (master)
});
test('calculateMisionVida returns correct life path', () => {
const date = new Date('1990-02-15');
const result = calculateMisionVida(date);
expect(result.value).toBe(9); // 1+5+0+2+1+9+9+0=27, 2+7=9
});
test('calculateDestino processes names correctly', () => {
const result = calculateDestino("Juan Perez");
expect(result.value).toBeGreaterThan(0);
expect(result.value).toBeLessThanOrEqual(33);
});
});
```
--------------------------------
### Pythagorean Number Reduction (TypeScript)
Source: https://context7.com/aricanomx/numerology/llms.txt
Recursively reduces a number using Pythagorean rules, preserving Master Numbers (11, 22, 33) and detecting Karmic Numbers (13, 14, 16, 19). It returns the final reduced number, any detected karmic or master numbers, and a list of reduction steps for display.
```typescript
import { reduceNumber, ReductionResult } from '@/utils/numerology/core';
// Basic reduction with master number preservation
const result1: ReductionResult = reduceNumber(29);
// { final: 11, karmic: null, master: 11, steps: [29, 11] }
const result2: ReductionResult = reduceNumber(28);
// { final: 1, karmic: null, master: null, steps: [28, 10, 1] }
// Karmic number detection
const result3: ReductionResult = reduceNumber(13);
// { final: 4, karmic: 13, master: null, steps: [13, 4] }
const result4: ReductionResult = reduceNumber(19);
// { final: 1, karmic: 19, master: null, steps: [19, 10, 1] }
// Using reduction steps for display
const { final, karmic, master, steps } = reduceNumber(47);
console.log(`${steps.join(' → ')} = ${final}`);
// "47 → 11 = 11" (preserves master number 11)
```
--------------------------------
### Calculate Future Year Projections
Source: https://context7.com/aricanomx/numerology/llms.txt
Generates personal year vibrations for the next 9 years based on a birth date. This allows users to plan activities according to their upcoming numerological cycles.
```typescript
import { ProjectionService, YearlyProjection } from '@/utils/numerology/projections';
const birthDate = new Date('1992-04-18');
const projections: YearlyProjection[] = ProjectionService.calculateNextDecade(birthDate);
console.log(projections);
```
--------------------------------
### Calculate Life Challenges - TypeScript
Source: https://context7.com/aricanomx/numerology/llms.txt
Computes the four life challenges using absolute subtraction, representing obstacles to overcome in different life stages. Challenges are always reduced to single digits (0-8), where 0 signifies no karmic challenges for that period.
```typescript
import { calculateChallenges, ChallengesResult } from '@/utils/numerology';
const birthDate = new Date('1988-09-23');
const challenges: ChallengesResult = calculateChallenges(birthDate);
console.log(challenges);
// {
// a: { value: 4, map: "|Mes(9) - Día(5)| = 4", karmic: null, master: null },
// b: { value: 3, map: "|Día(5) - Año(8)| = 3", karmic: null, master: null },
// c: { value: 1, map: "|Desafío A(4) - Desafío B(3)| = 1", karmic: null, master: null },
// d: { value: 1, map: "|Mes(9) - Año(8)| = 1", karmic: null, master: null }
// }
// Note: Challenges always reduce to single digits (0-8)
// A challenge of 0 means "no karmic challenges" in that period
```
--------------------------------
### Calculate Life Pinnacles Pyramid - TypeScript
Source: https://context7.com/aricanomx/numerology/llms.txt
Calculates the four major life pinnacles (life stages) that form a pyramid structure. Each pinnacle represents specific talents and opportunities during different life periods. It also provides a function to determine the age ranges for these pinnacles based on the Life Path number.
```typescript
import { calculatePinnacles, PinnaclesResult, getPinnacleAges } from '@/utils/numerology';
const birthDate = new Date('1990-06-15');
const pinnacles: PinnaclesResult = calculatePinnacles(birthDate);
console.log(pinnacles);
// {
// a: { value: 3, map: "Mes(6) + Día(6) = 12 ➔ 1 + 2 = 3", ... }, // Youth
// b: { value: 5, map: "Día(6) + Año(1) = 7", ... }, // Early Maturity
// c: { value: 8, map: "A(3) + B(5) = 8", ... }, // Expansion
// d: { value: 7, map: "Mes(6) + Año(1) = 7", ... } // Transcendence
// }
// Calculate when each pinnacle starts/ends based on Life Path
const lifePathValue = 5;
const ages = getPinnacleAges(lifePathValue);
console.log(ages);
// { t1: 31, t2: 40, t3: 49 }
// Pinnacle A: Birth to age 31
// Pinnacle B: Age 31 to 40
// Pinnacle C: Age 40 to 49
// Pinnacle D: Age 49 onwards
```
--------------------------------
### Calculate Personal Year Cycles - TypeScript
Source: https://context7.com/aricanomx/numerology/llms.txt
Computes the current and next Personal Year numbers based on a birth date and the current calendar year. It supports two methods: ROOT (summing digits directly) and REDUCED (reducing the year to a single digit first).
```typescript
import { calculatePersonalYears, CalcResult } from '@/utils/numerology';
const birthDate = new Date('1985-03-22');
// Using ROOT method (default)
const years = calculatePersonalYears(birthDate, 'ROOT');
console.log(years);
// {
// current: {
// value: 7,
// karmic: null,
// master: null,
// map: "22 + 3 + Raíz(2024) = 34 ➔ 3 + 4 = 7",
// label: "Ciclo 2024 - 2025"
// },
// next: {
// value: 8,
// karmic: null,
// master: null,
// map: "22 + 3 + Raíz(2025) = 35 ➔ 3 + 5 = 8",
// label: "Ciclo 2025 - 2026"
// }
// }
// Using REDUCED method
const yearsReduced = calculatePersonalYears(birthDate, 'REDUCED');
// Reduces the year to single digit before adding
```
--------------------------------
### Perform Firestore CRUD Operations
Source: https://context7.com/aricanomx/numerology/llms.txt
Manages user profile persistence in Firestore, including saving and retrieving profile data with associated metadata.
```typescript
import { DatabaseService, UserProfileCloudData } from '@/services/databaseService';
async function saveProfile(uid: string, formData: any) {
const profile: UserProfileCloudData = {
uid,
fullName: formData.fullName,
paternalLastName: formData.lastName1,
maternalLastName: formData.lastName2,
hasOneLastName: !formData.lastName2,
birthDateIso: formData.birthDate.toISOString(),
methodology: 'ROOT'
};
const { success, error } = await DatabaseService.saveUserProfile(profile);
if (success) {
console.log('Profile saved successfully');
} else {
console.error('Save failed:', error);
}
}
async function loadProfile(uid: string) {
const { data, error } = await DatabaseService.getUserProfile(uid);
if (error) {
console.error('Fetch failed:', error);
return null;
}
if (data) {
console.log('Profile loaded:', data.fullName, data.birthDateIso);
return data;
}
console.log('No profile found for user');
return null;
}
```
--------------------------------
### Calculate Heritage Number from Last Names - TypeScript
Source: https://context7.com/aricanomx/numerology/llms.txt
Calculates the family heritage vibration using one or two last names. It reveals ancestral karma and inherited talents. The function handles Latin American style (two last names) and single last names, with an edge case for mononymous individuals.
```typescript
import { calculateHerencia, CalcResult } from '@/utils/numerology';
// With both last names (Latin American style)
const heritage1: CalcResult = calculateHerencia("Garcia", "Lopez");
// Calculates: "Garcia Lopez" using Pythagorean values
// With single last name
const heritage2: CalcResult = calculateHerencia("Smith", "");
// Calculates: "Smith" only
// Edge case for mononymous people (Madonna, Sting)
const heritage3: CalcResult = calculateHerencia("", "");
// { value: 0, karmic: null, master: null, map: '' }
```
--------------------------------
### Life Path Number Calculation (TypeScript)
Source: https://context7.com/aricanomx/numerology/llms.txt
Calculates the Life Path Number (Mission) from a given birth date. This number represents an individual's life purpose and primary lessons. The function returns the calculated value, any karmic or master numbers, and a string detailing the calculation steps.
```typescript
import { calculateMisionVida, CalcResult } from '@/utils/numerology';
const birthDate = new Date('1990-07-15');
const mission: CalcResult = calculateMisionVida(birthDate);
console.log(mission);
// { value: 5, karmic: null, master: null, map: "1 + 5 + 0 + 7 + 1 + 9 + 9 + 0 = 32 ➔ 3 + 2 = 5" }
// Master number example
const masterDate = new Date('1988-11-29');
const masterMission = calculateMisionVida(masterDate);
// { value: 22, karmic: null, master: 22, map: "..." }
```
--------------------------------
### Destiny Number Calculation (TypeScript)
Source: https://context7.com/aricanomx/numerology/llms.txt
Calculates the Destiny Number (Expression Number) from a full official birth name using the Pythagorean letter-to-number mapping. This number reveals innate talents and professional expression. The output includes the calculated value, any karmic or master numbers, and a detailed calculation map.
```typescript
import { calculateDestino, CalcResult } from '@/utils/numerology';
const destiny: CalcResult = calculateDestino("Juan Carlos Rodriguez Lopez");
console.log(destiny);
// { value: 7, karmic: null, master: null, map: "J(1) + U(3) + A(1) + N(5) + C(3) + A(1) + R(9) + L(3) + O(6) + S(1) + R(9) + O(6) + D(4) + R(9) + I(9) + G(7) + U(3) + E(5) + Z(8) + L(3) + O(6) + P(7) + E(5) + Z(8) = 122 ➔ 1 + 2 + 2 = 5" }
// Pythagorean letter map reference:
// A=1, B=2, C=3, D=4, E=5, F=6, G=7, H=8, I=9
// J=1, K=2, L=3, M=4, N=5, O=6, P=7, Q=8, R=9
// S=1, T=2, U=3, V=4, W=5, X=6, Y=7, Z=8
```
--------------------------------
### Calculate Personality Number from Name - TypeScript
Source: https://context7.com/aricanomx/numerology/llms.txt
Calculates the Personality Number using only the consonants from a full name. This number represents the outer mask or 'protective shield' presented to the world. The calculation sums the Pythagorean values of consonants.
```typescript
import { calculatePersonalidad, CalcResult } from '@/utils/numerology';
const personality: CalcResult = calculatePersonalidad("Roberto Martinez");
console.log(personality);
// {
// value: 8,
// karmic: null,
// master: null,
// map: "R(9) + B(2) + R(9) + T(2) + M(4) + R(9) + T(2) + N(5) + Z(8) = 50 ➔ 5 + 0 = 5"
// }
```
--------------------------------
### Strict Single Digit Reduction (TypeScript)
Source: https://context7.com/aricanomx/numerology/llms.txt
Forces a number to reduce to a single digit (1-9), ignoring Master Numbers. This function is specifically used for challenge calculations where double-digit numbers are not permitted.
```typescript
import { reduceToSingleDigit } from '@/utils/numerology/core';
// Always reduces to single digit, even master numbers
const num1 = reduceToSingleDigit(11); // 2
const num2 = reduceToSingleDigit(22); // 4
const num3 = reduceToSingleDigit(33); // 6
const num4 = reduceToSingleDigit(1990); // 1 (1+9+9+0=19, 1+9=10, 1+0=1)
```
--------------------------------
### Calculate Soul Urge Number from Name - TypeScript
Source: https://context7.com/aricanomx/numerology/llms.txt
Extracts vowels from a full name to calculate the Soul Urge (Heart's Desire) number. This number reveals inner motivations and private happiness. The 'Y' is treated as a vowel or consonant based on phonetic rules.
```typescript
import { calculateAlma, CalcResult } from '@/utils/numerology';
const soul: CalcResult = calculateAlma("Maria Elena Garcia");
console.log(soul);
// {
// value: 6,
// karmic: null,
// master: null,
// map: "A(1) + I(9) + A(1) + E(5) + E(5) + A(1) + A(1) + I(9) + A(1) = 33 ➔ 33"
// }
// Note: 33 is a master number, so final value would be 33
// The 'Y' follows phonetic rules:
// - Acts as vowel when it sounds like one (e.g., "Lydia" - Y is vowel)
// - Acts as consonant when followed by a vowel (e.g., "Yolanda" - Y is consonant)
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.