@idmission/websdk-ui 0.1.0-rc.1 → 0.1.0-rc.2
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/dist/IdCaptureView.d.ts +38 -1
- package/dist/IdCaptureView.d.ts.map +1 -1
- package/dist/IdCaptureView.js +3 -3
- package/dist/SignatureCaptureView.d.ts +9 -5
- package/dist/SignatureCaptureView.d.ts.map +1 -1
- package/dist/SignatureCaptureView.js +51 -28
- package/dist/components/GuidanceMessage.d.ts +25 -1
- package/dist/components/GuidanceMessage.d.ts.map +1 -1
- package/dist/components/GuidanceMessage.js +37 -0
- package/dist/components/error/CameraAccessDeniedOverlay.d.ts +12 -1
- package/dist/components/error/CameraAccessDeniedOverlay.d.ts.map +1 -1
- package/dist/components/error/CameraAccessDeniedOverlay.js +15 -2
- package/dist/components/error/ErrorScreen.d.ts.map +1 -1
- package/dist/components/error/ErrorScreen.js +72 -57
- package/dist/components/guides/IdCaptureFitGuide.d.ts +13 -1
- package/dist/components/guides/IdCaptureFitGuide.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureFitGuide.js +27 -11
- package/dist/components/guides/IdCaptureGuides.d.ts +8 -1
- package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuides.js +2 -2
- package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
- package/dist/flows/DocumentCaptureFlow.js +2 -0
- package/dist/flows/SignatureKYCFlow.d.ts +19 -1
- package/dist/flows/SignatureKYCFlow.d.ts.map +1 -1
- package/dist/flows/SignatureKYCFlow.js +30 -0
- package/dist/flows/documentCapture.d.ts.map +1 -1
- package/dist/flows/documentCapture.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/layout/GuideLayoutContext.d.ts +11 -0
- package/dist/layout/GuideLayoutContext.d.ts.map +1 -1
- package/dist/layout/GuideLayoutContext.js +24 -3
- package/dist/testing/stubSignatureCanvas.d.ts.map +1 -1
- package/dist/testing/stubSignatureCanvas.js +3 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -8
- package/dist/utils/signaturePadStrokeGuard.d.ts +0 -16
- package/dist/utils/signaturePadStrokeGuard.d.ts.map +0 -1
- package/dist/utils/signaturePadStrokeGuard.js +0 -70
|
@@ -5,31 +5,7 @@ import { FlexCard } from '../common/Card';
|
|
|
5
5
|
import { useTranslations } from '../../i18n';
|
|
6
6
|
import { CameraAccessDeniedOverlay, } from './CameraAccessDeniedOverlay';
|
|
7
7
|
export const ErrorScreen = ({ error, onRetry, onExit, verbiage: rawVerbiage = {}, classNames = {}, cameraAccessDenied = {}, }) => {
|
|
8
|
-
|
|
9
|
-
// one camera-failure screen carried one verbiage bag as well as one class
|
|
10
|
-
// bag, and only the classes followed the split — so an integrator who had
|
|
11
|
-
// relabelled the denied screen ("Camera permission is required", their own
|
|
12
|
-
// button text) still got our stock English the moment the failure was
|
|
13
|
-
// "in use by another application" instead. Two screens, one of them
|
|
14
|
-
// unbrandable, which reads as the SDK ignoring them.
|
|
15
|
-
//
|
|
16
|
-
// `rawVerbiage` wins: a host that names the 3.0 key directly means it.
|
|
17
|
-
// `retryText` is shared with the model-load and submission screens, so
|
|
18
|
-
// unlike the other two it is only substituted for the camera error.
|
|
19
|
-
const denied = cameraAccessDenied.verbiage;
|
|
20
|
-
const isCameraUnavailable = error.code === 'CAMERA_UNAVAILABLE';
|
|
21
|
-
// Annotated rather than inferred: writing these three keys explicitly would
|
|
22
|
-
// otherwise make them REQUIRED in the inferred bag while the spread keys
|
|
23
|
-
// stay optional, and `getErrorContent` derives one return type from a key
|
|
24
|
-
// of each group.
|
|
25
|
-
const merged = {
|
|
26
|
-
...rawVerbiage,
|
|
27
|
-
cameraUnavailableHeadingText: rawVerbiage.cameraUnavailableHeadingText ?? denied?.headingText,
|
|
28
|
-
cameraUnavailableDescriptionText: rawVerbiage.cameraUnavailableDescriptionText ?? denied?.descriptionText,
|
|
29
|
-
retryText: rawVerbiage.retryText ??
|
|
30
|
-
(isCameraUnavailable ? denied?.retryBtnText : undefined),
|
|
31
|
-
};
|
|
32
|
-
const verbiage = useTranslations(merged, {
|
|
8
|
+
const verbiage = useTranslations(rawVerbiage, {
|
|
33
9
|
cameraUnavailableHeadingText: 'Unable to access your camera',
|
|
34
10
|
cameraUnavailableDescriptionText: 'Please make sure a camera is available and not in use by another application, then retry.',
|
|
35
11
|
cameraTamperingSuspectedHeadingText: 'Camera check failed',
|
|
@@ -41,8 +17,42 @@ export const ErrorScreen = ({ error, onRetry, onExit, verbiage: rawVerbiage = {}
|
|
|
41
17
|
retryText: 'Retry',
|
|
42
18
|
exitText: 'Exit',
|
|
43
19
|
});
|
|
44
|
-
|
|
45
|
-
|
|
20
|
+
// `CAMERA_UNAVAILABLE` is a 2.x CAMERA-DENIED screen wearing a new name.
|
|
21
|
+
//
|
|
22
|
+
// sdk2 had ONE camera-failure screen: its camera store set
|
|
23
|
+
// `cameraAccessDenied: true` for a `NotAllowedError` (permission), for
|
|
24
|
+
// "Could not start video source" (the camera is in use by another app) AND
|
|
25
|
+
// for an unplugged webcam (lib/camera/cameraStore.tsx:278,336,388) — all
|
|
26
|
+
// three rendering `CameraAccessDeniedOverlay`, styled and worded through
|
|
27
|
+
// `loadingOverlay.cameraAccessDenied`.
|
|
28
|
+
//
|
|
29
|
+
// 3.0 split them by code, and the unavailable half got a different SCREEN,
|
|
30
|
+
// not just different copy: a white `FlexCard` with no image. So a customer
|
|
31
|
+
// who had styled the denied screen watched half their classes evaporate the
|
|
32
|
+
// moment the failure was "in use" or "unplugged" — `imageContainer` and
|
|
33
|
+
// `image` had no element to land on at all, and the card underneath them
|
|
34
|
+
// has no 2.x key to reach it with. Both codes render the port again here;
|
|
35
|
+
// only the stock copy differs.
|
|
36
|
+
if (error.code === 'CAMERA_PERMISSION_DENIED' ||
|
|
37
|
+
error.code === 'CAMERA_UNAVAILABLE') {
|
|
38
|
+
const unavailable = error.code === 'CAMERA_UNAVAILABLE';
|
|
39
|
+
const denied = cameraAccessDenied.verbiage;
|
|
40
|
+
return (_jsx(CameraAccessDeniedOverlay, { onRetry: onRetry, assets: cameraAccessDenied.assets, classNames: unavailable
|
|
41
|
+
? cameraFailureClassNames(classNames, cameraAccessDenied.classNames)
|
|
42
|
+
: cameraAccessDenied.classNames, colors: cameraAccessDenied.colors,
|
|
43
|
+
// `rawVerbiage` wins: a host that names the 3.0 key directly means it.
|
|
44
|
+
// `retryText` is shared with the model-load and submission screens, so
|
|
45
|
+
// unlike the other two it is only substituted for the camera error —
|
|
46
|
+
// which this branch already is.
|
|
47
|
+
verbiage: unavailable
|
|
48
|
+
? {
|
|
49
|
+
headingText: rawVerbiage.cameraUnavailableHeadingText ??
|
|
50
|
+
denied?.headingText,
|
|
51
|
+
descriptionText: rawVerbiage.cameraUnavailableDescriptionText ??
|
|
52
|
+
denied?.descriptionText,
|
|
53
|
+
retryBtnText: rawVerbiage.retryText ?? denied?.retryBtnText,
|
|
54
|
+
}
|
|
55
|
+
: denied, variant: unavailable ? 'unavailable' : 'permissionDenied' }));
|
|
46
56
|
}
|
|
47
57
|
// Closes over `verbiage` above (rather than taking it as a parameter) so
|
|
48
58
|
// its resolved-value type — `string | ReactElement` per key, inferred
|
|
@@ -57,29 +67,27 @@ export const ErrorScreen = ({ error, onRetry, onExit, verbiage: rawVerbiage = {}
|
|
|
57
67
|
// `CaptureError`. TypeScript cannot narrow that literal-union PROPERTY away
|
|
58
68
|
// from an already-narrowed OUTER union at the `getErrorContent(error)` call
|
|
59
69
|
// site below (verified: it keeps reporting the full, unnarrowed
|
|
60
|
-
// `SelfieCaptureFlowError` there even after the
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
// combined union. `SelfieCaptureFlowError` is accepted here WHOLE instead,
|
|
70
|
+
// `SelfieCaptureFlowError` there even after the two-camera-code early return
|
|
71
|
+
// above) — so `Exclude`-ing 'CAMERA_PERMISSION_DENIED' out of the parameter
|
|
72
|
+
// type, the way this already worked for `CaptureError` alone, doesn't
|
|
73
|
+
// type-check for the combined union. `SelfieCaptureFlowError` is accepted here WHOLE instead,
|
|
65
74
|
// with a `case 'CAMERA_PERMISSION_DENIED'` added below purely to keep the
|
|
66
75
|
// switch exhaustive over it — that branch is unreachable in practice
|
|
67
76
|
// (the early return above always wins first for that code, on both error
|
|
68
77
|
// types) and its content is never seen.
|
|
69
78
|
const getErrorContent = (error) => {
|
|
70
79
|
switch (error.code) {
|
|
80
|
+
// Both camera codes return above, on both error types — these two cases
|
|
81
|
+
// exist only to keep the switch exhaustive, and their content is never
|
|
82
|
+
// seen. (`CAMERA_UNAVAILABLE` is `recoverable: true` at every
|
|
83
|
+
// construction site in core, and `CaptureError` pins the literal, so the
|
|
84
|
+
// shared screen's always-rendered Retry button loses nothing.)
|
|
71
85
|
case 'CAMERA_PERMISSION_DENIED':
|
|
72
|
-
// Unreachable — see comment above.
|
|
73
|
-
return {
|
|
74
|
-
heading: verbiage.cameraUnavailableHeadingText,
|
|
75
|
-
description: verbiage.cameraUnavailableDescriptionText,
|
|
76
|
-
canRetry: true,
|
|
77
|
-
};
|
|
78
86
|
case 'CAMERA_UNAVAILABLE':
|
|
79
87
|
return {
|
|
80
88
|
heading: verbiage.cameraUnavailableHeadingText,
|
|
81
89
|
description: verbiage.cameraUnavailableDescriptionText,
|
|
82
|
-
canRetry:
|
|
90
|
+
canRetry: true,
|
|
83
91
|
};
|
|
84
92
|
case 'CAMERA_TAMPERING_SUSPECTED':
|
|
85
93
|
return {
|
|
@@ -110,25 +118,32 @@ export const ErrorScreen = ({ error, onRetry, onExit, verbiage: rawVerbiage = {}
|
|
|
110
118
|
}
|
|
111
119
|
};
|
|
112
120
|
const { heading, description, canRetry } = getErrorContent(error);
|
|
113
|
-
|
|
114
|
-
//
|
|
115
|
-
// sdk2 had ONE camera-failure screen: its camera store set
|
|
116
|
-
// `cameraAccessDenied: true` for a `NotAllowedError` (permission), for
|
|
117
|
-
// "Could not start video source" (the camera is in use by another app) AND
|
|
118
|
-
// for an unplugged webcam (lib/camera/cameraStore.tsx:278,336,388) — all
|
|
119
|
-
// three rendering `CameraAccessDeniedOverlay`, styled through
|
|
120
|
-
// `loadingOverlay.cameraAccessDenied`.
|
|
121
|
-
//
|
|
122
|
-
// 3.0 splits them by code, and only the permission branch above kept that
|
|
123
|
-
// bag. So a customer who styled the denied screen watched their classes
|
|
124
|
-
// vanish the moment the failure was "in use" or "unplugged" instead — the
|
|
125
|
-
// same silent drop as the 2.4.73 reports, one error code over. The seal-fed
|
|
126
|
-
// `classNames` still wins where both name a part; this only fills the gaps.
|
|
127
|
-
const cameraClassNames = error.code === 'CAMERA_UNAVAILABLE'
|
|
128
|
-
? cameraAccessDenied.classNames
|
|
129
|
-
: undefined;
|
|
130
|
-
return (_jsx(GrayOverlayContainer, { className: classNames.container ?? cameraClassNames?.container, children: _jsx(OverlayInner, { className: classNames.inner ?? cameraClassNames?.inner, children: _jsxs(ErrorCard, { className: classNames.card, children: [_jsx(Heading, { className: classNames.heading ?? cameraClassNames?.heading, children: heading }), _jsx(Description, { className: classNames.description ?? cameraClassNames?.description, children: description }), canRetry && (_jsx(WideButton, { className: classNames.retryBtn ?? cameraClassNames?.retryBtn, variant: "warning", onClick: onRetry, finished: true, children: verbiage.retryText })), !canRetry && onExit && (_jsx(WideBorderButton, { className: classNames.exitBtn, variant: "secondary", onClick: onExit, finished: true, children: verbiage.exitText }))] }) }) }));
|
|
121
|
+
return (_jsx(GrayOverlayContainer, { className: classNames.container, children: _jsx(OverlayInner, { className: classNames.inner, children: _jsxs(ErrorCard, { className: classNames.card, children: [_jsx(Heading, { className: classNames.heading, children: heading }), _jsx(Description, { className: classNames.description, children: description }), canRetry && (_jsx(WideButton, { className: classNames.retryBtn, variant: "warning", onClick: onRetry, finished: true, children: verbiage.retryText })), !canRetry && onExit && (_jsx(WideBorderButton, { className: classNames.exitBtn, variant: "secondary", onClick: onExit, finished: true, children: verbiage.exitText }))] }) }) }));
|
|
131
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* Folds the ErrorScreen's own (seal-fed) classes into the 2.x camera-denied
|
|
125
|
+
* bag for the camera-UNAVAILABLE screen. The seal-fed one wins where both name
|
|
126
|
+
* a part — it is the more specific answer — and the bag keeps the parts only
|
|
127
|
+
* it has (`imageContainer`, `image`).
|
|
128
|
+
*
|
|
129
|
+
* Only that half folds. `classNames` is what compat feeds from 2.x's
|
|
130
|
+
* tamper-seal bag, and it reaches this screen only because compat targets the
|
|
131
|
+
* whole `ErrorScreen` with it. The permission screen was never an `ErrorScreen`
|
|
132
|
+
* render, so it has never worn those classes — and must not start now.
|
|
133
|
+
*
|
|
134
|
+
* `||`, not `??`: an empty class name is not a class name. A 2.x integrator
|
|
135
|
+
* writing `''` as a placeholder would otherwise blank the class the other bag
|
|
136
|
+
* supplied — see compat's `firstClass`, which strips them on the way in; this
|
|
137
|
+
* is the same rule at the point of use, so a direct 3.0 caller gets it too.
|
|
138
|
+
*/
|
|
139
|
+
const cameraFailureClassNames = (own, bag = {}) => ({
|
|
140
|
+
...bag,
|
|
141
|
+
container: own.container || bag.container,
|
|
142
|
+
inner: own.inner || bag.inner,
|
|
143
|
+
heading: own.heading || bag.heading,
|
|
144
|
+
description: own.description || bag.description,
|
|
145
|
+
retryBtn: own.retryBtn || bag.retryBtn,
|
|
146
|
+
});
|
|
132
147
|
// This screen pins a light surface (GrayOverlayContainer's #f7f6fb behind a
|
|
133
148
|
// white Card) whatever the theme says, but `OverlayContainer` still applies
|
|
134
149
|
// `color: ${theme.textColor}` — which dark 2.x themes set to white, rendering
|
|
@@ -13,6 +13,18 @@ export type IdCaptureFitGuideProps = {
|
|
|
13
13
|
borderColor?: string;
|
|
14
14
|
borderWidth?: number;
|
|
15
15
|
padding?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Upper bounds, in CSS pixels, on the guide rect the mask hole is cut from.
|
|
18
|
+
* Unset, the rect grows to fill the wrapper less `padding`/`borderWidth`,
|
|
19
|
+
* which on a desktop viewport means a card outline spanning nearly the whole
|
|
20
|
+
* screen. The aspect-ratio fit still applies afterwards, so capping one axis
|
|
21
|
+
* pulls the other in with it rather than distorting the card.
|
|
22
|
+
*
|
|
23
|
+
* Under `snapToGuides` the camera feed is clipped to this rect, so capping it
|
|
24
|
+
* caps the feed too.
|
|
25
|
+
*/
|
|
26
|
+
maxWidth?: number;
|
|
27
|
+
maxHeight?: number;
|
|
16
28
|
imageVisible?: boolean;
|
|
17
29
|
isMirrored?: boolean;
|
|
18
30
|
isBackToFront?: boolean;
|
|
@@ -47,5 +59,5 @@ export type IdCaptureFitGuideProps = {
|
|
|
47
59
|
images?: IdCaptureGuideImages;
|
|
48
60
|
classNames?: IdCaptureFitGuideClassNames;
|
|
49
61
|
};
|
|
50
|
-
export declare const IdCaptureFitGuide: ({ aspectRatio, maskColor, borderRadius, borderColor, borderWidth, padding, imageVisible, isMirrored, isBackToFront, portraitGuidesOnMobile, instruction, requestedAction, status, progress, guideBoxDisabled, guideBoxFollowsMask, cameraFeedMode, images, classNames, }: IdCaptureFitGuideProps) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export declare const IdCaptureFitGuide: ({ aspectRatio, maskColor, borderRadius, borderColor, borderWidth, padding, maxWidth, maxHeight, imageVisible, isMirrored, isBackToFront, portraitGuidesOnMobile, instruction, requestedAction, status, progress, guideBoxDisabled, guideBoxFollowsMask, cameraFeedMode, images, classNames, }: IdCaptureFitGuideProps) => import("react/jsx-runtime").JSX.Element;
|
|
51
63
|
//# sourceMappingURL=IdCaptureFitGuide.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdCaptureFitGuide.d.ts","sourceRoot":"","sources":["../../../src/components/guides/IdCaptureFitGuide.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAA;AAGvD,OAAO,EACL,oBAAoB,EAEpB,+BAA+B,EAChC,MAAM,yBAAy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CAAA;CACzC,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,+RAsB/B,sBAAsB,4CA4QxB,CAAA"}
|
|
@@ -35,7 +35,7 @@ import { defaultIdCaptureGuideImages } from '../guide_images';
|
|
|
35
35
|
import useResizeObserver from '../../layout/useResizeObserver';
|
|
36
36
|
import { useGuideOrientationContext } from '../../layout/GuideOrientationContext';
|
|
37
37
|
import { useGuideLayout } from '../../layout/GuideLayoutContext';
|
|
38
|
-
export const IdCaptureFitGuide = ({ aspectRatio, maskColor, borderRadius = 33, borderColor, borderWidth, padding, imageVisible, isMirrored = false, isBackToFront = false, portraitGuidesOnMobile = true, instruction, requestedAction = 'SHOW_ID_FRONT', status = 'ready', progress = 0, guideBoxDisabled = false, guideBoxFollowsMask = false, cameraFeedMode = 'snapToGuides', images = defaultIdCaptureGuideImages, classNames = {}, }) => {
|
|
38
|
+
export const IdCaptureFitGuide = ({ aspectRatio, maskColor, borderRadius = 33, borderColor, borderWidth, padding, maxWidth, maxHeight, imageVisible, isMirrored = false, isBackToFront = false, portraitGuidesOnMobile = true, instruction, requestedAction = 'SHOW_ID_FRONT', status = 'ready', progress = 0, guideBoxDisabled = false, guideBoxFollowsMask = false, cameraFeedMode = 'snapToGuides', images = defaultIdCaptureGuideImages, classNames = {}, }) => {
|
|
39
39
|
const { imageAspectRatio } = useGuideOrientationContext();
|
|
40
40
|
// sdk2 reads guideRectX/Y/Width/Height back out of its zustand store for
|
|
41
41
|
// the CaptureAreaProgress block below; this port reads the same rect from
|
|
@@ -80,26 +80,29 @@ export const IdCaptureFitGuide = ({ aspectRatio, maskColor, borderRadius = 33, b
|
|
|
80
80
|
const canvas = canvasRef.current;
|
|
81
81
|
if (!canvas)
|
|
82
82
|
return;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
];
|
|
83
|
+
// The padding/border inset is what the wrapper leaves for the rect; the
|
|
84
|
+
// max* caps then bound it from above. Unset, `Math.min` with Infinity is
|
|
85
|
+
// the identity, so the geometry below is unchanged for every existing
|
|
86
|
+
// caller.
|
|
87
|
+
const boundingWidth = Math.min(wrapperWidth - padding * 2 - borderWidth * 2, maxWidth ?? Infinity);
|
|
88
|
+
const boundingHeight = Math.min(wrapperHeight - padding * 2 - borderWidth * 2, maxHeight ?? Infinity);
|
|
89
|
+
let [rectWidth, rectHeight] = [boundingWidth, boundingHeight];
|
|
91
90
|
if (aspectRatio !== undefined) {
|
|
92
91
|
const scaledWidth = boundingHeight * aspectRatio;
|
|
93
92
|
const scaledHeight = boundingWidth / aspectRatio;
|
|
94
93
|
if (scaledWidth < boundingWidth) {
|
|
95
94
|
rectWidth = scaledWidth;
|
|
96
|
-
rectX += (boundingWidth - rectWidth) / 2;
|
|
97
95
|
}
|
|
98
96
|
else {
|
|
99
97
|
rectHeight = scaledHeight;
|
|
100
|
-
rectY += (boundingHeight - rectHeight) / 2;
|
|
101
98
|
}
|
|
102
99
|
}
|
|
100
|
+
// Centred on the wrapper rather than on the inset box. With no cap the two
|
|
101
|
+
// are the same point — the inset is symmetric, so `padding + borderWidth`
|
|
102
|
+
// already equals half the leftover — but once a cap bites, only this one
|
|
103
|
+
// keeps the box centred instead of pinning it to the top-left inset.
|
|
104
|
+
const rectX = (wrapperWidth - rectWidth) / 2;
|
|
105
|
+
const rectY = (wrapperHeight - rectHeight) / 2;
|
|
103
106
|
setCanvasDimensions(canvas, wrapperWidth, wrapperHeight);
|
|
104
107
|
const ctx = canvas.getContext('2d');
|
|
105
108
|
if (!ctx)
|
|
@@ -142,6 +145,9 @@ export const IdCaptureFitGuide = ({ aspectRatio, maskColor, borderRadius = 33, b
|
|
|
142
145
|
// Only in mask-following mode: this asks the feed to clip itself to the
|
|
143
146
|
// hole, which legacy integrations do not expect.
|
|
144
147
|
radius: followsMask ? borderRadius : undefined,
|
|
148
|
+
// Same condition, different consumer: outside this mode the box below is
|
|
149
|
+
// the overlay's flex-derived one, NOT this rect.
|
|
150
|
+
isGuideBox: followsMask,
|
|
145
151
|
});
|
|
146
152
|
return () => { };
|
|
147
153
|
}, [
|
|
@@ -151,11 +157,21 @@ export const IdCaptureFitGuide = ({ aspectRatio, maskColor, borderRadius = 33, b
|
|
|
151
157
|
borderWidth,
|
|
152
158
|
followsMask,
|
|
153
159
|
maskColor,
|
|
160
|
+
maxHeight,
|
|
161
|
+
maxWidth,
|
|
154
162
|
padding,
|
|
155
163
|
setGuideRect,
|
|
156
164
|
wrapperHeight,
|
|
157
165
|
wrapperWidth,
|
|
158
166
|
]);
|
|
167
|
+
// Unmount only. Deliberately NOT the draw effect's cleanup, which re-runs on
|
|
168
|
+
// every dependency change — including the border colour, which flips with
|
|
169
|
+
// guidance — and would clear the rect just to republish it a moment later.
|
|
170
|
+
// A guide that is gone must not leave its rect behind: consumers that place
|
|
171
|
+
// themselves against it (the guidance message) would otherwise anchor to a
|
|
172
|
+
// box no longer on screen. Switching `guideType` from 'fit' to 'overlay' is
|
|
173
|
+
// the reachable case.
|
|
174
|
+
useEffect(() => () => setGuideRect(null), [setGuideRect]);
|
|
159
175
|
return (_jsxs(_Fragment, { children: [_jsxs(CanvasWrapper, { ref: wrapperRef, "$maskColor": maskColor ?? '', "$aboveCameraFeed": maskAboveCameraFeed, className: classNames.canvasWrapper, children: [_jsx(Canvas, { ref: canvasRef, className: classNames.canvas }), guideBoxDisabled &&
|
|
160
176
|
status === 'capturing' &&
|
|
161
177
|
guideRect !== null &&
|
|
@@ -28,6 +28,13 @@ export type IdCaptureGuidesProps = {
|
|
|
28
28
|
guideBoxDisabled?: boolean;
|
|
29
29
|
/** Fit guides only: draw the guide box on the mask's own rect. See IdCaptureFitGuideProps. */
|
|
30
30
|
guideBoxFollowsMask?: boolean;
|
|
31
|
+
/** Fit guides only. Corner radius of the guide box and of the mask hole it is
|
|
32
|
+
* cut from. Both are drawn in JS — a canvas `roundRect` and an SVG `rx` — so
|
|
33
|
+
* this is the only way to change them; CSS has nothing to bite on. */
|
|
34
|
+
guideBoxBorderRadius?: number;
|
|
35
|
+
/** Fit guides only: caps on the guide rect. See IdCaptureFitGuideProps. */
|
|
36
|
+
guideBoxMaxWidth?: number;
|
|
37
|
+
guideBoxMaxHeight?: number;
|
|
31
38
|
cameraFeedMode?: 'snapToGuides' | 'fullscreen';
|
|
32
39
|
images?: IdCaptureGuideImages;
|
|
33
40
|
classNames?: IdCaptureGuidesClassNames;
|
|
@@ -43,5 +50,5 @@ export type IdCaptureGuidesProps = {
|
|
|
43
50
|
* keeps the landscape guides in every orientation. */
|
|
44
51
|
portraitGuidesOnMobile?: boolean;
|
|
45
52
|
};
|
|
46
|
-
export declare function IdCaptureGuides({ state, isRearFacing, guideType, guideBoxDisabled, guideBoxFollowsMask, cameraFeedMode, images, classNames, verbiage: rawVerbiage, status: statusOverride, portraitGuidesOnMobile, }: IdCaptureGuidesProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export declare function IdCaptureGuides({ state, isRearFacing, guideType, guideBoxDisabled, guideBoxFollowsMask, guideBoxBorderRadius, guideBoxMaxWidth, guideBoxMaxHeight, cameraFeedMode, images, classNames, verbiage: rawVerbiage, status: statusOverride, portraitGuidesOnMobile, }: IdCaptureGuidesProps): import("react/jsx-runtime").JSX.Element;
|
|
47
54
|
//# sourceMappingURL=IdCaptureGuides.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdCaptureGuides.d.ts","sourceRoot":"","sources":["../../../src/components/guides/IdCaptureGuides.tsx"],"names":[],"mappings":"AA0EA,OAAO,EAAmB,KAAK,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAEjG,OAAO,EAAmB,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC3E,OAAO,EAEL,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MA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E,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B;;0DAEsD;IACtD,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,YAAY,EACZ,SAAiB,EACjB,gBAAwB,EACxB,mBAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,cAA+B,EAC/B,MAAoC,EACpC,UAAe,EACf,QAAQ,EAAE,WAAgB,EAC1B,MAAM,EAAE,cAAc,EACtB,sBAA6B,GAC9B,EAAE,oBAAoB,2CAiHtB"}
|
|
@@ -81,7 +81,7 @@ import { IdCaptureGuideOverlay, } from './IdCaptureGuideOverlay';
|
|
|
81
81
|
import { defaultIdCaptureGuideImages } from '../guide_images';
|
|
82
82
|
import { BarcodeGuideOverlay, } from '../barcode/BarcodeGuideOverlay';
|
|
83
83
|
import { BarcodeSuccessOverlay } from '../barcode/BarcodeSuccessOverlay';
|
|
84
|
-
export function IdCaptureGuides({ state, isRearFacing, guideType = 'fit', guideBoxDisabled = false, guideBoxFollowsMask = false, cameraFeedMode = 'snapToGuides', images = defaultIdCaptureGuideImages, classNames = {}, verbiage: rawVerbiage = {}, status: statusOverride, portraitGuidesOnMobile = true, }) {
|
|
84
|
+
export function IdCaptureGuides({ state, isRearFacing, guideType = 'fit', guideBoxDisabled = false, guideBoxFollowsMask = false, guideBoxBorderRadius, guideBoxMaxWidth, guideBoxMaxHeight, cameraFeedMode = 'snapToGuides', images = defaultIdCaptureGuideImages, classNames = {}, verbiage: rawVerbiage = {}, status: statusOverride, portraitGuidesOnMobile = true, }) {
|
|
85
85
|
const { t } = useTranslation();
|
|
86
86
|
const theme = useTheme();
|
|
87
87
|
const barcodeVerbiage = useTranslations(rawVerbiage, {
|
|
@@ -127,7 +127,7 @@ export function IdCaptureGuides({ state, isRearFacing, guideType = 'fit', guideB
|
|
|
127
127
|
return (_jsxs(_Fragment, { children: [guideType === 'overlay' && (_jsx(IdCaptureGuideOverlay, { images: images, classNames: classNames, portraitGuidesOnMobile: portraitGuidesOnMobile, status: status, progress: progress, guideBoxDisabled: guideBoxDisabled, instruction: instruction, isMirrored: !isRearFacing, borderColor: borderColor, imageVisible: requestedAction === 'FLIP_ID' ||
|
|
128
128
|
!state.idCardFrontDetectionThresholdMet ||
|
|
129
129
|
!state.documentInBounds ||
|
|
130
|
-
state.documentTooClose })), guideType === 'fit' && (_jsx(IdCaptureFitGuide, { images: images, classNames: classNames, portraitGuidesOnMobile: portraitGuidesOnMobile, requestedAction: requestedAction, status: status, progress: progress, guideBoxDisabled: guideBoxDisabled, guideBoxFollowsMask: guideBoxFollowsMask, cameraFeedMode: cameraFeedMode, instruction: instruction, isMirrored: !isRearFacing, isBackToFront: isBackToFront, borderColor: borderColor, imageVisible: requestedAction === 'FLIP_ID' ||
|
|
130
|
+
state.documentTooClose })), guideType === 'fit' && (_jsx(IdCaptureFitGuide, { images: images, classNames: classNames, portraitGuidesOnMobile: portraitGuidesOnMobile, requestedAction: requestedAction, status: status, progress: progress, guideBoxDisabled: guideBoxDisabled, guideBoxFollowsMask: guideBoxFollowsMask, borderRadius: guideBoxBorderRadius, maxWidth: guideBoxMaxWidth, maxHeight: guideBoxMaxHeight, cameraFeedMode: cameraFeedMode, instruction: instruction, isMirrored: !isRearFacing, isBackToFront: isBackToFront, borderColor: borderColor, imageVisible: requestedAction === 'FLIP_ID' ||
|
|
131
131
|
!state.detectionThresholdMet ||
|
|
132
132
|
!state.documentInBounds ||
|
|
133
133
|
state.documentTooClose ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentCaptureFlow.d.ts","sourceRoot":"","sources":["../../src/flows/DocumentCaptureFlow.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EAErC,MAAM,wCAAwC,CAAA;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAIpE,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CAAA;AAIpE,OAAO,KAAK,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAE5E;;;;;;;GAOG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,eAAe,EACb,4BAA4B,GAC5B,mBAAmB,GACnB,iBAAiB,GACjB,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,qBAAqB,GACrB,kBAAkB,CACrB,GAAG;IACF,UAAU,CAAC,EAAE,yBAAyB,CAAA;IACtC,OAAO,CAAC,EAAE,IAAI,CAAC,+BAA+B,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAA;IACvE,IAAI,CAAC,EAAE,4BAA4B,CAAA;IACnC,kFAAkF;IAClF,SAAS,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACvC,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxE,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,KAAK,IAAI,CAAA;CAC9D,CAAA;AAwBD,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,UAAU,EACV,OAAuB,EACvB,IAAiB,EACjB,SAA2B,EAC3B,UAA6B,EAC7B,gBAAkC,EAClC,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,wBAAwB,2CA2H1B"}
|
|
@@ -49,6 +49,8 @@ export function DocumentCaptureFlow({ client, controller, capture = EMPTY_CAPTUR
|
|
|
49
49
|
createDocumentCaptureController({
|
|
50
50
|
...capture,
|
|
51
51
|
client,
|
|
52
|
+
jobID: submission.jobID,
|
|
53
|
+
taskID: submission.taskID,
|
|
52
54
|
// Only the React-free half crosses into core.
|
|
53
55
|
documents: documentsRef.current.map(({ title, aspectRatio, processAsPOA, content }) => ({
|
|
54
56
|
title,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SubmissionArtifacts } from '@idmission/websdk-core/client';
|
|
2
|
-
import { type SelfieCaptureController, type SelfieLivenessConfig } from '@idmission/websdk-core/selfieCapture';
|
|
2
|
+
import { type SelfieCaptureController, type SelfieCaptureThresholds, type SelfieLivenessConfig } from '@idmission/websdk-core/selfieCapture';
|
|
3
3
|
import { type SignatureCaptureController, type SignatureCaptureControllerConfig } from '@idmission/websdk-core/signatureCapture';
|
|
4
4
|
import { type SignatureCaptureViewProps } from '../SignatureCaptureView';
|
|
5
5
|
import type { CommonFlowProps, FaceLivenessFlowConfig, FaceLivenessFlowViewProps, FlowResultCallbacks } from './types';
|
|
@@ -29,5 +29,23 @@ export type SignatureKYCFlowProps = Omit<CommonFlowProps, keyof FlowResultCallba
|
|
|
29
29
|
onCaptured?: (artifacts: SubmissionArtifacts) => void;
|
|
30
30
|
onCaptureError?: (error: Error) => void;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Face-tracking thresholds the face stage runs under, given the layout its
|
|
34
|
+
* oval is drawn in.
|
|
35
|
+
*
|
|
36
|
+
* The legacy layout puts the oval in the TOP HALF of the screen
|
|
37
|
+
* (`SignatureCaptureView`'s `LegacyFaceGuideContainer`, bottom-aligned within
|
|
38
|
+
* it) with the signature pad below. Face tracking centres on the CAMERA
|
|
39
|
+
* FRAME, so requiring vertical centering there rejects a face sitting exactly
|
|
40
|
+
* in the oval and only accepts one at the middle of the screen — well below
|
|
41
|
+
* the guide the user is aiming at, and with nothing on screen to say so. sdk2
|
|
42
|
+
* turns the vertical half of that check off across this whole flow for the
|
|
43
|
+
* same reason (`VideoSignatureWizard.tsx:721`).
|
|
44
|
+
*
|
|
45
|
+
* The non-legacy layout centres its oval (`FaceCaptureGuideOverlay`), where
|
|
46
|
+
* the frame's centre IS the guide, so it keeps the check. A caller's own
|
|
47
|
+
* `thresholds` outrank both.
|
|
48
|
+
*/
|
|
49
|
+
export declare function faceThresholdsForLayout(legacyVideoLayout: boolean, thresholds: SelfieCaptureThresholds | undefined): SelfieCaptureThresholds | undefined;
|
|
32
50
|
export declare function SignatureKYCFlow({ client, selfieController, signatureController, faceCapture, signatureCapture, faceView, signatureView, challengeResponse, allowVirtualCameras, skipLivenessValidation, allowManualSelfieCaptureOnLoadingError, headTrackingDisabled, headTrackingBoundaryPercentage, headTrackingBoundaryType, allowSignatureAfterLivenessCheckFailure, showFaceGuideThenSignaturePad, skipSuccessScreen, submission, initialArtifacts, theme, className, geolocationEnabled, geolocationRequired, remoteDiagnostics, loadingSpinner, onCaptured, onCaptureError, }: SignatureKYCFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
33
51
|
//# sourceMappingURL=SignatureKYCFlow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignatureKYCFlow.d.ts","sourceRoot":"","sources":["../../src/flows/SignatureKYCFlow.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACtC,MAAM,yCAAyC,CAAA;AAShD,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAA;AAOhC,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,eAAe,EAIb,MAAM,mBAAmB,GACzB,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,4BAA4B,CAC/B,GAAG;IACF,gBAAgB,CAAC,EAAE,uBAAuB,CAAA;IAC1C,mBAAmB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AAsB,CAAC,EAAE,OAAO,CAAA;IAChC,sCAAsC,CAAC,EAAE,OAAO,CAAA;IAChD,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,8BAA8B,CAAC,EAAE,MAAM,CAAA;IACvC,wBAAwB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1C,oFAAoF;IACpF,uCAAuC,CAAC,EAAE,OAAO,CAAA;IACjD,6BAA6B,CAAC,EAAE,OAAO,CAAA;IACvC,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,yBAAyB,CAAC,mBAAmB,CAAC,CAAA;IAClE,yFAAyF;IACzF,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,CAAA;IACrD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACxC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,iBAAiB,EAAE,OAAO,EAC1B,UAAU,EAAE,uBAAuB,GAAG,SAAS,GAC9C,uBAAuB,GAAG,SAAS,CAWrC;AAWD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,WAAgC,EAChC,gBAA0C,EAC1C,QAA0B,EAC1B,aAAoC,EACpC,iBAAiB,EACjB,mBAAmB,EACnB,sBAA8B,EAC9B,sCAA8C,EAC9C,oBAA4B,EAC5B,8BAAqC,EACrC,wBAAiC,EACjC,uCAA+C,EAC/C,6BAAqC,EACrC,iBAAiB,EACjB,UAA6B,EAC7B,gBAAkC,EAClC,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,cAAc,GACf,EAAE,qBAAqB,2CAiUvB"}
|
|
@@ -13,6 +13,35 @@ import { SignatureCaptureView, } from '../SignatureCaptureView';
|
|
|
13
13
|
import { buildSelfieArtifacts, mergeSubmissionArtifacts } from './artifacts';
|
|
14
14
|
import { FlowChassis } from './FlowChassis';
|
|
15
15
|
import { createSharedCameraAcquirer, withVirtualCameras, } from './sharedCamera';
|
|
16
|
+
/**
|
|
17
|
+
* Face-tracking thresholds the face stage runs under, given the layout its
|
|
18
|
+
* oval is drawn in.
|
|
19
|
+
*
|
|
20
|
+
* The legacy layout puts the oval in the TOP HALF of the screen
|
|
21
|
+
* (`SignatureCaptureView`'s `LegacyFaceGuideContainer`, bottom-aligned within
|
|
22
|
+
* it) with the signature pad below. Face tracking centres on the CAMERA
|
|
23
|
+
* FRAME, so requiring vertical centering there rejects a face sitting exactly
|
|
24
|
+
* in the oval and only accepts one at the middle of the screen — well below
|
|
25
|
+
* the guide the user is aiming at, and with nothing on screen to say so. sdk2
|
|
26
|
+
* turns the vertical half of that check off across this whole flow for the
|
|
27
|
+
* same reason (`VideoSignatureWizard.tsx:721`).
|
|
28
|
+
*
|
|
29
|
+
* The non-legacy layout centres its oval (`FaceCaptureGuideOverlay`), where
|
|
30
|
+
* the frame's centre IS the guide, so it keeps the check. A caller's own
|
|
31
|
+
* `thresholds` outrank both.
|
|
32
|
+
*/
|
|
33
|
+
export function faceThresholdsForLayout(legacyVideoLayout, thresholds) {
|
|
34
|
+
if (!legacyVideoLayout)
|
|
35
|
+
return thresholds;
|
|
36
|
+
return {
|
|
37
|
+
...thresholds,
|
|
38
|
+
// `??`, not a plain spread the caller's bag lands on top of: a bag
|
|
39
|
+
// carrying an explicit `requireVerticalFaceCentering: undefined` would
|
|
40
|
+
// overwrite this `false`, and core's default puts the check back — the
|
|
41
|
+
// very "face in the oval is rejected" bug this exists to prevent.
|
|
42
|
+
requireVerticalFaceCentering: thresholds?.requireVerticalFaceCentering ?? false,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
16
45
|
const EMPTY_FACE_CAPTURE = {};
|
|
17
46
|
const EMPTY_SIGNATURE_CAPTURE = {};
|
|
18
47
|
const EMPTY_FACE_VIEW = {};
|
|
@@ -39,6 +68,7 @@ export function SignatureKYCFlow({ client, selfieController, signatureController
|
|
|
39
68
|
const [resolvedSelfieController] = useState(() => selfieController ??
|
|
40
69
|
createSelfieCaptureController({
|
|
41
70
|
...selfieCaptureConfig,
|
|
71
|
+
thresholds: faceThresholdsForLayout(legacyVideoLayout, selfieCaptureConfig.thresholds),
|
|
42
72
|
camera: withVirtualCameras(selfieCaptureConfig.camera, allowVirtualCameras),
|
|
43
73
|
deferCameraAcquisition: selfieCaptureConfig.deferCameraAcquisition ??
|
|
44
74
|
(faceView.loadingOverlayMode === 'ring' && faceView.showIntroScreen),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentCapture.d.ts","sourceRoot":"","sources":["../../src/flows/documentCapture.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAEvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAE3D,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,yBAAyB,EACrC,IAAI,GAAE,4BAAiC,EACvC,YAAY,
|
|
1
|
+
{"version":3,"file":"documentCapture.d.ts","sourceRoot":"","sources":["../../src/flows/documentCapture.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAEvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAE3D,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,yBAAyB,EACrC,IAAI,GAAE,4BAAiC,EACvC,YAAY,CAAC,EAAE,OAAO,GACrB,mBAAmB,CAYrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { DocumentCaptureView } from '../DocumentCaptureView';
|
|
3
|
-
export function buildDocumentCaptureStep(controller, view = {}, sessionReady
|
|
3
|
+
export function buildDocumentCaptureStep(controller, view = {}, sessionReady) {
|
|
4
4
|
return {
|
|
5
5
|
id: 'document-capture',
|
|
6
6
|
render: (complete) => (_jsx(DocumentCaptureView, { ...view, controller: controller, sessionReady: sessionReady, onCompleted: () => complete() })),
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type { GuideOrientationState } from './layout/GuideOrientationContext';
|
|
|
33
33
|
export { CameraVideoTag, ScalingCameraFeed, CameraFeedWrapper } from './components/CameraFeed';
|
|
34
34
|
export type { CameraVideoTagProps, CameraFeedMode, ScalingCameraFeedProps, } from './components/CameraFeed';
|
|
35
35
|
export { GuidanceMessage, GuidanceMessageContainer } from './components/GuidanceMessage';
|
|
36
|
-
export type { GuidanceMessageVariant } from './components/GuidanceMessage';
|
|
36
|
+
export type { GuidanceMessagePlacement, GuidanceMessageVariant, } from './components/GuidanceMessage';
|
|
37
37
|
export { ExitCaptureButton } from './components/ExitCaptureButton';
|
|
38
38
|
export { OverrideWrongDocumentTypeDialog } from './components/OverrideWrongDocumentTypeDialog';
|
|
39
39
|
export type { OverrideWrongDocumentTypeDialogProps, OverrideWrongDocumentTypeDialogClassNames, OverrideWrongDocumentTypeDialogVerbiage, } from './components/OverrideWrongDocumentTypeDialog';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAK3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,YAAY,EACV,sBAAsB,E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AAiB,EACjB,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,2BAA2B,CAAA;AAMlC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -12,6 +12,17 @@ export type GuideRect = {
|
|
|
12
12
|
* square hole simply omits it.
|
|
13
13
|
*/
|
|
14
14
|
radius?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the visible guide box is drawn on THIS rect.
|
|
17
|
+
*
|
|
18
|
+
* The rect is the mask hole. Only in mask-following mode is the box drawn on
|
|
19
|
+
* the same rect; otherwise the box comes from the guide overlay's flex layout
|
|
20
|
+
* and is materially smaller — measured at 436px narrower on a 1340x870
|
|
21
|
+
* desktop. Consumers that place themselves against the BOX (the guidance
|
|
22
|
+
* message) must check this, or they anchor to a rectangle the user cannot
|
|
23
|
+
* see. Consumers that want the HOLE (the camera feed's clip) should ignore it.
|
|
24
|
+
*/
|
|
25
|
+
isGuideBox?: boolean;
|
|
15
26
|
};
|
|
16
27
|
export type GuideLayoutState = {
|
|
17
28
|
guideRect: GuideRect | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideLayoutContext.d.ts","sourceRoot":"","sources":["../../src/layout/GuideLayoutContext.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEL,YAAY,EACZ,SAAS,
|
|
1
|
+
{"version":3,"file":"GuideLayoutContext.d.ts","sourceRoot":"","sources":["../../src/layout/GuideLayoutContext.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEL,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAA;AAEd,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;IAC3B,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAA;CAC/C,CAAA;AAOD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;CACpB,GAAG,YAAY,CAuBf;AAED,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD"}
|
|
@@ -4,16 +4,37 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
// fields are UI-only screen geometry and never crossed the core port). This
|
|
5
5
|
// context is the sole owner of "where does the guide rect sit on screen" —
|
|
6
6
|
// consumed by ScalingCameraFeed to snap the camera video under the guide.
|
|
7
|
-
import { createContext, useContext, useMemo, useState, } from 'react';
|
|
7
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from 'react';
|
|
8
8
|
const GuideLayoutContext = createContext({
|
|
9
9
|
guideRect: null,
|
|
10
10
|
setGuideRect: () => null,
|
|
11
11
|
});
|
|
12
12
|
export function GuideLayoutProvider({ children, }) {
|
|
13
|
-
const [guideRect,
|
|
14
|
-
|
|
13
|
+
const [guideRect, setRect] = useState(null);
|
|
14
|
+
// Publishers re-run their draw effect on inputs that do not move the rect —
|
|
15
|
+
// the guide border's colour is in those deps and flips with every guidance
|
|
16
|
+
// change, several times a second during capture — and each run hands over a
|
|
17
|
+
// freshly built object. Stored as-is, that object replaces state every time
|
|
18
|
+
// and re-renders every consumer (camera feed, guide box, guidance message)
|
|
19
|
+
// for a rect that is identical. Comparing by value makes those runs free.
|
|
20
|
+
const setGuideRect = useCallback((rect) => {
|
|
21
|
+
setRect((previous) => (sameRect(previous, rect) ? previous : rect));
|
|
22
|
+
}, []);
|
|
23
|
+
const value = useMemo(() => ({ guideRect, setGuideRect }), [guideRect, setGuideRect]);
|
|
15
24
|
return (_jsx(GuideLayoutContext.Provider, { value: value, children: children }));
|
|
16
25
|
}
|
|
17
26
|
export function useGuideLayout() {
|
|
18
27
|
return useContext(GuideLayoutContext);
|
|
19
28
|
}
|
|
29
|
+
function sameRect(a, b) {
|
|
30
|
+
if (a === b)
|
|
31
|
+
return true;
|
|
32
|
+
if (a === null || b === null)
|
|
33
|
+
return false;
|
|
34
|
+
return (a.x === b.x &&
|
|
35
|
+
a.y === b.y &&
|
|
36
|
+
a.width === b.width &&
|
|
37
|
+
a.height === b.height &&
|
|
38
|
+
a.radius === b.radius &&
|
|
39
|
+
a.isGuideBox === b.isGuideBox);
|
|
40
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stubSignatureCanvas.d.ts","sourceRoot":"","sources":["../../src/testing/stubSignatureCanvas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stubSignatureCanvas.d.ts","sourceRoot":"","sources":["../../src/testing/stubSignatureCanvas.ts"],"names":[],"mappings":"AAWA,wBAAgB,0BAA0B,IAAI,MAAM,IAAI,CAmBvD"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// `test/setup.ts` makes HTMLCanvasElement.getContext return null globally to
|
|
2
2
|
// silence jsdom's noisy "not implemented" error. That is fine for every view
|
|
3
|
-
// that only measures a canvas — but
|
|
4
|
-
// SignaturePad against a REAL 2D context
|
|
5
|
-
//
|
|
6
|
-
// 'fillStyle')" on mount.
|
|
3
|
+
// that only measures a canvas — but the signature stage constructs a
|
|
4
|
+
// SignaturePad against a REAL 2D context on mount, so any test that mounts one
|
|
5
|
+
// throws "Cannot set properties of null (setting 'fillStyle')".
|
|
7
6
|
//
|
|
8
7
|
// This installs a permissive proxy context (every property read returns a
|
|
9
8
|
// no-op function; writes are recorded) for the duration of a suite, and
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const webSdkUiVersion = "0.1.0-rc.
|
|
1
|
+
export declare const webSdkUiVersion = "0.1.0-rc.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|