idmission-web-sdk 2.2.101 → 2.2.102

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
@@ -204,7 +204,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
204
204
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
205
205
  };
206
206
 
207
- var webSdkVersion = '2.2.101';
207
+ var webSdkVersion = '2.2.102';
208
208
 
209
209
  function getPlatform() {
210
210
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -9258,6 +9258,7 @@ function IdCaptureOrUploadScreen(_a) {
9258
9258
  }, /*#__PURE__*/React__default.createElement(XIcon, null)))));
9259
9259
  }
9260
9260
  function PassportUploadScreen(_a) {
9261
+ var _this = this;
9261
9262
  var _b = _a.classNames,
9262
9263
  classNames = _b === void 0 ? {} : _b,
9263
9264
  _c = _a.verbiage,
@@ -9265,7 +9266,6 @@ function PassportUploadScreen(_a) {
9265
9266
  var _d = useState(null),
9266
9267
  file = _d[0],
9267
9268
  setFile = _d[1];
9268
- var onCapturedManually = useOnCapturedManually();
9269
9269
  var verbiage = useTranslations(rawVerbiage, {
9270
9270
  uploadPassportText: 'Upload Passport',
9271
9271
  loadingText: 'Loading...',
@@ -9291,7 +9291,23 @@ function PassportUploadScreen(_a) {
9291
9291
  disabled: !file,
9292
9292
  colors: buttonColors,
9293
9293
  onClick: function onClick() {
9294
- return onCapturedManually(file);
9294
+ return __awaiter(_this, void 0, void 0, function () {
9295
+ var _a;
9296
+ var _b, _c;
9297
+ return __generator(this, function (_d) {
9298
+ switch (_d.label) {
9299
+ case 0:
9300
+ _a = dispatchIdCaptureAction;
9301
+ _b = {
9302
+ type: 'documentCaptured'
9303
+ };
9304
+ _c = {};
9305
+ return [4 /*yield*/, readFile(file)];
9306
+ case 1:
9307
+ return [2 /*return*/, _a.apply(void 0, [(_b.payload = (_c.imageData = _d.sent(), _c.documentType = 'passport', _c.width = 0, _c.height = 0, _c), _b)])];
9308
+ }
9309
+ });
9310
+ });
9295
9311
  }
9296
9312
  }, verbiage.continueText)));
9297
9313
  }
@@ -9348,41 +9364,33 @@ function IdDocumentUploadScreen(_a) {
9348
9364
  colors: buttonColors,
9349
9365
  onClick: function onClick() {
9350
9366
  return __awaiter(_this, void 0, void 0, function () {
9351
- var _a, _b, _c, _d, _e;
9352
- var _f, _g, _h, _j, _k;
9353
- return __generator(this, function (_l) {
9354
- switch (_l.label) {
9367
+ var _a, _b, _c, _d;
9368
+ var _e, _f, _g, _h;
9369
+ return __generator(this, function (_j) {
9370
+ switch (_j.label) {
9355
9371
  case 0:
9356
- if (!(!idBackFile && state.allowSinglePageIdCapture)) return [3 /*break*/, 2];
9357
- state.dispatch({
9358
- type: 'setUploadingDocumentsType',
9359
- payload: 'singlePage'
9360
- });
9361
9372
  _b = (_a = state).dispatch;
9362
- _f = {
9363
- type: 'documentCaptured'
9373
+ _e = {
9374
+ type: 'documentsCaptured'
9364
9375
  };
9365
- _g = {};
9376
+ if (!(!idBackFile && state.allowSinglePageIdCapture)) return [3 /*break*/, 2];
9377
+ _f = {};
9366
9378
  return [4 /*yield*/, readFile(idFrontFile)];
9367
9379
  case 1:
9368
- _b.apply(_a, [(_f.payload = (_g.imageData = _l.sent(), _g.documentType = 'singlePage', _g.width = 0, _g.height = 0, _g), _f)]);
9380
+ _c = [(_f.imageData = _j.sent(), _f.documentType = 'singlePage', _f.width = 0, _f.height = 0, _f)];
9369
9381
  return [3 /*break*/, 5];
9370
9382
  case 2:
9371
- _d = (_c = state).dispatch;
9372
- _h = {
9373
- type: 'documentsCaptured'
9374
- };
9375
- _j = {};
9383
+ _g = {};
9376
9384
  return [4 /*yield*/, readFile(idFrontFile)];
9377
9385
  case 3:
9378
- _e = [(_j.imageData = _l.sent(), _j.documentType = 'idCardFront', _j.width = 0, _j.height = 0, _j)];
9379
- _k = {};
9386
+ _d = [(_g.imageData = _j.sent(), _g.documentType = 'idCardFront', _g.width = 0, _g.height = 0, _g)];
9387
+ _h = {};
9380
9388
  return [4 /*yield*/, readFile(idBackFile)];
9381
9389
  case 4:
9382
- _d.apply(_c, [(_h.payload = _e.concat([(_k.imageData = _l.sent(), _k.documentType = 'idCardBack', _k.width = 0, _k.height = 0, _k)]), _h)]);
9383
- _l.label = 5;
9390
+ _c = _d.concat([(_h.imageData = _j.sent(), _h.documentType = 'idCardBack', _h.width = 0, _h.height = 0, _h)]);
9391
+ _j.label = 5;
9384
9392
  case 5:
9385
- return [2 /*return*/];
9393
+ return [2 /*return*/, _b.apply(_a, [(_e.payload = _c, _e)])];
9386
9394
  }
9387
9395
  });
9388
9396
  });
@@ -9403,25 +9411,6 @@ function CancelUploadTypeButton(_a) {
9403
9411
  }
9404
9412
  }, children);
9405
9413
  }
9406
- function useOnCapturedManually() {
9407
- return useCallback(function () {
9408
- var files = [];
9409
- for (var _i = 0; _i < arguments.length; _i++) {
9410
- files[_i] = arguments[_i];
9411
- }
9412
- return Promise.all(files.filter(Boolean).map(readFile)).then(function (f) {
9413
- for (var _i = 0, f_1 = f; _i < f_1.length; _i++) {
9414
- var imageData = f_1[_i];
9415
- dispatchIdCaptureAction({
9416
- type: 'documentCapturedManually',
9417
- payload: {
9418
- imageData: imageData
9419
- }
9420
- });
9421
- }
9422
- });
9423
- }, []);
9424
- }
9425
9414
  function readFile(file) {
9426
9415
  return new Promise(function (resolve, reject) {
9427
9416
  if (!file) return reject(new Error('File is undefined'));