@kwik-id/sdk-react 0.1.0-alpha.4 → 0.1.0-alpha.8

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
@@ -44,8 +44,9 @@ import { openKwikVerification } from "@kwik-id/sdk-react";
44
44
 
45
45
  // Works in React, Vue, Angular, or plain JavaScript
46
46
  async function handleVerifyClick() {
47
- const { clientSecret } = await fetch("/api/create-session", { method: "POST" })
48
- .then((r) => r.json());
47
+ const { clientSecret } = await fetch("/api/create-session", { method: "POST" }).then((r) =>
48
+ r.json()
49
+ );
49
50
 
50
51
  const { status, jobId } = await openKwikVerification({
51
52
  clientSecret,
@@ -78,24 +79,24 @@ That's it — the modal handles the full flow: document selection, camera captur
78
79
 
79
80
  ### `OpenVerificationOptions`
80
81
 
81
- | Option | Type | Required | Description |
82
- | -------------- | --------------------- | -------- | --------------------------------------------------------------------------------------------------- |
83
- | `clientSecret` | `string` | Yes | Session token from your backend |
84
- | `appName` | `string` | No | App name shown in the modal header (falls back to org name) |
85
- | `baseUrl` | `string` | No | API base URL (defaults to production) |
86
- | `theme` | `KwikIDTheme` | No | Custom theme colors |
87
- | `showLogo` | `boolean` | No | Show org logo in header (default: `true`) |
88
- | `onSubmitted` | `({ jobId }) => void` | No | Called while the modal is still open, immediately when documents are uploaded. Save `jobId` here. |
82
+ | Option | Type | Required | Description |
83
+ | -------------- | --------------------- | -------- | ------------------------------------------------------------------------------------------------- |
84
+ | `clientSecret` | `string` | Yes | Session token from your backend |
85
+ | `appName` | `string` | No | App name shown in the modal header (falls back to org name) |
86
+ | `baseUrl` | `string` | No | API base URL (defaults to production) |
87
+ | `theme` | `KwikIDTheme` | No | Custom theme colors |
88
+ | `showLogo` | `boolean` | No | Show org logo in header (default: `true`) |
89
+ | `onSubmitted` | `({ jobId }) => void` | No | Called while the modal is still open, immediately when documents are uploaded. Save `jobId` here. |
89
90
 
90
91
  ### `VerificationOutcome`
91
92
 
92
93
  Resolved value of the Promise returned by `openKwikVerification()`:
93
94
 
94
- | Field | Type | Description |
95
- | -------- | ------------------------------------------ | ------------------------------------------------------ |
96
- | `status` | `"submitted" \| "cancelled" \| "error"` | What happened when the modal closed |
97
- | `jobId` | `string` | Present on `"submitted"` — use to track via webhooks |
98
- | `error` | `Error` | Present on `"cancelled"` and `"error"` |
95
+ | Field | Type | Description |
96
+ | -------- | --------------------------------------- | ---------------------------------------------------- |
97
+ | `status` | `"submitted" \| "cancelled" \| "error"` | What happened when the modal closed |
98
+ | `jobId` | `string` | Present on `"submitted"` — use to track via webhooks |
99
+ | `error` | `Error` | Present on `"cancelled"` and `"error"` |
99
100
 
100
101
  ### `KwikIDTheme`
101
102
 
@@ -115,17 +116,19 @@ If you prefer a declarative React approach, `<KwikID>` is available. It renders
115
116
  ```tsx
116
117
  import { KwikID } from "@kwik-id/sdk-react";
117
118
 
118
- {showVerification && (
119
- <KwikID
120
- config={{
121
- clientSecret,
122
- appName: "My App",
123
- onSubmitted: ({ jobId }) => saveJobId(jobId),
124
- onComplete: () => setShowVerification(false),
125
- onError: () => setShowVerification(false),
126
- }}
127
- />
128
- )}
119
+ {
120
+ showVerification && (
121
+ <KwikID
122
+ config={{
123
+ clientSecret,
124
+ appName: "My App",
125
+ onSubmitted: ({ jobId }) => saveJobId(jobId),
126
+ onComplete: () => setShowVerification(false),
127
+ onError: () => setShowVerification(false),
128
+ }}
129
+ />
130
+ );
131
+ }
129
132
  ```
130
133
 
131
134
  ### `<KwikIDProvider>` — Context Provider
@@ -140,22 +143,23 @@ Wraps your components to provide SDK state and actions via the `useKwikID()` hoo
140
143
 
141
144
  The following hooks are exported. They are used internally by the built-in components and are available for custom integrations. Hooks marked **requires provider** must be used inside `<KwikIDProvider>`.
142
145
 
143
- | Hook | Requires provider | Description |
144
- |---|---|---|
145
- | `useKwikID()` | Yes | Full SDK state and actions (camera, capture, submit) |
146
- | `useCamera(options)` | No | Camera access and frame capture |
147
- | `useQuality(options)` | No | Real-time image quality analysis |
148
- | `useFaceDetection(options)` | No | Face detection and alignment |
149
- | `useLiveness(options)` | No | Passive liveness detection |
150
- | `useVerification(options)` | Yes | Verification step state machine |
151
- | `useHandoff()` | Yes | Cross-device QR handoff |
146
+ | Hook | Requires provider | Description |
147
+ | --------------------------- | ----------------- | ---------------------------------------------------- |
148
+ | `useKwikID()` | Yes | Full SDK state and actions (camera, capture, submit) |
149
+ | `useCamera(options)` | No | Camera access and frame capture |
150
+ | `useQuality(options)` | No | Real-time image quality analysis |
151
+ | `useFaceDetection(options)` | No | Face detection and alignment |
152
+ | `useLiveness(options)` | No | Passive liveness detection |
153
+ | `useVerification(options)` | Yes | Verification step state machine |
154
+ | `useHandoff()` | Yes | Cross-device QR handoff |
152
155
 
153
156
  ## Utilities
154
157
 
155
158
  ```tsx
156
159
  import {
157
160
  // Check image sharpness
158
- UploadManager, // Manage file uploads
161
+ UploadManager,
162
+ // Manage file uploads
159
163
  // Compress images before upload
160
164
  analyzeImageQuality,
161
165
  // Check image brightness