business-obligations-ui 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,6 +12,36 @@ import { planLaunch, evaluate } from "business-obligations";
12
12
 
13
13
  The components are controlled: the host owns completed steps and obligation filters.
14
14
 
15
+ ## Business details in the URL
16
+
17
+ Four inputs collect the details the engine needs, and keep them in the address bar, so a link shares the whole setup:
18
+
19
+ ```tsx
20
+ import { TypeInput, IndustryInput, EmployeesInput, DetailsInput, useProfileChoices } from "business-obligations-ui";
21
+
22
+ <TypeInput /> {/* ?type=pllc */}
23
+ <IndustryInput /> {/* ?industry=healthcare */}
24
+ <EmployeesInput /> {/* ?employees=12 */}
25
+ <DetailsInput /> {/* ?sells=1&home=1&tradeName=1&exempt=1&signage=1&food=1 */}
26
+
27
+ const [choices] = useProfileChoices(); // { entityType, industry, employeeCount, sellsTaxableGoods, ... }
28
+ ```
29
+
30
+ - The options come from the engine (`ENTITY_TYPES`, `INDUSTRIES`), so a new type there shows up here.
31
+ - The inputs own the query string. A change goes in with `history.replaceState` (no page load, no history entry), keeps
32
+ the other parameters and the hash, and updates every input and hook on the page. A value equal to its default is left
33
+ out, and an invalid or missing one falls back to the default.
34
+ - `DetailsInput` shows a checkbox for every yes/no detail except "not formed yet": sells taxable goods, run from home,
35
+ trade name, tax-exempt status, exterior signage and food service. The S election appears for professional and benefit
36
+ corporations. Pass `fields={["homeBased", "foodService"]}` to show only some.
37
+ - `useProfileChoices()` returns the current choices and a setter. Use it to build the plan:
38
+ `planLaunch({ ...place, ...choices })`.
39
+ - To start from other defaults, wrap the inputs in `<ProfileQueryProvider defaults={{ industry: "restaurant", employeeCount: 3 }}>`.
40
+ `readProfileQuery`, `writeProfileQuery`, `setProfileQuery`, `PROFILE_PARAMS` and `PROFILE_DEFAULTS` are exported for
41
+ server code and links.
42
+ - On the server, and while hydrating, the inputs show the defaults; they pick up the URL right after.
43
+ - Labels follow the `locale` prop like the lists do (`<TypeInput locale="es" />`), from `messages.<locale>.profile`.
44
+
15
45
  ## Languages
16
46
 
17
47
  English is the default and Spanish ships with the package. Two things are translated, by two packages: