policyengine-household-wizard 0.1.0 → 0.3.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 (106) hide show
  1. package/README.md +50 -5
  2. package/dist/WizardReviewList-DhLx8Bla.cjs +1 -0
  3. package/dist/WizardReviewList-oY1HqmLw.js +354 -0
  4. package/dist/index-B_OXaS4a.cjs +1 -0
  5. package/dist/index-CIL8FXNR.cjs +1 -0
  6. package/dist/index-DWM0giHt.js +220 -0
  7. package/dist/index-fgLnXugs.js +225 -0
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +34 -28
  11. package/dist/primitives/WizardReviewList.d.ts +3 -2
  12. package/dist/primitives/WizardReviewList.d.ts.map +1 -1
  13. package/dist/primitives/index.d.ts +12 -10
  14. package/dist/primitives/index.d.ts.map +1 -1
  15. package/dist/primitives/types.d.ts +18 -0
  16. package/dist/primitives/types.d.ts.map +1 -1
  17. package/dist/primitives/useWizardStepFocus.d.ts +13 -0
  18. package/dist/primitives/useWizardStepFocus.d.ts.map +1 -0
  19. package/dist/primitives/useWizardSteps.d.ts +2 -2
  20. package/dist/primitives/useWizardSteps.d.ts.map +1 -1
  21. package/dist/primitives.cjs +1 -1
  22. package/dist/primitives.d.ts +1 -1
  23. package/dist/primitives.js +5 -4
  24. package/dist/uk-household/adapters/householdImpactRequest.d.ts +91 -0
  25. package/dist/uk-household/adapters/householdImpactRequest.d.ts.map +1 -0
  26. package/dist/uk-household/adapters/index.d.ts +2 -0
  27. package/dist/uk-household/adapters/index.d.ts.map +1 -0
  28. package/dist/uk-household/children.d.ts +18 -0
  29. package/dist/uk-household/children.d.ts.map +1 -0
  30. package/dist/uk-household/codes.d.ts +22 -0
  31. package/dist/uk-household/codes.d.ts.map +1 -0
  32. package/dist/uk-household/defaults.d.ts +56 -0
  33. package/dist/uk-household/defaults.d.ts.map +1 -0
  34. package/dist/uk-household/draft.d.ts +37 -0
  35. package/dist/uk-household/draft.d.ts.map +1 -0
  36. package/dist/uk-household/index.d.ts +10 -0
  37. package/dist/uk-household/index.d.ts.map +1 -0
  38. package/dist/uk-household/serialize.d.ts +4 -0
  39. package/dist/uk-household/serialize.d.ts.map +1 -0
  40. package/dist/uk-household/statePension.d.ts +42 -0
  41. package/dist/uk-household/statePension.d.ts.map +1 -0
  42. package/dist/uk-household/types.d.ts +134 -0
  43. package/dist/uk-household/types.d.ts.map +1 -0
  44. package/dist/uk-household/validate.d.ts +59 -0
  45. package/dist/uk-household/validate.d.ts.map +1 -0
  46. package/dist/uk-household-adapters.cjs +1 -0
  47. package/dist/uk-household-adapters.d.ts +1 -0
  48. package/dist/uk-household-adapters.js +5 -0
  49. package/dist/uk-household.cjs +1 -0
  50. package/dist/uk-household.d.ts +1 -0
  51. package/dist/uk-household.js +220 -0
  52. package/dist/us-household/adapters/index.d.ts +1 -1
  53. package/dist/us-household/adapters/v1Payload.d.ts +119 -3
  54. package/dist/us-household/adapters/v1Payload.d.ts.map +1 -1
  55. package/dist/us-household/amount.d.ts +8 -0
  56. package/dist/us-household/amount.d.ts.map +1 -0
  57. package/dist/us-household/draft.d.ts +1 -1
  58. package/dist/us-household/index.d.ts +9 -8
  59. package/dist/us-household/index.d.ts.map +1 -1
  60. package/dist/us-household/normalize.d.ts +1 -1
  61. package/dist/us-household/normalize.d.ts.map +1 -1
  62. package/dist/us-household/serialize.d.ts +1 -1
  63. package/dist/us-household/serialize.d.ts.map +1 -1
  64. package/dist/us-household/tippedOccupations.d.ts +40 -0
  65. package/dist/us-household/tippedOccupations.d.ts.map +1 -0
  66. package/dist/us-household/types.d.ts +138 -18
  67. package/dist/us-household/types.d.ts.map +1 -1
  68. package/dist/us-household/validate.d.ts +1 -1
  69. package/dist/us-household/validate.d.ts.map +1 -1
  70. package/dist/us-household-adapters.cjs +1 -1
  71. package/dist/us-household-adapters.d.ts +1 -1
  72. package/dist/us-household-adapters.js +3 -90
  73. package/dist/us-household.cjs +1 -1
  74. package/dist/us-household.d.ts +1 -1
  75. package/dist/us-household.js +346 -246
  76. package/dist/validation.d.ts +16 -0
  77. package/dist/validation.d.ts.map +1 -0
  78. package/package.json +16 -2
  79. package/src/primitives/WizardReviewList.tsx +35 -18
  80. package/src/primitives/index.ts +3 -0
  81. package/src/primitives/types.ts +20 -0
  82. package/src/primitives/useWizardStepFocus.ts +42 -0
  83. package/src/primitives/useWizardSteps.ts +181 -84
  84. package/src/styles.css +9 -0
  85. package/src/uk-household/adapters/householdImpactRequest.ts +164 -0
  86. package/src/uk-household/adapters/index.ts +9 -0
  87. package/src/uk-household/children.ts +23 -0
  88. package/src/uk-household/codes.ts +67 -0
  89. package/src/uk-household/defaults.ts +101 -0
  90. package/src/uk-household/draft.ts +138 -0
  91. package/src/uk-household/index.ts +75 -0
  92. package/src/uk-household/serialize.ts +189 -0
  93. package/src/uk-household/statePension.ts +69 -0
  94. package/src/uk-household/types.ts +159 -0
  95. package/src/uk-household/validate.ts +190 -0
  96. package/src/us-household/adapters/v1Payload.ts +211 -18
  97. package/src/us-household/amount.ts +10 -0
  98. package/src/us-household/index.ts +11 -0
  99. package/src/us-household/normalize.ts +79 -4
  100. package/src/us-household/serialize.ts +5 -1
  101. package/src/us-household/tippedOccupations.ts +145 -0
  102. package/src/us-household/types.ts +144 -15
  103. package/src/us-household/validate.ts +101 -4
  104. package/src/validation.ts +12 -0
  105. package/dist/WizardReviewList-De9RTK_4.js +0 -245
  106. package/dist/WizardReviewList-tfP9LcqU.cjs +0 -1
@@ -1,3 +1,3 @@
1
- import type { UseWizardStepsOptions, UseWizardStepsResult } from './types';
2
- export declare function useWizardSteps<TState>(options: UseWizardStepsOptions<TState>): UseWizardStepsResult;
1
+ import type { UseWizardStepsOptions, UseWizardStepsResult } from './types.js';
2
+ export declare function useWizardSteps<TState>({ steps, state, initialStepId, onStepChange, onComplete, onInvalidStep, advanceRequest, }: UseWizardStepsOptions<TState>): UseWizardStepsResult;
3
3
  //# sourceMappingURL=useWizardSteps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWizardSteps.d.ts","sourceRoot":"","sources":["../../src/primitives/useWizardSteps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,qBAAqB,EACrB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AA4BjB,wBAAgB,cAAc,CAAC,MAAM,EACnC,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,GACrC,oBAAoB,CAiHtB"}
1
+ {"version":3,"file":"useWizardSteps.d.ts","sourceRoot":"","sources":["../../src/primitives/useWizardSteps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,qBAAqB,EACrB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAiBjB,wBAAgB,cAAc,CAAC,MAAM,EAAE,EACrC,KAAK,EACL,KAAK,EACL,aAAa,EACb,YAAY,EACZ,UAAU,EACV,aAAa,EACb,cAAc,GACf,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,oBAAoB,CAuNtD"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./WizardReviewList-tfP9LcqU.cjs");exports.WizardNavigation=i.WizardNavigation;exports.WizardOptionCard=i.WizardOptionCard;exports.WizardProgress=i.WizardProgress;exports.WizardReviewList=i.WizardReviewList;exports.useWizardSteps=i.useWizardSteps;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./WizardReviewList-DhLx8Bla.cjs");exports.WizardNavigation=i.WizardNavigation;exports.WizardOptionCard=i.WizardOptionCard;exports.WizardProgress=i.WizardProgress;exports.WizardReviewList=i.WizardReviewList;exports.useWizardStepFocus=i.useWizardStepFocus;exports.useWizardSteps=i.useWizardSteps;
@@ -1 +1 @@
1
- export * from './primitives/index';
1
+ export * from './primitives/index.js';
@@ -1,8 +1,9 @@
1
- import { W as r, a as s, b as d, c as e, u as W } from "./WizardReviewList-De9RTK_4.js";
1
+ import { W as i, a as r, b as d, c as e, u as W, d as o } from "./WizardReviewList-oY1HqmLw.js";
2
2
  export {
3
- r as WizardNavigation,
4
- s as WizardOptionCard,
3
+ i as WizardNavigation,
4
+ r as WizardOptionCard,
5
5
  d as WizardProgress,
6
6
  e as WizardReviewList,
7
- W as useWizardSteps
7
+ W as useWizardStepFocus,
8
+ o as useWizardSteps
8
9
  };
@@ -0,0 +1,91 @@
1
+ import { type UKStatePensionTable } from '../statePension.js';
2
+ import type { UKHouseholdDraft } from '../types.js';
3
+ /**
4
+ * The request body of the Autumn Budget 2026 dashboard's household impact
5
+ * API (`POST /api/household-impact`, `HouseholdImpactRequest` in
6
+ * PolicyEngine/uk-autumn-budget-dashboard-2026's src/uk_budget_data/api.py).
7
+ * The API refuses unknown fields with a 422, and reads the `partner_*`
8
+ * fields only when `has_partner` is true.
9
+ */
10
+ export interface HouseholdImpactChild {
11
+ age: number;
12
+ /** Sent from 16 to 19 only. */
13
+ in_education?: boolean;
14
+ }
15
+ export interface HouseholdImpactHousehold {
16
+ age: number;
17
+ employment_income: number;
18
+ has_partner: boolean;
19
+ /** Left out without a partner when the draft's is not an age the API takes. */
20
+ partner_age?: number;
21
+ partner_employment_income: number;
22
+ children: HouseholdImpactChild[];
23
+ region: string;
24
+ claims_universal_credit: boolean;
25
+ tenure: string;
26
+ monthly_rent: number;
27
+ dividend_income: number;
28
+ savings_interest_income: number;
29
+ private_pension_income: number;
30
+ partner_private_pension_income: number;
31
+ property_income: number;
32
+ petrol_spending: number;
33
+ diesel_spending: number;
34
+ electricity_spending: number;
35
+ salary_sacrifice_pension_contributions: number;
36
+ student_loan_plan: string;
37
+ council_tax_band: string;
38
+ monthly_childcare: number;
39
+ salary_year: number;
40
+ state_pension?: number;
41
+ partner_state_pension?: number;
42
+ }
43
+ /** The slower parts of a calculation, asked for apart from the headline. */
44
+ export type HouseholdImpactPart = 'by_policy' | 'sweep';
45
+ export interface HouseholdImpactRequest {
46
+ year: number;
47
+ policies: string[];
48
+ household: HouseholdImpactHousehold;
49
+ include: HouseholdImpactPart[];
50
+ }
51
+ export interface ToHouseholdImpactRequestOptions {
52
+ /** The policy year (2027 is 2027-28). */
53
+ year: number;
54
+ /**
55
+ * The measures to compare the household under, sent as given: at least
56
+ * one, each an id the API knows (it refuses an empty list and an unknown
57
+ * id).
58
+ */
59
+ policies: readonly string[];
60
+ /** The slower parts to compute besides the headline; none by default. */
61
+ include?: readonly HouseholdImpactPart[];
62
+ /** State Pension ages by year; left out, `UK_STATE_PENSION`. */
63
+ statePension?: UKStatePensionTable;
64
+ }
65
+ /**
66
+ * The household impact API's request for a draft.
67
+ *
68
+ * Answers go as they are, so `validate()` first: the API refuses what it
69
+ * flags. The rules the request applies:
70
+ * - the partner's salary and pension are sent only with a partner, as 0
71
+ * otherwise. The partner's age is sent even without one, as the dashboard
72
+ * always has (the API reads it only with a partner); without a partner, an
73
+ * age the API would refuse (unanswered, or not a whole number from 16 to
74
+ * 100) is left out, so it cannot fail a single person's request;
75
+ * - children from 16 to 19 carry whether they are in full-time non-advanced
76
+ * education, yes unless answered `false`;
77
+ * - rent only when renting, as entered or else the region's average private
78
+ * rent; 0 otherwise;
79
+ * - childcare only with children; 0 otherwise;
80
+ * - a private pension left out is 0, and electricity left out is the
81
+ * average household's (`UK_DEFAULT_SPENDING.electricity`);
82
+ * - a State Pension only as entered and at State Pension age in `year`;
83
+ * left as prefilled (`null`), the API uses the full new State Pension.
84
+ *
85
+ * The keys come in a fixed order, so `JSON.stringify` of two requests for
86
+ * the same answers gives the same text (apps key caches on it).
87
+ */
88
+ export declare function toHouseholdImpactRequest(draft: UKHouseholdDraft, { year, policies, include, statePension }: ToHouseholdImpactRequestOptions): HouseholdImpactRequest;
89
+ /** The rent a month: as entered, else the region's average private rent. */
90
+ export declare function monthlyRentFor(draft: Pick<UKHouseholdDraft, 'monthlyRent' | 'region'>): number;
91
+ //# sourceMappingURL=householdImpactRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"householdImpactRequest.d.ts","sourceRoot":"","sources":["../../../src/uk-household/adapters/householdImpactRequest.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB,EAAE,OAAO,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,8BAA8B,EAAE,MAAM,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sCAAsC,EAAE,MAAM,CAAC;IAC/C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,4EAA4E;AAC5E,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,OAAO,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,wBAAwB,CAAC;IACpC,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,+BAA+B;IAC9C,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,yEAAyE;IACzE,OAAO,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACzC,gEAAgE;IAChE,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAQD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,gBAAgB,EACvB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAY,EAAE,YAAY,EAAE,EAAE,+BAA+B,GAC9E,sBAAsB,CA8CxB;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG,QAAQ,CAAC,GAAG,MAAM,CAI9F"}
@@ -0,0 +1,2 @@
1
+ export { monthlyRentFor, toHouseholdImpactRequest, type HouseholdImpactChild, type HouseholdImpactHousehold, type HouseholdImpactPart, type HouseholdImpactRequest, type ToHouseholdImpactRequestOptions, } from './householdImpactRequest.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/uk-household/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,GACrC,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The oldest age a child can have. policyengine-uk's qualifying young person
3
+ * is under 20, and the household impact API refuses a child of 20 or over
4
+ * (`HouseholdChildRequest.age`, `le=19`).
5
+ */
6
+ export declare const UK_OLDEST_CHILD_AGE = 19;
7
+ /**
8
+ * From this age, whether a child is in full-time non-advanced education
9
+ * decides whether they count as a dependant.
10
+ */
11
+ export declare const UK_YOUNG_PERSON_AGE = 16;
12
+ /** What to tell someone who enters a child of 20 or over. */
13
+ export declare const UK_CHILD_AGE_MESSAGE = "Children are 0 to 19. Someone aged 20 or over is not a dependant for Child Benefit or Universal Credit, so leave them out.";
14
+ /** Whether a child of `age` is asked about education: from 16 to 19. */
15
+ export declare const asksEducation: (age: number | null | undefined) => boolean;
16
+ /** The age a new child starts at in a form that adds one (`setChildCount`). */
17
+ export declare const UK_NEW_CHILD_AGE = 5;
18
+ //# sourceMappingURL=children.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"children.d.ts","sourceRoot":"","sources":["../../src/uk-household/children.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,+HAC6F,CAAC;AAE/H,wEAAwE;AACxE,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,OACmB,CAAC;AAEnF,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,IAAI,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { UKCouncilTaxBand, UKRegion, UKStudentLoanPlan, UKTenure } from './types.js';
2
+ export interface UKRegionOption {
3
+ code: UKRegion;
4
+ /** policyengine-uk's own label for the region. */
5
+ name: string;
6
+ }
7
+ /** The regions, in policyengine-uk's order, with its labels. */
8
+ export declare const UK_REGIONS: readonly UKRegionOption[];
9
+ export declare const UK_TENURES: readonly UKTenure[];
10
+ /** The tenures that pay rent: rent is read only for these. */
11
+ export declare const UK_RENTING_TENURES: readonly UKTenure[];
12
+ export declare const UK_STUDENT_LOAN_PLANS: readonly UKStudentLoanPlan[];
13
+ export declare const UK_COUNCIL_TAX_BANDS: readonly UKCouncilTaxBand[];
14
+ export declare const isUKRegion: (value: unknown) => value is UKRegion;
15
+ export declare const isUKTenure: (value: unknown) => value is UKTenure;
16
+ export declare const isUKStudentLoanPlan: (value: unknown) => value is UKStudentLoanPlan;
17
+ export declare const isUKCouncilTaxBand: (value: unknown) => value is UKCouncilTaxBand;
18
+ /** Whether a tenure pays rent. Anything else, unknown codes included, does not. */
19
+ export declare const isRenting: (tenure: unknown) => boolean;
20
+ /** policyengine-uk's label for a region, or the code itself if unknown. */
21
+ export declare function getRegionName(code: string): string;
22
+ //# sourceMappingURL=codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/uk-household/codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gEAAgE;AAChE,eAAO,MAAM,UAAU,EAAE,SAAS,cAAc,EAa/C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAMzC,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,EAAE,SAAS,QAAQ,EAA4D,CAAC;AAE/G,eAAO,MAAM,qBAAqB,EAAE,SAAS,iBAAiB,EAO7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SAAS,gBAAgB,EAAkD,CAAC;AAK/G,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,QAIlD,CAAC;AACJ,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,QAAkC,CAAC;AACxF,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,iBAC3B,CAAC;AACpC,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,gBAC3B,CAAC;AAEnC,mFAAmF;AACnF,eAAO,MAAM,SAAS,GAAI,QAAQ,OAAO,KAAG,OAA0C,CAAC;AAEvF,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -0,0 +1,56 @@
1
+ import type { UKRegion } from './types.js';
2
+ /**
3
+ * Typical answers, with their sources, for apps that start every answer at a
4
+ * typical value (the Autumn Budget 2026 dashboard does). `createTypicalDraft()`
5
+ * puts them together.
6
+ */
7
+ export interface UKDefaultSource {
8
+ /** What the figure is. */
9
+ statistic: string;
10
+ /** The publication and table it comes from. */
11
+ publication: string;
12
+ url: string;
13
+ }
14
+ /**
15
+ * The year salaries are entered for. The latest median salary (below) is for
16
+ * April 2026, so a form that asks for "salary in 2026" can start from it.
17
+ */
18
+ export declare const UK_SALARY_YEAR = 2026;
19
+ /**
20
+ * The UK median salary, rounded: ONS, Annual Survey of Hours and Earnings
21
+ * (ASHE) 2026 provisional, Table 6.7a "Annual pay - Gross", all employee jobs,
22
+ * UK: median £34,229 in April 2026 (employees on adult rates in the same job
23
+ * for more than a year), rounded to £34,200.
24
+ */
25
+ export declare const UK_DEFAULT_SALARY = 34200;
26
+ /** A sentence for forms that prefill the salary (the dashboard's hint). */
27
+ export declare const UK_DEFAULT_SALARY_NOTE = "\u00A334,200 is the UK median salary in April 2026 (ONS Annual Survey of Hours and Earnings, provisional).";
28
+ /**
29
+ * Average monthly private rent by region: ONS, Price Index of Private Rents
30
+ * (PIPR), September 2026 (Northern Ireland: July 2026, its latest month),
31
+ * published 21 October 2026.
32
+ */
33
+ export declare const UK_REGIONAL_RENT: Readonly<Record<UKRegion, number>>;
34
+ /** The UK's average monthly private rent in the same release. */
35
+ export declare const UK_AVERAGE_RENT = 1406;
36
+ /** The month each region's average rent is for. */
37
+ export declare const regionalRentMonth: (region: unknown) => string;
38
+ /**
39
+ * The region's average monthly private rent, or the UK's for anything that
40
+ * is not a region code (`null` included).
41
+ */
42
+ export declare function regionalRent(region: unknown): number;
43
+ /**
44
+ * Average household spending, pounds a year: ONS, Family Spending in the UK,
45
+ * FYE 2025, Workbook 1, Table A1, average weekly household spending times 52,
46
+ * rounded to £10. Petrol £11.90 a week (£620 a year), diesel £6.50 (£340),
47
+ * electricity (line 4.4.1) £20.00 (£1,040, the household impact API's own
48
+ * default for electricity).
49
+ */
50
+ export declare const UK_DEFAULT_SPENDING: {
51
+ readonly petrol: 620;
52
+ readonly diesel: 340;
53
+ readonly electricity: 1040;
54
+ };
55
+ export declare const UK_DEFAULT_SOURCES: Readonly<Record<'salary' | 'rent' | 'spending', UKDefaultSource>>;
56
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/uk-household/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;;GAIG;AAEH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AAEvC,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,+GACsE,CAAC;AAE1G;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAa/D,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,mDAAmD;AACnD,eAAO,MAAM,iBAAiB,GAAI,QAAQ,OAAO,KAAG,MACY,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAIpD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,GAAG,UAAU,EAAE,eAAe,CAAC,CAgBhG,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { UKAdultDraft, UKChildDraft, UKHeadDraft, UKHouseholdDraft } from './types.js';
2
+ /**
3
+ * A draft with nothing chosen: no region, ages, tenure, Council Tax band or
4
+ * Universal Credit answer, no partner or children, and amounts at zero. The
5
+ * app must capture each unanswered field before `validate()` accepts it.
6
+ * Rent, the State Pension and electricity start at their "left as prefilled"
7
+ * value (`null`).
8
+ */
9
+ export declare function createBlankDraft(salaryYear?: number): UKHouseholdDraft;
10
+ /**
11
+ * A draft with every answer at a typical value: the Autumn Budget 2026
12
+ * dashboard's starting answers. The salary, rent and spending are statistics
13
+ * (`UK_DEFAULT_SOURCES`); the rest are the dashboard's choices:
14
+ * - a single adult of 30 (and, if a partner is added, a partner of 30 on the
15
+ * median salary) in the North West, renting privately at the region's
16
+ * average rent (`monthlyRent: null`);
17
+ * - no student loan: policyengine-uk's repayment depends on the plan and
18
+ * income alone (the balance only caps a year's repayment);
19
+ * - Council Tax band D, the band the dashboard suggests when unsure;
20
+ * - claiming the Universal Credit the household is due;
21
+ * - the full new State Pension at State Pension age (`statePension: null`);
22
+ * - no other income, salary sacrifice, pensions or childcare.
23
+ */
24
+ export declare function createTypicalDraft(salaryYear?: number): UKHouseholdDraft;
25
+ /** A deep copy: changing it never changes the original. */
26
+ export declare function cloneDraft(draft: UKHouseholdDraft): UKHouseholdDraft;
27
+ export declare function updateHead(draft: UKHouseholdDraft, changes: Partial<UKHeadDraft>): UKHouseholdDraft;
28
+ export declare function updatePartner(draft: UKHouseholdDraft, changes: Partial<UKAdultDraft>): UKHouseholdDraft;
29
+ export declare function addChild(draft: UKHouseholdDraft, child?: Partial<UKChildDraft>): UKHouseholdDraft;
30
+ export declare function removeChild(draft: UKHouseholdDraft, index: number): UKHouseholdDraft;
31
+ export declare function updateChild(draft: UKHouseholdDraft, index: number, changes: Partial<UKChildDraft>): UKHouseholdDraft;
32
+ /**
33
+ * Keep the first `count` children, or add children of `newChildAge` until
34
+ * there are `count`. A form with a "number of children" question uses this.
35
+ */
36
+ export declare function setChildCount(draft: UKHouseholdDraft, count: number, newChildAge?: number): UKHouseholdDraft;
37
+ //# sourceMappingURL=draft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/uk-household/draft.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEzF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,GAAE,MAAuB,GAAG,gBAAgB,CAyBtF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,MAAuB,GAAG,gBAAgB,CA6BxF;AAKD,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,CASpE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,gBAAgB,CAEnG;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,gBAAgB,CAEvG;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,gBAAgB,CAErG;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAEpF;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAC7B,gBAAgB,CAKlB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,WAAW,GAAE,MAAyB,GACrC,gBAAgB,CAIlB"}
@@ -0,0 +1,10 @@
1
+ export type { UKAdultDraft, UKChildDraft, UKCouncilTaxBand, UKHeadDraft, UKHouseholdDraft, UKHouseholdSpending, UKRegion, UKStudentLoanPlan, UKTenure, ValidationIssue, ValidationResult, } from './types.js';
2
+ export { UK_COUNCIL_TAX_BANDS, UK_REGIONS, UK_RENTING_TENURES, UK_STUDENT_LOAN_PLANS, UK_TENURES, getRegionName, isRenting, isUKCouncilTaxBand, isUKRegion, isUKStudentLoanPlan, isUKTenure, type UKRegionOption, } from './codes.js';
3
+ export { UK_AVERAGE_RENT, UK_DEFAULT_SALARY, UK_DEFAULT_SALARY_NOTE, UK_DEFAULT_SOURCES, UK_DEFAULT_SPENDING, UK_REGIONAL_RENT, UK_SALARY_YEAR, regionalRent, regionalRentMonth, type UKDefaultSource, } from './defaults.js';
4
+ export { UK_STATE_PENSION, atStatePensionAge, statePensionEntered, statePensionFor, type UKStatePensionTable, type UKStatePensionYear, } from './statePension.js';
5
+ export { UK_CHILD_AGE_MESSAGE, UK_NEW_CHILD_AGE, UK_OLDEST_CHILD_AGE, UK_YOUNG_PERSON_AGE, asksEducation, } from './children.js';
6
+ export { addChild, cloneDraft, createBlankDraft, createTypicalDraft, removeChild, setChildCount, updateChild, updateHead, updatePartner, } from './draft.js';
7
+ export { UK_HOUSEHOLD_LIMITS, UK_POLICY_YEARS, isComplete, validate, type UKValidateOptions } from './validate.js';
8
+ export { deserializeDraft, serializeDraft } from './serialize.js';
9
+ export * from './adapters/index.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uk-household/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,cAAc,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { UKHouseholdDraft } from './types.js';
2
+ export declare function serializeDraft(draft: UKHouseholdDraft): string;
3
+ export declare function deserializeDraft(query: string | URLSearchParams): UKHouseholdDraft;
4
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/uk-household/serialize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA2C,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAyHzF,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CA4B9D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,gBAAgB,CAmClF"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * State Pension age and the full new State Pension by policy year, as a
3
+ * table of the same shape as the Autumn Budget 2026 dashboard's
4
+ * `src/uk_budget_data/state_pension.json`, so an app can pass its own copy.
5
+ */
6
+ export interface UKStatePensionYear {
7
+ /** The youngest whole age policyengine-uk places over State Pension age in the year. */
8
+ state_pension_age: number;
9
+ /** The full new State Pension, pounds a year. */
10
+ full_new_state_pension: number;
11
+ }
12
+ export interface UKStatePensionTable {
13
+ years: Readonly<Record<string, UKStatePensionYear>>;
14
+ }
15
+ /**
16
+ * The default table: the dashboard's state_pension.json at cc15d50e, which
17
+ * its tests/test_household_impact.py checks against policyengine-uk 2.132.6
18
+ * (the version its lockfile pins). The age is the youngest whole age the
19
+ * model's `is_SP_age` counts for a person entered by age alone; the amount is
20
+ * `gov.dwp.state_pension.new_state_pension.amount` times 52, to the penny.
21
+ * Both change with the model: an app that carries a copy checked against its
22
+ * own model should pass that copy instead.
23
+ */
24
+ export declare const UK_STATE_PENSION: UKStatePensionTable;
25
+ /**
26
+ * State Pension age and the full new State Pension in `year`: the table's
27
+ * row for that year, else for the first later year it has, else its last.
28
+ * So a year before the table (or 0, which apps use to compare answers without
29
+ * a year) takes its first row.
30
+ */
31
+ export declare function statePensionFor(year: number, table?: UKStatePensionTable): {
32
+ age: number;
33
+ full: number;
34
+ };
35
+ /**
36
+ * Whether someone of `age` in `year` is at State Pension age. An unanswered
37
+ * age (`null`) is not.
38
+ */
39
+ export declare function atStatePensionAge(age: number | null | undefined, year: number, table?: UKStatePensionTable): boolean;
40
+ /** Whether a State Pension amount was entered: a finite number; `null` is the full rate. */
41
+ export declare const statePensionEntered: (value: unknown) => value is number;
42
+ //# sourceMappingURL=statePension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statePension.d.ts","sourceRoot":"","sources":["../../src/uk-household/statePension.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,wFAAwF;IACxF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;CACrD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,mBAS9B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,mBAAsC,GAC5C;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAO/B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,mBAAsC,GAC5C,OAAO,CAET;AAED,4FAA4F;AAC5F,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACT,CAAC"}
@@ -0,0 +1,134 @@
1
+ export type { ValidationIssue, ValidationResult } from '../validation.js';
2
+ /**
3
+ * policyengine-uk's `Region` codes: the nine English regions, Wales, Scotland
4
+ * and Northern Ireland (its `UNKNOWN` is left out).
5
+ */
6
+ export type UKRegion = 'NORTH_EAST' | 'NORTH_WEST' | 'YORKSHIRE' | 'EAST_MIDLANDS' | 'WEST_MIDLANDS' | 'EAST_OF_ENGLAND' | 'LONDON' | 'SOUTH_EAST' | 'SOUTH_WEST' | 'WALES' | 'SCOTLAND' | 'NORTHERN_IRELAND';
7
+ /** policyengine-uk's `TenureType` codes. The first three are renting. */
8
+ export type UKTenure = 'RENT_PRIVATELY' | 'RENT_FROM_COUNCIL' | 'RENT_FROM_HA' | 'OWNED_WITH_MORTGAGE' | 'OWNED_OUTRIGHT';
9
+ /** policyengine-uk's `StudentLoanPlan` codes. */
10
+ export type UKStudentLoanPlan = 'NONE' | 'PLAN_1' | 'PLAN_2' | 'PLAN_4' | 'PLAN_5' | 'POSTGRADUATE';
11
+ /**
12
+ * policyengine-uk's `CouncilTaxBand` codes; band I is Wales's. Northern
13
+ * Ireland has domestic rates instead, and the household impact API estimates
14
+ * no Council Tax there.
15
+ */
16
+ export type UKCouncilTaxBand = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I';
17
+ /**
18
+ * One adult's answers. Amounts are pounds a year.
19
+ *
20
+ * Ages are in the policy year being calculated: a calculation for 2028-29
21
+ * takes the age then, and does not age anyone from another year. Employment
22
+ * income is the other way round: it is entered for the draft's `salaryYear`
23
+ * and grown from there.
24
+ */
25
+ export interface UKAdultDraft {
26
+ /** Age in whole years in the policy year. `null` means not answered. */
27
+ age: number | null;
28
+ /** Gross earnings from employment in the draft's `salaryYear`. */
29
+ employmentIncome: number;
30
+ /**
31
+ * Private and workplace pensions in payment, before tax, not counting the
32
+ * State Pension. `null` or left out means none.
33
+ */
34
+ privatePensionIncome?: number | null;
35
+ /**
36
+ * The State Pension in the policy year (not grown like earnings). `null`
37
+ * means the full new State Pension for that year. Calculations read it only
38
+ * from State Pension age in the policy year (`atStatePensionAge`).
39
+ */
40
+ statePension: number | null;
41
+ /** App-controlled fields; the shared adapters ignore them. */
42
+ extras?: Record<string, unknown>;
43
+ }
44
+ /**
45
+ * The household's head: the person answering ("you"). The dashboard's form
46
+ * asks these for the head only, so they are not on the partner (the
47
+ * household impact API also takes a partner's student loan plan; the request
48
+ * leaves it out, so the API's default, `NONE`, applies).
49
+ */
50
+ export interface UKHeadDraft extends UKAdultDraft {
51
+ studentLoanPlan: UKStudentLoanPlan;
52
+ /** Pension contributions made by salary sacrifice. */
53
+ salarySacrificePensionContributions: number;
54
+ dividendIncome: number;
55
+ savingsInterestIncome: number;
56
+ /** Net income from property (rent received). */
57
+ propertyIncome: number;
58
+ }
59
+ export interface UKChildDraft {
60
+ /**
61
+ * Age in whole years in the policy year. policyengine-uk counts a child
62
+ * under 16 as a dependant, and a 16- to 19-year-old only in full-time
63
+ * non-advanced education (`inEducation`). Someone of 20 or over is not a
64
+ * child for Child Benefit or Universal Credit; `validate()` refuses them.
65
+ */
66
+ age: number | null;
67
+ /**
68
+ * From 16 to 19: whether they are in full-time non-advanced education
69
+ * (school or college, not university or an apprenticeship). Anything but
70
+ * `false`, including leaving it out, counts as yes. Not read under 16.
71
+ */
72
+ inEducation?: boolean;
73
+ extras?: Record<string, unknown>;
74
+ }
75
+ /** Household spending, pounds a year. */
76
+ export interface UKHouseholdSpending {
77
+ petrol: number;
78
+ diesel: number;
79
+ /**
80
+ * Domestic electricity, including VAT. `null` or left out means the
81
+ * calculation's own default, the average UK household's
82
+ * (`UK_DEFAULT_SPENDING.electricity`).
83
+ */
84
+ electricity?: number | null;
85
+ }
86
+ /**
87
+ * A UK household: a head, an optional partner and their children, as one
88
+ * benefit unit, plus where and how they live.
89
+ *
90
+ * The policy year is not part of the draft. Apps choose it apart from the
91
+ * answers (the Autumn Budget dashboard's year pill reruns the same answers),
92
+ * so `validate()` and the adapters take it as an option.
93
+ */
94
+ export interface UKHouseholdDraft {
95
+ /**
96
+ * The year `employmentIncome` amounts are entered for. The household
97
+ * impact API grows them to the policy year with the OBR average earnings
98
+ * index, so this year must not be after the policy year.
99
+ */
100
+ salaryYear: number;
101
+ /** `null` means not answered. */
102
+ region: UKRegion | null;
103
+ head: UKHeadDraft;
104
+ /** Whether the head lives with a partner. */
105
+ hasPartner: boolean;
106
+ /**
107
+ * The partner's answers. They are kept while `hasPartner` is false, so
108
+ * turning it back on restores them; calculations read them only with a
109
+ * partner.
110
+ */
111
+ partner: UKAdultDraft;
112
+ /** Dependent children, in the order apps show them ("Child 1", ...). */
113
+ children: UKChildDraft[];
114
+ /** `null` means not answered. */
115
+ tenure: UKTenure | null;
116
+ /**
117
+ * Rent a month, read only when renting. `null` means the region's average
118
+ * private rent (`regionalRent`).
119
+ */
120
+ monthlyRent: number | null;
121
+ /** `null` means not answered. */
122
+ councilTaxBand: UKCouncilTaxBand | null;
123
+ /**
124
+ * Whether the household would claim Universal Credit if entitled. `null`
125
+ * means not answered.
126
+ */
127
+ claimsUniversalCredit: boolean | null;
128
+ /** Paid childcare a month, for all children together; read only with children. */
129
+ monthlyChildcare: number;
130
+ spending: UKHouseholdSpending;
131
+ /** App-controlled household-level fields; the shared adapters ignore them. */
132
+ extras?: Record<string, unknown>;
133
+ }
134
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/uk-household/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAChB,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,UAAU,GACV,kBAAkB,CAAC;AAEvB,yEAAyE;AACzE,MAAM,MAAM,QAAQ,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,cAAc,GACd,qBAAqB,GACrB,gBAAgB,CAAC;AAErB,iDAAiD;AACjD,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,CAAC;AAEpG;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEnF;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,kEAAkE;IAClE,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,eAAe,EAAE,iBAAiB,CAAC;IACnC,sDAAsD;IACtD,mCAAmC,EAAE,MAAM,CAAC;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gDAAgD;IAChD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,yCAAyC;AACzC,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,6CAA6C;IAC7C,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB,wEAAwE;IACxE,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iCAAiC;IACjC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB;;;OAGG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iCAAiC;IACjC,cAAc,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,qBAAqB,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,kFAAkF;IAClF,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC"}
@@ -0,0 +1,59 @@
1
+ import { type UKStatePensionTable } from './statePension.js';
2
+ import type { UKHouseholdDraft, ValidationResult } from './types.js';
3
+ /**
4
+ * The bounds the Autumn Budget 2026 dashboard's household impact API puts on
5
+ * each answer (`HouseholdAnswersRequest` in its src/uk_budget_data/api.py),
6
+ * which `validate()` applies. Amounts are pounds a year unless named monthly.
7
+ */
8
+ export declare const UK_HOUSEHOLD_LIMITS: {
9
+ readonly adultAge: {
10
+ readonly min: 16;
11
+ readonly max: 100;
12
+ };
13
+ readonly childAge: {
14
+ readonly min: 0;
15
+ readonly max: 19;
16
+ };
17
+ readonly maxChildren: 10;
18
+ /** Incomes and salary sacrifice. */
19
+ readonly maxAmount: 10000000;
20
+ readonly maxMonthlyRent: 100000;
21
+ readonly maxMonthlyChildcare: 10000;
22
+ /** Petrol, diesel and electricity. */
23
+ readonly maxSpending: 100000;
24
+ readonly maxStatePension: 100000;
25
+ };
26
+ /**
27
+ * The policy years the household impact API covers, 2026-27 to 2031-32
28
+ * (`POLICY_YEARS`, from the dashboard's src/uk_budget_data/budget_years.json).
29
+ * Salaries can be entered for these years too.
30
+ */
31
+ export declare const UK_POLICY_YEARS: readonly number[];
32
+ export interface UKValidateOptions {
33
+ /**
34
+ * The policy year (2027 is 2027-28). Ages are taken in this year, State
35
+ * Pension age is this year's, and salaries are grown to it.
36
+ */
37
+ year: number;
38
+ /**
39
+ * The policy years the calculation covers, for the year and the salary
40
+ * year; left out, the household impact API's (`UK_POLICY_YEARS`).
41
+ */
42
+ years?: readonly number[];
43
+ /** State Pension ages by year; left out, `UK_STATE_PENSION`. */
44
+ statePension?: UKStatePensionTable;
45
+ }
46
+ /**
47
+ * Check a draft for the calculation in `options.year`. Every issue is an
48
+ * answer the calculation needs and lacks, or one the household impact API
49
+ * would refuse, so a draft that passes builds a request within the API's
50
+ * bounds (`UK_HOUSEHOLD_LIMITS`) and years (`UK_POLICY_YEARS`), unless
51
+ * `options.years` names others. The request also needs at least one measure
52
+ * the API knows; the draft does not hold the measures, so that is the
53
+ * caller's to check. An answer the calculation does not read
54
+ * (rent when not renting, a partner's answers without a partner, a State
55
+ * Pension under State Pension age) is not checked.
56
+ */
57
+ export declare function validate(draft: UKHouseholdDraft, options: UKValidateOptions): ValidationResult;
58
+ export declare function isComplete(draft: UKHouseholdDraft, options: UKValidateOptions): boolean;
59
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/uk-household/validate.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,KAAK,EAAgB,gBAAgB,EAAmB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjG;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;IAI9B,oCAAoC;;;;IAIpC,sCAAsC;;;CAG9B,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAyC,CAAC;AAEvF,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,gEAAgE;IAChE,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CA6H9F;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAEvF"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CIL8FXNR.cjs");exports.monthlyRentFor=e.monthlyRentFor;exports.toHouseholdImpactRequest=e.toHouseholdImpactRequest;
@@ -0,0 +1 @@
1
+ export * from './uk-household/adapters/index.js';
@@ -0,0 +1,5 @@
1
+ import { B as e, G as s } from "./index-fgLnXugs.js";
2
+ export {
3
+ e as monthlyRentFor,
4
+ s as toHouseholdImpactRequest
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CIL8FXNR.cjs");function S(e=t.UK_SALARY_YEAR){return{salaryYear:e,region:null,head:{age:null,employmentIncome:0,privatePensionIncome:0,statePension:null,studentLoanPlan:"NONE",salarySacrificePensionContributions:0,dividendIncome:0,savingsInterestIncome:0,propertyIncome:0},hasPartner:!1,partner:{age:null,employmentIncome:0,privatePensionIncome:0,statePension:null},children:[],tenure:null,monthlyRent:null,councilTaxBand:null,claimsUniversalCredit:null,monthlyChildcare:0,spending:{petrol:0,diesel:0,electricity:null}}}function R(e=t.UK_SALARY_YEAR){return{salaryYear:e,region:"NORTH_WEST",head:{age:30,employmentIncome:t.UK_DEFAULT_SALARY,privatePensionIncome:0,statePension:null,studentLoanPlan:"NONE",salarySacrificePensionContributions:0,dividendIncome:0,savingsInterestIncome:0,propertyIncome:0},hasPartner:!1,partner:{age:30,employmentIncome:t.UK_DEFAULT_SALARY,privatePensionIncome:0,statePension:null},children:[],tenure:"RENT_PRIVATELY",monthlyRent:null,councilTaxBand:"D",claimsUniversalCredit:!0,monthlyChildcare:0,spending:{petrol:t.UK_DEFAULT_SPENDING.petrol,diesel:t.UK_DEFAULT_SPENDING.diesel,electricity:t.UK_DEFAULT_SPENDING.electricity}}}const d=e=>e?{extras:structuredClone(e)}:{};function P(e){return{...e,head:{...e.head,...d(e.head.extras)},partner:{...e.partner,...d(e.partner.extras)},children:e.children.map(n=>({...n,...d(n.extras)})),spending:{...e.spending},...d(e.extras)}}function I(e,n){return{...e,head:{...e.head,...n}}}function y(e,n){return{...e,partner:{...e.partner,...n}}}function C(e,n={}){return{...e,children:[...e.children,{age:null,...n}]}}function D(e,n){return{...e,children:e.children.filter((i,o)=>o!==n)}}function O(e,n,i){return{...e,children:e.children.map((o,r)=>r===n?{...o,...i}:o)}}function f(e,n,i=t.UK_NEW_CHILD_AGE){const o=e.children.slice(0,Math.max(0,n));for(;o.length<n;)o.push({age:i});return{...e,children:o}}const m=[["employmentIncome","e"],["privatePensionIncome","p"],["statePension","s"]],T=[["salarySacrificePensionContributions","x"],["dividendIncome","d"],["savingsInterestIncome","i"],["propertyIncome","r"]],K="l",v=S(),l=e=>typeof e=="number"&&Number.isFinite(e),L=e=>l(e)?String(e):"";function g(e,n){const i=e,o=[L(e.age)];for(const[r,s]of n){const a=i[r];l(a)&&(a===0&&r!=="statePension"||o.push(`${s}${a}`))}return o.join(":")}function A(e){if(e.trim()==="")return;const n=Number(e);if(Number.isFinite(n))return n===0?0:n}function h(e,n,i){const[o="",...r]=e.split(":"),s={...n},a=s;s.age=A(o)??null;for(const u of r){const _=u[0],c=u.slice(1);if(_===K&&"studentLoanPlan"in n){s.studentLoanPlan=t.isUKStudentLoanPlan(c)?c:"NONE";continue}const E=i.find(([,p])=>p===_),U=A(c);E&&U!==void 0&&(a[E[0]]=U)}return s}function G(e){const n=L(e==null?void 0:e.age),i=(e==null?void 0:e.inEducation)===!0?"y":(e==null?void 0:e.inEducation)===!1?"n":"";return`${n}${i}`}function Y(e){const n=e.slice(-1),i=n==="y"||n==="n",o={age:A(i?e.slice(0,-1):e)??null};return i&&(o.inEducation=n==="y"),o}const F=(e,n)=>e.age===n.age&&e.employmentIncome===n.employmentIncome&&(e.privatePensionIncome??0)===(n.privatePensionIncome??0)&&e.statePension===n.statePension;function H(e){const n=new URLSearchParams;l(e.salaryYear)&&n.set("sy",String(e.salaryYear)),e.region&&n.set("region",e.region),e.tenure&&n.set("tenure",e.tenure),l(e.monthlyRent)&&n.set("rent",String(e.monthlyRent)),e.councilTaxBand&&n.set("band",e.councilTaxBand),typeof e.claimsUniversalCredit=="boolean"&&n.set("uc",e.claimsUniversalCredit?"1":"0");let i=g(e.head,[...m,...T]);e.head.studentLoanPlan&&e.head.studentLoanPlan!=="NONE"&&(i+=`:${K}${e.head.studentLoanPlan}`),n.set("you",i),e.hasPartner&&n.set("hp","1"),(e.hasPartner||!F(e.partner,v.partner))&&n.set("partner",g(e.partner,m)),e.children.length>0&&n.set("c",Array.from(e.children,G).join(","));const{petrol:o,diesel:r,electricity:s}=e.spending;return l(o)&&o!==0&&n.set("petrol",String(o)),l(r)&&r!==0&&n.set("diesel",String(r)),l(s)&&n.set("elec",String(s)),l(e.monthlyChildcare)&&e.monthlyChildcare!==0&&n.set("cc",String(e.monthlyChildcare)),n.toString()}function x(e){const n=typeof e=="string"?new URLSearchParams(e):e,i=S(),o=p=>{const N=n.get(p);return N===null?void 0:A(N)},r=o("sy");r!==void 0&&(i.salaryYear=r);const s=n.get("region");i.region=t.isUKRegion(s)?s:null;const a=n.get("tenure");i.tenure=t.isUKTenure(a)?a:null,i.monthlyRent=o("rent")??null;const u=n.get("band");i.councilTaxBand=t.isUKCouncilTaxBand(u)?u:null;const _=n.get("uc");i.claimsUniversalCredit=_==="1"?!0:_==="0"?!1:null;const c=n.get("you");c!==null&&(i.head=h(c,i.head,[...m,...T])),i.hasPartner=n.get("hp")==="1";const E=n.get("partner");E!==null&&(i.partner=h(E,i.partner,m));const U=n.get("c");return U!==null&&(i.children=U.split(",").map(Y)),i.spending={petrol:o("petrol")??0,diesel:o("diesel")??0,electricity:o("elec")??null},i.monthlyChildcare=o("cc")??0,i}exports.UK_AVERAGE_RENT=t.UK_AVERAGE_RENT;exports.UK_CHILD_AGE_MESSAGE=t.UK_CHILD_AGE_MESSAGE;exports.UK_COUNCIL_TAX_BANDS=t.UK_COUNCIL_TAX_BANDS;exports.UK_DEFAULT_SALARY=t.UK_DEFAULT_SALARY;exports.UK_DEFAULT_SALARY_NOTE=t.UK_DEFAULT_SALARY_NOTE;exports.UK_DEFAULT_SOURCES=t.UK_DEFAULT_SOURCES;exports.UK_DEFAULT_SPENDING=t.UK_DEFAULT_SPENDING;exports.UK_HOUSEHOLD_LIMITS=t.UK_HOUSEHOLD_LIMITS;exports.UK_NEW_CHILD_AGE=t.UK_NEW_CHILD_AGE;exports.UK_OLDEST_CHILD_AGE=t.UK_OLDEST_CHILD_AGE;exports.UK_POLICY_YEARS=t.UK_POLICY_YEARS;exports.UK_REGIONAL_RENT=t.UK_REGIONAL_RENT;exports.UK_REGIONS=t.UK_REGIONS;exports.UK_RENTING_TENURES=t.UK_RENTING_TENURES;exports.UK_SALARY_YEAR=t.UK_SALARY_YEAR;exports.UK_STATE_PENSION=t.UK_STATE_PENSION;exports.UK_STUDENT_LOAN_PLANS=t.UK_STUDENT_LOAN_PLANS;exports.UK_TENURES=t.UK_TENURES;exports.UK_YOUNG_PERSON_AGE=t.UK_YOUNG_PERSON_AGE;exports.asksEducation=t.asksEducation;exports.atStatePensionAge=t.atStatePensionAge;exports.getRegionName=t.getRegionName;exports.isComplete=t.isComplete;exports.isRenting=t.isRenting;exports.isUKCouncilTaxBand=t.isUKCouncilTaxBand;exports.isUKRegion=t.isUKRegion;exports.isUKStudentLoanPlan=t.isUKStudentLoanPlan;exports.isUKTenure=t.isUKTenure;exports.monthlyRentFor=t.monthlyRentFor;exports.regionalRent=t.regionalRent;exports.regionalRentMonth=t.regionalRentMonth;exports.statePensionEntered=t.statePensionEntered;exports.statePensionFor=t.statePensionFor;exports.toHouseholdImpactRequest=t.toHouseholdImpactRequest;exports.validate=t.validate;exports.addChild=C;exports.cloneDraft=P;exports.createBlankDraft=S;exports.createTypicalDraft=R;exports.deserializeDraft=x;exports.removeChild=D;exports.serializeDraft=H;exports.setChildCount=f;exports.updateChild=O;exports.updateHead=I;exports.updatePartner=y;
@@ -0,0 +1 @@
1
+ export * from './uk-household/index.js';