@tap-payments/auth-jsconnect 2.9.21-development → 2.9.22-development

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.
@@ -55,9 +55,10 @@ import { sendCustomEventToGTM, sleep } from '../../../utils';
55
55
  export var verifyTokenApi = createAsyncThunk('kyc/verifyTokenApi', function (_a, thunkApi) {
56
56
  var token = _a.token;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, _b, config, country_code, segment_id, boardId, status, publicKey, nextScreen, userList, userPayload, users;
59
- return __generator(this, function (_c) {
60
- switch (_c.label) {
58
+ var payload, data, _b, config, country_code, segment_id, boardId, boardInfoId, publicKey, info, isCompleted, nextScreen, userList, userPayload, users;
59
+ var _c;
60
+ return __generator(this, function (_d) {
61
+ switch (_d.label) {
61
62
  case 0:
62
63
  payload = {
63
64
  service_name: 'tap_email',
@@ -68,15 +69,20 @@ export var verifyTokenApi = createAsyncThunk('kyc/verifyTokenApi', function (_a,
68
69
  };
69
70
  return [4, API.leadService.verifyToken(payload)];
70
71
  case 1:
71
- data = _c.sent();
72
- _b = data || {}, config = _b.config, country_code = _b.country_code, segment_id = _b.segment_id, boardId = _b.id, status = _b.status;
72
+ data = _d.sent();
73
+ _b = data || {}, config = _b.config, country_code = _b.country_code, segment_id = _b.segment_id, boardId = _b.id, boardInfoId = _b.board_info_id;
73
74
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
74
- nextScreen = status === 'completed' ? CONNECT_FLOWS.kyc.alreadySubmitted : CONNECT_FLOWS.kyc.terms;
75
+ return [4, API.boardService.retrieveBoardInfo({ id: boardId, infoId: boardInfoId })];
76
+ case 2:
77
+ info = (_d.sent()).info;
78
+ isCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'kyc'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
79
+ nextScreen = isCompleted ? CONNECT_FLOWS.kyc.alreadySubmitted : CONNECT_FLOWS.kyc.terms;
75
80
  userList = [];
76
81
  if (country_code)
77
82
  thunkApi.dispatch(handleSetCountryByIso2(country_code));
78
83
  if (publicKey)
79
84
  thunkApi.dispatch(handlePublicKey(publicKey));
85
+ if (!!isCompleted) return [3, 4];
80
86
  userPayload = {
81
87
  page: 1,
82
88
  limit: 25,
@@ -84,15 +90,16 @@ export var verifyTokenApi = createAsyncThunk('kyc/verifyTokenApi', function (_a,
84
90
  segment_ids: [segment_id]
85
91
  };
86
92
  return [4, API.userService.getUserListUsingSegmentId(userPayload)];
87
- case 2:
88
- users = (_c.sent()).users;
93
+ case 3:
94
+ users = (_d.sent()).users;
89
95
  userList = users || [];
90
- return [2, {
91
- data: __assign(__assign({}, data), { boardId: boardId }),
92
- userList: userList,
93
- token: token,
94
- nextScreen: nextScreen
95
- }];
96
+ _d.label = 4;
97
+ case 4: return [2, {
98
+ data: __assign(__assign({}, data), { boardId: boardId }),
99
+ userList: userList,
100
+ token: token,
101
+ nextScreen: nextScreen
102
+ }];
96
103
  }
97
104
  });
98
105
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.9.21-development",
3
+ "version": "2.9.22-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",