policyengine-household-wizard 0.1.0 → 0.2.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/README.md +37 -2
- package/dist/WizardReviewList-DhLx8Bla.cjs +1 -0
- package/dist/WizardReviewList-oY1HqmLw.js +354 -0
- package/dist/index-B_OXaS4a.cjs +1 -0
- package/dist/index-DWM0giHt.js +220 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +34 -28
- package/dist/primitives/WizardReviewList.d.ts +3 -2
- package/dist/primitives/WizardReviewList.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +3 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/types.d.ts +18 -0
- package/dist/primitives/types.d.ts.map +1 -1
- package/dist/primitives/useWizardStepFocus.d.ts +13 -0
- package/dist/primitives/useWizardStepFocus.d.ts.map +1 -0
- package/dist/primitives/useWizardSteps.d.ts +1 -1
- package/dist/primitives/useWizardSteps.d.ts.map +1 -1
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.js +5 -4
- package/dist/us-household/adapters/v1Payload.d.ts +119 -3
- package/dist/us-household/adapters/v1Payload.d.ts.map +1 -1
- package/dist/us-household/amount.d.ts +8 -0
- package/dist/us-household/amount.d.ts.map +1 -0
- package/dist/us-household/index.d.ts +2 -1
- package/dist/us-household/index.d.ts.map +1 -1
- package/dist/us-household/normalize.d.ts.map +1 -1
- package/dist/us-household/serialize.d.ts.map +1 -1
- package/dist/us-household/tippedOccupations.d.ts +40 -0
- package/dist/us-household/tippedOccupations.d.ts.map +1 -0
- package/dist/us-household/types.d.ts +137 -4
- package/dist/us-household/types.d.ts.map +1 -1
- package/dist/us-household/validate.d.ts.map +1 -1
- package/dist/us-household-adapters.cjs +1 -1
- package/dist/us-household-adapters.js +3 -90
- package/dist/us-household.cjs +1 -1
- package/dist/us-household.js +346 -246
- package/package.json +4 -1
- package/src/primitives/WizardReviewList.tsx +35 -18
- package/src/primitives/index.ts +3 -0
- package/src/primitives/types.ts +20 -0
- package/src/primitives/useWizardStepFocus.ts +42 -0
- package/src/primitives/useWizardSteps.ts +181 -84
- package/src/styles.css +9 -0
- package/src/us-household/adapters/v1Payload.ts +211 -18
- package/src/us-household/amount.ts +10 -0
- package/src/us-household/index.ts +11 -0
- package/src/us-household/normalize.ts +79 -4
- package/src/us-household/serialize.ts +5 -1
- package/src/us-household/tippedOccupations.ts +145 -0
- package/src/us-household/types.ts +143 -4
- package/src/us-household/validate.ts +101 -4
- package/dist/WizardReviewList-De9RTK_4.js +0 -245
- package/dist/WizardReviewList-tfP9LcqU.cjs +0 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ function MyWizard() {
|
|
|
64
64
|
}
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
See [`docs/api.md`](docs/api.md) for
|
|
67
|
+
See [`docs/api.md`](docs/api.md) for wizard navigation and focus APIs and [`docs/migration.md`](docs/migration.md)
|
|
68
68
|
for migrating from each app's local wizard.
|
|
69
69
|
|
|
70
70
|
## Design decisions
|
|
@@ -82,6 +82,39 @@ for migrating from each app's local wizard.
|
|
|
82
82
|
- **Adapters, not a UI shell.** Apps render their own form layouts and pass
|
|
83
83
|
the draft through `validate()` and `toV1HouseholdPayload()` (or their own
|
|
84
84
|
app-specific adapter) at submit time.
|
|
85
|
+
- **No income field overrides another.** An input on a PolicyEngine US total
|
|
86
|
+
such as `social_security` replaces the sum of its components, so components
|
|
87
|
+
sent alongside it are left out of the total. `socialSecurityIncome`
|
|
88
|
+
therefore sets `social_security_retirement` and `ssdiAmount` sets
|
|
89
|
+
`social_security_disability`; the model adds them. Pensions work the same
|
|
90
|
+
way: `publicPensionIncome` and `privatePensionIncome` set the components of
|
|
91
|
+
`taxable_pension_income`, which state rules read. A pension of unknown
|
|
92
|
+
source (`pensionIncome`) is sent as private, and fields that share a
|
|
93
|
+
variable are summed. Expenses set inputs too: `mortgageInterest` sets
|
|
94
|
+
`home_mortgage_interest`, not `mortgage_interest`, a computed total the
|
|
95
|
+
federal interest deduction ignores (the tests keep it as a guarded total
|
|
96
|
+
that no field may set). Tips are taxed as wages in PolicyEngine US, so
|
|
97
|
+
`tipIncome` sets `tip_income` and is also added to `employment_income`;
|
|
98
|
+
with a listed `tippedOccupationCode` (`TIPPED_OCCUPATIONS`, from the final
|
|
99
|
+
section 224 regulations) they can qualify for the 2025-2028 tip deduction. Property tests check the
|
|
100
|
+
adapter against a snapshot of the PolicyEngine US variable graph (refresh it
|
|
101
|
+
with `bun run regenerate-variable-graph`). Each total the adapter sets
|
|
102
|
+
directly, and each variable that more than one field sets, is listed with
|
|
103
|
+
its reason in `tests/us-household/v1PayloadInvariants.test.ts`.
|
|
104
|
+
- **Computed variables go to everyone or no one.** PolicyEngine stores each
|
|
105
|
+
person variable as one array covering everyone in the simulation, so an
|
|
106
|
+
input for one person on a variable the model computes gives everyone else
|
|
107
|
+
a stored default instead of the computed value: `ssi` sent for one adult
|
|
108
|
+
zeroed the other adult's SSI. The adapter therefore sends computed
|
|
109
|
+
variables for every person or no one, except employment income,
|
|
110
|
+
self-employment income and long-term capital gains, which
|
|
111
|
+
policyengine-us's Simulation moves onto input variables. `kind` is sent for everyone as `is_tax_unit_dependent`.
|
|
112
|
+
`isFullTimeStudent` is sent as the input `is_full_time_college_student`,
|
|
113
|
+
and only from age 18, because the model counts ages 5 to 17 as K-12
|
|
114
|
+
students. `ssiAmount` is sent as `ssi` only when every person has an
|
|
115
|
+
amount; `validate()` asks for the missing ones, and an entered 0 is sent as
|
|
116
|
+
`takes_up_ssi_if_eligible: false`. Property tests check this against the
|
|
117
|
+
variable graph snapshot, which records which variables the model computes.
|
|
85
118
|
|
|
86
119
|
## Repository structure
|
|
87
120
|
|
|
@@ -92,7 +125,7 @@ src/
|
|
|
92
125
|
adapters/ toV1HouseholdPayload — PolicyEngine API V1 envelope
|
|
93
126
|
data/ counties-by-state.json
|
|
94
127
|
tests/ vitest unit and round-trip tests
|
|
95
|
-
scripts/ generate-counties.ts
|
|
128
|
+
scripts/ generate-counties.ts, generate-variable-graph.ts
|
|
96
129
|
```
|
|
97
130
|
|
|
98
131
|
## Development
|
|
@@ -102,6 +135,7 @@ bun install
|
|
|
102
135
|
bun run test
|
|
103
136
|
bun run typecheck
|
|
104
137
|
bun run build
|
|
138
|
+
bun run test:live # adapter output against api.policyengine.org (network)
|
|
105
139
|
```
|
|
106
140
|
|
|
107
141
|
Changes follow the towncrier convention used by `@policyengine/ui-kit`. Add a
|
|
@@ -114,3 +148,4 @@ echo "Describe your change." > changelog.d/your-branch.added.md
|
|
|
114
148
|
Fragment types: `added` (minor), `changed` (patch), `fixed` (patch),
|
|
115
149
|
`removed` (minor), `breaking` (major). The release workflow on `main` bumps
|
|
116
150
|
the version, builds the changelog, publishes to npm, and commits the bump.
|
|
151
|
+
See [release setup and verification](docs/releasing.md) for npm trusted publishing.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("react"),d=require("react/jsx-runtime");function I(c){return{id:c.id,label:c.label}}function S(c,f){var u,t;return((u=c.find(s=>s.id===f))==null?void 0:u.id)??((t=c[0])==null?void 0:t.id)??null}function H({steps:c,state:f,initialStepId:u,onStepChange:t,onComplete:s,onInvalidStep:n,advanceRequest:o}){const e=a.useMemo(()=>c.filter(i=>!i.isVisible||i.isVisible(f)),[c,f]),p=a.useMemo(()=>e.map(I),[e]),[r,h]=a.useState(()=>S(e,u)),[m,j]=a.useState(()=>r===null?[]:[r]),[R,W]=a.useState(null),[V,N]=a.useState(0),w=a.useCallback(()=>W(null),[]),v=a.useCallback(i=>{h(i),i!==null&&j(b=>b.includes(i)?b:[...b,i]),w()},[w]);a.useEffect(()=>{var i;e.some(b=>b.id===r)||v(((i=e[0])==null?void 0:i.id)??null)},[e,r,v]);const E=a.useRef(t);a.useEffect(()=>{E.current=t},[t]);const B=a.useRef(r);a.useEffect(()=>{var i;B.current!==r&&(B.current=r,r!==null&&((i=E.current)==null||i.call(E,r)))},[r]);const P=e.findIndex(i=>i.id===r),z=P>=0?P:e.length>0?0:-1,l=e[z]??null,F=l?I(l):null,$=e.length,g=$===0||z===$-1,k=l!=null&&l.isComplete?l.isComplete(f):!0,x=a.useCallback(i=>{v(i),W(i),N(b=>b+1),n==null||n(i)},[v,n]),A=a.useCallback(()=>{const i=e.find(b=>b.isComplete&&!b.isComplete(f));return i?(x(i.id),!1):(w(),!0)},[e,f,x,w]),M=a.useCallback(()=>{if(!(!l||g)){if(!k){x(l.id);return}v(e[z+1].id)}},[l,g,k,x,v,e,z]),y=a.useCallback(()=>{if(l){if(!k){x(l.id);return}g?A()&&(s==null||s()):M()}},[l,k,x,g,A,s,M]),D=a.useRef(null);a.useEffect(()=>{!o||D.current===o||(D.current=o,l!=null&&l.autoAdvance&&o.stepId===l.id&&y())},[o,l,y]);const T=a.useCallback(()=>{w(),z>0&&v(e[z-1].id)},[w,z,v,e]),C=a.useCallback(i=>{e.some(b=>b.id===i)&&v(i)},[e,v]),O=a.useCallback(()=>{const i=S(e,u);v(i),j(i===null?[]:[i])},[e,u,v]),K=a.useCallback(i=>{i.preventDefault(),l!=null&&l.autoAdvance||y()},[l,y]),U=a.useCallback(i=>{l!=null&&l.autoAdvance&&i.key==="Enter"&&i.target.tagName==="INPUT"&&i.preventDefault()},[l]),G=a.useCallback(i=>m.includes(i),[m]);return{visibleSteps:p,currentStep:F,currentStepIndex:z,totalSteps:$,isFirstStep:z<=0,isLastStep:g,canAdvance:k,visitedStepIds:m,hasVisitedStep:G,validationStepId:R,validationAttempt:V,clearValidation:w,validateAll:A,advance:y,handleSubmit:K,handleKeyDown:U,goNext:M,goBack:T,goToStep:C,reset:O}}function J({stepId:c,hasError:f=!1,errorRevision:u,preventScroll:t=!1,onStepFocus:s}){const n=a.useRef(null),o=a.useRef(null),e=a.useRef({preventScroll:t,onStepFocus:s});return a.useEffect(()=>{e.current={preventScroll:t,onStepFocus:s}},[t,s]),a.useEffect(()=>{var p,r;c===null||!n.current||(n.current.focus({preventScroll:e.current.preventScroll}),(r=(p=e.current).onStepFocus)==null||r.call(p))},[c]),a.useEffect(()=>{var p;f&&((p=o.current)==null||p.focus({preventScroll:e.current.preventScroll}))},[c,f,u]),{headingRef:n,errorRef:o}}function L({totalSteps:c,currentStepIndex:f,currentStepLabel:u,className:t,...s}){const n=Math.max(c,0),o=Math.max(0,Math.min(f,n-1)),e=n>0?(o+1)/n*100:0,p=n>0?o+1:0,r={width:`${e}%`};return d.jsxs("div",{role:"group","aria-label":s["aria-label"]??"Wizard progress",className:["pe-wizard-progress",t].filter(Boolean).join(" "),...s,children:[d.jsxs("div",{className:"pe-wizard-progress-topline",children:[d.jsxs("span",{"data-testid":"pe-wizard-progress-step",children:["Step ",p," of ",n]}),u?d.jsx("span",{"data-testid":"pe-wizard-progress-label",children:u}):null]}),d.jsx("div",{className:"pe-wizard-progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":p,"aria-valuetext":u,children:d.jsx("div",{className:"pe-wizard-progress-bar",style:r})})]})}function Q({selected:c=!1,title:f,description:u,onSelect:t,onClick:s,className:n,type:o,disabled:e,...p}){const r=["pe-wizard-option-card"];return c&&r.push("pe-wizard-option-card--selected"),n&&r.push(n),d.jsxs("button",{type:o??"button",role:"radio","aria-checked":c,"aria-disabled":e?!0:void 0,disabled:e,className:r.join(" "),onClick:h=>{e||(s==null||s(h),h.defaultPrevented||t==null||t())},...p,children:[d.jsx("span",{className:"pe-wizard-option-card-title",children:f}),u?d.jsx("span",{className:"pe-wizard-option-card-description",children:u}):null]})}function X({canAdvance:c,isFirstStep:f,isLastStep:u,backLabel:t="Back",continueLabel:s="Continue",submitLabel:n="Submit",busyLabel:o,busy:e=!1,onBack:p,onContinue:r,onSubmit:h,leadingActions:m,trailingActions:j,hideBack:R=!1,className:W,...V}){const N=e||!c,w=e&&o?o:u?n:s,v=()=>{N||(u?h==null||h():r==null||r())};return d.jsxs("div",{className:["pe-wizard-nav",W].filter(Boolean).join(" "),...V,children:[m?d.jsx("div",{className:"pe-wizard-nav-leading",children:m}):null,R?null:d.jsx("button",{type:"button",className:"pe-wizard-nav-back",onClick:p,disabled:f||e,"aria-label":typeof t=="string"?t:void 0,children:t}),d.jsx("button",{type:"button",className:"pe-wizard-nav-primary",onClick:v,disabled:N,"aria-disabled":N,children:w}),j?d.jsx("div",{className:"pe-wizard-nav-trailing",children:j}):null]})}function Y({items:c,className:f,...u}){const t=a.useId();return d.jsx("div",{className:["pe-wizard-review-list",f].filter(Boolean).join(" "),role:"list",...u,children:c.map((s,n)=>{const o=`${t}-${n}-value`,e=["pe-wizard-review-item"];s.missing&&e.push("pe-wizard-review-item--missing");const p=typeof s.onEdit=="function",r=d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"pe-wizard-review-item-label",children:s.label}),d.jsx("span",{id:o,className:"pe-wizard-review-item-value",children:s.missing&&(s.value===null||s.value===void 0||s.value==="")?"Missing":s.value})]});return p?d.jsx("div",{role:"listitem",className:"pe-wizard-review-listitem",children:d.jsx("button",{type:"button",className:e.join(" "),"data-testid":`pe-wizard-review-${s.id}`,onClick:s.onEdit,"aria-describedby":o,"aria-label":s.editAriaLabel??(typeof s.label=="string"?`${s.editLabel??"Edit"} ${s.label}`:void 0),children:r})},s.id):d.jsx("div",{role:"listitem",className:e.join(" "),"data-testid":`pe-wizard-review-${s.id}`,children:r},s.id)})})}exports.WizardNavigation=X;exports.WizardOptionCard=Q;exports.WizardProgress=L;exports.WizardReviewList=Y;exports.useWizardStepFocus=J;exports.useWizardSteps=H;
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { useMemo as O, useState as M, useCallback as w, useEffect as b, useRef as y, useId as L } from "react";
|
|
2
|
+
import { jsxs as x, jsx as f, Fragment as S } from "react/jsx-runtime";
|
|
3
|
+
function U(n) {
|
|
4
|
+
return { id: n.id, label: n.label };
|
|
5
|
+
}
|
|
6
|
+
function G(n, o) {
|
|
7
|
+
var d, l;
|
|
8
|
+
return ((d = n.find((i) => i.id === o)) == null ? void 0 : d.id) ?? ((l = n[0]) == null ? void 0 : l.id) ?? null;
|
|
9
|
+
}
|
|
10
|
+
function ee({
|
|
11
|
+
steps: n,
|
|
12
|
+
state: o,
|
|
13
|
+
initialStepId: d,
|
|
14
|
+
onStepChange: l,
|
|
15
|
+
onComplete: i,
|
|
16
|
+
onInvalidStep: t,
|
|
17
|
+
advanceRequest: c
|
|
18
|
+
}) {
|
|
19
|
+
const e = O(
|
|
20
|
+
() => n.filter((a) => !a.isVisible || a.isVisible(o)),
|
|
21
|
+
[n, o]
|
|
22
|
+
), u = O(
|
|
23
|
+
() => e.map(U),
|
|
24
|
+
[e]
|
|
25
|
+
), [r, z] = M(
|
|
26
|
+
() => G(e, d)
|
|
27
|
+
), [N, j] = M(
|
|
28
|
+
() => r === null ? [] : [r]
|
|
29
|
+
), [D, A] = M(null), [E, W] = M(0), m = w(() => A(null), []), p = w(
|
|
30
|
+
(a) => {
|
|
31
|
+
z(a), a !== null && j(
|
|
32
|
+
(v) => v.includes(a) ? v : [...v, a]
|
|
33
|
+
), m();
|
|
34
|
+
},
|
|
35
|
+
[m]
|
|
36
|
+
);
|
|
37
|
+
b(() => {
|
|
38
|
+
var a;
|
|
39
|
+
e.some((v) => v.id === r) || p(((a = e[0]) == null ? void 0 : a.id) ?? null);
|
|
40
|
+
}, [e, r, p]);
|
|
41
|
+
const B = y(l);
|
|
42
|
+
b(() => {
|
|
43
|
+
B.current = l;
|
|
44
|
+
}, [l]);
|
|
45
|
+
const F = y(r);
|
|
46
|
+
b(() => {
|
|
47
|
+
var a;
|
|
48
|
+
F.current !== r && (F.current = r, r !== null && ((a = B.current) == null || a.call(B, r)));
|
|
49
|
+
}, [r]);
|
|
50
|
+
const R = e.findIndex(
|
|
51
|
+
(a) => a.id === r
|
|
52
|
+
), h = R >= 0 ? R : e.length > 0 ? 0 : -1, s = e[h] ?? null, H = s ? U(s) : null, I = e.length, k = I === 0 || h === I - 1, V = s != null && s.isComplete ? s.isComplete(o) : !0, g = w(
|
|
53
|
+
(a) => {
|
|
54
|
+
p(a), A(a), W((v) => v + 1), t == null || t(a);
|
|
55
|
+
},
|
|
56
|
+
[p, t]
|
|
57
|
+
), P = w(() => {
|
|
58
|
+
const a = e.find(
|
|
59
|
+
(v) => v.isComplete && !v.isComplete(o)
|
|
60
|
+
);
|
|
61
|
+
return a ? (g(a.id), !1) : (m(), !0);
|
|
62
|
+
}, [e, o, g, m]), T = w(() => {
|
|
63
|
+
if (!(!s || k)) {
|
|
64
|
+
if (!V) {
|
|
65
|
+
g(s.id);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
p(e[h + 1].id);
|
|
69
|
+
}
|
|
70
|
+
}, [
|
|
71
|
+
s,
|
|
72
|
+
k,
|
|
73
|
+
V,
|
|
74
|
+
g,
|
|
75
|
+
p,
|
|
76
|
+
e,
|
|
77
|
+
h
|
|
78
|
+
]), $ = w(() => {
|
|
79
|
+
if (s) {
|
|
80
|
+
if (!V) {
|
|
81
|
+
g(s.id);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
k ? P() && (i == null || i()) : T();
|
|
85
|
+
}
|
|
86
|
+
}, [
|
|
87
|
+
s,
|
|
88
|
+
V,
|
|
89
|
+
g,
|
|
90
|
+
k,
|
|
91
|
+
P,
|
|
92
|
+
i,
|
|
93
|
+
T
|
|
94
|
+
]), K = y(null);
|
|
95
|
+
b(() => {
|
|
96
|
+
!c || K.current === c || (K.current = c, s != null && s.autoAdvance && c.stepId === s.id && $());
|
|
97
|
+
}, [c, s, $]);
|
|
98
|
+
const J = w(() => {
|
|
99
|
+
m(), h > 0 && p(e[h - 1].id);
|
|
100
|
+
}, [m, h, p, e]), Q = w(
|
|
101
|
+
(a) => {
|
|
102
|
+
e.some((v) => v.id === a) && p(a);
|
|
103
|
+
},
|
|
104
|
+
[e, p]
|
|
105
|
+
), X = w(() => {
|
|
106
|
+
const a = G(e, d);
|
|
107
|
+
p(a), j(a === null ? [] : [a]);
|
|
108
|
+
}, [e, d, p]), Y = w(
|
|
109
|
+
(a) => {
|
|
110
|
+
a.preventDefault(), s != null && s.autoAdvance || $();
|
|
111
|
+
},
|
|
112
|
+
[s, $]
|
|
113
|
+
), Z = w(
|
|
114
|
+
(a) => {
|
|
115
|
+
s != null && s.autoAdvance && a.key === "Enter" && a.target.tagName === "INPUT" && a.preventDefault();
|
|
116
|
+
},
|
|
117
|
+
[s]
|
|
118
|
+
), _ = w(
|
|
119
|
+
(a) => N.includes(a),
|
|
120
|
+
[N]
|
|
121
|
+
);
|
|
122
|
+
return {
|
|
123
|
+
visibleSteps: u,
|
|
124
|
+
currentStep: H,
|
|
125
|
+
currentStepIndex: h,
|
|
126
|
+
totalSteps: I,
|
|
127
|
+
isFirstStep: h <= 0,
|
|
128
|
+
isLastStep: k,
|
|
129
|
+
canAdvance: V,
|
|
130
|
+
visitedStepIds: N,
|
|
131
|
+
hasVisitedStep: _,
|
|
132
|
+
validationStepId: D,
|
|
133
|
+
validationAttempt: E,
|
|
134
|
+
clearValidation: m,
|
|
135
|
+
validateAll: P,
|
|
136
|
+
advance: $,
|
|
137
|
+
handleSubmit: Y,
|
|
138
|
+
handleKeyDown: Z,
|
|
139
|
+
goNext: T,
|
|
140
|
+
goBack: J,
|
|
141
|
+
goToStep: Q,
|
|
142
|
+
reset: X
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function ie({
|
|
146
|
+
stepId: n,
|
|
147
|
+
hasError: o = !1,
|
|
148
|
+
errorRevision: d,
|
|
149
|
+
preventScroll: l = !1,
|
|
150
|
+
onStepFocus: i
|
|
151
|
+
}) {
|
|
152
|
+
const t = y(null), c = y(null), e = y({ preventScroll: l, onStepFocus: i });
|
|
153
|
+
return b(() => {
|
|
154
|
+
e.current = { preventScroll: l, onStepFocus: i };
|
|
155
|
+
}, [l, i]), b(() => {
|
|
156
|
+
var u, r;
|
|
157
|
+
n === null || !t.current || (t.current.focus({
|
|
158
|
+
preventScroll: e.current.preventScroll
|
|
159
|
+
}), (r = (u = e.current).onStepFocus) == null || r.call(u));
|
|
160
|
+
}, [n]), b(() => {
|
|
161
|
+
var u;
|
|
162
|
+
o && ((u = c.current) == null || u.focus({
|
|
163
|
+
preventScroll: e.current.preventScroll
|
|
164
|
+
}));
|
|
165
|
+
}, [n, o, d]), { headingRef: t, errorRef: c };
|
|
166
|
+
}
|
|
167
|
+
function ae({
|
|
168
|
+
totalSteps: n,
|
|
169
|
+
currentStepIndex: o,
|
|
170
|
+
currentStepLabel: d,
|
|
171
|
+
className: l,
|
|
172
|
+
...i
|
|
173
|
+
}) {
|
|
174
|
+
const t = Math.max(n, 0), c = Math.max(0, Math.min(o, t - 1)), e = t > 0 ? (c + 1) / t * 100 : 0, u = t > 0 ? c + 1 : 0, r = { width: `${e}%` };
|
|
175
|
+
return /* @__PURE__ */ x(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
role: "group",
|
|
179
|
+
"aria-label": i["aria-label"] ?? "Wizard progress",
|
|
180
|
+
className: ["pe-wizard-progress", l].filter(Boolean).join(" "),
|
|
181
|
+
...i,
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ x("div", { className: "pe-wizard-progress-topline", children: [
|
|
184
|
+
/* @__PURE__ */ x("span", { "data-testid": "pe-wizard-progress-step", children: [
|
|
185
|
+
"Step ",
|
|
186
|
+
u,
|
|
187
|
+
" of ",
|
|
188
|
+
t
|
|
189
|
+
] }),
|
|
190
|
+
d ? /* @__PURE__ */ f("span", { "data-testid": "pe-wizard-progress-label", children: d }) : null
|
|
191
|
+
] }),
|
|
192
|
+
/* @__PURE__ */ f(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
className: "pe-wizard-progress-track",
|
|
196
|
+
role: "progressbar",
|
|
197
|
+
"aria-valuemin": 0,
|
|
198
|
+
"aria-valuemax": t,
|
|
199
|
+
"aria-valuenow": u,
|
|
200
|
+
"aria-valuetext": d,
|
|
201
|
+
children: /* @__PURE__ */ f("div", { className: "pe-wizard-progress-bar", style: r })
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function re({
|
|
209
|
+
selected: n = !1,
|
|
210
|
+
title: o,
|
|
211
|
+
description: d,
|
|
212
|
+
onSelect: l,
|
|
213
|
+
onClick: i,
|
|
214
|
+
className: t,
|
|
215
|
+
type: c,
|
|
216
|
+
disabled: e,
|
|
217
|
+
...u
|
|
218
|
+
}) {
|
|
219
|
+
const r = ["pe-wizard-option-card"];
|
|
220
|
+
return n && r.push("pe-wizard-option-card--selected"), t && r.push(t), /* @__PURE__ */ x(
|
|
221
|
+
"button",
|
|
222
|
+
{
|
|
223
|
+
type: c ?? "button",
|
|
224
|
+
role: "radio",
|
|
225
|
+
"aria-checked": n,
|
|
226
|
+
"aria-disabled": e ? !0 : void 0,
|
|
227
|
+
disabled: e,
|
|
228
|
+
className: r.join(" "),
|
|
229
|
+
onClick: (z) => {
|
|
230
|
+
e || (i == null || i(z), z.defaultPrevented || l == null || l());
|
|
231
|
+
},
|
|
232
|
+
...u,
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ f("span", { className: "pe-wizard-option-card-title", children: o }),
|
|
235
|
+
d ? /* @__PURE__ */ f("span", { className: "pe-wizard-option-card-description", children: d }) : null
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
function se({
|
|
241
|
+
canAdvance: n,
|
|
242
|
+
isFirstStep: o,
|
|
243
|
+
isLastStep: d,
|
|
244
|
+
backLabel: l = "Back",
|
|
245
|
+
continueLabel: i = "Continue",
|
|
246
|
+
submitLabel: t = "Submit",
|
|
247
|
+
busyLabel: c,
|
|
248
|
+
busy: e = !1,
|
|
249
|
+
onBack: u,
|
|
250
|
+
onContinue: r,
|
|
251
|
+
onSubmit: z,
|
|
252
|
+
leadingActions: N,
|
|
253
|
+
trailingActions: j,
|
|
254
|
+
hideBack: D = !1,
|
|
255
|
+
className: A,
|
|
256
|
+
...E
|
|
257
|
+
}) {
|
|
258
|
+
const W = e || !n, m = e && c ? c : d ? t : i, p = () => {
|
|
259
|
+
W || (d ? z == null || z() : r == null || r());
|
|
260
|
+
};
|
|
261
|
+
return /* @__PURE__ */ x(
|
|
262
|
+
"div",
|
|
263
|
+
{
|
|
264
|
+
className: ["pe-wizard-nav", A].filter(Boolean).join(" "),
|
|
265
|
+
...E,
|
|
266
|
+
children: [
|
|
267
|
+
N ? /* @__PURE__ */ f("div", { className: "pe-wizard-nav-leading", children: N }) : null,
|
|
268
|
+
D ? null : /* @__PURE__ */ f(
|
|
269
|
+
"button",
|
|
270
|
+
{
|
|
271
|
+
type: "button",
|
|
272
|
+
className: "pe-wizard-nav-back",
|
|
273
|
+
onClick: u,
|
|
274
|
+
disabled: o || e,
|
|
275
|
+
"aria-label": typeof l == "string" ? l : void 0,
|
|
276
|
+
children: l
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ f(
|
|
280
|
+
"button",
|
|
281
|
+
{
|
|
282
|
+
type: "button",
|
|
283
|
+
className: "pe-wizard-nav-primary",
|
|
284
|
+
onClick: p,
|
|
285
|
+
disabled: W,
|
|
286
|
+
"aria-disabled": W,
|
|
287
|
+
children: m
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
j ? /* @__PURE__ */ f("div", { className: "pe-wizard-nav-trailing", children: j }) : null
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
function le({
|
|
296
|
+
items: n,
|
|
297
|
+
className: o,
|
|
298
|
+
...d
|
|
299
|
+
}) {
|
|
300
|
+
const l = L();
|
|
301
|
+
return /* @__PURE__ */ f(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
className: ["pe-wizard-review-list", o].filter(Boolean).join(" "),
|
|
305
|
+
role: "list",
|
|
306
|
+
...d,
|
|
307
|
+
children: n.map((i, t) => {
|
|
308
|
+
const c = `${l}-${t}-value`, e = ["pe-wizard-review-item"];
|
|
309
|
+
i.missing && e.push("pe-wizard-review-item--missing");
|
|
310
|
+
const u = typeof i.onEdit == "function", r = /* @__PURE__ */ x(S, { children: [
|
|
311
|
+
/* @__PURE__ */ f("span", { className: "pe-wizard-review-item-label", children: i.label }),
|
|
312
|
+
/* @__PURE__ */ f("span", { id: c, className: "pe-wizard-review-item-value", children: i.missing && (i.value === null || i.value === void 0 || i.value === "") ? "Missing" : i.value })
|
|
313
|
+
] });
|
|
314
|
+
return u ? /* @__PURE__ */ f(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
role: "listitem",
|
|
318
|
+
className: "pe-wizard-review-listitem",
|
|
319
|
+
children: /* @__PURE__ */ f(
|
|
320
|
+
"button",
|
|
321
|
+
{
|
|
322
|
+
type: "button",
|
|
323
|
+
className: e.join(" "),
|
|
324
|
+
"data-testid": `pe-wizard-review-${i.id}`,
|
|
325
|
+
onClick: i.onEdit,
|
|
326
|
+
"aria-describedby": c,
|
|
327
|
+
"aria-label": i.editAriaLabel ?? (typeof i.label == "string" ? `${i.editLabel ?? "Edit"} ${i.label}` : void 0),
|
|
328
|
+
children: r
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
},
|
|
332
|
+
i.id
|
|
333
|
+
) : /* @__PURE__ */ f(
|
|
334
|
+
"div",
|
|
335
|
+
{
|
|
336
|
+
role: "listitem",
|
|
337
|
+
className: e.join(" "),
|
|
338
|
+
"data-testid": `pe-wizard-review-${i.id}`,
|
|
339
|
+
children: r
|
|
340
|
+
},
|
|
341
|
+
i.id
|
|
342
|
+
);
|
|
343
|
+
})
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
export {
|
|
348
|
+
se as W,
|
|
349
|
+
re as a,
|
|
350
|
+
ae as b,
|
|
351
|
+
le as c,
|
|
352
|
+
ee as d,
|
|
353
|
+
ie as u
|
|
354
|
+
};
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
const V = 0, O = {
|
|
2
|
+
1: "Beverage and food service",
|
|
3
|
+
2: "Entertainment and events",
|
|
4
|
+
3: "Hospitality and guest services",
|
|
5
|
+
4: "Home services",
|
|
6
|
+
5: "Personal services",
|
|
7
|
+
6: "Personal appearance and wellness",
|
|
8
|
+
7: "Recreation and instruction",
|
|
9
|
+
8: "Transportation and delivery"
|
|
10
|
+
}, P = [
|
|
11
|
+
[101, "Bartenders"],
|
|
12
|
+
[102, "Wait staff"],
|
|
13
|
+
[103, "Food or beverage servers, non-restaurant"],
|
|
14
|
+
[104, "Dining room and cafeteria attendants and bartender helpers"],
|
|
15
|
+
[105, "Chefs and cooks"],
|
|
16
|
+
[106, "Food preparation workers"],
|
|
17
|
+
[107, "Fast food and counter workers"],
|
|
18
|
+
[108, "Dishwashers"],
|
|
19
|
+
[109, "Host staff, restaurant, lounge, and coffee shop"],
|
|
20
|
+
[110, "Bakers"],
|
|
21
|
+
[201, "Gambling dealers"],
|
|
22
|
+
[202, "Gambling change persons and booth cashiers"],
|
|
23
|
+
[203, "Gambling cage workers"],
|
|
24
|
+
[204, "Gambling and sports book writers and runners"],
|
|
25
|
+
[205, "Dancers"],
|
|
26
|
+
[206, "Musicians and singers"],
|
|
27
|
+
[207, "Disc jockeys, except radio"],
|
|
28
|
+
[208, "Entertainers and performers"],
|
|
29
|
+
[209, "Digital content creators"],
|
|
30
|
+
[210, "Ushers, lobby attendants, and ticket takers"],
|
|
31
|
+
[211, "Locker room, coatroom, and dressing room attendants"],
|
|
32
|
+
[301, "Baggage porters and bellhops"],
|
|
33
|
+
[302, "Concierges"],
|
|
34
|
+
[303, "Hotel, motel, and resort desk clerks"],
|
|
35
|
+
[304, "Maids and housekeeping cleaners"],
|
|
36
|
+
[401, "Home maintenance and repair workers"],
|
|
37
|
+
[402, "Home landscaping and groundskeeping workers"],
|
|
38
|
+
[403, "Home electricians"],
|
|
39
|
+
[404, "Home plumbers"],
|
|
40
|
+
[405, "Home heating and air conditioning mechanics and installers"],
|
|
41
|
+
[406, "Home appliance installers and repairers"],
|
|
42
|
+
[407, "Home cleaning service workers"],
|
|
43
|
+
[408, "Locksmiths"],
|
|
44
|
+
[409, "Roadside assistance workers"],
|
|
45
|
+
[501, "Personal care and service workers"],
|
|
46
|
+
[502, "Private event planners"],
|
|
47
|
+
[503, "Private event and portrait photographers"],
|
|
48
|
+
[504, "Private event videographers"],
|
|
49
|
+
[505, "Event officiants"],
|
|
50
|
+
[506, "Pet and show animal caretakers"],
|
|
51
|
+
[507, "Tutors"],
|
|
52
|
+
[508, "Nannies and babysitters"],
|
|
53
|
+
[509, "Visual artists"],
|
|
54
|
+
[510, "Floral designers"],
|
|
55
|
+
[601, "Skincare specialists"],
|
|
56
|
+
[602, "Massage therapists"],
|
|
57
|
+
[603, "Barbers, hairdressers, hairstylists, and cosmetologists"],
|
|
58
|
+
[604, "Shampooers"],
|
|
59
|
+
[605, "Manicurists and pedicurists"],
|
|
60
|
+
[606, "Eyebrow and eyelash technicians"],
|
|
61
|
+
[607, "Makeup artists"],
|
|
62
|
+
[608, "Exercise trainers and group fitness instructors"],
|
|
63
|
+
[609, "Tattoo artists and piercers"],
|
|
64
|
+
[610, "Tailors"],
|
|
65
|
+
[611, "Shoe and leather workers and repairers"],
|
|
66
|
+
[701, "Golf caddies"],
|
|
67
|
+
[702, "Self-enrichment teachers"],
|
|
68
|
+
[703, "Recreational and tour pilots"],
|
|
69
|
+
[704, "Tour guides"],
|
|
70
|
+
[705, "Travel guides"],
|
|
71
|
+
[706, "Sports and recreation instructors"],
|
|
72
|
+
[801, "Parking and valet attendants"],
|
|
73
|
+
[802, "Taxi and rideshare drivers and chauffeurs"],
|
|
74
|
+
[803, "Shuttle drivers"],
|
|
75
|
+
[804, "Goods delivery people"],
|
|
76
|
+
[805, "Personal vehicle and equipment cleaners"],
|
|
77
|
+
[806, "Private and charter bus drivers"],
|
|
78
|
+
[807, "Water taxi operators and charter boat workers"],
|
|
79
|
+
[808, "Rickshaw, pedicab, and carriage drivers"],
|
|
80
|
+
[809, "Home movers"],
|
|
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);
|
|
90
|
+
}
|
|
91
|
+
function S(e) {
|
|
92
|
+
const n = typeof e == "string" && /^\s*\d+\s*$/.test(e) ? Number(e) : e;
|
|
93
|
+
return n === 0 ? 0 : C(n) ? n : void 0;
|
|
94
|
+
}
|
|
95
|
+
function f(e) {
|
|
96
|
+
const n = typeof e == "string" && e.trim() !== "" ? Number(e) : e;
|
|
97
|
+
return typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
98
|
+
}
|
|
99
|
+
const U = {
|
|
100
|
+
household: "household",
|
|
101
|
+
family: "family",
|
|
102
|
+
taxUnit: "tax_unit",
|
|
103
|
+
spmUnit: "spm_unit",
|
|
104
|
+
maritalUnit: "marital_unit"
|
|
105
|
+
}, x = {
|
|
106
|
+
household: "your household",
|
|
107
|
+
family: "your family",
|
|
108
|
+
taxUnit: "your tax unit",
|
|
109
|
+
spmUnit: "your household",
|
|
110
|
+
// app-v2 uses the same label for SPM unit
|
|
111
|
+
maritalUnit: "your marital unit"
|
|
112
|
+
}, w = {
|
|
113
|
+
isDisabled: "is_disabled",
|
|
114
|
+
isBlind: "is_blind",
|
|
115
|
+
isFullTimeStudent: "is_full_time_college_student",
|
|
116
|
+
isPregnant: "is_pregnant",
|
|
117
|
+
needsCare: "is_incapable_of_self_care"
|
|
118
|
+
}, N = 18, D = "takes_up_ssi_if_eligible", v = {
|
|
119
|
+
employmentIncome: "employment_income",
|
|
120
|
+
tipIncome: "tip_income",
|
|
121
|
+
selfEmploymentIncome: "self_employment_income",
|
|
122
|
+
socialSecurityIncome: "social_security_retirement",
|
|
123
|
+
ssiAmount: "ssi",
|
|
124
|
+
ssdiAmount: "social_security_disability",
|
|
125
|
+
pensionIncome: "taxable_private_pension_income",
|
|
126
|
+
publicPensionIncome: "taxable_public_pension_income",
|
|
127
|
+
privatePensionIncome: "taxable_private_pension_income",
|
|
128
|
+
dividendIncome: "qualified_dividend_income",
|
|
129
|
+
nonQualifiedDividendIncome: "non_qualified_dividend_income",
|
|
130
|
+
shortTermCapitalGains: "short_term_capital_gains",
|
|
131
|
+
longTermCapitalGains: "long_term_capital_gains",
|
|
132
|
+
taxableInterestIncome: "taxable_interest_income",
|
|
133
|
+
rentalIncome: "rental_income",
|
|
134
|
+
unemploymentCompensation: "unemployment_compensation",
|
|
135
|
+
childSupportReceived: "child_support_received",
|
|
136
|
+
miscellaneousIncome: "miscellaneous_income"
|
|
137
|
+
}, H = {
|
|
138
|
+
tipIncome: "employment_income"
|
|
139
|
+
}, R = {
|
|
140
|
+
charitableCashDonations: "charitable_cash_donations",
|
|
141
|
+
mortgageInterest: "home_mortgage_interest",
|
|
142
|
+
realEstateTaxes: "real_estate_taxes"
|
|
143
|
+
}, B = "treasury_tipped_occupation_code", G = [
|
|
144
|
+
...Object.entries(v),
|
|
145
|
+
...Object.entries(H),
|
|
146
|
+
...Object.entries(R)
|
|
147
|
+
];
|
|
148
|
+
function a(e, n) {
|
|
149
|
+
return { [e]: n };
|
|
150
|
+
}
|
|
151
|
+
function L(e, n) {
|
|
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));
|
|
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);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const o = S(e.tippedOccupationCode);
|
|
168
|
+
return o !== void 0 && (i[B] = a(n, o)), i;
|
|
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;
|
|
175
|
+
});
|
|
176
|
+
const m = {
|
|
177
|
+
members: [...s]
|
|
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] }
|
|
186
|
+
}, A = {
|
|
187
|
+
[o.household]: m
|
|
188
|
+
}, b = {};
|
|
189
|
+
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)
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
country_id: "us",
|
|
197
|
+
label: _,
|
|
198
|
+
data: {
|
|
199
|
+
people: d,
|
|
200
|
+
families: T,
|
|
201
|
+
marital_units: b,
|
|
202
|
+
tax_units: I,
|
|
203
|
+
spm_units: E,
|
|
204
|
+
households: A
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function K(e, n = {}) {
|
|
209
|
+
return M(e, n).data;
|
|
210
|
+
}
|
|
211
|
+
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
|
|
220
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|