policyengine-household-wizard 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "policyengine-household-wizard",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Shared wizard primitives and US and UK household draft contracts for PolicyEngine apps.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -27,6 +27,11 @@
27
27
  "import": "./dist/us-household-adapters.js",
28
28
  "require": "./dist/us-household-adapters.cjs"
29
29
  },
30
+ "./us-household/samples": {
31
+ "types": "./dist/us-household/samples/index.d.ts",
32
+ "import": "./dist/us-household-samples.js",
33
+ "require": "./dist/us-household-samples.cjs"
34
+ },
30
35
  "./uk-household": {
31
36
  "types": "./dist/uk-household/index.d.ts",
32
37
  "import": "./dist/uk-household.js",
@@ -367,6 +367,10 @@ export function toV1HouseholdPayload(
367
367
  const spmUnits: V1GroupCollection = {
368
368
  [keys.spmUnit]: { members: [...memberIds] },
369
369
  };
370
+ const childcare = toAmount(draft.childcareExpenses);
371
+ if (childcare !== undefined) {
372
+ spmUnits[keys.spmUnit].spm_unit_pre_subsidy_childcare_expenses = yearMap(year, childcare);
373
+ }
370
374
  const households: V1GroupCollection = {
371
375
  [keys.household]: householdRecord,
372
376
  };
@@ -46,6 +46,7 @@ export function cloneDraft(draft: USHouseholdDraft): USHouseholdDraft {
46
46
  zip: draft.zip,
47
47
  maritalStatus: draft.maritalStatus,
48
48
  year: draft.year,
49
+ childcareExpenses: draft.childcareExpenses,
49
50
  extras: draft.extras ? structuredClone(draft.extras) : undefined,
50
51
  people: draft.people.map((person) => ({
51
52
  ...person,
@@ -110,6 +110,7 @@ interface LegacyDraftShape {
110
110
  partnerAge?: number | string | null;
111
111
  spouseAge?: number | string | null;
112
112
  year?: number;
113
+ childcareExpenses?: number | string | null;
113
114
  }
114
115
 
115
116
  function coerceAge(value: unknown): number | null {
@@ -233,6 +234,8 @@ export function normalizeLegacyDraft(
233
234
  }
234
235
  const legacy = raw as LegacyDraftShape;
235
236
  const draft = createBlankDraft(options.year ?? legacy.year ?? DEFAULT_HOUSEHOLD_YEAR);
237
+ const childcare = coerceNumber(legacy.childcareExpenses);
238
+ if (childcare !== undefined) draft.childcareExpenses = childcare;
236
239
 
237
240
  // Location.
238
241
  if (typeof legacy.state === 'string' && isUSStateCode(legacy.state)) {