@jjlmoya/utils-finance 1.7.0 → 1.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjlmoya/utils-finance",
3
- "version": "1.7.0",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { financeCategory } from './category';
2
- export { default as financeCategorySEO } from './category/seo.astro';
2
+ export const financeCategorySEO = () => import('./category/seo.astro').then((m) => m.default);
3
3
 
4
4
  export type {
5
5
  KnownLocale,
@@ -15,7 +15,7 @@ export type {
15
15
  ToolDefinition,
16
16
  } from './types';
17
17
 
18
- export { ALL_TOOLS } from './tools';
18
+ export { ALL_ENTRIES, ALL_TOOLS } from './tools';
19
19
 
20
20
  export { COMPOUND_INTEREST_TOOL } from './tool/compoundInterest';
21
21
  export { MORTGAGE_TOOL } from './tool/mortgage';
@@ -14,7 +14,8 @@ import type { UtilitySEOContent } from "@jjlmoya/utils-shared";
14
14
  export async function getStaticPaths() {
15
15
  const paths = [];
16
16
 
17
- for (const { entry, Component } of ALL_TOOLS) {
17
+ for (const { entry, Component: lazyComp } of ALL_TOOLS) {
18
+ const { default: Component } = await lazyComp();
18
19
  const localeEntries = Object.entries(entry.i18n) as [
19
20
  KnownLocale,
20
21
  () => Promise<ToolLocaleContent>,
@@ -52,8 +53,6 @@ export async function getStaticPaths() {
52
53
  return paths;
53
54
  }
54
55
 
55
- type ToolComponent = (props: { ui: Record<string, string> }) => unknown;
56
-
57
56
  interface NavItem {
58
57
  id: string;
59
58
  title: string;
@@ -62,7 +61,7 @@ interface NavItem {
62
61
  }
63
62
 
64
63
  interface Props {
65
- Component: ToolComponent;
64
+ Component: unknown;
66
65
  locale: KnownLocale;
67
66
  content: ToolLocaleContent;
68
67
  localeUrls: Partial<Record<KnownLocale, string>>;
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import CompoundInterestComponent from './component.astro';
3
- import CompoundInterestSEO from './seo.astro';
4
- import CompoundInterestBibliography from './bibliography.astro';
5
2
 
6
3
  import type { CompoundInterestUI } from './ui';
7
4
 
@@ -32,11 +29,10 @@ export const compoundInterest: FinanceToolEntry<CompoundInterestUI> = {
32
29
  },
33
30
  };
34
31
 
35
- export { CompoundInterestComponent, CompoundInterestSEO, CompoundInterestBibliography };
36
32
 
37
33
  export const COMPOUND_INTEREST_TOOL: ToolDefinition = {
38
34
  entry: compoundInterest,
39
- Component: CompoundInterestComponent,
40
- SEOComponent: CompoundInterestSEO,
41
- BibliographyComponent: CompoundInterestBibliography,
35
+ Component: () => import('./component.astro'),
36
+ SEOComponent: () => import('./seo.astro'),
37
+ BibliographyComponent: () => import('./bibliography.astro'),
42
38
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import CourtFeeCalculatorComponent from './component.astro';
3
- import CourtFeeCalculatorSEO from './seo.astro';
4
- import CourtFeeCalculatorBibliography from './bibliography.astro';
5
2
  import type { CourtFeeCalculatorUI } from './ui';
6
3
 
7
4
  export type CourtFeeCalculatorLocaleContent = ToolLocaleContent<CourtFeeCalculatorUI>;
@@ -31,11 +28,10 @@ export const courtFeeCalculator: FinanceToolEntry<CourtFeeCalculatorUI> = {
31
28
  },
32
29
  };
33
30
 
34
- export { CourtFeeCalculatorComponent, CourtFeeCalculatorSEO, CourtFeeCalculatorBibliography };
35
31
 
36
32
  export const COURT_FEE_CALCULATOR_TOOL: ToolDefinition = {
37
33
  entry: courtFeeCalculator,
38
- Component: CourtFeeCalculatorComponent,
39
- SEOComponent: CourtFeeCalculatorSEO,
40
- BibliographyComponent: CourtFeeCalculatorBibliography,
34
+ Component: () => import('./component.astro'),
35
+ SEOComponent: () => import('./seo.astro'),
36
+ BibliographyComponent: () => import('./bibliography.astro'),
41
37
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import DebtSnowballComponent from './component.astro';
3
- import DebtSnowballSEO from './seo.astro';
4
- import DebtSnowballBibliography from './bibliography.astro';
5
2
  import type { DebtSnowballUI } from './ui';
6
3
  import { DebtSnowballLogic, type Debt, type SimulationResult, type ProjectionMonth } from './logic';
7
4
 
@@ -33,13 +30,12 @@ export const debtSnowball: FinanceToolEntry<DebtSnowballUI> = {
33
30
  },
34
31
  };
35
32
 
36
- export { DebtSnowballComponent, DebtSnowballSEO, DebtSnowballBibliography };
37
33
 
38
34
  export const DEBT_SNOWBALL_TOOL: ToolDefinition = {
39
35
  entry: debtSnowball,
40
- Component: DebtSnowballComponent,
41
- SEOComponent: DebtSnowballSEO,
42
- BibliographyComponent: DebtSnowballBibliography,
36
+ Component: () => import('./component.astro'),
37
+ SEOComponent: () => import('./seo.astro'),
38
+ BibliographyComponent: () => import('./bibliography.astro'),
43
39
  };
44
40
 
45
41
  export const DebtSnowballLogicExport = DebtSnowballLogic;
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import FIRECalculatorComponent from './component.astro';
3
- import FIRECalculatorSEO from './seo.astro';
4
- import FIRECalculatorBibliography from './bibliography.astro';
5
2
  import type { FIRECalculatorUI } from './ui';
6
3
 
7
4
  export type FIRECalculatorLocaleContent = ToolLocaleContent<FIRECalculatorUI>;
@@ -31,11 +28,10 @@ export const fireCalculator: FinanceToolEntry<FIRECalculatorUI> = {
31
28
  },
32
29
  };
33
30
 
34
- export { FIRECalculatorComponent, FIRECalculatorSEO, FIRECalculatorBibliography };
35
31
 
36
32
  export const FIRE_CALCULATOR_TOOL: ToolDefinition = {
37
33
  entry: fireCalculator,
38
- Component: FIRECalculatorComponent,
39
- SEOComponent: FIRECalculatorSEO,
40
- BibliographyComponent: FIRECalculatorBibliography,
34
+ Component: () => import('./component.astro'),
35
+ SEOComponent: () => import('./seo.astro'),
36
+ BibliographyComponent: () => import('./bibliography.astro'),
41
37
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import IBANBICSwiftComponent from './component.astro';
3
- import IBANBICSwiftSEO from './seo.astro';
4
- import IBANBICSwiftBibliography from './bibliography.astro';
5
2
  import type { IBANBICSwiftUI } from './ui';
6
3
 
7
4
  export type IBANBICSwiftLocaleContent = ToolLocaleContent<IBANBICSwiftUI>;
@@ -31,11 +28,10 @@ export const ibanBicSwift: FinanceToolEntry<IBANBICSwiftUI> = {
31
28
  },
32
29
  };
33
30
 
34
- export { IBANBICSwiftComponent, IBANBICSwiftSEO, IBANBICSwiftBibliography };
35
31
 
36
32
  export const IBAN_BIC_SWIFT_TOOL: ToolDefinition = {
37
33
  entry: ibanBicSwift,
38
- Component: IBANBICSwiftComponent,
39
- SEOComponent: IBANBICSwiftSEO,
40
- BibliographyComponent: IBANBICSwiftBibliography,
34
+ Component: () => import('./component.astro'),
35
+ SEOComponent: () => import('./seo.astro'),
36
+ BibliographyComponent: () => import('./bibliography.astro'),
41
37
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import InflationComponent from './component.astro';
3
- import InflationSEO from './seo.astro';
4
- import InflationBibliography from './bibliography.astro';
5
2
 
6
3
  import type { InflationUI } from './ui';
7
4
 
@@ -32,11 +29,10 @@ export const inflation: FinanceToolEntry<InflationUI> = {
32
29
  },
33
30
  };
34
31
 
35
- export { InflationComponent, InflationSEO, InflationBibliography };
36
32
 
37
33
  export const INFLATION_TOOL: ToolDefinition = {
38
34
  entry: inflation,
39
- Component: InflationComponent,
40
- SEOComponent: InflationSEO,
41
- BibliographyComponent: InflationBibliography,
35
+ Component: () => import('./component.astro'),
36
+ SEOComponent: () => import('./seo.astro'),
37
+ BibliographyComponent: () => import('./bibliography.astro'),
42
38
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import LateInterestComponent from './component.astro';
3
- import LateInterestSEO from './seo.astro';
4
- import LateInterestBibliography from './bibliography.astro';
5
2
 
6
3
  import type { LateInterestUI } from './ui';
7
4
 
@@ -32,11 +29,10 @@ export const lateInterest: FinanceToolEntry<LateInterestUI> = {
32
29
  },
33
30
  };
34
31
 
35
- export { LateInterestComponent, LateInterestSEO, LateInterestBibliography };
36
32
 
37
33
  export const LATE_INTEREST_TOOL: ToolDefinition = {
38
34
  entry: lateInterest,
39
- Component: LateInterestComponent,
40
- SEOComponent: LateInterestSEO,
41
- BibliographyComponent: LateInterestBibliography,
35
+ Component: () => import('./component.astro'),
36
+ SEOComponent: () => import('./seo.astro'),
37
+ BibliographyComponent: () => import('./bibliography.astro'),
42
38
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import LegalInterestRateComponent from './component.astro';
3
- import LegalInterestRateSEO from './seo.astro';
4
- import LegalInterestRateBibliography from './bibliography.astro';
5
2
  import type { LegalInterestRateUI } from './ui';
6
3
 
7
4
  export type LegalInterestRateLocaleContent = ToolLocaleContent<LegalInterestRateUI>;
@@ -31,11 +28,10 @@ export const legalInterestRate: FinanceToolEntry<LegalInterestRateUI> = {
31
28
  },
32
29
  };
33
30
 
34
- export { LegalInterestRateComponent, LegalInterestRateSEO, LegalInterestRateBibliography };
35
31
 
36
32
  export const LEGAL_INTEREST_RATE_TOOL: ToolDefinition = {
37
33
  entry: legalInterestRate,
38
- Component: LegalInterestRateComponent,
39
- SEOComponent: LegalInterestRateSEO,
40
- BibliographyComponent: LegalInterestRateBibliography,
34
+ Component: () => import('./component.astro'),
35
+ SEOComponent: () => import('./seo.astro'),
36
+ BibliographyComponent: () => import('./bibliography.astro'),
41
37
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import LotteryOptimizerComponent from './component.astro';
3
- import LotteryOptimizerSEO from './seo.astro';
4
- import LotteryOptimizerBibliography from './bibliography.astro';
5
2
  import type { LotteryOptimizerUI } from './ui';
6
3
 
7
4
  export type LotteryOptimizerLocaleContent = ToolLocaleContent<LotteryOptimizerUI>;
@@ -31,11 +28,10 @@ export const lotteryOptimizer: FinanceToolEntry<LotteryOptimizerUI> = {
31
28
  },
32
29
  };
33
30
 
34
- export { LotteryOptimizerComponent, LotteryOptimizerSEO, LotteryOptimizerBibliography };
35
31
 
36
32
  export const LOTTERY_OPTIMIZER_TOOL: ToolDefinition = {
37
33
  entry: lotteryOptimizer,
38
- Component: LotteryOptimizerComponent,
39
- SEOComponent: LotteryOptimizerSEO,
40
- BibliographyComponent: LotteryOptimizerBibliography,
34
+ Component: () => import('./component.astro'),
35
+ SEOComponent: () => import('./seo.astro'),
36
+ BibliographyComponent: () => import('./bibliography.astro'),
41
37
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import MortgageComponent from './component.astro';
3
- import MortgageSEO from './seo.astro';
4
- import MortgageBibliography from './bibliography.astro';
5
2
 
6
3
  import type { MortgageUI } from './ui';
7
4
 
@@ -32,11 +29,10 @@ export const mortgage: FinanceToolEntry<MortgageUI> = {
32
29
  },
33
30
  };
34
31
 
35
- export { MortgageComponent, MortgageSEO, MortgageBibliography };
36
32
 
37
33
  export const MORTGAGE_TOOL: ToolDefinition = {
38
34
  entry: mortgage,
39
- Component: MortgageComponent,
40
- SEOComponent: MortgageSEO,
41
- BibliographyComponent: MortgageBibliography,
35
+ Component: () => import('./component.astro'),
36
+ SEOComponent: () => import('./seo.astro'),
37
+ BibliographyComponent: () => import('./bibliography.astro'),
42
38
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import PercentageCalculatorComponent from './component.astro';
3
- import PercentageCalculatorSEO from './seo.astro';
4
- import PercentageCalculatorBibliography from './bibliography.astro';
5
2
 
6
3
  import type { PercentageCalculatorUI } from './ui';
7
4
 
@@ -32,11 +29,10 @@ export const percentageCalculator: FinanceToolEntry<PercentageCalculatorUI> = {
32
29
  },
33
30
  };
34
31
 
35
- export { PercentageCalculatorComponent, PercentageCalculatorSEO, PercentageCalculatorBibliography };
36
32
 
37
33
  export const PERCENTAGE_CALCULATOR_TOOL: ToolDefinition = {
38
34
  entry: percentageCalculator,
39
- Component: PercentageCalculatorComponent,
40
- SEOComponent: PercentageCalculatorSEO,
41
- BibliographyComponent: PercentageCalculatorBibliography,
35
+ Component: () => import('./component.astro'),
36
+ SEOComponent: () => import('./seo.astro'),
37
+ BibliographyComponent: () => import('./bibliography.astro'),
42
38
  };
@@ -1,7 +1,4 @@
1
1
  import type { FinanceToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
- import RentIncreaseComponent from './component.astro';
3
- import RentIncreaseSEO from './seo.astro';
4
- import RentIncreaseBibliography from './bibliography.astro';
5
2
  import type { RentIncreaseUI } from './ui';
6
3
 
7
4
  export type RentIncreaseLocaleContent = ToolLocaleContent<RentIncreaseUI>;
@@ -31,11 +28,10 @@ export const rentIncrease: FinanceToolEntry<RentIncreaseUI> = {
31
28
  },
32
29
  };
33
30
 
34
- export { RentIncreaseComponent, RentIncreaseSEO, RentIncreaseBibliography };
35
31
 
36
32
  export const RENT_INCREASE_TOOL: ToolDefinition = {
37
33
  entry: rentIncrease,
38
- Component: RentIncreaseComponent,
39
- SEOComponent: RentIncreaseSEO,
40
- BibliographyComponent: RentIncreaseBibliography,
34
+ Component: () => import('./component.astro'),
35
+ SEOComponent: () => import('./seo.astro'),
36
+ BibliographyComponent: () => import('./bibliography.astro'),
41
37
  };
package/src/tools.ts CHANGED
@@ -14,3 +14,5 @@ import { DEBT_SNOWBALL_TOOL } from './tool/debtSnowball';
14
14
 
15
15
  export const ALL_TOOLS: ToolDefinition[] = [COMPOUND_INTEREST_TOOL, MORTGAGE_TOOL, INFLATION_TOOL, PERCENTAGE_CALCULATOR_TOOL, LATE_INTEREST_TOOL, IBAN_BIC_SWIFT_TOOL, RENT_INCREASE_TOOL, LOTTERY_OPTIMIZER_TOOL, COURT_FEE_CALCULATOR_TOOL, LEGAL_INTEREST_RATE_TOOL, FIRE_CALCULATOR_TOOL, DEBT_SNOWBALL_TOOL];
16
16
 
17
+
18
+ export const ALL_ENTRIES = ALL_TOOLS.map(t => t.entry);