@meeeetup/camera-web 0.8.0 → 0.9.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.
Files changed (58) hide show
  1. package/README.md +211 -167
  2. package/dist/index.d.ts +5 -16
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +9 -17
  5. package/dist/index.js.map +1 -1
  6. package/dist/react/components/AlignmentRing.js +2 -2
  7. package/dist/react/components/AlignmentRing.js.map +1 -1
  8. package/dist/react/components/CameraToggle.js +2 -2
  9. package/dist/react/components/CameraToggle.js.map +1 -1
  10. package/dist/react/components/CameraViewport.d.ts +4 -2
  11. package/dist/react/components/CameraViewport.d.ts.map +1 -1
  12. package/dist/react/components/CameraViewport.js +12 -10
  13. package/dist/react/components/CameraViewport.js.map +1 -1
  14. package/dist/react/components/CaptureButton.js +2 -2
  15. package/dist/react/components/CaptureButton.js.map +1 -1
  16. package/dist/react/components/DevicePicker.js +2 -2
  17. package/dist/react/components/DevicePicker.js.map +1 -1
  18. package/dist/react/components/FaceCounter.js +2 -2
  19. package/dist/react/components/FaceCounter.js.map +1 -1
  20. package/dist/react/components/FaceGrid.d.ts.map +1 -1
  21. package/dist/react/components/FaceGrid.js +23 -11
  22. package/dist/react/components/FaceGrid.js.map +1 -1
  23. package/dist/react/components/SingleAlignmentOverlay.js +2 -2
  24. package/dist/react/components/SingleAlignmentOverlay.js.map +1 -1
  25. package/dist/react/context/{MeeeetUpCamContext.d.ts → CameraContext.d.ts} +23 -6
  26. package/dist/react/context/CameraContext.d.ts.map +1 -0
  27. package/dist/react/context/CameraContext.js +3 -0
  28. package/dist/react/context/CameraContext.js.map +1 -0
  29. package/dist/react/context/{MeeeetUpCamProvider.d.ts → CameraProvider.d.ts} +32 -26
  30. package/dist/react/context/CameraProvider.d.ts.map +1 -0
  31. package/dist/react/context/{MeeeetUpCamProvider.js → CameraProvider.js} +34 -62
  32. package/dist/react/context/CameraProvider.js.map +1 -0
  33. package/dist/react/context/useCamera.d.ts +15 -0
  34. package/dist/react/context/useCamera.d.ts.map +1 -0
  35. package/dist/react/context/useCamera.js +22 -0
  36. package/dist/react/context/useCamera.js.map +1 -0
  37. package/dist/react/usePassiveCamera.d.ts +16 -1
  38. package/dist/react/usePassiveCamera.d.ts.map +1 -1
  39. package/dist/react/usePassiveCamera.js +19 -2
  40. package/dist/react/usePassiveCamera.js.map +1 -1
  41. package/dist/ui/index.d.ts +19 -0
  42. package/dist/ui/index.d.ts.map +1 -0
  43. package/dist/ui/index.js +18 -0
  44. package/dist/ui/index.js.map +1 -0
  45. package/package.json +7 -2
  46. package/dist/react/context/MeeeetUpCamContext.d.ts.map +0 -1
  47. package/dist/react/context/MeeeetUpCamContext.js +0 -3
  48. package/dist/react/context/MeeeetUpCamContext.js.map +0 -1
  49. package/dist/react/context/MeeeetUpCamProvider.d.ts.map +0 -1
  50. package/dist/react/context/MeeeetUpCamProvider.js.map +0 -1
  51. package/dist/react/context/useMeeeetUpCam.d.ts +0 -15
  52. package/dist/react/context/useMeeeetUpCam.d.ts.map +0 -1
  53. package/dist/react/context/useMeeeetUpCam.js +0 -22
  54. package/dist/react/context/useMeeeetUpCam.js.map +0 -1
  55. package/dist/react/useAutoUpload.d.ts +0 -17
  56. package/dist/react/useAutoUpload.d.ts.map +0 -1
  57. package/dist/react/useAutoUpload.js +0 -46
  58. package/dist/react/useAutoUpload.js.map +0 -1
package/README.md CHANGED
@@ -1,91 +1,116 @@
1
1
  # @meeeetup/camera-web
2
2
 
3
- Browser face-capture SDK for the Meeeetup face-ID service. Detects faces with
4
- MediaPipe BlazeFace, tracks them, picks the best-quality frame per person, and
5
- hands you the images through a callback.
6
-
7
- **Transport is yours by default.** Without `autoUpload` the SDK makes no
8
- network request and holds no credential: it calls `onBatchCapture` (passive) or
9
- `onCapture` (single, interactive) with base64 JPEG data URLs, and sending them
10
- is your code. Pass the opt-in `autoUpload` prop and the SDK posts the captures
11
- itself — see [Auto-upload](#auto-upload--opt-in-transport).
3
+ Browser face-capture SDK. Detects faces with MediaPipe BlazeFace, tracks each
4
+ one, picks the best-quality frame per person, and hands you the images through
5
+ a callback. **No network, no credentials, no vendor lock-in** — the SDK runs
6
+ entirely on the device and the transport is yours.
7
+
8
+ - **Headless-first.** The data surface (`CameraProvider`, `useCamera`) is the
9
+ package default. Pre-built UI (viewport, overlay, face grid) is a separate
10
+ entry under `/ui` — import it only if you want the stock visuals.
11
+ - **BYOT (bring your own transport).** The SDK calls `onBatchCapture` (passive)
12
+ or `onCapture` (single, interactive) with base64 JPEG data URLs. Sending
13
+ them is your code — any backend, any auth scheme, any retry strategy.
14
+ - **Pre-GA.** Breaking API changes land without deprecation shims; version
15
+ bumps document them in `CHANGELOG.md`.
12
16
 
13
17
  Requires React 18 or 19. ESM-only. Served over HTTPS or `localhost` —
14
18
  `getUserMedia` is a secure-context API.
15
19
 
20
+ ---
21
+
16
22
  ## Install
17
23
 
18
24
  ```bash
19
25
  npm i @meeeetup/camera-web react react-dom
20
26
  ```
21
27
 
22
- `@meeeetup/camera-core` arrives as a dependency — add it explicitly only if you
23
- import from it directly (this package already re-exports `SelectedFace`,
24
- `LiveFacePreview` and `PersonResult`).
28
+ Optional (only if you use the stock components):
25
29
 
26
30
  ```ts
27
31
  import "@meeeetup/camera-web/styles.css";
28
32
  ```
29
33
 
30
- ## Passive capture — continuous, batched
34
+ `@meeeetup/camera-core` arrives as a transitive dependency — add it explicitly
35
+ only if you import from it directly (`SelectedFace`, `LiveFacePreview`,
36
+ `PersonResult`, `TrackSnapshot` are already re-exported here).
37
+
38
+ ---
39
+
40
+ ## The two entry points
41
+
42
+ ```ts
43
+ // Headless API — Provider, hook, types. ~zero visual bytes.
44
+ import { CameraProvider, useCamera } from "@meeeetup/camera-web";
45
+
46
+ // Pre-built components — only if you want our visuals. Opt-in bundle cost.
47
+ import { CameraViewport, FaceGrid, FaceCounter } from "@meeeetup/camera-web/ui";
48
+ ```
49
+
50
+ Everything renders inside a single `<CameraProvider>`. Children — stock
51
+ components or your own — read live state through `useCamera()`.
31
52
 
32
- Faces are flushed every 10 s — to `onBatchCapture` as below, or straight to the
33
- SDK's own uploader if you set `autoUpload`.
53
+ ---
54
+
55
+ ## Three capture modes
56
+
57
+ | Mode | Trigger | Output | When to use |
58
+ |---|---|---|---|
59
+ | `passive` | Continuous — SDK picks best shots as faces appear | Batched `onBatchCapture(faces[])` | Walk-by cameras, kiosks that watch a space |
60
+ | `single` | Automatic — one best-shot per `trigger()` call | One `onCapture(crop, _, meta)` | Checkout-style self-serve ID |
61
+ | `interactive` | Manual — user presses the capture button | One `onCapture(crop, fullCircleImage)` | Guided enrollment flow |
62
+
63
+ ### Passive — continuous, batched
34
64
 
35
65
  ```tsx
36
- import {
37
- MeeeetUpCamProvider,
38
- CameraViewport,
39
- FaceCounter,
40
- FaceGrid,
41
- type SelectedFace,
42
- } from "@meeeetup/camera-web";
66
+ import { CameraProvider, useCamera, type SelectedFace } from "@meeeetup/camera-web";
67
+ import { CameraViewport, FaceCounter, FaceGrid } from "@meeeetup/camera-web/ui";
43
68
 
44
69
  export function PassiveCamera({ captureKey }: { captureKey: string }) {
70
+ const handleBatch = async (faces: SelectedFace[]) => {
71
+ const res = await fetch("https://api.example.com/capture", {
72
+ method: "POST",
73
+ headers: {
74
+ Authorization: `Bearer ${captureKey}`,
75
+ "Content-Type": "application/json",
76
+ },
77
+ body: JSON.stringify({
78
+ images: faces.map((f) => ({
79
+ image: f.dataUrl,
80
+ capturedAt: new Date(f.createdAt).toISOString(),
81
+ })),
82
+ }),
83
+ });
84
+ // Throw to report failure. The SDK re-queues on throw; a 4xx would
85
+ // livelock a retry, so swallow those at the sink.
86
+ if (!res.ok && res.status >= 500) throw new Error(`send failed: ${res.status}`);
87
+ };
88
+
45
89
  return (
46
- <MeeeetUpCamProvider
47
- mode="passive"
48
- onBatchCapture={async (faces: SelectedFace[]) => {
49
- const res = await fetch("https://api.example.com/capture", {
50
- method: "POST",
51
- headers: {
52
- Authorization: `Bearer ${captureKey}`,
53
- "Content-Type": "application/json",
54
- },
55
- body: JSON.stringify({
56
- images: faces.map((f) => ({
57
- image: f.dataUrl,
58
- capturedAt: new Date(f.createdAt).toISOString(),
59
- })),
60
- }),
61
- });
62
- // Throw to report failure. A missing status, <400 or >=500 is retried;
63
- // 4xx drops that batch (resending an unchanged rejected payload
64
- // livelocks).
65
- if (!res.ok) throw Object.assign(new Error("send failed"), { status: res.status });
66
- }}
67
- >
90
+ <CameraProvider mode="passive" onBatchCapture={handleBatch}>
68
91
  <CameraViewport />
69
92
  <FaceCounter />
70
93
  <FaceGrid />
71
- </MeeeetUpCamProvider>
94
+ </CameraProvider>
72
95
  );
73
96
  }
74
97
  ```
75
98
 
76
- ## Interactive capture — user-triggered
99
+ Faces flush every 10 s or when the buffer reaches the key's
100
+ `maxFacesPerRequest` cap. A face is handed over once per selection event — if a
101
+ better frame arrives later the SDK commits again. On the default settle path
102
+ every selection is `final: true`; set `captureWindowMs` and tracks publish
103
+ with `final: false` intermediate updates until the window expires.
104
+
105
+ ### Interactive — user-triggered
77
106
 
78
107
  ```tsx
79
- import {
80
- MeeeetUpCamProvider,
81
- CameraViewport,
82
- AlignmentRing,
83
- CaptureButton,
84
- } from "@meeeetup/camera-web";
108
+ import { CameraProvider } from "@meeeetup/camera-web";
109
+ import { CameraViewport, AlignmentRing, CaptureButton } from "@meeeetup/camera-web/ui";
85
110
 
86
111
  export function KioskCamera() {
87
112
  return (
88
- <MeeeetUpCamProvider
113
+ <CameraProvider
89
114
  mode="interactive"
90
115
  onCapture={async (faceImage, fullCircleImage) => {
91
116
  await upload(faceImage, fullCircleImage);
@@ -94,163 +119,184 @@ export function KioskCamera() {
94
119
  <CameraViewport />
95
120
  <AlignmentRing />
96
121
  <CaptureButton />
97
- </MeeeetUpCamProvider>
122
+ </CameraProvider>
98
123
  );
99
124
  }
100
125
  ```
101
126
 
102
- ## Auto-upload — opt-in transport
103
-
104
- `autoUpload` is accepted by `MeeeetUpCamProvider` in all three modes
105
- (`passive`, `single`, `interactive`) and makes the SDK post captures itself.
106
- Omit it and no capture ever leaves the device — your callback stays the only
107
- output path. With it, a passive camera needs no transport code at all:
127
+ ### Single — automatic one-shot
108
128
 
109
129
  ```tsx
110
- import {
111
- MeeeetUpCamProvider,
112
- CameraViewport,
113
- FaceCounter,
114
- FaceGrid,
115
- } from "@meeeetup/camera-web";
130
+ import { CameraProvider } from "@meeeetup/camera-web";
131
+ import { CameraViewport } from "@meeeetup/camera-web/ui";
116
132
 
117
- export function PassiveCamera({ captureKey }: { captureKey: string }) {
133
+ export function EnrollCamera() {
118
134
  return (
119
- <MeeeetUpCamProvider mode="passive" autoUpload={{ captureKey }}>
135
+ <CameraProvider
136
+ mode="single"
137
+ onCapture={async (faceImage, _fullCircleImage, meta) => {
138
+ console.log("frontalness", meta.frontalness, "face size", meta.faceSize);
139
+ await upload(faceImage);
140
+ }}
141
+ >
120
142
  <CameraViewport />
121
- <FaceCounter />
122
- <FaceGrid />
123
- </MeeeetUpCamProvider>
143
+ </CameraProvider>
124
144
  );
125
145
  }
126
146
  ```
127
147
 
128
- Each flush becomes `POST https://api.meeeetup.com/capture` with headers
129
- `Authorization: Bearer <captureKey>` and `Content-Type: application/json`, and
130
- a body of `{ images: [{ image, capturedAt }], channelId? }` — the `POST
131
- /capture` contract of the Meeeetup face-ID API. `capturedAt` is each face's
132
- `createdAt` as an ISO-8601 string.
148
+ ---
133
149
 
134
- ### `AutoUploadOptions`
150
+ ## Custom UI (`useCamera`)
135
151
 
136
- | Field | Type | Default |
137
- |---|---|---|
138
- | `captureKey` | `string` | required — sent as `Authorization: Bearer <captureKey>` |
139
- | `endpoint` | `string` | `DEFAULT_CAPTURE_ENDPOINT` (`https://api.meeeetup.com/capture`) |
140
- | `channelId` | `string` | unset — omitted from the body entirely, not sent empty |
141
- | `maxRetries` | `number` | `2` — extra attempts after a transient failure |
142
- | `retryDelayMs` | `number` | `1000` — base backoff, doubled each attempt |
143
- | `fetch` | `CaptureFetch` | the global `fetch` — override for tests or a proxy |
144
- | `onUploaded` | `(result: AutoUploadResult) => void` | — fires per accepted request with `{ count, status, attempts }` |
145
- | `onError` | `(error: unknown) => void` | — fires once per upload that exhausted its attempts |
146
-
147
- ### Capture callbacks become observers
148
-
149
- With `autoUpload` set, `onBatchCapture` / `onCapture` are optional and purely
150
- observational — a counter, a preview, analytics. They are fired without being
151
- awaited, so they can neither delay nor fail the upload, and anything they throw
152
- surfaces on `autoUpload.onError` rather than in the capture pipeline. Without
153
- `autoUpload` they are the only output path and behave as before: a rejection
154
- requeues the batch.
155
-
156
- In single and interactive mode only the face crop is uploaded.
157
- `fullCircleImage` is framing for your own UI and never leaves the device.
158
-
159
- ### Retries and failures
160
-
161
- 5xx, 429, 408 and transport-level failures are retried up to `maxRetries`, each
162
- attempt resending a byte-identical payload after
163
- `retryDelayMs * 2 ** (attempt - 1)` ms. Any other 4xx fails immediately — the
164
- server rejected that payload, and resending it unchanged would livelock.
165
-
166
- Once the attempts are spent the uploader throws `CaptureUploadError`:
167
-
168
- | Field | Meaning |
169
- |---|---|
170
- | `status` | HTTP status; absent when the request never completed |
171
- | `retryable` | `true` for 408 / 429 / 5xx / transport failure, `false` for any other 4xx |
172
- | `attempts` | attempts spent before giving up |
173
- | `cause` | the underlying transport error, when there was one |
174
-
175
- The passive session reads that flag: a retryable batch is requeued and retried
176
- on a later flush, a non-retryable one is dropped. Batches reach the uploader
177
- already chunked to 50 images (`maxFacesPerRequest`), which must not exceed the
178
- key's `maxImagesPerRequest` from `GET /capture/keys/me`.
179
-
180
- ### Driving the low-level hooks
181
-
182
- `createAutoUploader`, `CaptureUploadError`, `DEFAULT_CAPTURE_ENDPOINT` and the
183
- `AutoUpload*` / `Capture*` types are re-exported from this package, so code
184
- driving the low-level hooks (`usePassiveCamera`, `useSingleCapture`) instead of
185
- the provider gets the same transport. `uploadFaces` takes `SelectedFace[]` from
186
- a passive batch; `uploadImages` takes the single-shot data URLs.
152
+ `useCamera()` is the data surface. Narrow on `cam.mode` first; the hook throws
153
+ if used outside a provider.
187
154
 
188
155
  ```tsx
189
- import { createAutoUploader, useSingleCapture } from "@meeeetup/camera-web";
190
-
191
- const uploader = createAutoUploader({ captureKey });
192
- const cam = useSingleCapture({
193
- onCapture: (faceImage) =>
194
- uploader.uploadImages([
195
- { image: faceImage, capturedAt: new Date().toISOString() },
196
- ]),
197
- });
156
+ import { useCamera } from "@meeeetup/camera-web";
157
+
158
+ function Status() {
159
+ const cam = useCamera();
160
+ if (cam.mode !== "passive") return null;
161
+ return (
162
+ <p>
163
+ {cam.trackedCount} in frame — {cam.capturedFaces.length} captured
164
+ </p>
165
+ );
166
+ }
198
167
  ```
199
168
 
200
- ## Custom UI
169
+ ### Shared across modes
170
+
171
+ `ready`, `error`, `videoRef`, `devices`, `currentDeviceId`, `setDeviceId`,
172
+ `currentFacingMode`, `toggleCamera`.
201
173
 
202
- `useMeeeetUpCam()` exposes everything the built-in components render. Narrow on
203
- `cam.mode` first; it throws outside a provider.
174
+ ### Passive mode (`cam.mode === "passive"`)
175
+
176
+ | Field | Shape | What it is |
177
+ |---|---|---|
178
+ | `activeTracks` | `TrackSnapshot[]` | Per-frame snapshot of every live track — `cx`/`cy`/`width`/`height` in normalised 0–1 coords, plus `smoothedFrontalness` / `selectedFrontalness` / `lastSeenAt` / `lastSentAt`. Drive custom overlays off this |
179
+ | `liveFaces` | `LiveFacePreview[]` | Tracks currently in frame that have NOT yet been committed — your "watching" row |
180
+ | `capturedFaces` | `SelectedFace[]` | Everything committed this session, newest first — your "captured" row |
181
+ | `livePreviews` | `LiveFacePreview[]` | Raw: all tracked faces that have a best crop yet |
182
+ | `selectedFaces` | `SelectedFace[]` | Raw: SDK's committed buffer, order defined by the pipeline |
183
+ | `trackedCount` / `totalCount` | `number` | Faces in frame now / unique faces seen this session |
184
+ | `flushBatch` | `() => Promise<void>` | Drive the batch flush yourself instead of waiting 10 s |
185
+ | `rearm` | `() => void` | Re-open every track's capture window (no-op without `captureWindowMs`) |
186
+ | `overlayRef` | `RefObject<HTMLCanvasElement>` | Where the stock green-box overlay draws — attach to your own `<canvas>` to let the SDK render into it |
187
+
188
+ ### Interactive mode (`cam.mode === "interactive"`)
189
+
190
+ | Field | Shape | What it is |
191
+ |---|---|---|
192
+ | `videoStream` | `MediaStream \| null` | Raw camera stream — attach to secondary `<video>` elements for picture-in-picture |
193
+ | `isLoading` / `isCapturing` / `isSwitchingCamera` / `isFlipped` / `isFaceAligned` | `boolean` | Pipeline state |
194
+ | `captureProgress` / `alignmentCountdown` | `number` | 0–1 progress for the alignment ring and auto-capture countdown |
195
+ | `faceBoundingBox` | `{ originX, originY, width, height } \| null` | Current face box in video coords |
196
+ | `captureImage()` / `toggleFlip()` | `() => void` | Trigger capture / mirror the preview |
197
+ | `canvasRef` | `RefObject<HTMLCanvasElement>` | Full-circle framing canvas |
198
+
199
+ ### Single mode (`cam.mode === "single"`)
200
+
201
+ | Field | Shape | What it is |
202
+ |---|---|---|
203
+ | `state` | `SingleCaptureState` | `idle` / `tracking` / `capturing` / `locked` |
204
+ | `bbox` | `SingleCaptureBox \| null` | Current face box |
205
+ | `isAligned` / `locked` | `boolean` | Alignment / lock state |
206
+ | `captureProgress` / `faceSize` / `frontalness` / `score` | `number` | Per-frame readings |
207
+ | `result` | `SingleCaptureResult \| null` | Published best-shot + meta |
208
+ | `trigger()` / `rearm()` | `() => void` | Open a fresh capture window / restart search |
209
+
210
+ ---
211
+
212
+ ## Declarative overlays (`CameraViewport` children)
213
+
214
+ `<CameraViewport>` passes any children through to a `pointer-events: none`
215
+ layer on top of the camera. Anything that reads `useCamera()` can position
216
+ itself over the video — Mapbox-style composition.
204
217
 
205
218
  ```tsx
206
- const cam = useMeeeetUpCam();
207
- if (cam.mode === "passive") {
208
- // cam.ready, cam.error, cam.trackedCount, cam.totalCount,
209
- // cam.selectedFaces, cam.livePreviews, cam.flushBatch()
219
+ <CameraProvider mode="passive" overlayEnabled={false} onBatchCapture={handleBatch}>
220
+ <CameraViewport>
221
+ <TrackBoxes /> {/* reads activeTracks, draws DOM boxes */}
222
+ <ThresholdLine />
223
+ <DebugHud />
224
+ </CameraViewport>
225
+ </CameraProvider>
226
+
227
+ function TrackBoxes() {
228
+ const cam = useCamera();
229
+ if (cam.mode !== "passive") return null;
230
+ return (
231
+ <>
232
+ {cam.activeTracks.map((t) => (
233
+ <div
234
+ key={t.trackId}
235
+ style={{
236
+ position: "absolute",
237
+ left: `${(t.cx - t.width / 2) * 100}%`,
238
+ top: `${(t.cy - t.height / 2) * 100}%`,
239
+ width: `${t.width * 100}%`,
240
+ height: `${t.height * 100}%`,
241
+ border: `2px solid ${t.smoothedFrontalness > 50 ? "lime" : "red"}`,
242
+ }}
243
+ />
244
+ ))}
245
+ </>
246
+ );
210
247
  }
211
248
  ```
212
249
 
213
- Shared across modes: `ready`, `error`, `videoRef`, `devices`, `currentDeviceId`,
214
- `setDeviceId`, `currentFacingMode`, `toggleCamera`.
250
+ `overlayEnabled={false}` turns off the SDK's green-box canvas so your DOM
251
+ boxes are the only overlay. Omit it (or set `true`) to layer custom children
252
+ on top of the stock overlay.
253
+
254
+ ---
215
255
 
216
- ## Components
256
+ ## Pre-built components (`@meeeetup/camera-web/ui`)
217
257
 
218
258
  | Component | Mode | Renders |
219
259
  |---|---|---|
220
260
  | `CameraViewport` | both | `<video>` + overlay canvas (passive) / circular viewport (interactive) |
221
261
  | `FaceCounter` | passive | Tracked + total badge |
222
- | `FaceGrid` | passive | Grid of selected face crops |
262
+ | `FaceGrid` | passive | Grid of selected face crops (live / committed / ready) |
223
263
  | `DevicePicker` | both | Camera dropdown |
224
264
  | `CameraToggle` | both | Front/back switch |
225
265
  | `AlignmentRing` | interactive | Alignment ring, progress, countdown |
226
266
  | `CaptureButton` | interactive | Manual capture trigger |
227
267
 
228
- Every component except `AlignmentRing` accepts `className`. The skin is CSS
229
- custom properties (`--mfc-*`) with dark defaults — re-theme by setting them on
230
- any ancestor.
268
+ Every component accepts `className`. The skin is CSS custom properties
269
+ (`--mfc-*`) with dark defaults — re-theme by setting them on any ancestor.
270
+
271
+ ---
231
272
 
232
273
  ## Provider props
233
274
 
234
- Every mode accepts `children`, `mediapipeWasmUrl` and `autoUpload`; the capture
235
- gates (`cooldownMs` and the three below) are passive-only.
275
+ Every mode: `children`, `mediapipeWasmUrl`, `deviceId`, `onDeviceChange`,
276
+ `overlayEnabled`. Mode-specific props below. Capture gates (`cooldownMs`,
277
+ `minFrontalness`, `captureWindowMs`, …) are passive-only.
236
278
 
237
279
  | Prop | Mode | Type | Default |
238
280
  |---|---|---|---|
239
- | `autoUpload` | all | `AutoUploadOptions` | unset — opt in and the SDK posts captures itself |
240
- | `onBatchCapture` | passive | `(faces: SelectedFace[]) => void \| Promise<void>` | required without `autoUpload`; an optional observer with it |
241
- | `onCapture` | interactive | `(faceImage: string, fullCircleImage: string) => void \| Promise<void>` | required without `autoUpload`; an optional observer with it |
281
+ | `onBatchCapture` | passive | `(faces: SelectedFace[]) => void \| Promise<void>` | **required** |
282
+ | `onCapture` | single, interactive | mode-specific signature | **required** |
283
+ | `deviceId` | all | `string` | unset — browser picks a default camera |
284
+ | `onDeviceChange` | all | `(id: string \| undefined) => void` | — fires when a child picker changes the device |
285
+ | `overlayEnabled` | passive | `boolean` | `true` — set `false` to disable the SDK's green boxes and render custom overlays |
242
286
  | `cooldownMs` | passive | `number` | `10000` — minimum ms between sends for the same face |
243
- | `mediapipeWasmUrl` | passive | `string` | jsDelivr CDN — point it at a self-hosted WASM directory |
244
- | `alignmentCaptureDelayMs` | interactive | `number` | `2000` — how long a face must stay aligned before auto-capture |
245
- | `minDetectionScore` | passive | `number` | `0.5` — detector confidence floor, applied before any pose analysis |
287
+ | `captureWindowMs` | passive | `number` | `0` — per-track best-shot window; `0` keeps settle-based capture |
288
+ | `minDetectionScore` | passive | `number` | `0.5` — detector confidence floor, applied before pose analysis |
246
289
  | `minFaceHeight` | passive | `number` | `0` — minimum face-box height as a fraction of frame height (0–1); off by default |
247
290
  | `minFrontalness` | passive | `number` | `50` — minimum pose score (0–100) a frame must reach to be captured |
248
- | `captureWindowMs` | passive | `number` | `0` — per-track best-shot window in ms; `0` keeps settle-based capture |
291
+ | `mediapipeWasmUrl` | all | `string` | jsDelivr CDN — override to self-host MediaPipe WASM |
292
+ | `alignmentCaptureDelayMs` | interactive | `number` | `2000` — how long a face must stay aligned before auto-capture |
249
293
 
250
- With `captureWindowMs` set, each tracked face is searched for that long and the
251
- best frame is published as final at expiry. `useMeeeetUpCam()` in passive mode
294
+ With `captureWindowMs > 0`, each tracked face is searched for that long and
295
+ the best frame is published as final at expiry. `useCamera()` in passive mode
252
296
  returns `rearm()`, which starts every window's search again.
253
297
 
298
+ ---
299
+
254
300
  ## Runtime network access
255
301
 
256
302
  MediaPipe assets are fetched on demand, so the browser must reach:
@@ -258,12 +304,10 @@ MediaPipe assets are fetched on demand, so the browser must reach:
258
304
  - `https://cdn.jsdelivr.net` — WASM runtime (override with `mediapipeWasmUrl`)
259
305
  - `https://storage.googleapis.com` — the `.tflite` detection model
260
306
 
261
- With `autoUpload` set, and only then, the browser also posts to:
262
-
263
- - `https://api.meeeetup.com` — capture ingest (override with `autoUpload.endpoint`)
307
+ The SDK itself makes no other requests. A strict CSP needs the two asset
308
+ origins in `connect-src`, plus `script-src 'wasm-unsafe-eval'`.
264
309
 
265
- A strict CSP needs the asset origins in `connect-src`, plus `script-src
266
- 'wasm-unsafe-eval'`; add the capture origin when you use `autoUpload`.
310
+ ---
267
311
 
268
312
  ## Licence
269
313
 
package/dist/index.d.ts CHANGED
@@ -1,19 +1,8 @@
1
- export type { SelectedFace, LiveFacePreview, PersonResult } from "@meeeetup/camera-core";
2
- export { createAutoUploader, CaptureUploadError, DEFAULT_CAPTURE_ENDPOINT } from "@meeeetup/camera-core";
3
- export type { AutoUploader, AutoUploadOptions, AutoUploadResult, CaptureFetch, CaptureImage, } from "@meeeetup/camera-core";
4
- export { MeeeetUpCamProvider } from "./react/context/MeeeetUpCamProvider.js";
5
- export type { MeeeetUpCamProviderProps, PassiveCaptureOnlyMeeeetUpCamProviderProps, InteractiveMeeeetUpCamProviderProps, SingleCaptureMeeeetUpCamProviderProps, SingleCaptureMeta, } from "./react/context/MeeeetUpCamProvider.js";
6
- export { useMeeeetUpCam } from "./react/context/useMeeeetUpCam.js";
7
- export type { MeeeetUpCamContextValue, CameraMode, PassiveState, InteractiveState, SingleState } from "./react/context/MeeeetUpCamContext.js";
1
+ export type { SelectedFace, LiveFacePreview, PersonResult, TrackSnapshot } from "@meeeetup/camera-core";
2
+ export { CameraProvider } from "./react/context/CameraProvider.js";
3
+ export type { CameraProviderProps, PassiveCameraProviderProps, InteractiveCameraProviderProps, SingleCameraProviderProps, SingleCaptureMeta, } from "./react/context/CameraProvider.js";
4
+ export { useCamera } from "./react/context/useCamera.js";
5
+ export type { CameraContextValue, CameraMode, PassiveState, InteractiveState, SingleState } from "./react/context/CameraContext.js";
8
6
  export { useSingleCapture, MIN_SCORE_FLOOR, MIN_WINDOW_MS, MAX_WINDOW_MS } from "./react/useSingleCapture.js";
9
7
  export type { UseSingleCaptureOptions, UseSingleCaptureReturn, SingleCaptureState, SingleCaptureBox, SingleCaptureResult, } from "./react/useSingleCapture.js";
10
- export { CameraViewport } from "./react/components/CameraViewport.js";
11
- export type { CameraViewportProps } from "./react/components/CameraViewport.js";
12
- export { FaceCounter } from "./react/components/FaceCounter.js";
13
- export { FaceGrid } from "./react/components/FaceGrid.js";
14
- export { CameraToggle } from "./react/components/CameraToggle.js";
15
- export { DevicePicker } from "./react/components/DevicePicker.js";
16
- export { AlignmentRing } from "./react/components/AlignmentRing.js";
17
- export { SingleAlignmentOverlay } from "./react/components/SingleAlignmentOverlay.js";
18
- export { CaptureButton } from "./react/components/CaptureButton.js";
19
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EA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ceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AASxG,OAAO,EAAE,cAAc,EAAE,MAAS,mCAAmC,CAAC;AACtE,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAc,8BAA8B,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAGpI,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC9G,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -1,20 +1,12 @@
1
- // ── Opt-in transport ────────────────────────────────────────────────────────────
2
- // Pass `autoUpload` to the Provider and the SDK posts captures itself. Omit it
3
- // and the SDK never touches the network. `createAutoUploader` is the same
4
- // transport for consumers driving the low-level hooks directly.
5
- export { createAutoUploader, CaptureUploadError, DEFAULT_CAPTURE_ENDPOINT } from "@meeeetup/camera-core";
6
- // ── Context API (primary) ───────────────────────────────────────────────────────
7
- export { MeeeetUpCamProvider } from "./react/context/MeeeetUpCamProvider.js";
8
- export { useMeeeetUpCam } from "./react/context/useMeeeetUpCam.js";
1
+ // ── Context API (headless) ──────────────────────────────────────────────────────
2
+ // The Provider + context + hooks are the data surface — bring-your-own UI
3
+ // composes against them. Pre-built UI components live under `/ui`.
4
+ //
5
+ // Transport is yours. The Provider hands captures to your `onBatchCapture` /
6
+ // `onCapture` sink and makes no network request itself; sending the JPEG
7
+ // data URLs is your code (see README for the POST /capture reference).
8
+ export { CameraProvider } from "./react/context/CameraProvider.js";
9
+ export { useCamera } from "./react/context/useCamera.js";
9
10
  // ── Single-mode hook (low-level, when the Provider is too much) ────────────────
10
11
  export { useSingleCapture, MIN_SCORE_FLOOR, MIN_WINDOW_MS, MAX_WINDOW_MS } from "./react/useSingleCapture.js";
11
- // ── Built-in components ─────────────────────────────────────────────────────────
12
- export { CameraViewport } from "./react/components/CameraViewport.js";
13
- export { FaceCounter } from "./react/components/FaceCounter.js";
14
- export { FaceGrid } from "./react/components/FaceGrid.js";
15
- export { CameraToggle } from "./react/components/CameraToggle.js";
16
- export { DevicePicker } from "./react/components/DevicePicker.js";
17
- export { AlignmentRing } from "./react/components/AlignmentRing.js";
18
- export { SingleAlignmentOverlay } from "./react/components/SingleAlignmentOverlay.js";
19
- export { CaptureButton } from "./react/components/CaptureButton.js";
20
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,mFAAmF;AACnF,+EAA+E;AAC/E,0EAA0E;AAC1E,gEAAgE;AAChE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AASzG,mFAAmF;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAS,wCAAwC,CAAC;AAQhF,OAAO,EAAE,cAAc,EAAE,MAAc,mCAAmC,CAAC;AAG3E,kFAAkF;AAClF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAS9G,mFAAmF;AACnF,OAAO,EAAE,cAAc,EAAE,MAAc,sCAAsC,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAiB,mCAAmC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAoB,gCAAgC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAgB,oCAAoC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAgB,oCAAoC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAe,qCAAqC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAe,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,mFAAmF;AACnF,0EAA0E;AAC1E,mEAAmE;AACnE,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,uEAAuE;AACvE,OAAO,EAAE,cAAc,EAAE,MAAS,mCAAmC,CAAC;AAQtE,OAAO,EAAE,SAAS,EAAE,MAAc,8BAA8B,CAAC;AAGjE,kFAAkF;AAClF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMeeeetUpCam } from "../context/useMeeeetUpCam.js";
2
+ import { useCamera } from "../context/useCamera.js";
3
3
  import { CircleProgress } from "../CircleProgress.js";
4
4
  /** Alignment ring + progress + countdown. Interactive mode only — renders nothing in passive mode. */
5
5
  export function AlignmentRing() {
6
- const cam = useMeeeetUpCam();
6
+ const cam = useCamera();
7
7
  if (cam.mode !== "interactive")
8
8
  return null;
9
9
  return (_jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: _jsxs("div", { style: { position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)", width: "var(--mfc-circle-size, min(320px, 75vw))", aspectRatio: "1" }, children: [_jsx("div", { className: cam.isFaceAligned ? undefined : "mfc-pulse", style: {
@@ -1 +1 @@
1
- {"version":3,"file":"AlignmentRing.js","sourceRoot":"","sources":["../../../src/react/components/AlignmentRing.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE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BACL,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,KAAK;wBAC9D,MAAM,EAAE,aAAa,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC,yCAAyC,EAAE;wBACtI,SAAS,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,uDAAuD,CAAC,CAAC,CAAC,SAAS;wBAClG,UAAU,EAAE,WAAW;qBACxB,GACD,EACD,GAAG,CAAC,aAAa,IAAI,CACpB,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,YACxD,KAAC,cAAc,IAAC,QAAQ,EAAE,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAC,uCAAuC,EAAC,WAAW,EAAE,EAAE,GAAI,GACvH,CACP,EACA,GAAG,CAAC,kBAAkB,KAAK,IAAI,IAAI,CAClC,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,YACzH,eAAM,SAAS,EAAC,gBAAgB,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,sCAAsC,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,mEAAmE,EAAE,YAClN,GAAG,CAAC,kBAAkB,GAClB,GACH,CACP,IACG,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SwitchCamera } from "lucide-react";
3
- import { useMeeeetUpCam } from "../context/useMeeeetUpCam.js";
3
+ import { useCamera } from "../context/useCamera.js";
4
4
  import { cx } from "../cx.js";
5
5
  /** Front/back camera switch button. Works in both modes. */
6
6
  export function CameraToggle({ className }) {
7
- const cam = useMeeeetUpCam();
7
+ const cam = useCamera();
8
8
  return (_jsx("button", { className: cx("mfc-toggle", className), onClick: cam.toggleCamera, title: "Switch camera", style: { background: "var(--mfc-toggle-bg, rgba(0,0,0,0.45))", border: "none", borderRadius: 8, padding: "6px 8px", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center" }, children: _jsx(SwitchCamera, { size: 16, color: "var(--mfc-fg, #fff)" }) }));
9
9
  }
10
10
  //# sourceMappingURL=CameraToggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CameraToggle.js","sourceRoot":"","sources":["../../../src/react/components/CameraToggle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAM9B,4DAA4D;AAC5D,MAAM,UAAU,YAAY,CAAC,EAAE,SAAS,EAAqB;IAC3D,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;IAE7B,OAAO,CACL,iBACE,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,EACtC,OAAO,EAAE,GAAG,CAAC,YAAY,EACzB,KAAK,EAAC,eAAe,EACrB,KAAK,EAAE,EAAE,UAAU,EAAE,wCAAwC,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,YAExM,KAAC,YAAY,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAC,qBAAqB,GAAG,GAC/C,CACV,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"CameraToggle.js","sourceRoot":"","sources":["../../../src/react/components/CameraToggle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAM9B,4DAA4D;AAC5D,MAAM,UAAU,YAAY,CAAC,EAAE,SAAS,EAAqB;IAC3D,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IAExB,OAAO,CACL,iBACE,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,EACtC,OAAO,EAAE,GAAG,CAAC,YAAY,EACzB,KAAK,EAAC,eAAe,EACrB,KAAK,EAAE,EAAE,UAAU,EAAE,wCAAwC,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,YAExM,KAAC,YAAY,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAC,qBAAqB,GAAG,GAC/C,CACV,CAAC;AACJ,CAAC"}
@@ -12,8 +12,10 @@ export interface CameraViewportProps {
12
12
  }
13
13
  /**
14
14
  * Renders the camera `<video>` and overlay `<canvas>`.
15
- * - Passive mode: video + detection overlay (`overlay` prop ignored — passive
16
- * draws its own canvas-based overlay for tracked boxes).
15
+ * - Passive mode: video + the SDK's detection overlay. `children` are rendered
16
+ * as a declarative overlay layer on top (Mapbox-style) — any component that
17
+ * calls `useCamera` can read live track data and position itself over
18
+ * the viewport. `overlay` is ignored.
17
19
  * - Interactive mode: circular viewport with blurred background and the
18
20
  * default alignment ring. Replaceable via `overlay` or `children`.
19
21
  * - Single mode: same circular viewport with the single-mode alignment ring
@@ -1 +1 @@
1
- {"version":3,"file":"CameraViewport.d.ts","sourceRoot":"","sources":["../../../src/react/components/CameraViewport.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAO3F,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,mBAAmB,+BAOnF"}
1
+ {"version":3,"file":"CameraViewport.d.ts","sourceRoot":"","sources":["../../../src/react/components/CameraViewport.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAO3F,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,mBAAmB,+BAOnF"}