@rightkit/onboarding 0.2.2 → 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 +35 -61
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,76 +1,50 @@
|
|
|
1
1
|
# @rightkit/onboarding
|
|
2
2
|
|
|
3
|
-
First-run onboarding framework for Right Suite apps
|
|
3
|
+
First-run onboarding framework for Right Suite apps. The legal agreement gate comes first, then ordered steps (permissions, model download, license or trial, and app-defined steps), with progress, skip and resume.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
| Item | Value |
|
|
6
|
+
|---|---|
|
|
7
|
+
| Where it runs | App webview UI (React) |
|
|
8
|
+
| Rust pair | None |
|
|
9
|
+
| Version | see INDEX.md |
|
|
10
|
+
| License | MIT OR Apache-2.0 |
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
onComplete={finish} onSkip={later} />
|
|
11
|
-
```
|
|
12
|
+
## Entry points
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
| Import | Contents |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `@rightkit/onboarding` | `Onboarding`, `isLegalAccepted`, `onboardingStateKey`, `licenseStep`, `modelsStep`, `permissionsStep`; types from `types.ts`, `ModelsStepOptions` |
|
|
17
|
+
| `@rightkit/onboarding/onboarding.css` | Stylesheet |
|
|
16
18
|
|
|
17
|
-
##
|
|
19
|
+
## Peer dependencies
|
|
18
20
|
|
|
19
|
-
|
|
|
20
|
-
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `beforeLegalGate()` | Awaited before the gate shows (e.g. size or reveal the window). The package does no window sizing itself. |
|
|
25
|
-
| `requireModel` | Continue/Finish on the models step wait for an installed model. |
|
|
26
|
-
| `autoStartDownload` | Start the first missing model download when the models step opens. |
|
|
27
|
-
| `shouldAutoStart(entry, models)` | Choose which missing model auto-starts when the models step first opens (first `missing` entry returning true). Replaces `autoStartDownload`'s rule, including its "a model is already installed" guard. Once per mount, across re-renders and Back/Next. |
|
|
28
|
-
| `onModelsStepEnter(ctx)` | Full control, called once when the step opens and the list has loaded: `ctx.models`, `ctx.start(id)`, `ctx.refresh()`. Replaces `shouldAutoStart` and `autoStartDownload`; a throw is shown in the step. |
|
|
29
|
-
| `modelsIntro` | App copy shown at the top of the models step. |
|
|
30
|
-
| `allowSkip` | Show "Set up later" (default `true`). |
|
|
31
|
-
| `titlebar` | Node rendered in a strip along the top. |
|
|
32
|
-
| `dragRegion` | Add `data-tauri-drag-region` to that strip on the setup steps (default `false`; height `--rk-onboarding-titlebar-h`, default 32px). Never rendered on the legal stage. |
|
|
33
|
-
| `legalDragRegion` | Also render the drag region on the legal stage (default `false`; the legal gate has no strip, and `titlebar` content alone never adds the attribute). |
|
|
34
|
-
| `legalReceipt` | `{ read(), write(record) }`: the app's own acceptance receipt. See below. |
|
|
21
|
+
| Peer | Range |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `@rightkit/app-shell` | `>=0.2.0 <1` |
|
|
24
|
+
| `@rightkit/legal-ui` | `>=0.1.2 <1` |
|
|
25
|
+
| `react` | `>=18 <20` |
|
|
35
26
|
|
|
36
|
-
##
|
|
27
|
+
## Example
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
Illustrative. The `settings`, `legal`, `permissions`, `models` and `license` values are app-provided adapters.
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
```tsx
|
|
32
|
+
import { Onboarding } from "@rightkit/onboarding";
|
|
33
|
+
import "@rightkit/onboarding/onboarding.css";
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
documentsHash: r.legalMaterialSha256 ?? "",
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
write(rec) {
|
|
55
|
-
saveLegalAcceptance({
|
|
56
|
-
legalAcceptanceVersion: rec.version,
|
|
57
|
-
legalAcceptedAt: rec.acceptedAt, // UTC ISO, ends in Z
|
|
58
|
-
legalEligibilityBasis: rec.eligibilityBasis,
|
|
59
|
-
legalMaterialSha256: rec.documentsHash,
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
<Onboarding legalReceipt={legalReceipt} requiredVersion={REQUIRED_LEGAL_ACCEPTANCE_VERSION} documentsHash={LEGAL_MATERIAL_SHA256} ... />
|
|
35
|
+
<Onboarding
|
|
36
|
+
settings={settings} // SettingsBackend; progress saved under "onboarding.state"
|
|
37
|
+
legal={legal}
|
|
38
|
+
permissions={permissions}
|
|
39
|
+
models={models}
|
|
40
|
+
license={license}
|
|
41
|
+
onComplete={finish} // runs only after the state was saved
|
|
42
|
+
onSkip={later}
|
|
43
|
+
/>
|
|
64
44
|
```
|
|
65
45
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
A step may set `canContinue(context)`; Continue/Finish stay disabled while it returns `false` (optional `blockedHint` is shown). Steps with async readiness call `context.setReady(boolean)` from `render` and read `context.ready[stepId]`. Back is disabled on the first step after the agreement.
|
|
69
|
-
|
|
70
|
-
## Models backend
|
|
71
|
-
|
|
72
|
-
`ModelsBackend.cancel` is optional; the Pause control appears only when it is supplied.
|
|
46
|
+
Acceptance is stored as `legalAcceptance: { version, documentsHash, acceptedAt, eligibilityBasis }`. An app that already keeps its own acceptance receipt can pass `legalReceipt` (`read()` and `write(record)`) and keep that store as the source of truth. Steps can set `canContinue(context)`.
|
|
73
47
|
|
|
74
|
-
##
|
|
48
|
+
## Known issues
|
|
75
49
|
|
|
76
|
-
|
|
50
|
+
- Peer React is `<20`, while `doc-render`, `i18n`, `media-ui` and `pdf-ui` accept `<21` (npm audit 2026-10-08).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rightkit/onboarding",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "First-run onboarding framework: ordered steps, progress, skip/resume, legal gate first, permissions, model download and licence/trial steps.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@rightkit/app-shell": ">=0.2.0 <1",
|
|
28
28
|
"@rightkit/legal-ui": ">=0.1.2 <1",
|
|
29
|
-
"react": ">=18 <
|
|
29
|
+
"react": ">=18 <21"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@rightkit/app-shell": "0.
|
|
33
|
-
"@rightkit/legal-ui": "0.
|
|
32
|
+
"@rightkit/app-shell": "0.3.0",
|
|
33
|
+
"@rightkit/legal-ui": "0.2.0",
|
|
34
|
+
"@rightkit/qa": "0.4.0",
|
|
34
35
|
"@testing-library/jest-dom": "^6.6.3",
|
|
35
36
|
"@testing-library/react": "^16.1.0",
|
|
36
37
|
"@testing-library/user-event": "^14.5.2",
|