@kwik-id/sdk-react 0.1.0-alpha.3 → 0.1.0-alpha.7
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 +83 -182
- package/dist/hooks/kwik-id-context.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37106 -6115
- package/dist/open-kwik-verification.d.ts +54 -0
- package/dist/open-kwik-verification.d.ts.map +1 -0
- package/dist/views/consent-step.d.ts +1 -1
- package/dist/views/document-upload-step.d.ts +1 -1
- package/dist/views/kwik-id.d.ts +2 -2
- package/dist/views/kyc-form.d.ts +6 -1
- package/dist/views/kyc-form.d.ts.map +1 -1
- package/dist/views/kyc-modal-flow.d.ts +1 -1
- package/dist/views/kyc-modal-flow.d.ts.map +1 -1
- package/dist/views/kyc-substeps/camera-capture.d.ts.map +1 -1
- package/dist/views/selfie-step.d.ts +1 -1
- package/dist/views/verification-step.d.ts +1 -1
- package/package.json +6 -6
- package/dist/assets/image-processor.worker-B6Di_lR_.js +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { KwikIDTheme } from '../../types/src';
|
|
2
|
+
export interface OpenVerificationOptions {
|
|
3
|
+
/** Client secret from your backend session creation. Required. */
|
|
4
|
+
clientSecret: string;
|
|
5
|
+
/** App name shown in the modal header. Falls back to org name from session. */
|
|
6
|
+
appName?: string;
|
|
7
|
+
/** Custom theme colors. */
|
|
8
|
+
theme?: KwikIDTheme;
|
|
9
|
+
/** API base URL. Defaults to production. */
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
/** Show org logo in header. Defaults to true. */
|
|
12
|
+
showLogo?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Called immediately when documents are uploaded and background processing begins.
|
|
15
|
+
* The modal is still open at this point — use this to save the jobId before the
|
|
16
|
+
* user dismisses the result screen.
|
|
17
|
+
*/
|
|
18
|
+
onSubmitted?: (data: {
|
|
19
|
+
jobId: string;
|
|
20
|
+
}) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface VerificationOutcome {
|
|
23
|
+
/**
|
|
24
|
+
* - `"submitted"` — Documents received by backend. Verification result arrives via webhook.
|
|
25
|
+
* - `"cancelled"` — User closed the modal before submitting.
|
|
26
|
+
* - `"error"` — Upload or submission failed.
|
|
27
|
+
*/
|
|
28
|
+
status: "submitted" | "cancelled" | "error";
|
|
29
|
+
/** Present on `"submitted"` — the verification job ID for tracking via webhooks. */
|
|
30
|
+
jobId?: string;
|
|
31
|
+
/** Present on `"cancelled"` and `"error"`. */
|
|
32
|
+
error?: Error;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Opens the KwikID verification modal programmatically.
|
|
36
|
+
*
|
|
37
|
+
* Injects the modal at `document.body` — zero impact on your page layout.
|
|
38
|
+
* Works from React, Vue, Angular, or plain JavaScript.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const { status, jobId } = await openKwikVerification({
|
|
43
|
+
* clientSecret,
|
|
44
|
+
* appName: "My App",
|
|
45
|
+
* onSubmitted: ({ jobId }) => saveJobId(jobId),
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* if (status === "submitted") {
|
|
49
|
+
* // Documents received. Outcome arrives via webhook.
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function openKwikVerification(options: OpenVerificationOptions): Promise<VerificationOutcome>;
|
|
54
|
+
//# sourceMappingURL=open-kwik-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-kwik-verification.d.ts","sourceRoot":"","sources":["../src/open-kwik-verification.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAU1D,MAAM,WAAW,uBAAuB;IACpC,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACnD;AAED,MAAM,WAAW,mBAAmB;IAChC;;;;OAIG;IACH,MAAM,EAAE,WAAW,GAAG,WAAW,GAAG,OAAO,CAAC;IAC5C,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,oBAAoB,CACtC,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAoD9B"}
|
package/dist/views/kwik-id.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KwikIDConfig } from '../../../types/src
|
|
1
|
+
import { KwikIDConfig } from '../../../types/src';
|
|
2
2
|
interface KwikIDProps {
|
|
3
3
|
config: KwikIDConfig;
|
|
4
4
|
}
|
|
@@ -46,5 +46,5 @@ interface KwikIDProps {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
export declare const KwikID: React.FC<KwikIDProps>;
|
|
49
|
-
export type { KwikIDConfig, KwikIDTheme } from '../../../types/src
|
|
49
|
+
export type { KwikIDConfig, KwikIDTheme } from '../../../types/src';
|
|
50
50
|
//# sourceMappingURL=kwik-id.d.ts.map
|
package/dist/views/kyc-form.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Renders the KYC verification modal as a portal at document.body.
|
|
3
|
+
* Injects nothing into the host page layout — the modal floats above everything.
|
|
4
|
+
* The host controls visibility by mounting/unmounting <KwikID>.
|
|
5
|
+
*/
|
|
6
|
+
export declare function KYCForm(): import('react').ReactPortal | null;
|
|
2
7
|
//# sourceMappingURL=kyc-form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kyc-form.d.ts","sourceRoot":"","sources":["../../src/views/kyc-form.tsx"],"names":[],"mappings":"AAQA,wBAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"kyc-form.d.ts","sourceRoot":"","sources":["../../src/views/kyc-form.tsx"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,wBAAgB,OAAO,uCAqBtB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KYCFormData } from '../../../types/src
|
|
1
|
+
import { KYCFormData } from '../../../types/src';
|
|
2
2
|
export type SubStep = "consent" | "intro" | "handoff-choice" | "handoff-waiting" | "document-type" | "prepare-front" | "camera-front" | "confirm-front" | "prepare-back" | "camera-back" | "confirm-back" | "prepare-selfie" | "camera-selfie" | "confirm-selfie" | "processing" | "result";
|
|
3
3
|
interface KYCModalFlowProps {
|
|
4
4
|
isOpen: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kyc-modal-flow.d.ts","sourceRoot":"","sources":["../../src/views/kyc-modal-flow.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGH,WAAW,EAGd,MAAM,gBAAgB,CAAC;AAoBxB,MAAM,MAAM,OAAO,GACb,SAAS,GACT,OAAO,GACP,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,cAAc,GACd,eAAe,GACf,cAAc,GACd,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,YAAY,GACZ,QAAQ,CAAC;AAEf,UAAU,iBAAiB;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"kyc-modal-flow.d.ts","sourceRoot":"","sources":["../../src/views/kyc-modal-flow.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGH,WAAW,EAGd,MAAM,gBAAgB,CAAC;AAoBxB,MAAM,MAAM,OAAO,GACb,SAAS,GACT,OAAO,GACP,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,cAAc,GACd,eAAe,GACf,cAAc,GACd,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,YAAY,GACZ,QAAQ,CAAC;AAEf,UAAU,iBAAiB;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,iBAAiB,2CAumB9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-capture.d.ts","sourceRoot":"","sources":["../../../src/views/kyc-substeps/camera-capture.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"camera-capture.d.ts","sourceRoot":"","sources":["../../../src/views/kyc-substeps/camera-capture.tsx"],"names":[],"mappings":"AAQA,KAAK,WAAW,GAAG,gBAAgB,GAAG,eAAe,GAAG,QAAQ,CAAC;AACjE,KAAK,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC;AAEpF,UAAU,kBAAkB;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAcD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAkoB9E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kwik-id/sdk-react",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -25,10 +25,7 @@
|
|
|
25
25
|
"lottie-react": ">=2.4.0",
|
|
26
26
|
"lucide-react": ">=0.300.0",
|
|
27
27
|
"react": ">=18.0.0",
|
|
28
|
-
"react-dom": ">=18.0.0"
|
|
29
|
-
"@kwik-id/shared-ui": "0.0.1",
|
|
30
|
-
"@kwik-id/types": "0.0.1",
|
|
31
|
-
"@kwik-id/utils": "0.0.1"
|
|
28
|
+
"react-dom": ">=18.0.0"
|
|
32
29
|
},
|
|
33
30
|
"dependencies": {
|
|
34
31
|
"compressorjs": "^1.2.1",
|
|
@@ -36,7 +33,10 @@
|
|
|
36
33
|
},
|
|
37
34
|
"devDependencies": {
|
|
38
35
|
"@types/qrcode": "^1.5.6",
|
|
39
|
-
"@kwik-id/
|
|
36
|
+
"@kwik-id/shared-ui": "0.0.1",
|
|
37
|
+
"@kwik-id/types": "0.0.1",
|
|
38
|
+
"@kwik-id/sdk-core": "0.0.1",
|
|
39
|
+
"@kwik-id/utils": "0.0.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "vite build",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(){"use strict";function h(t){let a=0;const r=t.length/4;for(let c=0;c<t.length;c+=4)a+=.299*t[c]+.587*t[c+1]+.114*t[c+2];const e=a/r,o=Math.min(100,e/255*100);return e<50?{score:o,isAcceptable:!1,message:"Image is too dark. Please ensure better lighting."}:e>220?{score:o,isAcceptable:!1,message:"Image is too bright. Please reduce exposure or lighting."}:{score:o,isAcceptable:!0}}function A(t,a,r){const e=new Float32Array(a*r);for(let s=0;s<t.length;s+=4)e[s/4]=.299*t[s]+.587*t[s+1]+.114*t[s+2];let o=0,c=0,l=0;for(let s=1;s<r-1;s++)for(let m=1;m<a-1;m++){const f=s*a+m,g=e[f-a]+e[f-1]-4*e[f]+e[f+1]+e[f+a];o+=g,c+=g*g,l++}const i=o/l,n=c/l-i*i,u=Math.min(100,n/500*100);return n<0?{score:u,isAcceptable:!1,message:"Image is too blurry. Please hold the camera steady."}:{score:u,isAcceptable:!0}}self.onmessage=async t=>{const{id:a,type:r}=t.data;if(r==="analyze-quality"){const{buffer:e,width:o,height:c}=t.data,l=new Uint8ClampedArray(e),i=h(l),n=A(l,o,c),u={score:(i.score+n.score)/2,isAcceptable:i.isAcceptable&&n.isAcceptable,message:i.isAcceptable?n.isAcceptable?void 0:n.message:i.message};self.postMessage({id:a,luminance:i,blur:n,overall:u});return}if(r==="compress"){const{bitmap:e,maxSizeKB:o,quality:c,maxWidth:l,maxHeight:i}=t.data;if(typeof OffscreenCanvas>"u"){self.postMessage({id:a,fallback:!0}),e.close();return}const n=Math.min(e.width,l??1920),u=Math.min(e.height,i??1920),s=new OffscreenCanvas(n,u);s.getContext("2d").drawImage(e,0,0,n,u),e.close();const f=(o??500)*1024;let g=c??.8,p=await s.convertToBlob({type:"image/jpeg",quality:g}),b=0;for(;p.size>f&&b<5;)g*=.8,p=await s.convertToBlob({type:"image/jpeg",quality:g}),b++;const y=await p.arrayBuffer();self.postMessage({id:a,buffer:y},[y])}}})();
|