@sekyro/react 0.1.0-rc.2 → 0.1.0-rc.4
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/CHANGELOG.md +62 -0
- package/README.md +84 -2
- package/dist/index.cjs +2 -900
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -15
- package/dist/index.d.ts +164 -15
- package/dist/index.js +2 -879
- package/dist/index.js.map +1 -1
- package/dist/styles.css +275 -1
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# @sekyro/react
|
|
2
2
|
|
|
3
|
+
## 0.1.0-rc.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e3469ab: The pre-capture screen can now read its instructions aloud. A "Listen to the instructions" button under the tips plays a short spoken summary of them, and tapping it again stops it.
|
|
8
|
+
|
|
9
|
+
- **When it shows.** The button needs something that can speak the summary in the current locale: a clip, or a device voice that `speechFallback` allows. It shows with the built-in tips, in any order. It never shows with `voice={false}`. It stays visible when the voice-guidance switch is off, because the person asked for it by tapping.
|
|
10
|
+
- **Playback.** It never auto-plays. The clip comes from the same source as the guidance clips: your `voice.clips`, else the session's Sekyro set, else the device voice. Playback stops when the person taps Start, when the screen unmounts, or when voice guidance is switched off. It never overlaps the guidance during capture. The tap is a user gesture, so it also unlocks audio on iOS.
|
|
11
|
+
- **New voice key `capture.tips.summary`.** It is now in `VOICE_KEYS` and `VoiceKey`, so a `voice.clips` resolver or map can also be asked for it. If your resolver builds file names from the key, check that it handles this key.
|
|
12
|
+
- **Custom tips.** With your own `tips`, or `tips={false}`, the built-in summary would describe tips that are not on the screen, so the button stays hidden. To offer it, put a `capture.tips.summary` clip for the locale in `voice.clips`. Optionally override the `capture.tips.summary` string too, as the device voice reads it when the clip cannot play: `voice={{ clips: { fr: { "capture.tips.summary": "https://cdn.example.com/fr/summary.mp3" } } }}`.
|
|
13
|
+
- **New strings** (en/fr/ar): `capture.tips.summary` (the spoken text), `capture.tips.listen` (the button label) and `capture.tips.stop` (the label while it plays).
|
|
14
|
+
- 4b7bbfc: Voice guidance in verification mode now speaks the recorded Sekyro clip set that comes with the session. The package no longer ships any audio.
|
|
15
|
+
|
|
16
|
+
- **Sekyro clips by default.** With a `verification`, `<LivenessCapture>` speaks the session's ar/fr clips, read through `verification.voiceClips()` from `@sekyro/web`. They are served from `https://assets.sekyro.ai`, so a page with a Content-Security-Policy must add that origin to `media-src`. Until the set arrives, when the session has none, or when it cannot be fetched, the device voice speaks as before. A set that arrives after the Start tap is prefetched then. The guidance being spoken is never repeated.
|
|
17
|
+
- **Your clips still win.** `voice.clips` replaces the Sekyro clips entirely. With it set, or with `voice={false}`, the component does not fetch the Sekyro set.
|
|
18
|
+
- **Capture-only mode is unchanged.** Without a `verification` there are no default clips, only the device voice, which is how it already behaved: the bundled set was empty.
|
|
19
|
+
- **Peer dependency:** `@sekyro/web` `^0.1.0-rc.6` (for `verification.voiceClips()`).
|
|
20
|
+
|
|
21
|
+
**Breaking (rc):**
|
|
22
|
+
|
|
23
|
+
- `VoiceOptions.clipBaseUrl` is removed. There is no bundled set left to locate.
|
|
24
|
+
- `createManifestResolver` and the `VoiceClipManifest` type are removed.
|
|
25
|
+
- The `@sekyro/react/assets/*` export, including `assets/audio/v1/`, is removed, and the package no longer ships an `assets/` directory.
|
|
26
|
+
|
|
27
|
+
If you host your own clips in the `<base>/<locale>/<name>.mp3` layout, pass a resolver. `<name>` is the last segment of the key, for example `center_face`:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
const base = "https://cdn.example.com/voice/v1";
|
|
31
|
+
const clips: VoiceClipResolver = (key, locale) => `${base}/${locale}/${key.slice(key.lastIndexOf(".") + 1)}.mp3`;
|
|
32
|
+
<LivenessCapture verification={verification} locale="fr" voice={{ clips }} />;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 26270c4: Shorter pre-capture spoken summary (`capture.tips.summary`) in fr, en and ar: well-lit place, uncover your face, phone at eye level, look at the camera and keep still.
|
|
38
|
+
- 819d2fa: Clarify the `fcv3.too_bright` capture hint (en/fr/ar). The old wording ("turn away from the light source" / "tournez-vous dos à la source de lumière") could lead users to backlight their face; it now reads "Too much light — move out of direct light" / "Trop de lumière — évitez la lumière directe sur le visage" / "الإضاءة قوية جدًا — تجنّب الضوء المباشر على وجهك".
|
|
39
|
+
- Updated dependencies [54b153c]
|
|
40
|
+
- @sekyro/web@0.1.0-rc.6
|
|
41
|
+
|
|
42
|
+
## 0.1.0-rc.3
|
|
43
|
+
|
|
44
|
+
### Minor Changes
|
|
45
|
+
|
|
46
|
+
- 1ab07df: `<LivenessCapture>` now ships a built-in "get ready" screen and speaks the capture guidance.
|
|
47
|
+
|
|
48
|
+
- **Pre-capture screen (default intro).** Tips, a camera-permission row, a front/back camera choice (on devices with both), a voice switch, the security note and one Start control that waits for the detector preload (`preloadLivenessAssets`, started on mount): busy while the models download, ready to start, or a Retry if the download failed.
|
|
49
|
+
- **New props:** `notice` (a node or `{ tone, text }` above the screen, pre-capture only), `startDisabled` / `startLabel` (e.g. a cooldown; gates only the built-in Start, not the error Retry / "record again" / retake), `tips` (`false`, or built-in ids / your own `IntroTip`s; `DEFAULT_TIPS`), `defaultFacing`, `voice` (`false` or `VoiceOptions`), `onGuidance(key)` (once per displayed `fcv3.*` key change).
|
|
50
|
+
- **`autoStart: "when-permitted"`** starts only when the camera permission is already granted (until the permission probe answers, the screen shows its loader). **Behaviour change:** `autoStart` (both forms) now waits for the detector preload to be ready before starting; meanwhile the screen shows its loader (or the retry on failure).
|
|
51
|
+
- **Voice guidance, on by default.** Bundled clips (`assets/audio/v1`, served at `${assetBaseUrl ?? "/models-v3"}/audio/v1`) with a device-voice (speechSynthesis) fallback; a stage chip and the intro switch toggle it; the choice persists in `localStorage`. `VoiceOptions.clips` takes a `VoiceClipSource`: a resolver `(key, locale) => url | null` or a `{ [locale]: { [voiceKey]: url } }` map (e.g. from your backend); `createManifestResolver(manifest, baseUrl)` resolves over a clip-set manifest. CSP: `media-src 'self' blob:` is enough. On iOS audio unlocks in the Start tap; with `autoStart` it unlocks on the first activating touch (`touchend`), click or key press (not Escape) inside the component. Clips are prefetched in that same gesture, and only while voice is on.
|
|
52
|
+
- **Slots:** `slots.intro(start, context)` gets an `IntroContext` (preload gate + retry, permission, facing + setter, voice), and `start` opens the chosen camera. `slots.voicePrompt(hint, text, key, voice)` replaces the built-in chip and gets the `VoiceControl` (`{ supported, enabled, setEnabled, toggle }`) as a 4th argument.
|
|
53
|
+
- **Migration — partners who speak from `voicePrompt`:** the component now speaks the guidance itself; pass `voice={false}` or the person hears it twice. A development build warns once (`console.warn`) when `slots.voicePrompt` is set and `voice` is left undefined; pass `voice={false}` (your slot speaks) or `voice={{}}` (keep the built-in voice) to silence it.
|
|
54
|
+
- **Migration — hosts with their own intro + `autoStart`:** if you render your own "get ready" screen outside the component and mount it with `autoStart`, the built-in pre-capture screen now appears (with its loader) while the detector preload loads, instead of the camera starting at once. Pass `slots.intro` to keep your own look during that wait (e.g. `(start, context) => context.assets === "failed" ? <YourRetry onClick={context.retryAssets} /> : <YourLoader />`), or move your intro into `slots.intro` and drop `autoStart`.
|
|
55
|
+
- New exports: `LivenessNotice`, `IntroContext`, `IntroTip`, `BuiltInTipId`, `DEFAULT_TIPS`, `VoiceOptions`, `VoiceControl`, `VoiceKey`, `VOICE_KEYS`, `VoiceClipSource`, `VoiceClipMap`, `VoiceClipResolver`, `VoiceClipManifest`, `createManifestResolver`.
|
|
56
|
+
- The bundle is now built with whitespace/syntax minification (identifiers, function names and sourcemaps kept). `process.env.NODE_ENV` stays a live expression in the published bundle, so the dev-only warnings follow your build mode.
|
|
57
|
+
- Peer dependency: `@sekyro/web` `^0.1.0-rc.5` (the pre-capture building blocks).
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [a14ac15]
|
|
62
|
+
- Updated dependencies [66522c3]
|
|
63
|
+
- @sekyro/web@0.1.0-rc.5
|
|
64
|
+
|
|
3
65
|
## 0.1.0-rc.2
|
|
4
66
|
|
|
5
67
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -59,14 +59,96 @@ const verification = createVerification({ clientToken, locale: "ar" });
|
|
|
59
59
|
| `locale` | `"ar" \| "fr" \| "en"` | Built-in dictionary. |
|
|
60
60
|
| `dir?` | `"ltr" \| "rtl"` | Defaults to `rtl` for `ar`. |
|
|
61
61
|
| `strings?` | `Partial<Strings>` | Per-key overrides on top of the built-ins. |
|
|
62
|
-
| `slots?` | `{ header, footer, intro(start), stageOverlay(videoRef), voicePrompt(hint, text, key), errorPanel(err, retry) }` | `intro` replaces the built-in
|
|
63
|
-
| `autoStart?` | `boolean` |
|
|
62
|
+
| `slots?` | `{ header, footer, intro(start, context), stageOverlay(videoRef), voicePrompt(hint, text, key, voice), errorPanel(err, retry) }` | `intro` replaces the built-in pre-capture screen (see below); `stageOverlay` renders inside the stage box above the ring (overlays, debug HUDs); `voicePrompt` replaces the built-in voice chip in the stage's start corner; `errorPanel` replaces the camera-error notice. |
|
|
63
|
+
| `autoStart?` | `boolean \| "when-permitted"` | Skip the pre-capture screen and start once the detector preload is ready — at most once per mount. `true` arms it (flip it when your own preconditions are met); `"when-permitted"` arms it only when the camera permission is already `granted` (until the permission probe answers, the screen shows its loader). |
|
|
64
|
+
| `notice?` | `ReactNode \| { tone, text }` | Host message above the pre-capture screen (busy service, previous failure). Pre-capture only. |
|
|
65
|
+
| `startDisabled?` / `startLabel?` | `boolean` / `ReactNode` | Disable the built-in Start and relabel it (e.g. a cooldown: "Retry in 12 s"). It gates only the pre-capture Start — not the error Retry, "record again" or the retake button. |
|
|
66
|
+
| `tips?` | `false \| (BuiltInTipId \| IntroTip)[]` | Tips card; default `DEFAULT_TIPS`; `false` hides it. |
|
|
67
|
+
| `defaultFacing?` | `"user" \| "environment"` | Camera the attempt opens with (default front). |
|
|
68
|
+
| `voice?` | `false \| VoiceOptions` | Voice guidance; on by default. `false` = no speech, no switch, no chip. |
|
|
69
|
+
| `onGuidance?` | `(key) => void` | Telemetry: once per change of the displayed `fcv3.*` guidance key. |
|
|
64
70
|
| `onStateChange?` | `(state) => void` | Every capture-state transition, for host chrome (hide a description while the stage is live, telemetry). |
|
|
65
71
|
| `onCaptured?` | `(artifacts) => void` | Fires before any upload. |
|
|
66
72
|
| `onResult?` | `(result) => void` | Verification mode only. |
|
|
67
73
|
| `onError?` | `(error) => void` | Camera / engine failure (`permission \| notfound \| inuse \| insecure \| unsupported \| generic`). |
|
|
68
74
|
| `assetBaseUrl?` | `string` | Detector assets base (default `/models-v3`). |
|
|
69
75
|
|
|
76
|
+
### Pre-capture screen
|
|
77
|
+
|
|
78
|
+
While the capture is idle the component renders a built-in "get ready" screen:
|
|
79
|
+
a tips card, the camera-permission row (`granted` / `prompt` / `denied` with the
|
|
80
|
+
fix / `unknown`), a front/back choice on devices with both cameras, the voice
|
|
81
|
+
switch, the security note and **one** Start control gated on the detector preload
|
|
82
|
+
(`preloadLivenessAssets` from `@sekyro/web`, kicked on mount): a busy Start while
|
|
83
|
+
the models download, Start when ready, a danger notice + Retry if the download
|
|
84
|
+
failed. Without a camera API (SSR, old browsers) the preload is skipped and Start
|
|
85
|
+
is ready at once.
|
|
86
|
+
|
|
87
|
+
`slots.intro(start, context)` replaces the whole screen. `context` is
|
|
88
|
+
`{ assets: "loading" | "ready" | "failed", retryAssets, permission, facing,
|
|
89
|
+
setFacing, canChooseFacing, voice }`; call `start` from your click handler — it
|
|
90
|
+
opens `context.facing` and unlocks audio inside the gesture (iOS). The `notice`
|
|
91
|
+
still renders above your intro.
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<LivenessCapture
|
|
95
|
+
verification={verification}
|
|
96
|
+
locale="fr"
|
|
97
|
+
notice={busy ? { tone: "warning", text: t("serviceBusy") } : undefined}
|
|
98
|
+
startDisabled={cooldown > 0}
|
|
99
|
+
startLabel={cooldown > 0 ? t("retryIn", { s: cooldown }) : undefined}
|
|
100
|
+
tips={["light", "uncover", { id: "id-card", text: t("haveIdReady") }]}
|
|
101
|
+
/>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Voice guidance
|
|
105
|
+
|
|
106
|
+
During capture the component speaks the displayed (debounced) guidance — the
|
|
107
|
+
`fcv3.*` gate hints — through one `<audio>` element, falling back to the
|
|
108
|
+
device voice (`speechSynthesis`). A stage chip (`aria-pressed`) and the intro
|
|
109
|
+
switch toggle it; the viewer's choice persists in `localStorage`.
|
|
110
|
+
|
|
111
|
+
| `VoiceOptions` | Default | Notes |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `defaultEnabled?` | `true` | Used when the viewer has no stored preference. |
|
|
114
|
+
| `clips?` | verification mode: Sekyro clips from the session (add `https://assets.sekyro.ai` to `media-src`); capture-only: none | `VoiceClipSource`: a resolver `(key, locale) => url \| null` **or** a map `{ [locale]: { [voiceKey]: url } }` (e.g. delivered by your backend — pass a new object to change it). Yours always wins over the Sekyro clips. A missing URL or a throwing resolver = no clip → device voice. |
|
|
115
|
+
| `speechFallback?` | `true` | `false`, or the locales where the device voice may speak. A device with no voice for the language stays silent rather than read Arabic in a French voice. |
|
|
116
|
+
| `storageKey?` | `"sekyro.voiceGuidance"` | `null` = do not persist. |
|
|
117
|
+
|
|
118
|
+
**Sekyro clips.** In verification mode the component speaks the recorded
|
|
119
|
+
ar/fr clip set that arrives with the session (`verification.voiceClips()`),
|
|
120
|
+
served from `https://assets.sekyro.ai` — a page with a Content-Security-Policy
|
|
121
|
+
must allow that origin in `media-src`. Until the set arrives, when the session
|
|
122
|
+
has none, or when it cannot be fetched, the device voice speaks. The package
|
|
123
|
+
ships no audio. `VOICE_KEYS` lists the nine `fcv3.*` guidance keys plus
|
|
124
|
+
`capture.tips.summary`.
|
|
125
|
+
|
|
126
|
+
**"Listen to the instructions".** The pre-capture screen has a button under
|
|
127
|
+
the tips that plays the spoken summary `capture.tips.summary`. It never
|
|
128
|
+
auto-plays, a second tap stops it, and Start stops it too. It shows only with
|
|
129
|
+
the built-in tips, unless your `voice.clips` has a `capture.tips.summary` clip
|
|
130
|
+
for the locale. It never shows with `voice={false}`, and the voice switch
|
|
131
|
+
does not hide it.
|
|
132
|
+
|
|
133
|
+
**iOS.** Audio unlocks inside a user gesture: the Start tap, or the voice
|
|
134
|
+
switch/chip turned on. With `autoStart` there is no Start tap, so audio stays
|
|
135
|
+
locked until the person's first activating touch, click or key press anywhere
|
|
136
|
+
inside the component (`touchend` / `click` / `keydown` other than Escape, or a
|
|
137
|
+
mouse/pen `pointerup`; a touch `pointerdown` is not a user activation on WebKit).
|
|
138
|
+
It unlocks once; an event without activation leaves the listener armed. The
|
|
139
|
+
clips are prefetched in that same gesture, and only while voice is on. Guidance
|
|
140
|
+
due before the unlock stays silent on iOS.
|
|
141
|
+
|
|
142
|
+
**`voicePrompt` slot.** It replaces the chip and receives the shared
|
|
143
|
+
`VoiceControl` (`{ supported, enabled, setEnabled, toggle }`) as its fourth
|
|
144
|
+
argument; the component keeps speaking. If your slot plays audio itself, pass
|
|
145
|
+
`voice={false}` or the person hears it twice. A development build warns once
|
|
146
|
+
when `slots.voicePrompt` is set and `voice` is undefined (pass `voice={{}}` to keep
|
|
147
|
+
the built-in voice and silence it).
|
|
148
|
+
|
|
149
|
+
**CSP.** Clips and the unlock use `media-src 'self' blob:` (the silent unlock WAV
|
|
150
|
+
is a `blob:` URL — no `data:` needed); add your clip host if `clips` points off-origin.
|
|
151
|
+
|
|
70
152
|
### Theme
|
|
71
153
|
|
|
72
154
|
`SekyroThemeProvider` writes CSS variables on a `.sekyro-root` wrapper:
|