policyengine-household-wizard 0.2.0 → 0.4.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 (80) hide show
  1. package/README.md +30 -4
  2. package/dist/{index-B_OXaS4a.cjs → index-BfoPBFne.cjs} +1 -1
  3. package/dist/index-CIL8FXNR.cjs +1 -0
  4. package/dist/{index-DWM0giHt.js → index-DoD0AXHz.js} +72 -70
  5. package/dist/index-fgLnXugs.js +225 -0
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +1 -1
  9. package/dist/primitives/index.d.ts +12 -12
  10. package/dist/primitives/useWizardSteps.d.ts +1 -1
  11. package/dist/primitives.d.ts +1 -1
  12. package/dist/uk-household/adapters/householdImpactRequest.d.ts +91 -0
  13. package/dist/uk-household/adapters/householdImpactRequest.d.ts.map +1 -0
  14. package/dist/uk-household/adapters/index.d.ts +2 -0
  15. package/dist/uk-household/adapters/index.d.ts.map +1 -0
  16. package/dist/uk-household/children.d.ts +18 -0
  17. package/dist/uk-household/children.d.ts.map +1 -0
  18. package/dist/uk-household/codes.d.ts +22 -0
  19. package/dist/uk-household/codes.d.ts.map +1 -0
  20. package/dist/uk-household/defaults.d.ts +56 -0
  21. package/dist/uk-household/defaults.d.ts.map +1 -0
  22. package/dist/uk-household/draft.d.ts +37 -0
  23. package/dist/uk-household/draft.d.ts.map +1 -0
  24. package/dist/uk-household/index.d.ts +10 -0
  25. package/dist/uk-household/index.d.ts.map +1 -0
  26. package/dist/uk-household/serialize.d.ts +4 -0
  27. package/dist/uk-household/serialize.d.ts.map +1 -0
  28. package/dist/uk-household/statePension.d.ts +42 -0
  29. package/dist/uk-household/statePension.d.ts.map +1 -0
  30. package/dist/uk-household/types.d.ts +134 -0
  31. package/dist/uk-household/types.d.ts.map +1 -0
  32. package/dist/uk-household/validate.d.ts +59 -0
  33. package/dist/uk-household/validate.d.ts.map +1 -0
  34. package/dist/uk-household-adapters.cjs +1 -0
  35. package/dist/uk-household-adapters.d.ts +1 -0
  36. package/dist/uk-household-adapters.js +5 -0
  37. package/dist/uk-household.cjs +1 -0
  38. package/dist/uk-household.d.ts +1 -0
  39. package/dist/uk-household.js +220 -0
  40. package/dist/us-household/adapters/index.d.ts +1 -1
  41. package/dist/us-household/adapters/v1Payload.d.ts +1 -1
  42. package/dist/us-household/adapters/v1Payload.d.ts.map +1 -1
  43. package/dist/us-household/draft.d.ts +1 -1
  44. package/dist/us-household/draft.d.ts.map +1 -1
  45. package/dist/us-household/index.d.ts +9 -9
  46. package/dist/us-household/normalize.d.ts +1 -1
  47. package/dist/us-household/normalize.d.ts.map +1 -1
  48. package/dist/us-household/serialize.d.ts +1 -1
  49. package/dist/us-household/serialize.d.ts.map +1 -1
  50. package/dist/us-household/types.d.ts +9 -14
  51. package/dist/us-household/types.d.ts.map +1 -1
  52. package/dist/us-household/validate.d.ts +1 -1
  53. package/dist/us-household/validate.d.ts.map +1 -1
  54. package/dist/us-household-adapters.cjs +1 -1
  55. package/dist/us-household-adapters.d.ts +1 -1
  56. package/dist/us-household-adapters.js +1 -1
  57. package/dist/us-household.cjs +1 -1
  58. package/dist/us-household.d.ts +1 -1
  59. package/dist/us-household.js +213 -200
  60. package/dist/validation.d.ts +16 -0
  61. package/dist/validation.d.ts.map +1 -0
  62. package/package.json +13 -2
  63. package/src/uk-household/adapters/householdImpactRequest.ts +164 -0
  64. package/src/uk-household/adapters/index.ts +9 -0
  65. package/src/uk-household/children.ts +23 -0
  66. package/src/uk-household/codes.ts +67 -0
  67. package/src/uk-household/defaults.ts +101 -0
  68. package/src/uk-household/draft.ts +138 -0
  69. package/src/uk-household/index.ts +75 -0
  70. package/src/uk-household/serialize.ts +189 -0
  71. package/src/uk-household/statePension.ts +69 -0
  72. package/src/uk-household/types.ts +159 -0
  73. package/src/uk-household/validate.ts +190 -0
  74. package/src/us-household/adapters/v1Payload.ts +4 -0
  75. package/src/us-household/draft.ts +1 -0
  76. package/src/us-household/normalize.ts +3 -0
  77. package/src/us-household/serialize.ts +6 -0
  78. package/src/us-household/types.ts +9 -11
  79. package/src/us-household/validate.ts +15 -0
  80. package/src/validation.ts +12 -0
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # policyengine-household-wizard
2
2
 
3
- Shared wizard primitives and a US household draft contract for PolicyEngine
4
- apps (cliff-watch, Coverage Compass, app-v2, and standalone calculators).
3
+ Shared wizard primitives and US and UK household draft contracts for
4
+ PolicyEngine apps (cliff-watch, Coverage Compass, app-v2, the UK Autumn Budget
5
+ 2026 dashboard, and standalone calculators).
5
6
 
6
- The package ships two surfaces:
7
+ The package ships three surfaces:
7
8
 
8
9
  - **Wizard primitives** — copy-neutral React primitives for step state, progress,
9
10
  navigation, option cards, and review screens. No household-specific code.
@@ -11,6 +12,11 @@ The package ships two surfaces:
11
12
  marital status (issue #1044), validation rules, URL serialization,
12
13
  state-filtered counties, and adapters to the PolicyEngine API V1 household
13
14
  payload.
15
+ - **UK household model** (`policyengine-household-wizard/uk-household`) — the
16
+ household the UK Autumn Budget 2026 dashboard asks about: a draft type,
17
+ typical answers with their ONS sources, validation against the household
18
+ impact API's bounds, State Pension age by year, URL serialization, and an
19
+ adapter to that API's request. See [`docs/uk-household.md`](docs/uk-household.md).
14
20
 
15
21
  ## Install
16
22
 
@@ -64,9 +70,26 @@ function MyWizard() {
64
70
  }
65
71
  ```
66
72
 
67
- See [`docs/api.md`](docs/api.md) for wizard navigation and focus APIs and [`docs/migration.md`](docs/migration.md)
73
+ See [`docs/api.md`](docs/api.md) for wizard navigation and focus APIs, [`docs/uk-household.md`](docs/uk-household.md)
74
+ for the UK household model, and [`docs/migration.md`](docs/migration.md)
68
75
  for migrating from each app's local wizard.
69
76
 
77
+ ## US childcare expenses
78
+
79
+ Set optional `draft.childcareExpenses` to annual household childcare costs
80
+ before childcare subsidies, in dollars. Apps collect this amount once for
81
+ the household. The V1 adapter sends it once as
82
+ `spm_units.spm_unit.spm_unit_pre_subsidy_childcare_expenses`, keyed by the
83
+ draft's year; PolicyEngine allocates the total among children and subtracts
84
+ childcare subsidies. Do not also supply the computed person-level childcare
85
+ expenses. Credit eligibility depends on the model's employment, age and
86
+ other program rules.
87
+
88
+ Leave the field unset when the app does not ask about childcare. An entered
89
+ 0 stays explicit. `validate()` rejects negative or nonfinite amounts;
90
+ cloning, normalization and shared links preserve entered amounts. The shared
91
+ link parameter is `childcare`, for example `childcare=3000`.
92
+
70
93
  ## Design decisions
71
94
 
72
95
  - **Marital status, not filing status.** The wizard asks users marital status
@@ -124,6 +147,8 @@ src/
124
147
  us-household/ types, draft, validate, normalize, serialize, counties
125
148
  adapters/ toV1HouseholdPayload — PolicyEngine API V1 envelope
126
149
  data/ counties-by-state.json
150
+ uk-household/ types, codes, defaults, draft, validate, serialize, State Pension
151
+ adapters/ toHouseholdImpactRequest — the UK Autumn Budget dashboard's API
127
152
  tests/ vitest unit and round-trip tests
128
153
  scripts/ generate-counties.ts, generate-variable-graph.ts
129
154
  ```
@@ -135,6 +160,7 @@ bun install
135
160
  bun run test
136
161
  bun run typecheck
137
162
  bun run build
163
+ bun run check:consumer-types # NodeNext (ESM and CommonJS) and Bundler apps type-check against dist
138
164
  bun run test:live # adapter output against api.policyengine.org (network)
139
165
  ```
140
166
 
@@ -1 +1 @@
1
- "use strict";const S={1:"Beverage and food service",2:"Entertainment and events",3:"Hospitality and guest services",4:"Home services",5:"Personal services",6:"Personal appearance and wellness",7:"Recreation and instruction",8:"Transportation and delivery"},U=[[101,"Bartenders"],[102,"Wait staff"],[103,"Food or beverage servers, non-restaurant"],[104,"Dining room and cafeteria attendants and bartender helpers"],[105,"Chefs and cooks"],[106,"Food preparation workers"],[107,"Fast food and counter workers"],[108,"Dishwashers"],[109,"Host staff, restaurant, lounge, and coffee shop"],[110,"Bakers"],[201,"Gambling dealers"],[202,"Gambling change persons and booth cashiers"],[203,"Gambling cage workers"],[204,"Gambling and sports book writers and runners"],[205,"Dancers"],[206,"Musicians and singers"],[207,"Disc jockeys, except radio"],[208,"Entertainers and performers"],[209,"Digital content creators"],[210,"Ushers, lobby attendants, and ticket takers"],[211,"Locker room, coatroom, and dressing room attendants"],[301,"Baggage porters and bellhops"],[302,"Concierges"],[303,"Hotel, motel, and resort desk clerks"],[304,"Maids and housekeeping cleaners"],[401,"Home maintenance and repair workers"],[402,"Home landscaping and groundskeeping workers"],[403,"Home electricians"],[404,"Home plumbers"],[405,"Home heating and air conditioning mechanics and installers"],[406,"Home appliance installers and repairers"],[407,"Home cleaning service workers"],[408,"Locksmiths"],[409,"Roadside assistance workers"],[501,"Personal care and service workers"],[502,"Private event planners"],[503,"Private event and portrait photographers"],[504,"Private event videographers"],[505,"Event officiants"],[506,"Pet and show animal caretakers"],[507,"Tutors"],[508,"Nannies and babysitters"],[509,"Visual artists"],[510,"Floral designers"],[601,"Skincare specialists"],[602,"Massage therapists"],[603,"Barbers, hairdressers, hairstylists, and cosmetologists"],[604,"Shampooers"],[605,"Manicurists and pedicurists"],[606,"Eyebrow and eyelash technicians"],[607,"Makeup artists"],[608,"Exercise trainers and group fitness instructors"],[609,"Tattoo artists and piercers"],[610,"Tailors"],[611,"Shoe and leather workers and repairers"],[701,"Golf caddies"],[702,"Self-enrichment teachers"],[703,"Recreational and tour pilots"],[704,"Tour guides"],[705,"Travel guides"],[706,"Sports and recreation instructors"],[801,"Parking and valet attendants"],[802,"Taxi and rideshare drivers and chauffeurs"],[803,"Shuttle drivers"],[804,"Goods delivery people"],[805,"Personal vehicle and equipment cleaners"],[806,"Private and charter bus drivers"],[807,"Water taxi operators and charter boat workers"],[808,"Rickshaw, pedicab, and carriage drivers"],[809,"Home movers"],[810,"Gas pump attendant"]],T=U.map(([e,t])=>({code:e,label:t,category:S[Math.floor(e/100)]})),y=new Map(T.map(e=>[e.code,e]));function N(e){return y.get(e)}function v(e){return typeof e=="number"&&y.has(e)}function O(e){const t=typeof e=="string"&&/^\s*\d+\s*$/.test(e)?Number(e):e;return t===0?0:v(t)?t:void 0}function _(e){const t=typeof e=="string"&&e.trim()!==""?Number(e):e;return typeof t=="number"&&Number.isFinite(t)?t:void 0}const D={household:"household",family:"family",taxUnit:"tax_unit",spmUnit:"spm_unit",maritalUnit:"marital_unit"},x={household:"your household",family:"your family",taxUnit:"your tax unit",spmUnit:"your household",maritalUnit:"your marital unit"},w={isDisabled:"is_disabled",isBlind:"is_blind",isFullTimeStudent:"is_full_time_college_student",isPregnant:"is_pregnant",needsCare:"is_incapable_of_self_care"},H=18,R="takes_up_ssi_if_eligible",I={employmentIncome:"employment_income",tipIncome:"tip_income",selfEmploymentIncome:"self_employment_income",socialSecurityIncome:"social_security_retirement",ssiAmount:"ssi",ssdiAmount:"social_security_disability",pensionIncome:"taxable_private_pension_income",publicPensionIncome:"taxable_public_pension_income",privatePensionIncome:"taxable_private_pension_income",dividendIncome:"qualified_dividend_income",nonQualifiedDividendIncome:"non_qualified_dividend_income",shortTermCapitalGains:"short_term_capital_gains",longTermCapitalGains:"long_term_capital_gains",taxableInterestIncome:"taxable_interest_income",rentalIncome:"rental_income",unemploymentCompensation:"unemployment_compensation",childSupportReceived:"child_support_received",miscellaneousIncome:"miscellaneous_income"},B={tipIncome:"employment_income"},G={charitableCashDonations:"charitable_cash_donations",mortgageInterest:"home_mortgage_interest",realEstateTaxes:"real_estate_taxes"},L="treasury_tipped_occupation_code",M=[...Object.entries(I),...Object.entries(B),...Object.entries(G)];function o(e,t){return{[e]:t}}function V(e,t){var r;const i={};e.age!==null&&e.age!==void 0&&(i.age=o(t,e.age)),i.is_tax_unit_dependent=o(t,e.kind==="dependent");const p=_(e.age),h=p!==void 0&&p<H;for(const[s,c]of Object.entries(w)){const d=e[s];s==="isFullTimeStudent"&&h||typeof d=="boolean"&&(i[c]=o(t,d))}for(const[s,c]of M){const d=_(e[s]);if(d!==void 0&&s!=="ssiAmount"){const l=(r=i[c])==null?void 0:r[t],m=typeof l=="number"?l+d:d;i[c]=o(t,m)}}const a=O(e.tippedOccupationCode);return a!==void 0&&(i[L]=o(t,a)),i}function A(e,t={}){const{groupKeyStyle:i="short",includeMaritalUnit:p=!1,label:h=null}=t,a=i==="verbose"?x:D,r=String(e.year),s=e.people.map(n=>n.id),c=e.people.map(n=>_(n.ssiAmount)),d=c.every(n=>n!==void 0)&&c.some(n=>n!==0),l={};e.people.forEach((n,u)=>{const g=V(n,r),f=c[u];f===0&&(g[R]=o(r,!1)),d&&f!==void 0&&(g[I.ssiAmount]=o(r,f)),l[n.id]=g});const m={members:[...s]};e.state&&(m.state_name=o(r,e.state)),e.county&&(m.county=o(r,e.county));const P={[a.family]:{members:[...s]}},E={[a.taxUnit]:{members:[...s]}},C={[a.spmUnit]:{members:[...s]}},k={[a.household]:m},b={};if(p){const n=e.people.filter(u=>u.kind==="adult");b[a.maritalUnit]={members:n.slice(0,2).map(u=>u.id)}}return{country_id:"us",label:h,data:{people:l,families:P,marital_units:b,tax_units:E,spm_units:C,households:k}}}function F(e,t={}){return A(e,t).data}exports.NOT_A_TIPPED_OCCUPATION=0;exports.TIPPED_OCCUPATIONS=T;exports.getTippedOccupation=N;exports.isTippedOccupationCode=v;exports.toAmount=_;exports.toTippedOccupationCode=O;exports.toV1HouseholdPayload=A;exports.toV1HouseholdSituation=F;
1
+ "use strict";const U={1:"Beverage and food service",2:"Entertainment and events",3:"Hospitality and guest services",4:"Home services",5:"Personal services",6:"Personal appearance and wellness",7:"Recreation and instruction",8:"Transportation and delivery"},N=[[101,"Bartenders"],[102,"Wait staff"],[103,"Food or beverage servers, non-restaurant"],[104,"Dining room and cafeteria attendants and bartender helpers"],[105,"Chefs and cooks"],[106,"Food preparation workers"],[107,"Fast food and counter workers"],[108,"Dishwashers"],[109,"Host staff, restaurant, lounge, and coffee shop"],[110,"Bakers"],[201,"Gambling dealers"],[202,"Gambling change persons and booth cashiers"],[203,"Gambling cage workers"],[204,"Gambling and sports book writers and runners"],[205,"Dancers"],[206,"Musicians and singers"],[207,"Disc jockeys, except radio"],[208,"Entertainers and performers"],[209,"Digital content creators"],[210,"Ushers, lobby attendants, and ticket takers"],[211,"Locker room, coatroom, and dressing room attendants"],[301,"Baggage porters and bellhops"],[302,"Concierges"],[303,"Hotel, motel, and resort desk clerks"],[304,"Maids and housekeeping cleaners"],[401,"Home maintenance and repair workers"],[402,"Home landscaping and groundskeeping workers"],[403,"Home electricians"],[404,"Home plumbers"],[405,"Home heating and air conditioning mechanics and installers"],[406,"Home appliance installers and repairers"],[407,"Home cleaning service workers"],[408,"Locksmiths"],[409,"Roadside assistance workers"],[501,"Personal care and service workers"],[502,"Private event planners"],[503,"Private event and portrait photographers"],[504,"Private event videographers"],[505,"Event officiants"],[506,"Pet and show animal caretakers"],[507,"Tutors"],[508,"Nannies and babysitters"],[509,"Visual artists"],[510,"Floral designers"],[601,"Skincare specialists"],[602,"Massage therapists"],[603,"Barbers, hairdressers, hairstylists, and cosmetologists"],[604,"Shampooers"],[605,"Manicurists and pedicurists"],[606,"Eyebrow and eyelash technicians"],[607,"Makeup artists"],[608,"Exercise trainers and group fitness instructors"],[609,"Tattoo artists and piercers"],[610,"Tailors"],[611,"Shoe and leather workers and repairers"],[701,"Golf caddies"],[702,"Self-enrichment teachers"],[703,"Recreational and tour pilots"],[704,"Tour guides"],[705,"Travel guides"],[706,"Sports and recreation instructors"],[801,"Parking and valet attendants"],[802,"Taxi and rideshare drivers and chauffeurs"],[803,"Shuttle drivers"],[804,"Goods delivery people"],[805,"Personal vehicle and equipment cleaners"],[806,"Private and charter bus drivers"],[807,"Water taxi operators and charter boat workers"],[808,"Rickshaw, pedicab, and carriage drivers"],[809,"Home movers"],[810,"Gas pump attendant"]],v=N.map(([e,n])=>({code:e,label:n,category:U[Math.floor(e/100)]})),O=new Map(v.map(e=>[e.code,e]));function x(e){return O.get(e)}function I(e){return typeof e=="number"&&O.has(e)}function A(e){const n=typeof e=="string"&&/^\s*\d+\s*$/.test(e)?Number(e):e;return n===0?0:I(n)?n:void 0}function p(e){const n=typeof e=="string"&&e.trim()!==""?Number(e):e;return typeof n=="number"&&Number.isFinite(n)?n:void 0}const D={household:"household",family:"family",taxUnit:"tax_unit",spmUnit:"spm_unit",maritalUnit:"marital_unit"},w={household:"your household",family:"your family",taxUnit:"your tax unit",spmUnit:"your household",maritalUnit:"your marital unit"},H={isDisabled:"is_disabled",isBlind:"is_blind",isFullTimeStudent:"is_full_time_college_student",isPregnant:"is_pregnant",needsCare:"is_incapable_of_self_care"},R=18,B="takes_up_ssi_if_eligible",P={employmentIncome:"employment_income",tipIncome:"tip_income",selfEmploymentIncome:"self_employment_income",socialSecurityIncome:"social_security_retirement",ssiAmount:"ssi",ssdiAmount:"social_security_disability",pensionIncome:"taxable_private_pension_income",publicPensionIncome:"taxable_public_pension_income",privatePensionIncome:"taxable_private_pension_income",dividendIncome:"qualified_dividend_income",nonQualifiedDividendIncome:"non_qualified_dividend_income",shortTermCapitalGains:"short_term_capital_gains",longTermCapitalGains:"long_term_capital_gains",taxableInterestIncome:"taxable_interest_income",rentalIncome:"rental_income",unemploymentCompensation:"unemployment_compensation",childSupportReceived:"child_support_received",miscellaneousIncome:"miscellaneous_income"},G={tipIncome:"employment_income"},L={charitableCashDonations:"charitable_cash_donations",mortgageInterest:"home_mortgage_interest",realEstateTaxes:"real_estate_taxes"},M="treasury_tipped_occupation_code",V=[...Object.entries(P),...Object.entries(G),...Object.entries(L)];function i(e,n){return{[e]:n}}function F(e,n){var r;const o={};e.age!==null&&e.age!==void 0&&(o.age=i(n,e.age)),o.is_tax_unit_dependent=i(n,e.kind==="dependent");const _=p(e.age),h=_!==void 0&&_<R;for(const[s,c]of Object.entries(H)){const d=e[s];s==="isFullTimeStudent"&&h||typeof d=="boolean"&&(o[c]=i(n,d))}for(const[s,c]of V){const d=p(e[s]);if(d!==void 0&&s!=="ssiAmount"){const l=(r=o[c])==null?void 0:r[n],m=typeof l=="number"?l+d:d;o[c]=i(n,m)}}const a=A(e.tippedOccupationCode);return a!==void 0&&(o[M]=i(n,a)),o}function E(e,n={}){const{groupKeyStyle:o="short",includeMaritalUnit:_=!1,label:h=null}=n,a=o==="verbose"?w:D,r=String(e.year),s=e.people.map(t=>t.id),c=e.people.map(t=>p(t.ssiAmount)),d=c.every(t=>t!==void 0)&&c.some(t=>t!==0),l={};e.people.forEach((t,u)=>{const g=F(t,r),f=c[u];f===0&&(g[B]=i(r,!1)),d&&f!==void 0&&(g[P.ssiAmount]=i(r,f)),l[t.id]=g});const m={members:[...s]};e.state&&(m.state_name=i(r,e.state)),e.county&&(m.county=i(r,e.county));const C={[a.family]:{members:[...s]}},k={[a.taxUnit]:{members:[...s]}},b={[a.spmUnit]:{members:[...s]}},T=p(e.childcareExpenses);T!==void 0&&(b[a.spmUnit].spm_unit_pre_subsidy_childcare_expenses=i(r,T));const S={[a.household]:m},y={};if(_){const t=e.people.filter(u=>u.kind==="adult");y[a.maritalUnit]={members:t.slice(0,2).map(u=>u.id)}}return{country_id:"us",label:h,data:{people:l,families:C,marital_units:y,tax_units:k,spm_units:b,households:S}}}function K(e,n={}){return E(e,n).data}exports.NOT_A_TIPPED_OCCUPATION=0;exports.TIPPED_OCCUPATIONS=v;exports.getTippedOccupation=x;exports.isTippedOccupationCode=I;exports.toAmount=p;exports.toTippedOccupationCode=A;exports.toV1HouseholdPayload=E;exports.toV1HouseholdSituation=K;
@@ -0,0 +1 @@
1
+ "use strict";const R=[{code:"NORTH_EAST",name:"North East"},{code:"NORTH_WEST",name:"North West"},{code:"YORKSHIRE",name:"Yorkshire and the Humber"},{code:"EAST_MIDLANDS",name:"East Midlands"},{code:"WEST_MIDLANDS",name:"West Midlands"},{code:"EAST_OF_ENGLAND",name:"East of England"},{code:"LONDON",name:"London"},{code:"SOUTH_EAST",name:"South East"},{code:"SOUTH_WEST",name:"South West"},{code:"WALES",name:"Wales"},{code:"SCOTLAND",name:"Scotland"},{code:"NORTHERN_IRELAND",name:"Northern Ireland"}],D=["RENT_PRIVATELY","RENT_FROM_COUNCIL","RENT_FROM_HA","OWNED_WITH_MORTGAGE","OWNED_OUTRIGHT"],f=["RENT_PRIVATELY","RENT_FROM_COUNCIL","RENT_FROM_HA"],b=["NONE","PLAN_1","PLAN_2","PLAN_4","PLAN_5","POSTGRADUATE"],$=["A","B","C","D","E","F","G","H","I"],h=(e,a)=>typeof a=="string"&&e.includes(a),v=e=>h(R.map(a=>a.code),e),x=e=>h(D,e),Y=e=>h(b,e),H=e=>h($,e),U=e=>h(f,e);function X(e){var a;return((a=R.find(r=>r.code===e))==null?void 0:a.name)??e}const z=2026,Q=34200,Z="£34,200 is the UK median salary in April 2026 (ONS Annual Survey of Hours and Earnings, provisional).",y={NORTH_EAST:790,NORTH_WEST:975,YORKSHIRE:869,EAST_MIDLANDS:928,WEST_MIDLANDS:983,EAST_OF_ENGLAND:1298,LONDON:2338,SOUTH_EAST:1438,SOUTH_WEST:1251,WALES:848,SCOTLAND:1011,NORTHERN_IRELAND:879},w=1406,ee=e=>e==="NORTHERN_IRELAND"?"July 2026":"September 2026";function G(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(y,e)?y[e]:w}const F={petrol:620,diesel:340,electricity:1040},ne={salary:{statistic:"Median gross annual pay, all employee jobs, UK, April 2026 (provisional): £34,229",publication:"ONS, Annual Survey of Hours and Earnings 2026, Table 6.7a",url:"https://www.ons.gov.uk/employmentandlabourmarket/peopleinwork/earningsandworkinghours/datasets/agegroupashetable6"},rent:{statistic:"Average monthly private rent by region, September 2026 (Northern Ireland: July 2026)",publication:"ONS, Price Index of Private Rents, published 21 October 2026",url:"https://www.ons.gov.uk/economy/inflationandpriceindices/datasets/priceindexofprivaterentsukmonthlypricestatistics"},spending:{statistic:"Average weekly household spending on petrol, diesel and electricity, FYE 2025",publication:"ONS, Family Spending in the UK, FYE 2025, Workbook 1, Table A1",url:"https://www.ons.gov.uk/peoplepopulationandcommunity/personalandhouseholdfinances/expenditure/datasets/familyspendingworkbook1detailedexpenditureandtrends"}},T={years:{2026:{state_pension_age:66,full_new_state_pension:12547.6},2027:{state_pension_age:67,full_new_state_pension:13036.97},2028:{state_pension_age:67,full_new_state_pension:13362.92},2029:{state_pension_age:67,full_new_state_pension:13696.98},2030:{state_pension_age:67,full_new_state_pension:14039.42},2031:{state_pension_age:67,full_new_state_pension:14390.39}}};function M(e,a=T){const r=Object.keys(a.years).map(Number).sort((n,c)=>n-c),p=r.find(n=>n>=e)??r[r.length-1],d=a.years[String(p)];return{age:d.state_pension_age,full:d.full_new_state_pension}}function S(e,a,r=T){return e>=M(a,r).age}const N=e=>typeof e=="number"&&Number.isFinite(e),I=19,k=16,W="Children are 0 to 19. Someone aged 20 or over is not a dependant for Child Benefit or Universal Credit, so leave them out.",q=e=>e>=k&&e<=I,te=5,L={adultAge:{min:16,max:100},childAge:{min:0,max:I},maxChildren:10,maxAmount:1e7,maxMonthlyRent:1e5,maxMonthlyChildcare:1e4,maxSpending:1e5,maxStatePension:1e5},B=[2026,2027,2028,2029,2030,2031],A=e=>typeof e=="number"&&Number.isInteger(e),ie=e=>typeof e=="number"&&Number.isFinite(e),oe=e=>`£${e.toLocaleString("en-GB")}`;function V(e,a){var O,P,K;const{year:r,years:p=B,statePension:d}=a,n=L,c=[],o=(t,s,i)=>c.push({code:t,path:s,message:i});(!A(r)||!p.includes(r))&&o("year.unsupported","year",`${String(r)} is not a year this calculation covers.`),!A(e.salaryYear)||!p.includes(e.salaryYear)?o("salaryYear.unsupported","salaryYear",`Salaries cannot be entered for ${String(e.salaryYear)}.`):A(r)&&e.salaryYear>r&&o("salaryYear.afterYear","salaryYear",`Salaries are entered for ${e.salaryYear}, after ${r}; they can only be grown forward.`);const g=(t,s,i,m)=>{i==null?o(`${t}.required`,t,`${s} is required.`):m(i)||o(`${t}.invalid`,t,`Unknown ${s.toLowerCase()} "${String(i)}".`)};g("region","Region",e.region,v),g("tenure","Housing",e.tenure,x),g("councilTaxBand","Council Tax band",e.councilTaxBand,H),typeof e.claimsUniversalCredit!="boolean"&&o("claimsUniversalCredit.required","claimsUniversalCredit","Whether the household claims Universal Credit is required.");const l=(t,s,i,m,{optional:J=!1}={})=>{i==null?J||o(`${t}.required`,t,`${s} is required.`):ie(i)?i<0?o(`${t}.negative`,t,`${s} cannot be negative.`):i>m&&o(`${t}.tooLarge`,t,`${s} cannot be more than ${oe(m)}.`):o(`${t}.notANumber`,t,`${s} must be a number.`)},u=(t,s,i)=>{i==null?o(`${t}.required`,t,`${s} is required.`):A(i)?(i<n.adultAge.min||i>n.adultAge.max)&&o(`${t}.outOfRange`,t,`${s} must be from ${n.adultAge.min} to ${n.adultAge.max}.`):o(`${t}.notWhole`,t,`${s} must be a whole number of years.`)},{head:_,partner:E}=e;u("head.age","Your age",_.age),l("head.employmentIncome","Your salary",_.employmentIncome,n.maxAmount),l("head.privatePensionIncome","Your private pension",_.privatePensionIncome,n.maxAmount,{optional:!0}),l("head.dividendIncome","Dividends",_.dividendIncome,n.maxAmount),l("head.savingsInterestIncome","Savings interest",_.savingsInterestIncome,n.maxAmount),l("head.propertyIncome","Property income",_.propertyIncome,n.maxAmount),l("head.salarySacrificePensionContributions","Salary sacrifice",_.salarySacrificePensionContributions,n.maxAmount),Y(_.studentLoanPlan)||o("head.studentLoanPlan.invalid","head.studentLoanPlan",`Unknown student loan plan "${String(_.studentLoanPlan)}".`),N(_.statePension)&&S(_.age,r,d)&&l("head.statePension","Your State Pension",_.statePension,n.maxStatePension),e.hasPartner&&(u("partner.age","Your partner's age",E.age),l("partner.employmentIncome","Your partner's salary",E.employmentIncome,n.maxAmount),l("partner.privatePensionIncome","Your partner's private pension",E.privatePensionIncome,n.maxAmount,{optional:!0}),N(E.statePension)&&S(E.age,r,d)&&l("partner.statePension","Your partner's State Pension",E.statePension,n.maxStatePension)),e.children.length>n.maxChildren&&o("children.tooMany","children",`At most ${n.maxChildren} children can be entered.`);for(let t=0;t<e.children.length;t++){const s=e.children[t];if(s==null){o(`children[${t}].required`,`children[${t}]`,`Child ${t+1}'s details are missing.`);continue}const i=`children[${t}].age`,m=`Child ${t+1}'s age`;s.age===null||s.age===void 0?o(`${i}.required`,i,`${m} is required.`):A(s.age)?s.age<n.childAge.min?o(`${i}.negative`,i,`${m} cannot be negative.`):s.age>n.childAge.max&&o(`${i}.tooOld`,i,W):o(`${i}.notWhole`,i,`${m} must be a whole number of years.`)}return U(e.tenure)&&l("monthlyRent","Rent",e.monthlyRent,n.maxMonthlyRent,{optional:!0}),e.children.length>0&&l("monthlyChildcare","Childcare",e.monthlyChildcare,n.maxMonthlyChildcare),l("spending.petrol","Petrol spending",(O=e.spending)==null?void 0:O.petrol,n.maxSpending),l("spending.diesel","Diesel spending",(P=e.spending)==null?void 0:P.diesel,n.maxSpending),l("spending.electricity","Electricity spending",(K=e.spending)==null?void 0:K.electricity,n.maxSpending,{optional:!0}),c.length===0?{ok:!0,issues:[]}:{ok:!1,issues:c}}function se(e,a){return V(e,a).ok}const{adultAge:C}=L,ae=e=>typeof e=="number"&&Number.isInteger(e)&&e>=C.min&&e<=C.max;function re(e,{year:a,policies:r,include:p=[],statePension:d}){const{head:n,partner:c,hasPartner:o}=e,g=e.children.map(u=>q(u.age)?{age:u.age,in_education:u.inEducation!==!1}:{age:u.age}),l=U(e.tenure);return{year:a,policies:[...r],household:{age:n.age,employment_income:n.employmentIncome,has_partner:!!o,...o||ae(c.age)?{partner_age:c.age}:{},partner_employment_income:o?c.employmentIncome:0,children:g,region:e.region,claims_universal_credit:!!e.claimsUniversalCredit,tenure:e.tenure,monthly_rent:l?j(e):0,dividend_income:n.dividendIncome,savings_interest_income:n.savingsInterestIncome,private_pension_income:n.privatePensionIncome??0,partner_private_pension_income:o?c.privatePensionIncome??0:0,property_income:n.propertyIncome,petrol_spending:e.spending.petrol,diesel_spending:e.spending.diesel,electricity_spending:e.spending.electricity??F.electricity,salary_sacrifice_pension_contributions:n.salarySacrificePensionContributions,student_loan_plan:n.studentLoanPlan,council_tax_band:e.councilTaxBand,monthly_childcare:g.length?e.monthlyChildcare:0,salary_year:e.salaryYear,...N(n.statePension)&&S(n.age,a,d)?{state_pension:n.statePension}:{},...o&&N(c.statePension)&&S(c.age,a,d)?{partner_state_pension:c.statePension}:{}},include:[...p]}}function j(e){return typeof e.monthlyRent=="number"&&Number.isFinite(e.monthlyRent)?e.monthlyRent:G(e.region)}exports.UK_AVERAGE_RENT=w;exports.UK_CHILD_AGE_MESSAGE=W;exports.UK_COUNCIL_TAX_BANDS=$;exports.UK_DEFAULT_SALARY=Q;exports.UK_DEFAULT_SALARY_NOTE=Z;exports.UK_DEFAULT_SOURCES=ne;exports.UK_DEFAULT_SPENDING=F;exports.UK_HOUSEHOLD_LIMITS=L;exports.UK_NEW_CHILD_AGE=te;exports.UK_OLDEST_CHILD_AGE=I;exports.UK_POLICY_YEARS=B;exports.UK_REGIONAL_RENT=y;exports.UK_REGIONS=R;exports.UK_RENTING_TENURES=f;exports.UK_SALARY_YEAR=z;exports.UK_STATE_PENSION=T;exports.UK_STUDENT_LOAN_PLANS=b;exports.UK_TENURES=D;exports.UK_YOUNG_PERSON_AGE=k;exports.asksEducation=q;exports.atStatePensionAge=S;exports.getRegionName=X;exports.isComplete=se;exports.isRenting=U;exports.isUKCouncilTaxBand=H;exports.isUKRegion=v;exports.isUKStudentLoanPlan=Y;exports.isUKTenure=x;exports.monthlyRentFor=j;exports.regionalRent=G;exports.regionalRentMonth=ee;exports.statePensionEntered=N;exports.statePensionFor=M;exports.toHouseholdImpactRequest=re;exports.validate=V;
@@ -1,4 +1,4 @@
1
- const V = 0, O = {
1
+ const F = 0, P = {
2
2
  1: "Beverage and food service",
3
3
  2: "Entertainment and events",
4
4
  3: "Hospitality and guest services",
@@ -7,7 +7,7 @@ const V = 0, O = {
7
7
  6: "Personal appearance and wellness",
8
8
  7: "Recreation and instruction",
9
9
  8: "Transportation and delivery"
10
- }, P = [
10
+ }, k = [
11
11
  [101, "Bartenders"],
12
12
  [102, "Wait staff"],
13
13
  [103, "Food or beverage servers, non-restaurant"],
@@ -79,20 +79,20 @@ const V = 0, O = {
79
79
  [808, "Rickshaw, pedicab, and carriage drivers"],
80
80
  [809, "Home movers"],
81
81
  [810, "Gas pump attendant"]
82
- ], k = P.map(
83
- ([e, n]) => ({ code: e, label: n, category: O[Math.floor(e / 100)] })
84
- ), y = new Map(k.map((e) => [e.code, e]));
85
- function F(e) {
86
- return y.get(e);
87
- }
88
- function C(e) {
89
- return typeof e == "number" && y.has(e);
82
+ ], C = k.map(
83
+ ([e, n]) => ({ code: e, label: n, category: P[Math.floor(e / 100)] })
84
+ ), T = new Map(C.map((e) => [e.code, e]));
85
+ function K(e) {
86
+ return T.get(e);
90
87
  }
91
88
  function S(e) {
89
+ return typeof e == "number" && T.has(e);
90
+ }
91
+ function x(e) {
92
92
  const n = typeof e == "string" && /^\s*\d+\s*$/.test(e) ? Number(e) : e;
93
- return n === 0 ? 0 : C(n) ? n : void 0;
93
+ return n === 0 ? 0 : S(n) ? n : void 0;
94
94
  }
95
- function f(e) {
95
+ function _(e) {
96
96
  const n = typeof e == "string" && e.trim() !== "" ? Number(e) : e;
97
97
  return typeof n == "number" && Number.isFinite(n) ? n : void 0;
98
98
  }
@@ -102,20 +102,20 @@ const U = {
102
102
  taxUnit: "tax_unit",
103
103
  spmUnit: "spm_unit",
104
104
  maritalUnit: "marital_unit"
105
- }, x = {
105
+ }, w = {
106
106
  household: "your household",
107
107
  family: "your family",
108
108
  taxUnit: "your tax unit",
109
109
  spmUnit: "your household",
110
110
  // app-v2 uses the same label for SPM unit
111
111
  maritalUnit: "your marital unit"
112
- }, w = {
112
+ }, N = {
113
113
  isDisabled: "is_disabled",
114
114
  isBlind: "is_blind",
115
115
  isFullTimeStudent: "is_full_time_college_student",
116
116
  isPregnant: "is_pregnant",
117
117
  needsCare: "is_incapable_of_self_care"
118
- }, N = 18, D = "takes_up_ssi_if_eligible", v = {
118
+ }, D = 18, H = "takes_up_ssi_if_eligible", E = {
119
119
  employmentIncome: "employment_income",
120
120
  tipIncome: "tip_income",
121
121
  selfEmploymentIncome: "self_employment_income",
@@ -134,87 +134,89 @@ const U = {
134
134
  unemploymentCompensation: "unemployment_compensation",
135
135
  childSupportReceived: "child_support_received",
136
136
  miscellaneousIncome: "miscellaneous_income"
137
- }, H = {
138
- tipIncome: "employment_income"
139
137
  }, R = {
138
+ tipIncome: "employment_income"
139
+ }, B = {
140
140
  charitableCashDonations: "charitable_cash_donations",
141
141
  mortgageInterest: "home_mortgage_interest",
142
142
  realEstateTaxes: "real_estate_taxes"
143
- }, B = "treasury_tipped_occupation_code", G = [
144
- ...Object.entries(v),
145
- ...Object.entries(H),
146
- ...Object.entries(R)
143
+ }, G = "treasury_tipped_occupation_code", L = [
144
+ ...Object.entries(E),
145
+ ...Object.entries(R),
146
+ ...Object.entries(B)
147
147
  ];
148
- function a(e, n) {
148
+ function i(e, n) {
149
149
  return { [e]: n };
150
150
  }
151
- function L(e, n) {
151
+ function M(e, n) {
152
152
  var r;
153
- const i = {};
154
- e.age !== null && e.age !== void 0 && (i.age = a(n, e.age)), i.is_tax_unit_dependent = a(n, e.kind === "dependent");
155
- const p = f(e.age), _ = p !== void 0 && p < N;
156
- for (const [s, c] of Object.entries(w)) {
157
- const l = e[s];
158
- s === "isFullTimeStudent" && _ || typeof l == "boolean" && (i[c] = a(n, l));
153
+ const a = {};
154
+ e.age !== null && e.age !== void 0 && (a.age = i(n, e.age)), a.is_tax_unit_dependent = i(n, e.kind === "dependent");
155
+ const p = _(e.age), h = p !== void 0 && p < D;
156
+ for (const [t, c] of Object.entries(N)) {
157
+ const d = e[t];
158
+ t === "isFullTimeStudent" && h || typeof d == "boolean" && (a[c] = i(n, d));
159
159
  }
160
- for (const [s, c] of G) {
161
- const l = f(e[s]);
162
- if (l !== void 0 && s !== "ssiAmount") {
163
- const d = (r = i[c]) == null ? void 0 : r[n], m = typeof d == "number" ? d + l : l;
164
- i[c] = a(n, m);
160
+ for (const [t, c] of L) {
161
+ const d = _(e[t]);
162
+ if (d !== void 0 && t !== "ssiAmount") {
163
+ const l = (r = a[c]) == null ? void 0 : r[n], m = typeof l == "number" ? l + d : d;
164
+ a[c] = i(n, m);
165
165
  }
166
166
  }
167
- const o = S(e.tippedOccupationCode);
168
- return o !== void 0 && (i[B] = a(n, o)), i;
167
+ const o = x(e.tippedOccupationCode);
168
+ return o !== void 0 && (a[G] = i(n, o)), a;
169
169
  }
170
- function M(e, n = {}) {
171
- const { groupKeyStyle: i = "short", includeMaritalUnit: p = !1, label: _ = null } = n, o = i === "verbose" ? x : U, r = String(e.year), s = e.people.map((t) => t.id), c = e.people.map((t) => f(t.ssiAmount)), l = c.every((t) => t !== void 0) && c.some((t) => t !== 0), d = {};
172
- e.people.forEach((t, u) => {
173
- const h = L(t, r), g = c[u];
174
- g === 0 && (h[D] = a(r, !1)), l && g !== void 0 && (h[v.ssiAmount] = a(r, g)), d[t.id] = h;
170
+ function V(e, n = {}) {
171
+ const { groupKeyStyle: a = "short", includeMaritalUnit: p = !1, label: h = null } = n, o = a === "verbose" ? w : U, r = String(e.year), t = e.people.map((s) => s.id), c = e.people.map((s) => _(s.ssiAmount)), d = c.every((s) => s !== void 0) && c.some((s) => s !== 0), l = {};
172
+ e.people.forEach((s, u) => {
173
+ const g = M(s, r), f = c[u];
174
+ f === 0 && (g[H] = i(r, !1)), d && f !== void 0 && (g[E.ssiAmount] = i(r, f)), l[s.id] = g;
175
175
  });
176
176
  const m = {
177
- members: [...s]
177
+ members: [...t]
178
178
  };
179
- e.state && (m.state_name = a(r, e.state)), e.county && (m.county = a(r, e.county));
180
- const T = {
181
- [o.family]: { members: [...s] }
182
- }, I = {
183
- [o.taxUnit]: { members: [...s] }
184
- }, E = {
185
- [o.spmUnit]: { members: [...s] }
179
+ e.state && (m.state_name = i(r, e.state)), e.county && (m.county = i(r, e.county));
180
+ const I = {
181
+ [o.family]: { members: [...t] }
186
182
  }, A = {
183
+ [o.taxUnit]: { members: [...t] }
184
+ }, b = {
185
+ [o.spmUnit]: { members: [...t] }
186
+ }, y = _(e.childcareExpenses);
187
+ y !== void 0 && (b[o.spmUnit].spm_unit_pre_subsidy_childcare_expenses = i(r, y));
188
+ const O = {
187
189
  [o.household]: m
188
- }, b = {};
190
+ }, v = {};
189
191
  if (p) {
190
- const t = e.people.filter((u) => u.kind === "adult");
191
- b[o.maritalUnit] = {
192
- members: t.slice(0, 2).map((u) => u.id)
192
+ const s = e.people.filter((u) => u.kind === "adult");
193
+ v[o.maritalUnit] = {
194
+ members: s.slice(0, 2).map((u) => u.id)
193
195
  };
194
196
  }
195
197
  return {
196
198
  country_id: "us",
197
- label: _,
199
+ label: h,
198
200
  data: {
199
- people: d,
200
- families: T,
201
- marital_units: b,
202
- tax_units: I,
203
- spm_units: E,
204
- households: A
201
+ people: l,
202
+ families: I,
203
+ marital_units: v,
204
+ tax_units: A,
205
+ spm_units: b,
206
+ households: O
205
207
  }
206
208
  };
207
209
  }
208
- function K(e, n = {}) {
209
- return M(e, n).data;
210
+ function j(e, n = {}) {
211
+ return V(e, n).data;
210
212
  }
211
213
  export {
212
- V as N,
213
- k as T,
214
- S as a,
215
- M as b,
216
- K as c,
217
- F as g,
218
- C as i,
219
- f as t
214
+ F as N,
215
+ C as T,
216
+ x as a,
217
+ V as b,
218
+ j as c,
219
+ K as g,
220
+ S as i,
221
+ _ as t
220
222
  };
@@ -0,0 +1,225 @@
1
+ const U = [
2
+ { code: "NORTH_EAST", name: "North East" },
3
+ { code: "NORTH_WEST", name: "North West" },
4
+ { code: "YORKSHIRE", name: "Yorkshire and the Humber" },
5
+ { code: "EAST_MIDLANDS", name: "East Midlands" },
6
+ { code: "WEST_MIDLANDS", name: "West Midlands" },
7
+ { code: "EAST_OF_ENGLAND", name: "East of England" },
8
+ { code: "LONDON", name: "London" },
9
+ { code: "SOUTH_EAST", name: "South East" },
10
+ { code: "SOUTH_WEST", name: "South West" },
11
+ { code: "WALES", name: "Wales" },
12
+ { code: "SCOTLAND", name: "Scotland" },
13
+ { code: "NORTHERN_IRELAND", name: "Northern Ireland" }
14
+ ], C = [
15
+ "RENT_PRIVATELY",
16
+ "RENT_FROM_COUNCIL",
17
+ "RENT_FROM_HA",
18
+ "OWNED_WITH_MORTGAGE",
19
+ "OWNED_OUTRIGHT"
20
+ ], $ = ["RENT_PRIVATELY", "RENT_FROM_COUNCIL", "RENT_FROM_HA"], v = [
21
+ "NONE",
22
+ "PLAN_1",
23
+ "PLAN_2",
24
+ "PLAN_4",
25
+ "PLAN_5",
26
+ "POSTGRADUATE"
27
+ ], D = ["A", "B", "C", "D", "E", "F", "G", "H", "I"], A = (e, a) => typeof a == "string" && e.includes(a), Y = (e) => A(
28
+ U.map((a) => a.code),
29
+ e
30
+ ), w = (e) => A(C, e), H = (e) => A(v, e), K = (e) => A(D, e), P = (e) => A($, e);
31
+ function Z(e) {
32
+ var a;
33
+ return ((a = U.find((r) => r.code === e)) == null ? void 0 : a.name) ?? e;
34
+ }
35
+ const ee = 2026, ne = 34200, te = "£34,200 is the UK median salary in April 2026 (ONS Annual Survey of Hours and Earnings, provisional).", I = {
36
+ NORTH_EAST: 790,
37
+ NORTH_WEST: 975,
38
+ YORKSHIRE: 869,
39
+ EAST_MIDLANDS: 928,
40
+ WEST_MIDLANDS: 983,
41
+ EAST_OF_ENGLAND: 1298,
42
+ LONDON: 2338,
43
+ SOUTH_EAST: 1438,
44
+ SOUTH_WEST: 1251,
45
+ WALES: 848,
46
+ SCOTLAND: 1011,
47
+ NORTHERN_IRELAND: 879
48
+ }, k = 1406, oe = (e) => e === "NORTHERN_IRELAND" ? "July 2026" : "September 2026";
49
+ function F(e) {
50
+ return typeof e == "string" && Object.prototype.hasOwnProperty.call(I, e) ? I[e] : k;
51
+ }
52
+ const W = {
53
+ petrol: 620,
54
+ diesel: 340,
55
+ electricity: 1040
56
+ }, ie = {
57
+ salary: {
58
+ statistic: "Median gross annual pay, all employee jobs, UK, April 2026 (provisional): £34,229",
59
+ publication: "ONS, Annual Survey of Hours and Earnings 2026, Table 6.7a",
60
+ url: "https://www.ons.gov.uk/employmentandlabourmarket/peopleinwork/earningsandworkinghours/datasets/agegroupashetable6"
61
+ },
62
+ rent: {
63
+ statistic: "Average monthly private rent by region, September 2026 (Northern Ireland: July 2026)",
64
+ publication: "ONS, Price Index of Private Rents, published 21 October 2026",
65
+ url: "https://www.ons.gov.uk/economy/inflationandpriceindices/datasets/priceindexofprivaterentsukmonthlypricestatistics"
66
+ },
67
+ spending: {
68
+ statistic: "Average weekly household spending on petrol, diesel and electricity, FYE 2025",
69
+ publication: "ONS, Family Spending in the UK, FYE 2025, Workbook 1, Table A1",
70
+ url: "https://www.ons.gov.uk/peoplepopulationandcommunity/personalandhouseholdfinances/expenditure/datasets/familyspendingworkbook1detailedexpenditureandtrends"
71
+ }
72
+ }, L = {
73
+ years: {
74
+ 2026: { state_pension_age: 66, full_new_state_pension: 12547.6 },
75
+ 2027: { state_pension_age: 67, full_new_state_pension: 13036.97 },
76
+ 2028: { state_pension_age: 67, full_new_state_pension: 13362.92 },
77
+ 2029: { state_pension_age: 67, full_new_state_pension: 13696.98 },
78
+ 2030: { state_pension_age: 67, full_new_state_pension: 14039.42 },
79
+ 2031: { state_pension_age: 67, full_new_state_pension: 14390.39 }
80
+ }
81
+ };
82
+ function G(e, a = L) {
83
+ const r = Object.keys(a.years).map(Number).sort((n, c) => n - c), p = r.find((n) => n >= e) ?? r[r.length - 1], m = a.years[String(p)];
84
+ return { age: m.state_pension_age, full: m.full_new_state_pension };
85
+ }
86
+ function E(e, a, r = L) {
87
+ return e >= G(a, r).age;
88
+ }
89
+ const S = (e) => typeof e == "number" && Number.isFinite(e), f = 19, M = 16, q = "Children are 0 to 19. Someone aged 20 or over is not a dependant for Child Benefit or Universal Credit, so leave them out.", B = (e) => e >= M && e <= f, se = 5, b = {
90
+ adultAge: { min: 16, max: 100 },
91
+ childAge: { min: 0, max: f },
92
+ maxChildren: 10,
93
+ /** Incomes and salary sacrifice. */
94
+ maxAmount: 1e7,
95
+ maxMonthlyRent: 1e5,
96
+ maxMonthlyChildcare: 1e4,
97
+ /** Petrol, diesel and electricity. */
98
+ maxSpending: 1e5,
99
+ maxStatePension: 1e5
100
+ }, j = [2026, 2027, 2028, 2029, 2030, 2031], h = (e) => typeof e == "number" && Number.isInteger(e), V = (e) => typeof e == "number" && Number.isFinite(e), J = (e) => `£${e.toLocaleString("en-GB")}`;
101
+ function z(e, a) {
102
+ var N, T, R;
103
+ const { year: r, years: p = j, statePension: m } = a, n = b, c = [], i = (t, s, o) => c.push({ code: t, path: s, message: o });
104
+ (!h(r) || !p.includes(r)) && i("year.unsupported", "year", `${String(r)} is not a year this calculation covers.`), !h(e.salaryYear) || !p.includes(e.salaryYear) ? i("salaryYear.unsupported", "salaryYear", `Salaries cannot be entered for ${String(e.salaryYear)}.`) : h(r) && e.salaryYear > r && i(
105
+ "salaryYear.afterYear",
106
+ "salaryYear",
107
+ `Salaries are entered for ${e.salaryYear}, after ${r}; they can only be grown forward.`
108
+ );
109
+ const g = (t, s, o, u) => {
110
+ o == null ? i(`${t}.required`, t, `${s} is required.`) : u(o) || i(`${t}.invalid`, t, `Unknown ${s.toLowerCase()} "${String(o)}".`);
111
+ };
112
+ g("region", "Region", e.region, Y), g("tenure", "Housing", e.tenure, w), g("councilTaxBand", "Council Tax band", e.councilTaxBand, K), typeof e.claimsUniversalCredit != "boolean" && i("claimsUniversalCredit.required", "claimsUniversalCredit", "Whether the household claims Universal Credit is required.");
113
+ const l = (t, s, o, u, { optional: x = !1 } = {}) => {
114
+ o == null ? x || i(`${t}.required`, t, `${s} is required.`) : V(o) ? o < 0 ? i(`${t}.negative`, t, `${s} cannot be negative.`) : o > u && i(`${t}.tooLarge`, t, `${s} cannot be more than ${J(u)}.`) : i(`${t}.notANumber`, t, `${s} must be a number.`);
115
+ }, _ = (t, s, o) => {
116
+ o == null ? i(`${t}.required`, t, `${s} is required.`) : h(o) ? (o < n.adultAge.min || o > n.adultAge.max) && i(`${t}.outOfRange`, t, `${s} must be from ${n.adultAge.min} to ${n.adultAge.max}.`) : i(`${t}.notWhole`, t, `${s} must be a whole number of years.`);
117
+ }, { head: d, partner: y } = e;
118
+ _("head.age", "Your age", d.age), l("head.employmentIncome", "Your salary", d.employmentIncome, n.maxAmount), l("head.privatePensionIncome", "Your private pension", d.privatePensionIncome, n.maxAmount, {
119
+ optional: !0
120
+ }), l("head.dividendIncome", "Dividends", d.dividendIncome, n.maxAmount), l("head.savingsInterestIncome", "Savings interest", d.savingsInterestIncome, n.maxAmount), l("head.propertyIncome", "Property income", d.propertyIncome, n.maxAmount), l(
121
+ "head.salarySacrificePensionContributions",
122
+ "Salary sacrifice",
123
+ d.salarySacrificePensionContributions,
124
+ n.maxAmount
125
+ ), H(d.studentLoanPlan) || i("head.studentLoanPlan.invalid", "head.studentLoanPlan", `Unknown student loan plan "${String(d.studentLoanPlan)}".`), S(d.statePension) && E(d.age, r, m) && l("head.statePension", "Your State Pension", d.statePension, n.maxStatePension), e.hasPartner && (_("partner.age", "Your partner's age", y.age), l("partner.employmentIncome", "Your partner's salary", y.employmentIncome, n.maxAmount), l(
126
+ "partner.privatePensionIncome",
127
+ "Your partner's private pension",
128
+ y.privatePensionIncome,
129
+ n.maxAmount,
130
+ { optional: !0 }
131
+ ), S(y.statePension) && E(y.age, r, m) && l("partner.statePension", "Your partner's State Pension", y.statePension, n.maxStatePension)), e.children.length > n.maxChildren && i("children.tooMany", "children", `At most ${n.maxChildren} children can be entered.`);
132
+ for (let t = 0; t < e.children.length; t++) {
133
+ const s = e.children[t];
134
+ if (s == null) {
135
+ i(`children[${t}].required`, `children[${t}]`, `Child ${t + 1}'s details are missing.`);
136
+ continue;
137
+ }
138
+ const o = `children[${t}].age`, u = `Child ${t + 1}'s age`;
139
+ s.age === null || s.age === void 0 ? i(`${o}.required`, o, `${u} is required.`) : h(s.age) ? s.age < n.childAge.min ? i(`${o}.negative`, o, `${u} cannot be negative.`) : s.age > n.childAge.max && i(`${o}.tooOld`, o, q) : i(`${o}.notWhole`, o, `${u} must be a whole number of years.`);
140
+ }
141
+ return P(e.tenure) && l("monthlyRent", "Rent", e.monthlyRent, n.maxMonthlyRent, { optional: !0 }), e.children.length > 0 && l("monthlyChildcare", "Childcare", e.monthlyChildcare, n.maxMonthlyChildcare), l("spending.petrol", "Petrol spending", (N = e.spending) == null ? void 0 : N.petrol, n.maxSpending), l("spending.diesel", "Diesel spending", (T = e.spending) == null ? void 0 : T.diesel, n.maxSpending), l("spending.electricity", "Electricity spending", (R = e.spending) == null ? void 0 : R.electricity, n.maxSpending, {
142
+ optional: !0
143
+ }), c.length === 0 ? { ok: !0, issues: [] } : { ok: !1, issues: c };
144
+ }
145
+ function ae(e, a) {
146
+ return z(e, a).ok;
147
+ }
148
+ const { adultAge: O } = b, X = (e) => typeof e == "number" && Number.isInteger(e) && e >= O.min && e <= O.max;
149
+ function re(e, { year: a, policies: r, include: p = [], statePension: m }) {
150
+ const { head: n, partner: c, hasPartner: i } = e, g = e.children.map(
151
+ (_) => B(_.age) ? { age: _.age, in_education: _.inEducation !== !1 } : { age: _.age }
152
+ ), l = P(e.tenure);
153
+ return {
154
+ year: a,
155
+ policies: [...r],
156
+ household: {
157
+ age: n.age,
158
+ employment_income: n.employmentIncome,
159
+ has_partner: !!i,
160
+ ...i || X(c.age) ? { partner_age: c.age } : {},
161
+ partner_employment_income: i ? c.employmentIncome : 0,
162
+ children: g,
163
+ region: e.region,
164
+ claims_universal_credit: !!e.claimsUniversalCredit,
165
+ tenure: e.tenure,
166
+ monthly_rent: l ? Q(e) : 0,
167
+ dividend_income: n.dividendIncome,
168
+ savings_interest_income: n.savingsInterestIncome,
169
+ private_pension_income: n.privatePensionIncome ?? 0,
170
+ partner_private_pension_income: i ? c.privatePensionIncome ?? 0 : 0,
171
+ property_income: n.propertyIncome,
172
+ petrol_spending: e.spending.petrol,
173
+ diesel_spending: e.spending.diesel,
174
+ electricity_spending: e.spending.electricity ?? W.electricity,
175
+ salary_sacrifice_pension_contributions: n.salarySacrificePensionContributions,
176
+ student_loan_plan: n.studentLoanPlan,
177
+ council_tax_band: e.councilTaxBand,
178
+ monthly_childcare: g.length ? e.monthlyChildcare : 0,
179
+ salary_year: e.salaryYear,
180
+ ...S(n.statePension) && E(n.age, a, m) ? { state_pension: n.statePension } : {},
181
+ ...i && S(c.statePension) && E(c.age, a, m) ? { partner_state_pension: c.statePension } : {}
182
+ },
183
+ include: [...p]
184
+ };
185
+ }
186
+ function Q(e) {
187
+ return typeof e.monthlyRent == "number" && Number.isFinite(e.monthlyRent) ? e.monthlyRent : F(e.region);
188
+ }
189
+ export {
190
+ w as A,
191
+ Q as B,
192
+ F as C,
193
+ oe as D,
194
+ S as E,
195
+ G as F,
196
+ re as G,
197
+ z as H,
198
+ k as U,
199
+ q as a,
200
+ D as b,
201
+ ne as c,
202
+ te as d,
203
+ ie as e,
204
+ W as f,
205
+ b as g,
206
+ se as h,
207
+ f as i,
208
+ j,
209
+ I as k,
210
+ U as l,
211
+ $ as m,
212
+ ee as n,
213
+ L as o,
214
+ v as p,
215
+ C as q,
216
+ M as r,
217
+ B as s,
218
+ E as t,
219
+ Z as u,
220
+ ae as v,
221
+ P as w,
222
+ K as x,
223
+ Y as y,
224
+ H as z
225
+ };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./WizardReviewList-DhLx8Bla.cjs"),e=require("./us-household.cjs"),t=require("./index-B_OXaS4a.cjs");exports.WizardNavigation=a.WizardNavigation;exports.WizardOptionCard=a.WizardOptionCard;exports.WizardProgress=a.WizardProgress;exports.WizardReviewList=a.WizardReviewList;exports.useWizardStepFocus=a.useWizardStepFocus;exports.useWizardSteps=a.useWizardSteps;exports.DEFAULT_HOUSEHOLD_YEAR=e.DEFAULT_HOUSEHOLD_YEAR;exports.US_STATES=e.US_STATES;exports.addPerson=e.addPerson;exports.applyMaritalStatusChange=e.applyMaritalStatusChange;exports.cloneDraft=e.cloneDraft;exports.createBlankDraft=e.createBlankDraft;exports.createPerson=e.createPerson;exports.deserializeDraft=e.deserializeDraft;exports.getAdults=e.getAdults;exports.getCountiesByState=e.getCountiesByState;exports.getCountyName=e.getCountyName;exports.getDependents=e.getDependents;exports.getStateFromZip=e.getStateFromZip;exports.getStateName=e.getStateName;exports.isComplete=e.isComplete;exports.isCountyCode=e.isCountyCode;exports.isUSStateCode=e.isUSStateCode;exports.normalizeLegacyDraft=e.normalizeLegacyDraft;exports.removePerson=e.removePerson;exports.resolveCountyCode=e.resolveCountyCode;exports.serializeDraft=e.serializeDraft;exports.updatePerson=e.updatePerson;exports.validate=e.validate;exports.NOT_A_TIPPED_OCCUPATION=t.NOT_A_TIPPED_OCCUPATION;exports.TIPPED_OCCUPATIONS=t.TIPPED_OCCUPATIONS;exports.getTippedOccupation=t.getTippedOccupation;exports.isTippedOccupationCode=t.isTippedOccupationCode;exports.toTippedOccupationCode=t.toTippedOccupationCode;exports.toV1HouseholdPayload=t.toV1HouseholdPayload;exports.toV1HouseholdSituation=t.toV1HouseholdSituation;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./WizardReviewList-DhLx8Bla.cjs"),e=require("./us-household.cjs"),t=require("./index-BfoPBFne.cjs");exports.WizardNavigation=a.WizardNavigation;exports.WizardOptionCard=a.WizardOptionCard;exports.WizardProgress=a.WizardProgress;exports.WizardReviewList=a.WizardReviewList;exports.useWizardStepFocus=a.useWizardStepFocus;exports.useWizardSteps=a.useWizardSteps;exports.DEFAULT_HOUSEHOLD_YEAR=e.DEFAULT_HOUSEHOLD_YEAR;exports.US_STATES=e.US_STATES;exports.addPerson=e.addPerson;exports.applyMaritalStatusChange=e.applyMaritalStatusChange;exports.cloneDraft=e.cloneDraft;exports.createBlankDraft=e.createBlankDraft;exports.createPerson=e.createPerson;exports.deserializeDraft=e.deserializeDraft;exports.getAdults=e.getAdults;exports.getCountiesByState=e.getCountiesByState;exports.getCountyName=e.getCountyName;exports.getDependents=e.getDependents;exports.getStateFromZip=e.getStateFromZip;exports.getStateName=e.getStateName;exports.isComplete=e.isComplete;exports.isCountyCode=e.isCountyCode;exports.isUSStateCode=e.isUSStateCode;exports.normalizeLegacyDraft=e.normalizeLegacyDraft;exports.removePerson=e.removePerson;exports.resolveCountyCode=e.resolveCountyCode;exports.serializeDraft=e.serializeDraft;exports.updatePerson=e.updatePerson;exports.validate=e.validate;exports.NOT_A_TIPPED_OCCUPATION=t.NOT_A_TIPPED_OCCUPATION;exports.TIPPED_OCCUPATIONS=t.TIPPED_OCCUPATIONS;exports.getTippedOccupation=t.getTippedOccupation;exports.isTippedOccupationCode=t.isTippedOccupationCode;exports.toTippedOccupationCode=t.toTippedOccupationCode;exports.toV1HouseholdPayload=t.toV1HouseholdPayload;exports.toV1HouseholdSituation=t.toV1HouseholdSituation;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './primitives';
2
- export * from './us-household';
1
+ export * from './primitives.js';
2
+ export * from './us-household.js';
3
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { W as t, a as o, b as s, c as i, u as r, d } from "./WizardReviewList-oY1HqmLw.js";
2
2
  import { DEFAULT_HOUSEHOLD_YEAR as n, US_STATES as u, addPerson as C, applyMaritalStatusChange as l, cloneDraft as S, createBlankDraft as c, createPerson as g, deserializeDraft as P, getAdults as T, getCountiesByState as O, getCountyName as D, getDependents as m, getStateFromZip as z, getStateName as f, isComplete as y, isCountyCode as A, isUSStateCode as N, normalizeLegacyDraft as W, removePerson as _, resolveCountyCode as E, serializeDraft as U, updatePerson as v, validate as H } from "./us-household.js";
3
- import { N as L, T as h, g as x, i as F, a as b, b as B, c as R } from "./index-DWM0giHt.js";
3
+ import { N as L, T as h, g as x, i as F, a as b, b as B, c as R } from "./index-DoD0AXHz.js";
4
4
  export {
5
5
  n as DEFAULT_HOUSEHOLD_YEAR,
6
6
  L as NOT_A_TIPPED_OCCUPATION,
@@ -1,13 +1,13 @@
1
- export { useWizardSteps } from './useWizardSteps';
2
- export { useWizardStepFocus } from './useWizardStepFocus';
3
- export type { UseWizardStepFocusOptions } from './useWizardStepFocus';
4
- export { WizardProgress } from './WizardProgress';
5
- export type { WizardProgressProps } from './WizardProgress';
6
- export { WizardOptionCard } from './WizardOptionCard';
7
- export type { WizardOptionCardProps } from './WizardOptionCard';
8
- export { WizardNavigation } from './WizardNavigation';
9
- export type { WizardNavigationProps } from './WizardNavigation';
10
- export { WizardReviewList } from './WizardReviewList';
11
- export type { WizardReviewItem, WizardReviewListProps } from './WizardReviewList';
12
- export type { ResolvedWizardStep, UseWizardStepsOptions, UseWizardStepsResult, WizardStepConfig, WizardAdvanceRequest, } from './types';
1
+ export { useWizardSteps } from './useWizardSteps.js';
2
+ export { useWizardStepFocus } from './useWizardStepFocus.js';
3
+ export type { UseWizardStepFocusOptions } from './useWizardStepFocus.js';
4
+ export { WizardProgress } from './WizardProgress.js';
5
+ export type { WizardProgressProps } from './WizardProgress.js';
6
+ export { WizardOptionCard } from './WizardOptionCard.js';
7
+ export type { WizardOptionCardProps } from './WizardOptionCard.js';
8
+ export { WizardNavigation } from './WizardNavigation.js';
9
+ export type { WizardNavigationProps } from './WizardNavigation.js';
10
+ export { WizardReviewList } from './WizardReviewList.js';
11
+ export type { WizardReviewItem, WizardReviewListProps } from './WizardReviewList.js';
12
+ export type { ResolvedWizardStep, UseWizardStepsOptions, UseWizardStepsResult, WizardStepConfig, WizardAdvanceRequest, } from './types.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- import type { UseWizardStepsOptions, UseWizardStepsResult } from './types';
1
+ import type { UseWizardStepsOptions, UseWizardStepsResult } from './types.js';
2
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
- export * from './primitives/index';
1
+ export * from './primitives/index.js';