@tap-payments/auth-jsconnect 2.8.8-test → 2.8.10-test

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.
@@ -171,14 +171,14 @@ export var resendMobileAuthOTP = createAsyncThunk('auth/resendMobileAuthOTP', fu
171
171
  });
172
172
  }); });
173
173
  export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
174
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, scope, payload, data;
174
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
175
175
  var _d, _e, _f, _g;
176
176
  return __generator(this, function (_h) {
177
177
  switch (_h.label) {
178
178
  case 0:
179
179
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
180
180
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
181
- _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type;
181
+ _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type, sign_in = _c.sign_in;
182
182
  if (!auth_token)
183
183
  throw new Error('Auth token is missing');
184
184
  scope = settings.data.appConfig.scope;
@@ -189,7 +189,7 @@ export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (
189
189
  auth_type: auth_type,
190
190
  device_token: device_token,
191
191
  service_name: service_name,
192
- sign_in: false,
192
+ sign_in: sign_in,
193
193
  step_name: AUTH_STEP_NAMES.VERIFY_AUTH_MOBILE,
194
194
  encryption_contract: ['data']
195
195
  };
@@ -243,14 +243,14 @@ export var createEmailAuth = createAsyncThunk('auth/createEmailAuth', function (
243
243
  });
244
244
  }); });
245
245
  export var verifyEmailPassword = createAsyncThunk('auth/verifyEmailPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
246
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, scope, payload, data;
246
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
247
247
  var _d, _e, _f, _g;
248
248
  return __generator(this, function (_h) {
249
249
  switch (_h.label) {
250
250
  case 0:
251
251
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
252
252
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
253
- _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type;
253
+ _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type, sign_in = _c.sign_in;
254
254
  if (!auth_token)
255
255
  throw new Error('Auth token is missing');
256
256
  scope = settings.data.appConfig.scope;
@@ -261,7 +261,7 @@ export var verifyEmailPassword = createAsyncThunk('auth/verifyEmailPassword', fu
261
261
  auth_type: auth_type,
262
262
  device_token: device_token,
263
263
  service_name: service_name,
264
- sign_in: true,
264
+ sign_in: sign_in,
265
265
  is_lead: false,
266
266
  step_name: AUTH_STEP_NAMES.VERIFY_AUTH_EMAIL,
267
267
  encryption_contract: ['data']
@@ -308,14 +308,14 @@ export var resendEmailAuthOTP = createAsyncThunk('auth/resendEmailAuthOTP', func
308
308
  });
309
309
  }); });
310
310
  export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
311
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, scope, payload, data;
311
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
312
312
  var _d, _e, _f, _g;
313
313
  return __generator(this, function (_h) {
314
314
  switch (_h.label) {
315
315
  case 0:
316
316
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
317
317
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
318
- _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type;
318
+ _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type, sign_in = _c.sign_in;
319
319
  if (!auth_token)
320
320
  throw new Error('Auth token is missing');
321
321
  scope = settings.data.appConfig.scope;
@@ -326,7 +326,7 @@ export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (pa
326
326
  auth_type: auth_type,
327
327
  device_token: device_token,
328
328
  service_name: service_name,
329
- sign_in: false,
329
+ sign_in: sign_in,
330
330
  step_name: AUTH_STEP_NAMES.VERIFY_AUTH_MOBILE,
331
331
  encryption_contract: ['data']
332
332
  };
@@ -423,14 +423,14 @@ export var resendNIDAuthOTP = createAsyncThunk('auth/resendNIDAuthOTP', function
423
423
  });
424
424
  }); });
425
425
  export var verifyNIDOtp = createAsyncThunk('auth/verifyNIDOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
426
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, scope, payload, data;
426
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
427
427
  var _d, _e, _f, _g;
428
428
  return __generator(this, function (_h) {
429
429
  switch (_h.label) {
430
430
  case 0:
431
431
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
432
432
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
433
- _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type;
433
+ _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type, sign_in = _c.sign_in;
434
434
  if (!auth_token)
435
435
  throw new Error('Auth token is missing');
436
436
  scope = settings.data.appConfig.scope;
@@ -441,7 +441,7 @@ export var verifyNIDOtp = createAsyncThunk('auth/verifyNIDOtp', function (params
441
441
  auth_type: auth_type,
442
442
  device_token: device_token,
443
443
  service_name: service_name || 'ABSHER',
444
- sign_in: false,
444
+ sign_in: sign_in,
445
445
  step_name: AUTH_STEP_NAMES.VERIFY_AUTH_NID,
446
446
  encryption_contract: ['data']
447
447
  };
@@ -534,13 +534,14 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
534
534
  });
535
535
  }); });
536
536
  export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
537
- var _a, settings, auth, authConfigData, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
537
+ var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
538
538
  var _c;
539
539
  return __generator(this, function (_d) {
540
540
  switch (_d.label) {
541
541
  case 0:
542
542
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
543
543
  authConfigData = settings.data.appConfig.data;
544
+ authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
544
545
  isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
545
546
  data = (_c = auth.data.responseData) === null || _c === void 0 ? void 0 : _c.authResponse;
546
547
  authId = data === null || data === void 0 ? void 0 : data.id;
@@ -557,7 +558,7 @@ export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailab
557
558
  _d.sent();
558
559
  return [2, { brandList: brandList, entityList: entityList }];
559
560
  case 3:
560
- if (isExistingUser && !isDataHasIndividualOnly && brandList.length && entityList.length) {
561
+ if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
561
562
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
562
563
  return [2, { brandList: brandList, entityList: entityList }];
563
564
  }
@@ -417,7 +417,7 @@ export var createCivilIdAuthAsync = createAsyncThunk('connectExpress/createCivil
417
417
  });
418
418
  }); });
419
419
  export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
420
- var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, mobileData, _c, auth_token, device_token, service_name, _d, scope, redirectUrl, authData, isScopeAuthentication, bi, isDataHasIndividualOnly, payload, data, authId, urlQueryStart, _e, brandList, entityList, isKuwait, next;
420
+ var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, mobileData, _c, auth_token, device_token, service_name, _d, scope, redirectUrl, authData, isScopeAuthentication, bi, isDataHasIndividualOnly, authDataHasValue, payload, data, authId, urlQueryStart, _e, brandList, entityList, isKuwait, next;
421
421
  var _f, _g;
422
422
  return __generator(this, function (_h) {
423
423
  switch (_h.label) {
@@ -431,6 +431,7 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
431
431
  isScopeAuthentication = scope === SCOPE_AUTH;
432
432
  bi = settings.data.deviceInfo.browser.browser_id;
433
433
  isDataHasIndividualOnly = (authData === null || authData === void 0 ? void 0 : authData.length) === 1 && authData.includes('individual');
434
+ authDataHasValue = authData === null || authData === void 0 ? void 0 : authData.length;
434
435
  payload = {
435
436
  auth_token: auth_token,
436
437
  lead_id: leadId,
@@ -461,7 +462,7 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
461
462
  return [2, data];
462
463
  }
463
464
  }
464
- if (!(isScopeAuthentication && !data.new_user && !isDataHasIndividualOnly)) return [3, 3];
465
+ if (!(isScopeAuthentication && !data.new_user && authDataHasValue)) return [3, 3];
465
466
  return [4, thunkApi.dispatch(retrieveAuthenticationListAsync({ individualId: data.individual_id })).unwrap()];
466
467
  case 2:
467
468
  _e = _h.sent(), brandList = _e.brandList, entityList = _e.entityList;
@@ -483,7 +484,7 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
483
484
  });
484
485
  }); });
485
486
  export var verifyNIDOtpAsync = createAsyncThunk('connectExpress/verifyNIDOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
486
- var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, nidData, _c, auth_token, device_token, service_name, _d, scope, redirectUrl, authData, isScopeAuthentication, bi, isDataHasIndividualOnly, payload, data, authId, urlQueryStart, _e, brandList, entityList, stepName, needToCollectMoreInfo, creatingAccount;
487
+ var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, nidData, _c, auth_token, device_token, service_name, _d, scope, redirectUrl, authData, isScopeAuthentication, bi, isDataHasIndividualOnly, authDataHasValue, payload, data, authId, urlQueryStart, _e, brandList, entityList, stepName, needToCollectMoreInfo, creatingAccount;
487
488
  var _f, _g;
488
489
  return __generator(this, function (_h) {
489
490
  switch (_h.label) {
@@ -497,6 +498,7 @@ export var verifyNIDOtpAsync = createAsyncThunk('connectExpress/verifyNIDOtpAsyn
497
498
  isScopeAuthentication = scope === SCOPE_AUTH;
498
499
  bi = settings.data.deviceInfo.browser.browser_id;
499
500
  isDataHasIndividualOnly = (authData === null || authData === void 0 ? void 0 : authData.length) === 1 && authData.includes('individual');
501
+ authDataHasValue = authData === null || authData === void 0 ? void 0 : authData.length;
500
502
  payload = {
501
503
  auth_token: auth_token,
502
504
  lead_id: leadId,
@@ -527,7 +529,7 @@ export var verifyNIDOtpAsync = createAsyncThunk('connectExpress/verifyNIDOtpAsyn
527
529
  return [2, data];
528
530
  }
529
531
  }
530
- if (!(isScopeAuthentication && !data.new_user && !isDataHasIndividualOnly)) return [3, 3];
532
+ if (!(isScopeAuthentication && !data.new_user && authDataHasValue)) return [3, 3];
531
533
  return [4, thunkApi.dispatch(retrieveAuthenticationListAsync({ individualId: data.individual_id })).unwrap()];
532
534
  case 2:
533
535
  _e = _h.sent(), brandList = _e.brandList, entityList = _e.entityList;
@@ -553,7 +555,7 @@ export var verifyNIDOtpAsync = createAsyncThunk('connectExpress/verifyNIDOtpAsyn
553
555
  });
554
556
  }); });
555
557
  export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
556
- var _a, settings, connectExpress, authData, _b, scope, redirectUrl, authConfigData, isScopeAuthentication, bi, isDataHasIndividualOnly, expiry, interval, maxCalls, count, data, isSuccess, authId, urlQueryStart, _c, brandList, entityList, stepName, needToCollectMoreInfo, creatingAccount;
558
+ var _a, settings, connectExpress, authData, _b, scope, redirectUrl, authConfigData, isScopeAuthentication, bi, isDataHasIndividualOnly, authDataHasValue, expiry, interval, maxCalls, count, data, isSuccess, authId, urlQueryStart, _c, brandList, entityList, stepName, needToCollectMoreInfo, creatingAccount;
557
559
  var _d, _e, _f;
558
560
  return __generator(this, function (_g) {
559
561
  switch (_g.label) {
@@ -563,7 +565,8 @@ export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync',
563
565
  _b = settings.data.appConfig, scope = _b.scope, redirectUrl = _b.redirectUrl, authConfigData = _b.data;
564
566
  isScopeAuthentication = scope === SCOPE_AUTH;
565
567
  bi = settings.data.deviceInfo.browser.browser_id;
566
- isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authData.includes('individual');
568
+ isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
569
+ authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
567
570
  expiry = (authData === null || authData === void 0 ? void 0 : authData.expiry) || 120;
568
571
  interval = 3;
569
572
  maxCalls = Math.floor(expiry / interval);
@@ -593,7 +596,7 @@ export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync',
593
596
  return [2, data];
594
597
  }
595
598
  }
596
- if (!(isScopeAuthentication && !data.new_user && !isDataHasIndividualOnly)) return [3, 4];
599
+ if (!(isScopeAuthentication && !data.new_user && authDataHasValue)) return [3, 4];
597
600
  return [4, thunkApi.dispatch(retrieveAuthenticationListAsync({ individualId: data.individual_id })).unwrap()];
598
601
  case 3:
599
602
  _c = _g.sent(), brandList = _c.brandList, entityList = _c.entityList;
@@ -868,10 +871,10 @@ export var checkBrandNameAvailabilityAsync = createAsyncThunk('connectExpress/ch
868
871
  });
869
872
  });
870
873
  export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAsync', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
871
- var _a, connectExpress, settings, responseData, _b, postURL, scope, redirectUrl, mode, showBoard, platforms, payment_provider, authId, bi, body, data, leadData, board_id, board_info_id, _c, boardInfo, boardData, urlQueryStart;
872
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
873
- return __generator(this, function (_t) {
874
- switch (_t.label) {
874
+ var _a, connectExpress, settings, responseData, _b, postURL, scope, redirectUrl, mode, showBoard, platforms, payment_provider, authId, bi, body, data, leadData, board_id, board_info_id, _c, boardInfo, boardData, leadData, urlQueryStart;
875
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
876
+ return __generator(this, function (_w) {
877
+ switch (_w.label) {
875
878
  case 0:
876
879
  _a = thunkApi.getState(), connectExpress = _a.connectExpress, settings = _a.settings;
877
880
  responseData = connectExpress.data.responseData;
@@ -888,14 +891,14 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
888
891
  };
889
892
  return [4, API.accountService.expressCreateAccount(body)];
890
893
  case 1:
891
- data = _t.sent();
894
+ data = _w.sent();
892
895
  (_l = (_k = settings.data.appConfig).onCreated) === null || _l === void 0 ? void 0 : _l.call(_k, data);
893
896
  (_o = (_m = settings.data.appConfig).onFlowCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, data);
894
897
  (_q = (_p = settings.data.appConfig).onStepCompleted) === null || _q === void 0 ? void 0 : _q.call(_p, settings.data.activeScreen.name, data);
895
898
  if (!showBoard) return [3, 4];
896
899
  return [4, thunkApi.dispatch(getLeadByIdAsync(data.lead.id)).unwrap()];
897
900
  case 2:
898
- leadData = (_t.sent()).data;
901
+ leadData = (_w.sent()).data;
899
902
  board_id = (_r = data.board_id) !== null && _r !== void 0 ? _r : leadData.board_id;
900
903
  board_info_id = (_s = data.board_info_id) !== null && _s !== void 0 ? _s : leadData.board_info_id;
901
904
  return [4, Promise.all([
@@ -903,10 +906,19 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
903
906
  API.boardService.retrieveBoardDetails(board_id)
904
907
  ])];
905
908
  case 3:
906
- _c = _t.sent(), boardInfo = _c[0], boardData = _c[1];
909
+ _c = _w.sent(), boardInfo = _c[0], boardData = _c[1];
907
910
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
908
911
  return [2, { boardInfo: boardInfo, boardData: boardData, account: data }];
909
912
  case 4:
913
+ if (!(scope === SCOPE_AUTH)) return [3, 7];
914
+ return [4, thunkApi.dispatch(getLeadByIdAsync(data.lead.id)).unwrap()];
915
+ case 5:
916
+ leadData = (_w.sent()).data;
917
+ return [4, thunkApi.dispatch(onCloseComplete({ merchantId: (_t = data === null || data === void 0 ? void 0 : data.merchant) === null || _t === void 0 ? void 0 : _t.id, brandId: (_u = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _u === void 0 ? void 0 : _u.id, entityId: (_v = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _v === void 0 ? void 0 : _v.id }))];
918
+ case 6:
919
+ _w.sent();
920
+ return [2, { account: data }];
921
+ case 7:
910
922
  if (redirectUrl && mode === 'page') {
911
923
  urlQueryStart = redirectUrl.includes('?') ? '&' : '?';
912
924
  window.open("".concat(redirectUrl).concat(urlQueryStart, "authentication_id=").concat(authId, "&bi=").concat(bi), '_self');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.8-test",
3
+ "version": "2.8.10-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",