idmission-web-sdk 2.2.107 → 2.2.108
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/components/id_capture/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureFitGuide.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieCapture.d.ts.map +1 -1
- package/dist/components/signature_capture/SignatureCapture.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureGuides.d.ts.map +1 -1
- package/dist/lib/utils/useResizeObserver.d.ts +11 -0
- package/dist/lib/utils/useResizeObserver.d.ts.map +1 -0
- package/dist/sdk2.cjs.development.js +128 -14
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +117 -2
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +117 -178
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -4
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
var webSdkVersion = '2.2.
|
|
214
|
+
var webSdkVersion = '2.2.108';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2963,183 +2963,6 @@
|
|
|
2963
2963
|
});
|
|
2964
2964
|
}
|
|
2965
2965
|
|
|
2966
|
-
// This could've been more streamlined with internal state instead of abusing
|
|
2967
|
-
// refs to such extent, but then composing hooks and components could not opt out of unnecessary renders.
|
|
2968
|
-
function useResolvedElement(subscriber, refOrElement) {
|
|
2969
|
-
var lastReportRef = React.useRef(null);
|
|
2970
|
-
var refOrElementRef = React.useRef(null);
|
|
2971
|
-
refOrElementRef.current = refOrElement;
|
|
2972
|
-
var cbElementRef = React.useRef(null); // Calling re-evaluation after each render without using a dep array,
|
|
2973
|
-
// as the ref object's current value could've changed since the last render.
|
|
2974
|
-
|
|
2975
|
-
React.useEffect(function () {
|
|
2976
|
-
evaluateSubscription();
|
|
2977
|
-
});
|
|
2978
|
-
var evaluateSubscription = React.useCallback(function () {
|
|
2979
|
-
var cbElement = cbElementRef.current;
|
|
2980
|
-
var refOrElement = refOrElementRef.current; // Ugly ternary. But smaller than an if-else block.
|
|
2981
|
-
|
|
2982
|
-
var element = cbElement ? cbElement : refOrElement ? refOrElement instanceof Element ? refOrElement : refOrElement.current : null;
|
|
2983
|
-
if (lastReportRef.current && lastReportRef.current.element === element && lastReportRef.current.subscriber === subscriber) {
|
|
2984
|
-
return;
|
|
2985
|
-
}
|
|
2986
|
-
if (lastReportRef.current && lastReportRef.current.cleanup) {
|
|
2987
|
-
lastReportRef.current.cleanup();
|
|
2988
|
-
}
|
|
2989
|
-
lastReportRef.current = {
|
|
2990
|
-
element: element,
|
|
2991
|
-
subscriber: subscriber,
|
|
2992
|
-
// Only calling the subscriber, if there's an actual element to report.
|
|
2993
|
-
// Setting cleanup to undefined unless a subscriber returns one, as an existing cleanup function would've been just called.
|
|
2994
|
-
cleanup: element ? subscriber(element) : undefined
|
|
2995
|
-
};
|
|
2996
|
-
}, [subscriber]); // making sure we call the cleanup function on unmount
|
|
2997
|
-
|
|
2998
|
-
React.useEffect(function () {
|
|
2999
|
-
return function () {
|
|
3000
|
-
if (lastReportRef.current && lastReportRef.current.cleanup) {
|
|
3001
|
-
lastReportRef.current.cleanup();
|
|
3002
|
-
lastReportRef.current = null;
|
|
3003
|
-
}
|
|
3004
|
-
};
|
|
3005
|
-
}, []);
|
|
3006
|
-
return React.useCallback(function (element) {
|
|
3007
|
-
cbElementRef.current = element;
|
|
3008
|
-
evaluateSubscription();
|
|
3009
|
-
}, [evaluateSubscription]);
|
|
3010
|
-
}
|
|
3011
|
-
|
|
3012
|
-
// We're only using the first element of the size sequences, until future versions of the spec solidify on how
|
|
3013
|
-
// exactly it'll be used for fragments in multi-column scenarios:
|
|
3014
|
-
// From the spec:
|
|
3015
|
-
// > The box size properties are exposed as FrozenArray in order to support elements that have multiple fragments,
|
|
3016
|
-
// > which occur in multi-column scenarios. However the current definitions of content rect and border box do not
|
|
3017
|
-
// > mention how those boxes are affected by multi-column layout. In this spec, there will only be a single
|
|
3018
|
-
// > ResizeObserverSize returned in the FrozenArray, which will correspond to the dimensions of the first column.
|
|
3019
|
-
// > A future version of this spec will extend the returned FrozenArray to contain the per-fragment size information.
|
|
3020
|
-
// (https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface)
|
|
3021
|
-
//
|
|
3022
|
-
// Also, testing these new box options revealed that in both Chrome and FF everything is returned in the callback,
|
|
3023
|
-
// regardless of the "box" option.
|
|
3024
|
-
// The spec states the following on this:
|
|
3025
|
-
// > This does not have any impact on which box dimensions are returned to the defined callback when the event
|
|
3026
|
-
// > is fired, it solely defines which box the author wishes to observe layout changes on.
|
|
3027
|
-
// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)
|
|
3028
|
-
// I'm not exactly clear on what this means, especially when you consider a later section stating the following:
|
|
3029
|
-
// > This section is non-normative. An author may desire to observe more than one CSS box.
|
|
3030
|
-
// > In this case, author will need to use multiple ResizeObservers.
|
|
3031
|
-
// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)
|
|
3032
|
-
// Which is clearly not how current browser implementations behave, and seems to contradict the previous quote.
|
|
3033
|
-
// For this reason I decided to only return the requested size,
|
|
3034
|
-
// even though it seems we have access to results for all box types.
|
|
3035
|
-
// This also means that we get to keep the current api, being able to return a simple { width, height } pair,
|
|
3036
|
-
// regardless of box option.
|
|
3037
|
-
function extractSize(entry, boxProp, sizeType) {
|
|
3038
|
-
if (!entry[boxProp]) {
|
|
3039
|
-
if (boxProp === "contentBoxSize") {
|
|
3040
|
-
// The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.
|
|
3041
|
-
// See the 6th step in the description for the RO algorithm:
|
|
3042
|
-
// https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h
|
|
3043
|
-
// > Set this.contentRect to logical this.contentBoxSize given target and observedBox of "content-box".
|
|
3044
|
-
// In real browser implementations of course these objects differ, but the width/height values should be equivalent.
|
|
3045
|
-
return entry.contentRect[sizeType === "inlineSize" ? "width" : "height"];
|
|
3046
|
-
}
|
|
3047
|
-
return undefined;
|
|
3048
|
-
} // A couple bytes smaller than calling Array.isArray() and just as effective here.
|
|
3049
|
-
|
|
3050
|
-
return entry[boxProp][0] ? entry[boxProp][0][sizeType] :
|
|
3051
|
-
// TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current
|
|
3052
|
-
// behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.
|
|
3053
|
-
// @ts-ignore
|
|
3054
|
-
entry[boxProp][sizeType];
|
|
3055
|
-
}
|
|
3056
|
-
function useResizeObserver(opts) {
|
|
3057
|
-
if (opts === void 0) {
|
|
3058
|
-
opts = {};
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3061
|
-
// Saving the callback as a ref. With this, I don't need to put onResize in the
|
|
3062
|
-
// effect dep array, and just passing in an anonymous function without memoising
|
|
3063
|
-
// will not reinstantiate the hook's ResizeObserver.
|
|
3064
|
-
var onResize = opts.onResize;
|
|
3065
|
-
var onResizeRef = React.useRef(undefined);
|
|
3066
|
-
onResizeRef.current = onResize;
|
|
3067
|
-
var round = opts.round || Math.round; // Using a single instance throughout the hook's lifetime
|
|
3068
|
-
|
|
3069
|
-
var resizeObserverRef = React.useRef();
|
|
3070
|
-
var _useState = React.useState({
|
|
3071
|
-
width: undefined,
|
|
3072
|
-
height: undefined
|
|
3073
|
-
}),
|
|
3074
|
-
size = _useState[0],
|
|
3075
|
-
setSize = _useState[1]; // In certain edge cases the RO might want to report a size change just after
|
|
3076
|
-
// the component unmounted.
|
|
3077
|
-
|
|
3078
|
-
var didUnmount = React.useRef(false);
|
|
3079
|
-
React.useEffect(function () {
|
|
3080
|
-
didUnmount.current = false;
|
|
3081
|
-
return function () {
|
|
3082
|
-
didUnmount.current = true;
|
|
3083
|
-
};
|
|
3084
|
-
}, []); // Using a ref to track the previous width / height to avoid unnecessary renders.
|
|
3085
|
-
|
|
3086
|
-
var previous = React.useRef({
|
|
3087
|
-
width: undefined,
|
|
3088
|
-
height: undefined
|
|
3089
|
-
}); // This block is kinda like a useEffect, only it's called whenever a new
|
|
3090
|
-
// element could be resolved based on the ref option. It also has a cleanup
|
|
3091
|
-
// function.
|
|
3092
|
-
|
|
3093
|
-
var refCallback = useResolvedElement(React.useCallback(function (element) {
|
|
3094
|
-
// We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.
|
|
3095
|
-
// This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option.
|
|
3096
|
-
if (!resizeObserverRef.current || resizeObserverRef.current.box !== opts.box || resizeObserverRef.current.round !== round) {
|
|
3097
|
-
resizeObserverRef.current = {
|
|
3098
|
-
box: opts.box,
|
|
3099
|
-
round: round,
|
|
3100
|
-
instance: new ResizeObserver(function (entries) {
|
|
3101
|
-
var entry = entries[0];
|
|
3102
|
-
var boxProp = opts.box === "border-box" ? "borderBoxSize" : opts.box === "device-pixel-content-box" ? "devicePixelContentBoxSize" : "contentBoxSize";
|
|
3103
|
-
var reportedWidth = extractSize(entry, boxProp, "inlineSize");
|
|
3104
|
-
var reportedHeight = extractSize(entry, boxProp, "blockSize");
|
|
3105
|
-
var newWidth = reportedWidth ? round(reportedWidth) : undefined;
|
|
3106
|
-
var newHeight = reportedHeight ? round(reportedHeight) : undefined;
|
|
3107
|
-
if (previous.current.width !== newWidth || previous.current.height !== newHeight) {
|
|
3108
|
-
var newSize = {
|
|
3109
|
-
width: newWidth,
|
|
3110
|
-
height: newHeight
|
|
3111
|
-
};
|
|
3112
|
-
previous.current.width = newWidth;
|
|
3113
|
-
previous.current.height = newHeight;
|
|
3114
|
-
if (onResizeRef.current) {
|
|
3115
|
-
onResizeRef.current(newSize);
|
|
3116
|
-
} else {
|
|
3117
|
-
if (!didUnmount.current) {
|
|
3118
|
-
setSize(newSize);
|
|
3119
|
-
}
|
|
3120
|
-
}
|
|
3121
|
-
}
|
|
3122
|
-
})
|
|
3123
|
-
};
|
|
3124
|
-
}
|
|
3125
|
-
resizeObserverRef.current.instance.observe(element, {
|
|
3126
|
-
box: opts.box
|
|
3127
|
-
});
|
|
3128
|
-
return function () {
|
|
3129
|
-
if (resizeObserverRef.current) {
|
|
3130
|
-
resizeObserverRef.current.instance.unobserve(element);
|
|
3131
|
-
}
|
|
3132
|
-
};
|
|
3133
|
-
}, [opts.box, round]), opts.ref);
|
|
3134
|
-
return React.useMemo(function () {
|
|
3135
|
-
return {
|
|
3136
|
-
ref: refCallback,
|
|
3137
|
-
width: size.width,
|
|
3138
|
-
height: size.height
|
|
3139
|
-
};
|
|
3140
|
-
}, [refCallback, size.width, size.height]);
|
|
3141
|
-
}
|
|
3142
|
-
|
|
3143
2966
|
function _typeof$1(o) {
|
|
3144
2967
|
"@babel/helpers - typeof";
|
|
3145
2968
|
|
|
@@ -15430,6 +15253,122 @@
|
|
|
15430
15253
|
var Button$1 = styled(LoaderButton)(templateObject_5$c || (templateObject_5$c = __makeTemplateObject(["\n white-space: nowrap;\n margin: auto;\n"], ["\n white-space: nowrap;\n margin: auto;\n"])));
|
|
15431
15254
|
var templateObject_1$E, templateObject_2$x, templateObject_3$p, templateObject_4$j, templateObject_5$c;
|
|
15432
15255
|
|
|
15256
|
+
// This is a simplified version of https://github.com/ZeeCoder/use-resize-observer.
|
|
15257
|
+
// We have removed all options and made it compliant with React Compiler/React 19.
|
|
15258
|
+
function useResizeObserver() {
|
|
15259
|
+
// Using a single instance throughout the hook's lifetime
|
|
15260
|
+
var resizeObserverRef = React.useRef();
|
|
15261
|
+
var _a = React.useState({}),
|
|
15262
|
+
size = _a[0],
|
|
15263
|
+
setSize = _a[1];
|
|
15264
|
+
// In certain edge cases the RO might want to report a size change just after
|
|
15265
|
+
// the component unmounted.
|
|
15266
|
+
var didUnmount = React.useRef(false);
|
|
15267
|
+
React.useEffect(function () {
|
|
15268
|
+
didUnmount.current = false;
|
|
15269
|
+
return function () {
|
|
15270
|
+
didUnmount.current = true;
|
|
15271
|
+
};
|
|
15272
|
+
}, []);
|
|
15273
|
+
// Using a ref to track the previous width / height to avoid unnecessary renders.
|
|
15274
|
+
var previous = React.useRef({});
|
|
15275
|
+
// This block is kinda like a useEffect, only it's called whenever a new
|
|
15276
|
+
// element could be resolved based on the ref option. It also has a cleanup
|
|
15277
|
+
// function.
|
|
15278
|
+
var refCallback = useResolvedElement(React.useCallback(function (element) {
|
|
15279
|
+
// We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.
|
|
15280
|
+
// This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option.
|
|
15281
|
+
resizeObserverRef.current || (resizeObserverRef.current = new ResizeObserver(function (entries) {
|
|
15282
|
+
var entry = entries[0];
|
|
15283
|
+
var reportedWidth = extractSize(entry, 'inlineSize');
|
|
15284
|
+
var reportedHeight = extractSize(entry, 'blockSize');
|
|
15285
|
+
var newWidth = reportedWidth ? Math.round(reportedWidth) : undefined;
|
|
15286
|
+
var newHeight = reportedHeight ? Math.round(reportedHeight) : undefined;
|
|
15287
|
+
if (previous.current.width !== newWidth || previous.current.height !== newHeight) {
|
|
15288
|
+
var newSize = {
|
|
15289
|
+
width: newWidth,
|
|
15290
|
+
height: newHeight
|
|
15291
|
+
};
|
|
15292
|
+
previous.current.width = newWidth;
|
|
15293
|
+
previous.current.height = newHeight;
|
|
15294
|
+
if (!didUnmount.current) {
|
|
15295
|
+
setSize(newSize);
|
|
15296
|
+
}
|
|
15297
|
+
}
|
|
15298
|
+
}));
|
|
15299
|
+
resizeObserverRef.current.observe(element);
|
|
15300
|
+
return function () {
|
|
15301
|
+
var _a, _b;
|
|
15302
|
+
(_b = (_a = resizeObserverRef.current) === null || _a === void 0 ? void 0 : _a.unobserve) === null || _b === void 0 ? void 0 : _b.call(_a, element);
|
|
15303
|
+
};
|
|
15304
|
+
}, []));
|
|
15305
|
+
return React.useMemo(function () {
|
|
15306
|
+
return {
|
|
15307
|
+
ref: refCallback,
|
|
15308
|
+
width: size.width,
|
|
15309
|
+
height: size.height
|
|
15310
|
+
};
|
|
15311
|
+
}, [refCallback, size.width, size.height]);
|
|
15312
|
+
}
|
|
15313
|
+
// This could've been more streamlined with internal state instead of abusing
|
|
15314
|
+
// refs to such extent, but then composing hooks and components could not opt out of unnecessary renders.
|
|
15315
|
+
function useResolvedElement(subscriber) {
|
|
15316
|
+
var lastReportRef = React.useRef(null);
|
|
15317
|
+
var cbElementRef = React.useRef(null);
|
|
15318
|
+
// Calling re-evaluation after each render without using a dep array,
|
|
15319
|
+
// as the ref object's current value could've changed since the last render.
|
|
15320
|
+
React.useEffect(function () {
|
|
15321
|
+
evaluateSubscription();
|
|
15322
|
+
});
|
|
15323
|
+
var evaluateSubscription = React.useCallback(function () {
|
|
15324
|
+
var cbElement = cbElementRef.current;
|
|
15325
|
+
// Ugly ternary. But smaller than an if-else block.
|
|
15326
|
+
var element = cbElement ? cbElement : null;
|
|
15327
|
+
if (lastReportRef.current && lastReportRef.current.element === element && lastReportRef.current.subscriber === subscriber) {
|
|
15328
|
+
return;
|
|
15329
|
+
}
|
|
15330
|
+
if (lastReportRef.current && lastReportRef.current.cleanup) {
|
|
15331
|
+
lastReportRef.current.cleanup();
|
|
15332
|
+
}
|
|
15333
|
+
lastReportRef.current = {
|
|
15334
|
+
element: element,
|
|
15335
|
+
subscriber: subscriber,
|
|
15336
|
+
// Only calling the subscriber, if there's an actual element to report.
|
|
15337
|
+
// Setting cleanup to undefined unless a subscriber returns one, as an existing cleanup function would've been just called.
|
|
15338
|
+
cleanup: element ? subscriber(element) : undefined
|
|
15339
|
+
};
|
|
15340
|
+
}, [subscriber]);
|
|
15341
|
+
// making sure we call the cleanup function on unmount
|
|
15342
|
+
React.useEffect(function () {
|
|
15343
|
+
return function () {
|
|
15344
|
+
if (lastReportRef.current && lastReportRef.current.cleanup) {
|
|
15345
|
+
lastReportRef.current.cleanup();
|
|
15346
|
+
lastReportRef.current = null;
|
|
15347
|
+
}
|
|
15348
|
+
};
|
|
15349
|
+
}, []);
|
|
15350
|
+
return React.useCallback(function (element) {
|
|
15351
|
+
cbElementRef.current = element;
|
|
15352
|
+
evaluateSubscription();
|
|
15353
|
+
}, [evaluateSubscription]);
|
|
15354
|
+
}
|
|
15355
|
+
function extractSize(entry, sizeType) {
|
|
15356
|
+
if (!entry.contentBoxSize) {
|
|
15357
|
+
// The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.
|
|
15358
|
+
// See the 6th step in the description for the RO algorithm:
|
|
15359
|
+
// https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h
|
|
15360
|
+
// > Set this.contentRect to logical this.contentBoxSize given target and observedBox of "content-box".
|
|
15361
|
+
// In real browser implementations of course these objects differ, but the width/height values should be equivalent.
|
|
15362
|
+
return entry.contentRect[sizeType === 'inlineSize' ? 'width' : 'height'];
|
|
15363
|
+
}
|
|
15364
|
+
// A couple bytes smaller than calling Array.isArray() and just as effective here.
|
|
15365
|
+
return entry.contentBoxSize[0] ? entry.contentBoxSize[0][sizeType] :
|
|
15366
|
+
// TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current
|
|
15367
|
+
// behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.
|
|
15368
|
+
// @ts-expect-error TS2339: Property '0' does not exist on type 'ResizeObserverSize'.
|
|
15369
|
+
entry.contentBoxSize[sizeType];
|
|
15370
|
+
}
|
|
15371
|
+
|
|
15433
15372
|
var IdCapture = function IdCapture(_a) {
|
|
15434
15373
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
15435
15374
|
var requiredDocumentType = _a.requiredDocumentType,
|