idmission-web-sdk 2.3.96 → 2.3.98

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
@@ -16,7 +16,6 @@ import { devtools } from 'zustand/middleware';
16
16
  import { useShallow } from 'zustand/react/shallow';
17
17
  import cn from 'clsx';
18
18
  import SignatureCanvas from 'react-signature-canvas';
19
- import mediaInfoFactory from 'mediainfo.js';
20
19
  import { renderToString } from 'react-dom/server';
21
20
 
22
21
  /******************************************************************************
@@ -206,7 +205,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
206
205
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
207
206
  };
208
207
 
209
- var webSdkVersion = '2.3.96';
208
+ var webSdkVersion = '2.3.98';
210
209
 
211
210
  function getPlatform() {
212
211
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -14296,23 +14295,14 @@ function inferBlobType(blobPart) {
14296
14295
  return t.length > 0 ? t : undefined;
14297
14296
  }
14298
14297
 
14299
- function makeReadChunk(file) {
14300
- var _this = this;
14301
- return function (chunkSize, offset) {
14302
- return __awaiter(_this, void 0, void 0, function () {
14303
- var _a;
14304
- return __generator(this, function (_b) {
14305
- switch (_b.label) {
14306
- case 0:
14307
- _a = Uint8Array.bind;
14308
- return [4 /*yield*/, file.slice(offset, offset + chunkSize).arrayBuffer()];
14309
- case 1:
14310
- return [2 /*return*/, new (_a.apply(Uint8Array, [void 0, _b.sent()]))()];
14311
- }
14312
- });
14313
- });
14314
- };
14315
- }
14298
+ // import { mediaInfoFactory } from 'mediainfo.js'
14299
+ // import type { ReadChunkFunc, MediaInfo, MediaInfoResult } from 'mediainfo.js'
14300
+ // import { DEFAULT_CDN_URL } from '../common/cdn'
14301
+ // import { warn } from '../../lib/utils/logger'
14302
+ // function makeReadChunk(file: File | Blob): ReadChunkFunc {
14303
+ // return async (chunkSize: number, offset: number) =>
14304
+ // new Uint8Array(await file.slice(offset, offset + chunkSize).arrayBuffer())
14305
+ // }
14316
14306
  var signatureRecorder = null;
14317
14307
  var signatureChunks = [];
14318
14308
  var videoSignatureInitialState = {
@@ -14394,42 +14384,39 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
14394
14384
  signatureRecorder.stop();
14395
14385
  signatureRecorder.onstop = function () {
14396
14386
  return __awaiter(void 0, void 0, void 0, function () {
14397
- var recordingStoppedAt, inferredType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt, mediaInfo;
14398
- var _b;
14399
- return __generator(this, function (_c) {
14400
- switch (_c.label) {
14401
- case 0:
14402
- recordingStoppedAt = performance.now();
14403
- set({
14404
- recordingStoppedAt: recordingStoppedAt
14405
- });
14406
- inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
14407
- blob = new Blob(signatureChunks, {
14408
- type: inferredType
14409
- });
14410
- signatureChunks = [];
14411
- signatureRecorder = null;
14412
- if (!signatureData) return [2 /*return*/];
14413
- _a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt;
14414
- return [4 /*yield*/, (_b = get().mediaInfo) === null || _b === void 0 ? void 0 : _b.analyzeData(blob.size, makeReadChunk(blob))];
14415
- case 1:
14416
- mediaInfo = _c.sent();
14417
- onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
14418
- mediaInfo: mediaInfo,
14419
- mimeType: inferredType,
14420
- timingData: {
14421
- recordingStartRequestedAt: recordingStartRequestedAt,
14422
- recordingStartedAt: recordingStartedAt,
14423
- firstChunkReceivedAt: firstChunkReceivedAt,
14424
- signatureStartedAt: signatureStartedAt,
14425
- signatureEndedAt: signatureEndedAt,
14426
- recordingStopRequestedAt: recordingStopRequestedAt,
14427
- recordingStoppedAt: recordingStoppedAt,
14428
- lastChunkReceivedAt: lastChunkReceivedAt
14429
- }
14430
- });
14431
- return [2 /*return*/];
14432
- }
14387
+ var recordingStoppedAt, inferredType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt;
14388
+ return __generator(this, function (_b) {
14389
+ recordingStoppedAt = performance.now();
14390
+ set({
14391
+ recordingStoppedAt: recordingStoppedAt
14392
+ });
14393
+ inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
14394
+ blob = new Blob(signatureChunks, {
14395
+ type: inferredType
14396
+ });
14397
+ signatureChunks = [];
14398
+ signatureRecorder = null;
14399
+ if (!signatureData) return [2 /*return*/];
14400
+ _a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt;
14401
+ // const mediaInfo = await get().mediaInfo?.analyzeData(
14402
+ // blob.size,
14403
+ // makeReadChunk(blob),
14404
+ // )
14405
+ onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
14406
+ // mediaInfo,
14407
+ mimeType: inferredType,
14408
+ timingData: {
14409
+ recordingStartRequestedAt: recordingStartRequestedAt,
14410
+ recordingStartedAt: recordingStartedAt,
14411
+ firstChunkReceivedAt: firstChunkReceivedAt,
14412
+ signatureStartedAt: signatureStartedAt,
14413
+ signatureEndedAt: signatureEndedAt,
14414
+ recordingStopRequestedAt: recordingStopRequestedAt,
14415
+ recordingStoppedAt: recordingStoppedAt,
14416
+ lastChunkReceivedAt: lastChunkReceivedAt
14417
+ }
14418
+ });
14419
+ return [2 /*return*/];
14433
14420
  });
14434
14421
  });
14435
14422
  };
@@ -14479,9 +14466,7 @@ function waitForOneMoreChunk(timeoutMs) {
14479
14466
  function VideoSignatureContextProvider(_a) {
14480
14467
  var _this = this;
14481
14468
  var _b, _c, _d, _e;
14482
- var children = _a.children,
14483
- _f = _a.captureMediaInfo,
14484
- captureMediaInfo = _f === void 0 ? false : _f;
14469
+ var children = _a.children;
14485
14470
  var videoRef = useCameraStore().videoRef;
14486
14471
  var outputCanvas = useRef(null);
14487
14472
  useEffect(function () {
@@ -14491,31 +14476,27 @@ function VideoSignatureContextProvider(_a) {
14491
14476
  }, []);
14492
14477
  var signatureVideoRef = useRef(null);
14493
14478
  var frameCheckCanvas = useRef(null);
14494
- useEffect(function () {
14495
- if (!captureMediaInfo) return;
14496
- mediaInfoFactory({
14497
- format: 'object',
14498
- full: true,
14499
- locateFile: function locateFile(filename) {
14500
- return "".concat(DEFAULT_CDN_URL, "/").concat(filename);
14501
- }
14502
- }).then(function (mediaInfo) {
14503
- useVideoSignatureStore.setState({
14504
- mediaInfo: mediaInfo
14505
- });
14506
- })["catch"](function (e) {
14507
- warn('error loading mediaInfo', e);
14508
- });
14509
- return function () {
14510
- var mediaInfo = useVideoSignatureStore.getState().mediaInfo;
14511
- if (mediaInfo) {
14512
- mediaInfo.close();
14513
- useVideoSignatureStore.setState({
14514
- mediaInfo: undefined
14515
- });
14516
- }
14517
- };
14518
- }, [captureMediaInfo]);
14479
+ // useEffect(() => {
14480
+ // if (!captureMediaInfo) return
14481
+ // mediaInfoFactory({
14482
+ // format: 'object',
14483
+ // full: true,
14484
+ // locateFile: (filename) => `${DEFAULT_CDN_URL}/${filename}`,
14485
+ // })
14486
+ // .then((mediaInfo) => {
14487
+ // useVideoSignatureStore.setState({ mediaInfo })
14488
+ // })
14489
+ // .catch((e) => {
14490
+ // warn('error loading mediaInfo', e)
14491
+ // })
14492
+ // return () => {
14493
+ // const mediaInfo = useVideoSignatureStore.getState().mediaInfo
14494
+ // if (mediaInfo) {
14495
+ // mediaInfo.close()
14496
+ // useVideoSignatureStore.setState({ mediaInfo: undefined })
14497
+ // }
14498
+ // }
14499
+ // }, [captureMediaInfo])
14519
14500
  var signaturePadEmpty = useVideoSignatureStore().signaturePadEmpty;
14520
14501
  var blankCheckPassed = useRef(false);
14521
14502
  useEffect(function () {
@@ -14587,9 +14568,9 @@ function VideoSignatureContextProvider(_a) {
14587
14568
  video.removeEventListener('play', onPlay);
14588
14569
  };
14589
14570
  }, [drawOutputFrame, videoRef]);
14590
- var _g = useVideoSignatureStore(),
14591
- signaturePad = _g.signaturePad,
14592
- recordingStartedAt = _g.recordingStartedAt;
14571
+ var _f = useVideoSignatureStore(),
14572
+ signaturePad = _f.signaturePad,
14573
+ recordingStartedAt = _f.recordingStartedAt;
14593
14574
  useEffect(function () {
14594
14575
  var _a;
14595
14576
  if (!signaturePad.current || !recordingStartedAt) return;