idmission-web-sdk 2.3.94 → 2.3.95

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
@@ -206,7 +206,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
206
206
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
207
207
  };
208
208
 
209
- var webSdkVersion = '2.3.94';
209
+ var webSdkVersion = '2.3.95';
210
210
 
211
211
  function getPlatform() {
212
212
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -14360,9 +14360,9 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
14360
14360
  videoBitsPerSecond: 650000,
14361
14361
  audioBitsPerSecond: 32000
14362
14362
  });
14363
- signatureRecorder.onstart = function () {
14363
+ signatureRecorder.onstart = function (e) {
14364
14364
  set({
14365
- recordingStartedAt: performance.now()
14365
+ recordingStartedAt: e.timeStamp
14366
14366
  });
14367
14367
  };
14368
14368
  var hasFirstChunk = false;
@@ -14381,14 +14381,20 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
14381
14381
  }
14382
14382
  };
14383
14383
  signatureRecorder.start(100);
14384
+ set({
14385
+ recordingStartRequestedAt: performance.now()
14386
+ });
14384
14387
  },
14385
14388
  stopRecording: function stopRecording(signatureData, imageUrl) {
14389
+ set({
14390
+ recordingStopRequestedAt: performance.now()
14391
+ });
14386
14392
  waitForOneMoreChunk().then(function () {
14387
14393
  if (!signatureRecorder) return;
14388
14394
  signatureRecorder.stop();
14389
14395
  signatureRecorder.onstop = function () {
14390
14396
  return __awaiter(void 0, void 0, void 0, function () {
14391
- var recordingStoppedAt, inferredType, blob, _a, onSignatureVideoCaptured, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, lastChunkReceivedAt, mediaInfo;
14397
+ var recordingStoppedAt, inferredType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt, mediaInfo;
14392
14398
  var _b;
14393
14399
  return __generator(this, function (_c) {
14394
14400
  switch (_c.label) {
@@ -14404,67 +14410,20 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
14404
14410
  signatureChunks = [];
14405
14411
  signatureRecorder = null;
14406
14412
  if (!signatureData) return [2 /*return*/];
14407
- _a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt;
14408
- return [4 /*yield*/, (_b = get().mediaInfo) === null || _b === void 0 ? void 0 : _b.analyzeData(blob.size, makeReadChunk(blob))
14409
- // const endMs = Math.min(
14410
- // signatureEndedAt ?? Infinity,
14411
- // lastChunkReceivedAt ?? Infinity,
14412
- // )
14413
- // const signatureStartTimestamp =
14414
- // signatureStartedAt && recordingStartedAt
14415
- // ? formatTimestamp(
14416
- // Math.max(
14417
- // 0,
14418
- // signatureStartedAt -
14419
- // recordingStartedAt -
14420
- // RECORDING_TIMESTAMP_PADDING_MS,
14421
- // ),
14422
- // )
14423
- // : undefined
14424
- // const signatureEndTimestamp =
14425
- // endMs !== Infinity && recordingStartedAt
14426
- // ? formatTimestamp(
14427
- // Math.min(
14428
- // endMs - recordingStartedAt + RECORDING_TIMESTAMP_PADDING_MS,
14429
- // lastChunkReceivedAt ?? Infinity,
14430
- // ),
14431
- // )
14432
- // : undefined
14433
- ];
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))];
14434
14415
  case 1:
14435
14416
  mediaInfo = _c.sent();
14436
- // const endMs = Math.min(
14437
- // signatureEndedAt ?? Infinity,
14438
- // lastChunkReceivedAt ?? Infinity,
14439
- // )
14440
- // const signatureStartTimestamp =
14441
- // signatureStartedAt && recordingStartedAt
14442
- // ? formatTimestamp(
14443
- // Math.max(
14444
- // 0,
14445
- // signatureStartedAt -
14446
- // recordingStartedAt -
14447
- // RECORDING_TIMESTAMP_PADDING_MS,
14448
- // ),
14449
- // )
14450
- // : undefined
14451
- // const signatureEndTimestamp =
14452
- // endMs !== Infinity && recordingStartedAt
14453
- // ? formatTimestamp(
14454
- // Math.min(
14455
- // endMs - recordingStartedAt + RECORDING_TIMESTAMP_PADDING_MS,
14456
- // lastChunkReceivedAt ?? Infinity,
14457
- // ),
14458
- // )
14459
- // : undefined
14460
14417
  onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
14461
14418
  mediaInfo: mediaInfo,
14462
14419
  mimeType: inferredType,
14463
14420
  timingData: {
14421
+ recordingStartRequestedAt: recordingStartRequestedAt,
14464
14422
  recordingStartedAt: recordingStartedAt,
14465
14423
  firstChunkReceivedAt: firstChunkReceivedAt,
14466
14424
  signatureStartedAt: signatureStartedAt,
14467
14425
  signatureEndedAt: signatureEndedAt,
14426
+ recordingStopRequestedAt: recordingStopRequestedAt,
14468
14427
  recordingStoppedAt: recordingStoppedAt,
14469
14428
  lastChunkReceivedAt: lastChunkReceivedAt
14470
14429
  }
@@ -14643,14 +14602,6 @@ function VideoSignatureContextProvider(_a) {
14643
14602
  muted: true,
14644
14603
  style: {
14645
14604
  display: 'none'
14646
- // position: 'absolute',
14647
- // top: 0,
14648
- // left: 0,
14649
- // width: '100%',
14650
- // height: '100%',
14651
- // zIndex: 1000,
14652
- // pointerEvents: 'none',
14653
- // opacity: 0.5,
14654
14605
  }
14655
14606
  }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
14656
14607
  ref: frameCheckCanvas,
@@ -14662,22 +14613,6 @@ function VideoSignatureContextProvider(_a) {
14662
14613
  height: (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.videoHeight
14663
14614
  }));
14664
14615
  }
14665
- // function formatTimestamp(durationMs: number): string {
14666
- // // should be in the format of 00:00:00:00 (hh:mm:ss:cs)
14667
- // const hours = Math.floor(durationMs / 3600000)
14668
- // const minutes = Math.floor((durationMs % 3600000) / 60000)
14669
- // const seconds = Math.floor((durationMs % 60000) / 1000)
14670
- // const milliseconds = durationMs % 1000
14671
- // // Convert milliseconds to centiseconds (1/100th of a second)
14672
- // const centiseconds = Math.floor(milliseconds / 10)
14673
- // const csString = centiseconds.toString().padStart(2, '0')
14674
- // return (
14675
- // `${hours.toString().padStart(2, '0')}:` +
14676
- // `${minutes.toString().padStart(2, '0')}:` +
14677
- // `${seconds.toString().padStart(2, '0')}:` +
14678
- // `${csString}`
14679
- // )
14680
- // }
14681
14616
  function isVideoBlank(video, canvas) {
14682
14617
  if (!video || !canvas) return true;
14683
14618
  var ctx2 = canvas.getContext('2d');