@idmission/websdk-ui 0.2.0-rc.2 → 0.2.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 +135 -56
- package/dist/DocumentCaptureView.d.ts +37 -0
- package/dist/DocumentCaptureView.d.ts.map +1 -1
- package/dist/DocumentCaptureView.js +489 -6
- package/dist/FaceLivenessView.d.ts +1 -1
- package/dist/FaceLivenessView.d.ts.map +1 -1
- package/dist/FaceLivenessView.js +37 -29
- package/dist/IdCaptureView.d.ts +6 -5
- package/dist/IdCaptureView.d.ts.map +1 -1
- package/dist/IdCaptureView.js +52 -12
- package/dist/SelfieCaptureView.d.ts +1 -1
- package/dist/SelfieCaptureView.d.ts.map +1 -1
- package/dist/SelfieCaptureView.js +6 -3
- package/dist/SignatureCaptureView.d.ts +9 -1
- package/dist/SignatureCaptureView.d.ts.map +1 -1
- package/dist/SignatureCaptureView.js +51 -10
- package/dist/VideoIdCaptureView.d.ts +1 -1
- package/dist/VideoIdCaptureView.d.ts.map +1 -1
- package/dist/VideoIdCaptureView.js +24 -4
- package/dist/components/CameraFeed.d.ts +11 -3
- package/dist/components/CameraFeed.d.ts.map +1 -1
- package/dist/components/CameraFeed.js +24 -4
- package/dist/components/barcode/BarcodeGuideOverlay.d.ts +7 -1
- package/dist/components/barcode/BarcodeGuideOverlay.d.ts.map +1 -1
- package/dist/components/barcode/BarcodeGuideOverlay.js +2 -2
- package/dist/components/debug/debug.d.ts +4 -4
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts +29 -0
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.js +274 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts +56 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.js +101 -0
- package/dist/components/document/DocumentCaptureGuideOverlay.d.ts +31 -1
- package/dist/components/document/DocumentCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/document/DocumentCaptureGuideOverlay.js +121 -2
- package/dist/components/document/DocumentCaptureReviewScreen.d.ts +44 -0
- package/dist/components/document/DocumentCaptureReviewScreen.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureReviewScreen.js +40 -0
- package/dist/components/document/types.d.ts +25 -0
- package/dist/components/document/types.d.ts.map +1 -1
- package/dist/components/document/types.js +18 -1
- package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuides.js +3 -4
- package/dist/components/review/ReviewScreen.d.ts.map +1 -1
- package/dist/components/review/ReviewScreen.js +1 -1
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts +50 -0
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -0
- package/dist/components/review/SignatureCaptureDiagnostics.js +142 -0
- package/dist/components/selfie/SelfieCaptureSurface.d.ts +11 -2
- package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
- package/dist/components/selfie/SelfieCaptureSurface.js +5 -2
- package/dist/components/videoId/VideoIdCaptureGuides.d.ts +4 -1
- package/dist/components/videoId/VideoIdCaptureGuides.d.ts.map +1 -1
- package/dist/components/videoId/VideoIdCaptureGuides.js +2 -2
- package/dist/flows/CompositeWizard.d.ts +5 -0
- package/dist/flows/CompositeWizard.d.ts.map +1 -1
- package/dist/flows/CompositeWizard.js +2 -1
- package/dist/flows/DocumentCaptureFlow.d.ts +1 -1
- package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
- package/dist/flows/DocumentCaptureFlow.js +6 -6
- package/dist/flows/SubmissionProvider.d.ts.map +1 -1
- package/dist/flows/SubmissionProvider.js +2 -4
- package/dist/flows/approval.d.ts +15 -0
- package/dist/flows/approval.d.ts.map +1 -0
- package/dist/flows/approval.js +19 -0
- package/dist/flows/autoCaptureMountGuard.d.ts +22 -0
- package/dist/flows/autoCaptureMountGuard.d.ts.map +1 -0
- package/dist/flows/autoCaptureMountGuard.js +61 -0
- package/dist/flows/ringScreens.d.ts +0 -3
- package/dist/flows/ringScreens.d.ts.map +1 -1
- package/dist/flows/ringScreens.js +2 -3
- package/dist/guidance/selfieStrings.d.ts +9 -1
- package/dist/guidance/selfieStrings.d.ts.map +1 -1
- package/dist/guidance/selfieStrings.js +59 -20
- package/dist/i18n/index.d.ts +28 -1177
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +58 -22
- package/dist/i18n/locales/threeOh.d.ts +4 -0
- package/dist/i18n/locales/threeOh.d.ts.map +1 -0
- package/dist/i18n/locales/threeOh.js +105 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/testing/autoCaptureFrames.d.ts +23 -0
- package/dist/testing/autoCaptureFrames.d.ts.map +1 -0
- package/dist/testing/autoCaptureFrames.js +187 -0
- package/dist/testing/fakeDocumentController.d.ts +7 -1
- package/dist/testing/fakeDocumentController.d.ts.map +1 -1
- package/dist/testing/fakeDocumentController.js +10 -2
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -0
- package/dist/useIdmissionClient.d.ts +29 -0
- package/dist/useIdmissionClient.d.ts.map +1 -0
- package/dist/useIdmissionClient.js +44 -0
- package/dist/utils/canvas.d.ts.map +1 -1
- package/dist/utils/canvas.js +41 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type IdmissionClient, type IdmissionClientConfig } from '@idmission/websdk-core/client';
|
|
2
|
+
type ClientMountOptions = Pick<IdmissionClientConfig, 'authUrl' | 'submissionUrl' | 'documentServiceUrl' | 'timeoutMs'>;
|
|
3
|
+
type ClientCallbackOptions = Pick<IdmissionClientConfig, 'onBeforeSubmit' | 'onSubmit' | 'onBeforeLivenessCheck' | 'onResponseReceived' | 'onRequestFailure' | 'onBeforeDocumentUpload' | 'onDocumentUploadProgress' | 'onDocumentUploaded' | 'onDocumentUploadFailed' | 'onAuthError'>;
|
|
4
|
+
export type IdmissionClientSession = IdmissionClientConfig['sessionId'] | null | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* React-owned client configuration.
|
|
7
|
+
*
|
|
8
|
+
* `sessionId` is live and may arrive after the first render. It is read when
|
|
9
|
+
* validation or retry resolves a session; changing it does not silently
|
|
10
|
+
* replace an already validated session. The URL and timeout fields are
|
|
11
|
+
* mount-only. Callback presence is also mount-only, while every callback
|
|
12
|
+
* supplied at mount delegates to its latest committed defined implementation.
|
|
13
|
+
*
|
|
14
|
+
* Remount the hook owner with a React `key` to intentionally replace the
|
|
15
|
+
* client or change any mount-only field. In particular, adding or removing
|
|
16
|
+
* `onSubmit` requires a remount because its presence selects customer handoff
|
|
17
|
+
* versus SDK submission.
|
|
18
|
+
*/
|
|
19
|
+
export type UseIdmissionClientOptions = ClientMountOptions & ClientCallbackOptions & {
|
|
20
|
+
sessionId: IdmissionClientSession;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Owns one stateful IDmission client for the lifetime of this React mount.
|
|
24
|
+
* Inline options are safe; consumers do not need `useMemo`, `useCallback`, or
|
|
25
|
+
* callback refs to preserve the client or keep its live values current.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useIdmissionClient(options: UseIdmissionClientOptions): IdmissionClient;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=useIdmissionClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIdmissionClient.d.ts","sourceRoot":"","sources":["../src/useIdmissionClient.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,+BAA+B,CAAA;AAKtC,KAAK,kBAAkB,GAAG,IAAI,CAC5B,qBAAqB,EACrB,SAAS,GAAG,eAAe,GAAG,oBAAoB,GAAG,WAAW,CACjE,CAAA;AAED,KAAK,qBAAqB,GAAG,IAAI,CAC/B,qBAAqB,EACnB,gBAAgB,GAChB,UAAU,GACV,uBAAuB,GACvB,oBAAoB,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,0BAA0B,GAC1B,oBAAoB,GACpB,wBAAwB,GACxB,aAAa,CAChB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,CAAA;AAE1F;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,GACxD,qBAAqB,GAAG;IACtB,SAAS,EAAE,sBAAsB,CAAA;CAClC,CAAA;AAEH;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,eAAe,CAuCtF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { createIdmissionClient, } from '@idmission/websdk-core/client';
|
|
3
|
+
import { withLatestCallbacks } from './flows/latestCallbacks';
|
|
4
|
+
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
5
|
+
/**
|
|
6
|
+
* Owns one stateful IDmission client for the lifetime of this React mount.
|
|
7
|
+
* Inline options are safe; consumers do not need `useMemo`, `useCallback`, or
|
|
8
|
+
* callback refs to preserve the client or keep its live values current.
|
|
9
|
+
*/
|
|
10
|
+
export function useIdmissionClient(options) {
|
|
11
|
+
const committedSession = useRef(options.sessionId);
|
|
12
|
+
const committedCallbacks = useRef(options);
|
|
13
|
+
useIsomorphicLayoutEffect(() => {
|
|
14
|
+
committedSession.current = options.sessionId;
|
|
15
|
+
committedCallbacks.current = {
|
|
16
|
+
onBeforeSubmit: options.onBeforeSubmit ?? committedCallbacks.current.onBeforeSubmit,
|
|
17
|
+
onSubmit: options.onSubmit ?? committedCallbacks.current.onSubmit,
|
|
18
|
+
onBeforeLivenessCheck: options.onBeforeLivenessCheck ?? committedCallbacks.current.onBeforeLivenessCheck,
|
|
19
|
+
onResponseReceived: options.onResponseReceived ?? committedCallbacks.current.onResponseReceived,
|
|
20
|
+
onRequestFailure: options.onRequestFailure ?? committedCallbacks.current.onRequestFailure,
|
|
21
|
+
onBeforeDocumentUpload: options.onBeforeDocumentUpload ?? committedCallbacks.current.onBeforeDocumentUpload,
|
|
22
|
+
onDocumentUploadProgress: options.onDocumentUploadProgress ?? committedCallbacks.current.onDocumentUploadProgress,
|
|
23
|
+
onDocumentUploaded: options.onDocumentUploaded ?? committedCallbacks.current.onDocumentUploaded,
|
|
24
|
+
onDocumentUploadFailed: options.onDocumentUploadFailed ?? committedCallbacks.current.onDocumentUploadFailed,
|
|
25
|
+
onAuthError: options.onAuthError ?? committedCallbacks.current.onAuthError,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
return useState(() => {
|
|
29
|
+
const mountedCallbacks = options;
|
|
30
|
+
const liveCallbacks = withLatestCallbacks(mountedCallbacks, () => committedCallbacks.current);
|
|
31
|
+
return createIdmissionClient({
|
|
32
|
+
...options,
|
|
33
|
+
...liveCallbacks,
|
|
34
|
+
sessionId: async () => {
|
|
35
|
+
const session = committedSession.current;
|
|
36
|
+
if (typeof session === 'function')
|
|
37
|
+
return session();
|
|
38
|
+
if (!session)
|
|
39
|
+
throw new Error('IDmission session is not ready');
|
|
40
|
+
return session;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
})[0];
|
|
44
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/utils/canvas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/utils/canvas.ts"],"names":[],"mappings":"AAkCA,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QAoBf;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,QAK9D"}
|
package/dist/utils/canvas.js
CHANGED
|
@@ -1,7 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ceilings on a guide-overlay backing store.
|
|
3
|
+
*
|
|
4
|
+
* Both are SAFETY RAILS rather than quality settings. Every caller of this
|
|
5
|
+
* helper is a guide overlay — `DocumentCaptureGuideOverlay`,
|
|
6
|
+
* `IdCaptureFitGuide` and `BarcodeGuideOverlay` — which draw a flat scrim and
|
|
7
|
+
* some thin lines. None carries user-drawn content: `SignatureCaptureView`
|
|
8
|
+
* sizes its pad through its own state setter that happens to share this
|
|
9
|
+
* function's name, and pen strokes are exactly the content that would suffer
|
|
10
|
+
* from a lower resolution.
|
|
11
|
+
*
|
|
12
|
+
* `MAX_PIXEL_RATIO` — a scrim and a 3px bracket gain nothing above 2, and a
|
|
13
|
+
* phone at ratio 3 pays 2.25x the memory for it.
|
|
14
|
+
*
|
|
15
|
+
* `MAX_CANVAS_PIXELS` — a backstop for the requested SIZE running away, which
|
|
16
|
+
* is the failure that prompted this. The size comes from a ResizeObserver, and
|
|
17
|
+
* a pinch zoom on iOS can grow the observed element; the backing store then
|
|
18
|
+
* grows with the SQUARE of the zoom:
|
|
19
|
+
*
|
|
20
|
+
* 390x700 overlay at ratio 3 -> 9 MB unzoomed
|
|
21
|
+
* -> 37 MB at 2x
|
|
22
|
+
* -> 84 MB at 3x
|
|
23
|
+
*
|
|
24
|
+
* which is enough for iOS to kill the tab. It surfaces as the whole page hard-
|
|
25
|
+
* reloading the moment the applicant pinches to look at something — reported
|
|
26
|
+
* on document capture, and equally reachable on ID capture and barcode, which
|
|
27
|
+
* mount the same kind of full-surface observed canvas.
|
|
28
|
+
*
|
|
29
|
+
* Neither ceiling engages on a normal layout: a phone overlay wants 1.1 Mpx
|
|
30
|
+
* and a 1920x1080 desktop at ratio 2 wants 8.3 Mpx.
|
|
31
|
+
*/
|
|
32
|
+
const MAX_PIXEL_RATIO = 2;
|
|
33
|
+
const MAX_CANVAS_PIXELS = 12_000_000;
|
|
1
34
|
export function setCanvasDimensions(canvas, width, height) {
|
|
2
35
|
let devicePixelRatio = 1;
|
|
3
36
|
if (typeof window !== 'undefined')
|
|
4
37
|
devicePixelRatio = window.devicePixelRatio;
|
|
38
|
+
devicePixelRatio = Math.min(devicePixelRatio, MAX_PIXEL_RATIO);
|
|
39
|
+
// Give way on RESOLUTION, never on the CSS box: the canvas has to keep
|
|
40
|
+
// covering the element it was measured from, or the mask stops reaching the
|
|
41
|
+
// edges it is masking.
|
|
42
|
+
const requested = width * height * devicePixelRatio * devicePixelRatio;
|
|
43
|
+
if (requested > MAX_CANVAS_PIXELS && width > 0 && height > 0) {
|
|
44
|
+
devicePixelRatio = Math.sqrt(MAX_CANVAS_PIXELS / (width * height));
|
|
45
|
+
}
|
|
5
46
|
canvas.width = width * devicePixelRatio;
|
|
6
47
|
canvas.height = height * devicePixelRatio;
|
|
7
48
|
canvas.style.width = width + 'px';
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const webSdkUiVersion = "0.2.0
|
|
1
|
+
export declare const webSdkUiVersion = "0.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,UAAU,CAAA"}
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idmission/websdk-ui",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React presentation layer for the IDmission Web SDK",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"react-i18next": "^13.5.0",
|
|
41
41
|
"signature_pad": "^5.1.4",
|
|
42
42
|
"thinking-orbs": "0.1.1",
|
|
43
|
-
"@idmission/websdk-core": "0.2.0
|
|
43
|
+
"@idmission/websdk-core": "0.2.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@testing-library/react": "^16.3.0",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
62
62
|
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
63
63
|
"check-readme": "mkdir -p .readme-check/node_modules/@idmission && ln -sfn ../../../.. .readme-check/node_modules/@idmission/websdk-ui && tsc --noEmit -p .readme-check/tsconfig.json",
|
|
64
|
+
"check-migration-guide": "node --test .migration-check/checkGuide.test.mjs && node .migration-check/checkGuide.mjs MIGRATION_FROM_COMPAT.md .migration-check/before .migration-check/after && tsc --noEmit -p .migration-check/tsconfig.json",
|
|
64
65
|
"check-types": "tsc --noEmit",
|
|
65
66
|
"lint": "eslint --max-warnings 0",
|
|
66
67
|
"test": "node --import tsx --import ./test/setup.ts --test 'src/**/*.test.ts' 'src/**/*.test.tsx'"
|