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/sdk2.esm.js CHANGED
@@ -6,7 +6,6 @@ import styled, { keyframes, useTheme, ThemeProvider as ThemeProvider$1 } from 's
6
6
  import { useTranslation, initReactI18next } from 'react-i18next';
7
7
  import { Upload } from 'tus-js-client';
8
8
  import SparkMD5 from 'spark-md5';
9
- import useResizeObserver from 'use-resize-observer';
10
9
  import { ImageSegmenter, FilesetResolver, ImageClassifier, FaceDetector, ObjectDetector } from '@mediapipe/tasks-vision';
11
10
  import { createStore, useStore, create } from 'zustand';
12
11
  import { useDebouncedCallback, useThrottledCallback } from 'use-debounce';
@@ -204,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
204
203
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
205
204
  };
206
205
 
207
- var webSdkVersion = '2.2.107';
206
+ var webSdkVersion = '2.2.108';
208
207
 
209
208
  function getPlatform() {
210
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -6130,6 +6129,122 @@ var ButtonContainer = styled.div(templateObject_4$j || (templateObject_4$j = __m
6130
6129
  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"])));
6131
6130
  var templateObject_1$E, templateObject_2$x, templateObject_3$p, templateObject_4$j, templateObject_5$c;
6132
6131
 
6132
+ // This is a simplified version of https://github.com/ZeeCoder/use-resize-observer.
6133
+ // We have removed all options and made it compliant with React Compiler/React 19.
6134
+ function useResizeObserver() {
6135
+ // Using a single instance throughout the hook's lifetime
6136
+ var resizeObserverRef = useRef();
6137
+ var _a = useState({}),
6138
+ size = _a[0],
6139
+ setSize = _a[1];
6140
+ // In certain edge cases the RO might want to report a size change just after
6141
+ // the component unmounted.
6142
+ var didUnmount = useRef(false);
6143
+ useEffect(function () {
6144
+ didUnmount.current = false;
6145
+ return function () {
6146
+ didUnmount.current = true;
6147
+ };
6148
+ }, []);
6149
+ // Using a ref to track the previous width / height to avoid unnecessary renders.
6150
+ var previous = useRef({});
6151
+ // This block is kinda like a useEffect, only it's called whenever a new
6152
+ // element could be resolved based on the ref option. It also has a cleanup
6153
+ // function.
6154
+ var refCallback = useResolvedElement(useCallback(function (element) {
6155
+ // We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.
6156
+ // 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.
6157
+ resizeObserverRef.current || (resizeObserverRef.current = new ResizeObserver(function (entries) {
6158
+ var entry = entries[0];
6159
+ var reportedWidth = extractSize(entry, 'inlineSize');
6160
+ var reportedHeight = extractSize(entry, 'blockSize');
6161
+ var newWidth = reportedWidth ? Math.round(reportedWidth) : undefined;
6162
+ var newHeight = reportedHeight ? Math.round(reportedHeight) : undefined;
6163
+ if (previous.current.width !== newWidth || previous.current.height !== newHeight) {
6164
+ var newSize = {
6165
+ width: newWidth,
6166
+ height: newHeight
6167
+ };
6168
+ previous.current.width = newWidth;
6169
+ previous.current.height = newHeight;
6170
+ if (!didUnmount.current) {
6171
+ setSize(newSize);
6172
+ }
6173
+ }
6174
+ }));
6175
+ resizeObserverRef.current.observe(element);
6176
+ return function () {
6177
+ var _a, _b;
6178
+ (_b = (_a = resizeObserverRef.current) === null || _a === void 0 ? void 0 : _a.unobserve) === null || _b === void 0 ? void 0 : _b.call(_a, element);
6179
+ };
6180
+ }, []));
6181
+ return useMemo(function () {
6182
+ return {
6183
+ ref: refCallback,
6184
+ width: size.width,
6185
+ height: size.height
6186
+ };
6187
+ }, [refCallback, size.width, size.height]);
6188
+ }
6189
+ // This could've been more streamlined with internal state instead of abusing
6190
+ // refs to such extent, but then composing hooks and components could not opt out of unnecessary renders.
6191
+ function useResolvedElement(subscriber) {
6192
+ var lastReportRef = useRef(null);
6193
+ var cbElementRef = useRef(null);
6194
+ // Calling re-evaluation after each render without using a dep array,
6195
+ // as the ref object's current value could've changed since the last render.
6196
+ useEffect(function () {
6197
+ evaluateSubscription();
6198
+ });
6199
+ var evaluateSubscription = useCallback(function () {
6200
+ var cbElement = cbElementRef.current;
6201
+ // Ugly ternary. But smaller than an if-else block.
6202
+ var element = cbElement ? cbElement : null;
6203
+ if (lastReportRef.current && lastReportRef.current.element === element && lastReportRef.current.subscriber === subscriber) {
6204
+ return;
6205
+ }
6206
+ if (lastReportRef.current && lastReportRef.current.cleanup) {
6207
+ lastReportRef.current.cleanup();
6208
+ }
6209
+ lastReportRef.current = {
6210
+ element: element,
6211
+ subscriber: subscriber,
6212
+ // Only calling the subscriber, if there's an actual element to report.
6213
+ // Setting cleanup to undefined unless a subscriber returns one, as an existing cleanup function would've been just called.
6214
+ cleanup: element ? subscriber(element) : undefined
6215
+ };
6216
+ }, [subscriber]);
6217
+ // making sure we call the cleanup function on unmount
6218
+ useEffect(function () {
6219
+ return function () {
6220
+ if (lastReportRef.current && lastReportRef.current.cleanup) {
6221
+ lastReportRef.current.cleanup();
6222
+ lastReportRef.current = null;
6223
+ }
6224
+ };
6225
+ }, []);
6226
+ return useCallback(function (element) {
6227
+ cbElementRef.current = element;
6228
+ evaluateSubscription();
6229
+ }, [evaluateSubscription]);
6230
+ }
6231
+ function extractSize(entry, sizeType) {
6232
+ if (!entry.contentBoxSize) {
6233
+ // The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.
6234
+ // See the 6th step in the description for the RO algorithm:
6235
+ // https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h
6236
+ // > Set this.contentRect to logical this.contentBoxSize given target and observedBox of "content-box".
6237
+ // In real browser implementations of course these objects differ, but the width/height values should be equivalent.
6238
+ return entry.contentRect[sizeType === 'inlineSize' ? 'width' : 'height'];
6239
+ }
6240
+ // A couple bytes smaller than calling Array.isArray() and just as effective here.
6241
+ return entry.contentBoxSize[0] ? entry.contentBoxSize[0][sizeType] :
6242
+ // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current
6243
+ // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.
6244
+ // @ts-expect-error TS2339: Property '0' does not exist on type 'ResizeObserverSize'.
6245
+ entry.contentBoxSize[sizeType];
6246
+ }
6247
+
6133
6248
  var IdCapture = function IdCapture(_a) {
6134
6249
  var _b, _c, _d, _e, _f, _g, _h;
6135
6250
  var requiredDocumentType = _a.requiredDocumentType,