@evaro/consultation-sdk 0.0.0-stage → 0.1.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
@@ -1,3 +1,52 @@
1
- # Temporary Holding Version
1
+ # @evaro/consultation-sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Evaro consultation as one React component: one question at a time, a progress bar, follow-up questions, jumps, the knockout screen and a Back button. It loads the consultation and the vendor theme itself, and it can save the answers to a target.
4
+
5
+ It renders in a shadow root with its own CSS, so the host CSS does not change it and it does not change the host.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @evaro/consultation-sdk
11
+ ```
12
+
13
+ React 19 and React DOM 19 are peer dependencies. Install an exact version.
14
+
15
+ ## Use
16
+
17
+ ```tsx
18
+ import { Consultation } from '@evaro/consultation-sdk'
19
+
20
+ <Consultation
21
+ consultation='<consultation hash>'
22
+ vendor='<vendor hash>'
23
+ environment='staging'
24
+ target={{ type: 'diagnosis-request', id: '<diagnosis request id>' }}
25
+ getToken={getToken}
26
+ onDone={closePanel}
27
+ onEvent={event => track(event.name, event.data)}
28
+ />
29
+ ```
30
+
31
+ With no `target`, the component runs as a preview and saves nothing. With `readOnly`, it shows the saved answers of the target.
32
+
33
+ The props, the target endpoints and the events are described in [docs/consultation-sdk.md](https://github.com/TotalAccessHealth/consultation/blob/main/docs/consultation-sdk.md).
34
+
35
+ ## Develop
36
+
37
+ The package lives in the `sdk/` folder of the CB repo. Run these commands from the repo root:
38
+
39
+ | Command | What it does |
40
+ |---------|--------------|
41
+ | `pnpm build:sdk` | Builds `sdk/dist`: the bundle and the type declarations. |
42
+ | `pnpm test:sdk` | Runs the tests. |
43
+ | `pnpm typecheck:sdk` | Checks the types. |
44
+
45
+ `pnpm dev` and `pnpm build` build the package first, because the CB preview uses it. `pnpm dev` builds it only once, so when you change the package while CB runs, also run `pnpm dev:sdk` to rebuild on each change.
46
+
47
+ `src/flow/questionnaire.ts` and its test are copies of Connect's `utils/questionnaire.ts`. Until Connect uses this package, a change to the flow goes to both repos, with its tests.
48
+
49
+ ## Publish
50
+
51
+ 1. Change `version` in `sdk/package.json`.
52
+ 2. Run `npm publish` from `sdk/`. It builds and tests the package first, and it asks for your npm 2FA code.