@tap-payments/auth-jsconnect 2.4.97-test → 2.4.99-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.
@@ -51,7 +51,7 @@ import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerP
51
51
  import { DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
52
52
  import i18n from '../i18n';
53
53
  import { updateLocale } from '../utils/locale';
54
- import API, { setAxiosGlobalHeaders } from '../api';
54
+ import API, { getAxiosHeaders, setAxiosGlobalHeaders } from '../api';
55
55
  export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
56
  var settings, _a, appConfig, language, _b, client, device, os, disableLocale, maturity, disableCountries, configToken, onVerifyConfigTokenSuccess, _c, visitorId, locale, configInfo, matureData, lang, initPayload, _d, country_list, ip_info, merchant, operator, config, list, _e, ip, latitude, longitude, domain, language_1, country, scope, public_key, maturity_1, board_maturity, deviceInfo, isValidOperator, countries, countryCode, isKWOrSA, businessCountry;
57
57
  return __generator(this, function (_f) {
@@ -70,7 +70,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
70
70
  setAxiosGlobalHeaders({
71
71
  bi: visitorId || '',
72
72
  mdn: encryptString(params.mdn || window.location.origin),
73
- authorization: encryptString(configInfo.publicKey)
73
+ authorization: configInfo.publicKey
74
74
  });
75
75
  initPayload = __assign(__assign({ type: 'website', app_client_version: 'js-auth-connect', requirer_browser: "".concat(client === null || client === void 0 ? void 0 : client.name, " , ").concat(client === null || client === void 0 ? void 0 : client.version), os: "".concat(os === null || os === void 0 ? void 0 : os.name, " , ").concat(os === null || os === void 0 ? void 0 : os.version), locale: language }, (configToken && { config_token: configToken })), { data_required: {
76
76
  country_list: !disableCountries
@@ -125,7 +125,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
125
125
  },
126
126
  source: 'browser'
127
127
  };
128
- setAxiosGlobalHeaders(__assign(__assign(__assign({}, getRequestHeaders(deviceInfo)), { authorization: encryptString(configInfo.publicKey), mdn: encryptString(params.mdn || window.location.origin), cu: window.location.href }), (matureData && { maturity: matureData })));
128
+ setAxiosGlobalHeaders(__assign(__assign(__assign({}, getRequestHeaders(deviceInfo)), { authorization: configInfo.publicKey, mdn: encryptString(params.mdn || window.location.origin), cu: window.location.href }), (matureData && { maturity: matureData })));
129
129
  isValidOperator = operator === 'valid';
130
130
  countries = sortCountries(list);
131
131
  countryCode = configInfo.businessCountryCode;
@@ -190,6 +190,7 @@ export var settingsSlice = createSlice({
190
190
  if (!action.payload)
191
191
  return;
192
192
  state.data.appConfig.publicKey = action.payload;
193
+ setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), { authorization: action.payload }));
193
194
  },
194
195
  handleSwitchCalender: function (state, action) {
195
196
  state.data.isHijri = action.payload;
@@ -49,13 +49,13 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
- import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
52
+ import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
54
  import { hasNoneEditableValue, isStringHasOneAsterisk, retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, boardData, boardInfoData, individualData, _b, board_id, board_info_id, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, countryIso2;
58
+ var payload, data, boardData, boardInfoData, individualData, _b, board_id, board_info_id, config, publicKey, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, countryIso2;
59
59
  var _e, _f, _g, _h, _j;
60
60
  return __generator(this, function (_k) {
61
61
  switch (_k.label) {
@@ -70,7 +70,11 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
70
70
  individualData = undefined;
71
71
  if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
72
72
  throw new Error(data.errors[0].description);
73
- _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
73
+ _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
74
+ publicKey = config === null || config === void 0 ? void 0 : config.public_key;
75
+ if (publicKey) {
76
+ thunkApi.dispatch(handlePublicKey(publicKey));
77
+ }
74
78
  if (!board_id) return [3, 6];
75
79
  if (!board_info_id) return [3, 3];
76
80
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
@@ -139,10 +143,10 @@ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunk
139
143
  });
140
144
  }); });
141
145
  export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
142
- var _a, bank, settings, responseBody, payload, data;
143
- var _b, _c, _d;
144
- return __generator(this, function (_e) {
145
- switch (_e.label) {
146
+ var _a, bank, settings, responseBody, payload, data, publicKey;
147
+ var _b, _c, _d, _e;
148
+ return __generator(this, function (_f) {
149
+ switch (_f.label) {
146
150
  case 0:
147
151
  _a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
148
152
  responseBody = bank.data.verify.responseBody;
@@ -155,9 +159,13 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
155
159
  };
156
160
  return [4, API.leadService.verifyLeadOTP(payload)];
157
161
  case 1:
158
- data = (_e.sent()).data;
162
+ data = (_f.sent()).data;
159
163
  if (!data.errors) {
160
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
164
+ publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
165
+ if (publicKey) {
166
+ thunkApi.dispatch(handlePublicKey(publicKey));
167
+ }
168
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
161
169
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
162
170
  }
163
171
  return [2, { data: data, formData: params }];
@@ -60,13 +60,13 @@ var _a;
60
60
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
61
61
  import API from '../../../api';
62
62
  import { FlowsTypes } from '../../../@types';
63
- import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
63
+ import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  import { BRAND_STEP_NAMES } from '../../../constants';
65
65
  import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sleep } from '../../../utils';
66
66
  export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
67
67
  var token = _a.token, isInternally = _a.isInternally;
68
68
  return __awaiter(void 0, void 0, void 0, function () {
69
- var payload, data, countryIso2, _b, board_id, board_info_id, salesChannels, boardData, boardInfoData, individualData, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes;
69
+ var payload, data, countryIso2, _b, board_id, board_info_id, config, publicKey, salesChannels, boardData, boardInfoData, individualData, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes;
70
70
  var _e, _f, _g, _h;
71
71
  return __generator(this, function (_j) {
72
72
  switch (_j.label) {
@@ -84,7 +84,11 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
84
84
  countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
85
85
  if (countryIso2)
86
86
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
87
- _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
87
+ _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
88
+ publicKey = config === null || config === void 0 ? void 0 : config.public_key;
89
+ if (publicKey) {
90
+ thunkApi.dispatch(handlePublicKey(publicKey));
91
+ }
88
92
  if (!board_id) {
89
93
  throw new Error('Internal server error');
90
94
  }
@@ -157,10 +161,10 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
157
161
  });
158
162
  }); });
159
163
  export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
160
- var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, salesChannels;
161
- var _e, _f, _g, _h, _j, _k, _l;
162
- return __generator(this, function (_m) {
163
- switch (_m.label) {
164
+ var _a, brand, settings, responseBody, payload, data, publicKey, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, salesChannels;
165
+ var _e, _f, _g, _h, _j, _k, _l, _m;
166
+ return __generator(this, function (_o) {
167
+ switch (_o.label) {
164
168
  case 0:
165
169
  _a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
166
170
  responseBody = brand.data.verify.responseBody;
@@ -173,9 +177,13 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
173
177
  };
174
178
  return [4, API.leadService.verifyLeadOTP(payload)];
175
179
  case 1:
176
- data = (_m.sent()).data;
180
+ data = (_o.sent()).data;
177
181
  if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
178
182
  throw new Error(data.errors[0].description);
183
+ publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
184
+ if (publicKey) {
185
+ thunkApi.dispatch(handlePublicKey(publicKey));
186
+ }
179
187
  _b = responseBody || {}, board_id = _b.id, board_info_id = _b.board_info_id;
180
188
  if (!board_id) {
181
189
  throw new Error('Internal server error');
@@ -184,22 +192,22 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
184
192
  if (!board_info_id) return [3, 3];
185
193
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
186
194
  case 2:
187
- boardInfoData = _m.sent();
188
- _m.label = 3;
195
+ boardInfoData = _o.sent();
196
+ _o.label = 3;
189
197
  case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
190
198
  case 4:
191
- boardData = _m.sent();
192
- _c = ((_g = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _g === void 0 ? void 0 : _g.recipient) || {}, id = _c.id, type = _c.type;
199
+ boardData = _o.sent();
200
+ _c = ((_h = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _h === void 0 ? void 0 : _h.recipient) || {}, id = _c.id, type = _c.type;
193
201
  serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
194
202
  return [4, retrieveIndividualData(type, boardData, serviceCallBack)];
195
203
  case 5:
196
- _d = _m.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
204
+ _d = _o.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
197
205
  boardData = boardRes;
198
206
  individualData = individualRes;
199
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
207
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, { otp: params.otp });
200
208
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
201
209
  case 6:
202
- salesChannels = _m.sent();
210
+ salesChannels = _o.sent();
203
211
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
204
212
  return [2, {
205
213
  data: data,
@@ -210,8 +218,8 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
210
218
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
211
219
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
212
220
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
213
- name: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.names,
214
- contact: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.contact,
221
+ name: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.names,
222
+ contact: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.contact,
215
223
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
216
224
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
217
225
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
@@ -60,12 +60,12 @@ import API from '../../../api';
60
60
  import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
61
61
  import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
62
62
  import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense } from '../../../utils';
63
- import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
63
+ import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
- var payload, data, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
66
- var _b;
67
- return __generator(this, function (_c) {
68
- switch (_c.label) {
65
+ var payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
66
+ var _b, _c;
67
+ return __generator(this, function (_d) {
68
+ switch (_d.label) {
69
69
  case 0:
70
70
  payload = {
71
71
  service_name: 'tap_email',
@@ -73,11 +73,15 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
73
73
  };
74
74
  return [4, API.leadService.verifyLeadToken(payload)];
75
75
  case 1:
76
- data = (_c.sent()).data;
76
+ data = (_d.sent()).data;
77
77
  if ((_b = data.errors) === null || _b === void 0 ? void 0 : _b.length)
78
78
  throw new Error(data.errors[0].description);
79
79
  if (data.mw_error)
80
80
  throw new Error(data.mw_error);
81
+ publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
82
+ if (publicKey) {
83
+ thunkApi.dispatch(handlePublicKey(publicKey));
84
+ }
81
85
  countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
82
86
  if (countryIso2)
83
87
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
@@ -86,7 +90,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
86
90
  brandData = void 0, isicActivityList = undefined;
87
91
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
88
92
  case 2:
89
- leadData = (_c.sent()).data;
93
+ leadData = (_d.sent()).data;
90
94
  countryIso2 = leadData === null || leadData === void 0 ? void 0 : leadData.country_code;
91
95
  if (!countryIso2)
92
96
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
@@ -107,11 +111,11 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
107
111
  if (!board_id) return [3, 5];
108
112
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
109
113
  case 3:
110
- boardData = _c.sent();
114
+ boardData = _d.sent();
111
115
  return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
112
116
  case 4:
113
- _c.sent();
114
- _c.label = 5;
117
+ _d.sent();
118
+ _d.label = 5;
115
119
  case 5:
116
120
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
117
121
  return [3, 19];
@@ -127,38 +131,38 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
127
131
  if (!hasBusinessCRActivitiesCompleted) return [3, 12];
128
132
  return [4, API.dataService.getActivitiesIsIc()];
129
133
  case 9:
130
- list = (_c.sent()).list;
134
+ list = (_d.sent()).list;
131
135
  isicActivityList = list || [];
132
136
  return [4, thunkApi.dispatch(retrieveDataList())];
133
137
  case 10:
134
- _c.sent();
138
+ _d.sent();
135
139
  return [4, API.brandService.retrieveBrand(brandID)];
136
140
  case 11:
137
- brandData = _c.sent();
141
+ brandData = _d.sent();
138
142
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
139
143
  return [3, 19];
140
144
  case 12:
141
145
  if (!hasBusinessCRInfoCompleted) return [3, 15];
142
146
  return [4, API.dataService.getActivitiesIsIc()];
143
147
  case 13:
144
- list = (_c.sent()).list;
148
+ list = (_d.sent()).list;
145
149
  isicActivityList = list || [];
146
150
  return [4, API.brandService.retrieveBrand(brandID)];
147
151
  case 14:
148
- brandData = _c.sent();
152
+ brandData = _d.sent();
149
153
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
150
154
  return [3, 19];
151
155
  case 15: return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
152
156
  case 16:
153
- _c.sent();
157
+ _d.sent();
154
158
  if (!isSA(countryIso2)) return [3, 18];
155
159
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
156
160
  case 17:
157
- _c.sent();
158
- _c.label = 18;
161
+ _d.sent();
162
+ _d.label = 18;
159
163
  case 18:
160
164
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
161
- _c.label = 19;
165
+ _d.label = 19;
162
166
  case 19: return [2, {
163
167
  data: data,
164
168
  isicActivityList: isicActivityList,
@@ -189,10 +193,10 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
189
193
  });
190
194
  }); });
191
195
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
192
- var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
193
- var _b, _c, _d, _e, _f, _g, _h;
194
- return __generator(this, function (_j) {
195
- switch (_j.label) {
196
+ var _a, business, settings, isNID, responseBody, stepName, payload, data, publicKey, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
197
+ var _b, _c, _d, _e, _f, _g, _h, _j;
198
+ return __generator(this, function (_k) {
199
+ switch (_k.label) {
196
200
  case 0:
197
201
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
198
202
  isNID = business.data.otpData.isNID;
@@ -207,20 +211,24 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
207
211
  };
208
212
  return [4, API.leadService.verifyLeadOTP(payload)];
209
213
  case 1:
210
- data = (_j.sent()).data;
214
+ data = (_k.sent()).data;
211
215
  if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
212
216
  throw new Error(data.errors[0].description);
217
+ publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
218
+ if (publicKey) {
219
+ thunkApi.dispatch(handlePublicKey(publicKey));
220
+ }
213
221
  isicActivityList = undefined;
214
222
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
215
223
  case 2:
216
- leadData = (_j.sent()).data;
224
+ leadData = (_k.sent()).data;
217
225
  thunkApi.dispatch(updateStepName(stepName));
218
226
  brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, business_id = leadData.business_id, entity = leadData.entity;
219
227
  brandID = brand === null || brand === void 0 ? void 0 : brand.id;
220
228
  countryIso2 = country_code;
221
229
  if (countryIso2)
222
230
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
223
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
231
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
224
232
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
225
233
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
226
234
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
@@ -229,14 +237,14 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
229
237
  if (!(!isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 4];
230
238
  return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
231
239
  case 3:
232
- _j.sent();
233
- _j.label = 4;
240
+ _k.sent();
241
+ _k.label = 4;
234
242
  case 4:
235
243
  if (!(isSA(countryIso2) && !isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 6];
236
244
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
237
245
  case 5:
238
- _j.sent();
239
- _j.label = 6;
246
+ _k.sent();
247
+ _k.label = 6;
240
248
  case 6:
241
249
  if (!isNID) return [3, 7];
242
250
  thunkApi.dispatch(handleNextScreenStep());
@@ -250,12 +258,12 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
250
258
  if (!board_id) return [3, 11];
251
259
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
252
260
  case 9:
253
- boardResponse = _j.sent();
261
+ boardResponse = _k.sent();
254
262
  leadData = __assign(__assign({}, leadData), { flows: (boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || [] });
255
263
  return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
256
264
  case 10:
257
- _j.sent();
258
- _j.label = 11;
265
+ _k.sent();
266
+ _k.label = 11;
259
267
  case 11:
260
268
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
261
269
  return [3, 22];
@@ -271,30 +279,30 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
271
279
  if (!hasBusinessCRActivitiesCompleted) return [3, 18];
272
280
  return [4, API.dataService.getActivitiesIsIc()];
273
281
  case 15:
274
- list = (_j.sent()).list;
282
+ list = (_k.sent()).list;
275
283
  isicActivityList = list || [];
276
284
  return [4, thunkApi.dispatch(retrieveDataList())];
277
285
  case 16:
278
- _j.sent();
286
+ _k.sent();
279
287
  return [4, API.brandService.retrieveBrand(brandID)];
280
288
  case 17:
281
- brandData = _j.sent();
289
+ brandData = _k.sent();
282
290
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
283
291
  return [3, 22];
284
292
  case 18:
285
293
  if (!hasBusinessCRInfoCompleted) return [3, 21];
286
294
  return [4, API.dataService.getActivitiesIsIc()];
287
295
  case 19:
288
- list = (_j.sent()).list;
296
+ list = (_k.sent()).list;
289
297
  isicActivityList = list || [];
290
298
  return [4, API.brandService.retrieveBrand(brandID)];
291
299
  case 20:
292
- brandData = _j.sent();
300
+ brandData = _k.sent();
293
301
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
294
302
  return [3, 22];
295
303
  case 21:
296
304
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
297
- _j.label = 22;
305
+ _k.label = 22;
298
306
  case 22: return [2, { data: data, isicActivityList: isicActivityList, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
299
307
  }
300
308
  });
@@ -60,17 +60,17 @@ var _a;
60
60
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
61
61
  import API from '../../../api';
62
62
  import { BusinessType, DocumentPurpose, FlowsTypes, LicenseType } from '../../../@types';
63
- import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
63
+ import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  import { ENTITY_STEP_NAMES } from '../../../constants';
65
65
  import moment from 'moment';
66
66
  import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber, retrieveIndividualData } from '../../../utils';
67
67
  export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
68
68
  var token = _a.token, isInternally = _a.isInternally;
69
69
  return __awaiter(void 0, void 0, void 0, function () {
70
- var payload, data, boardData, boardInfoData, entityData, entityTypes, individualData, countryIso2, _b, board_id, board_info_id, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, entityId;
71
- var _e, _f, _g, _h;
72
- return __generator(this, function (_j) {
73
- switch (_j.label) {
70
+ var payload, data, boardData, boardInfoData, entityData, entityTypes, individualData, countryIso2, publicKey, _b, board_id, board_info_id, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, entityId;
71
+ var _e, _f, _g, _h, _j;
72
+ return __generator(this, function (_k) {
73
+ switch (_k.label) {
74
74
  case 0:
75
75
  payload = {
76
76
  service_name: 'tap_email',
@@ -78,7 +78,7 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
78
78
  };
79
79
  return [4, API.leadService.verifyLeadToken(payload)];
80
80
  case 1:
81
- data = (_j.sent()).data;
81
+ data = (_k.sent()).data;
82
82
  countryIso2 = undefined;
83
83
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
84
84
  if (isInternally)
@@ -88,33 +88,37 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
88
88
  if (countryIso2)
89
89
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
90
90
  }
91
+ publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
92
+ if (publicKey) {
93
+ thunkApi.dispatch(handlePublicKey(publicKey));
94
+ }
91
95
  if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 10];
92
96
  _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
93
97
  if (!board_id) return [3, 6];
94
98
  return [4, API.boardService.retrieveBoardDetails(board_id)];
95
99
  case 2:
96
- boardData = _j.sent();
100
+ boardData = _k.sent();
97
101
  if (!board_info_id) return [3, 4];
98
102
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
99
103
  case 3:
100
- boardInfoData = _j.sent();
101
- _j.label = 4;
104
+ boardInfoData = _k.sent();
105
+ _k.label = 4;
102
106
  case 4:
103
- _c = ((_e = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _e === void 0 ? void 0 : _e.recipient) || {}, id_1 = _c.id, type_1 = _c.type;
107
+ _c = ((_f = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _f === void 0 ? void 0 : _f.recipient) || {}, id_1 = _c.id, type_1 = _c.type;
104
108
  serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
105
109
  return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
106
110
  case 5:
107
- _d = _j.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
111
+ _d = _k.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
108
112
  boardData = boardRes;
109
113
  individualData = individualRes;
110
- _j.label = 6;
114
+ _k.label = 6;
111
115
  case 6:
112
- entityId = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.id;
116
+ entityId = (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.id;
113
117
  if (!entityId) return [3, 8];
114
118
  return [4, API.entityService.retrieveEntity(entityId)];
115
119
  case 7:
116
- entityData = _j.sent();
117
- _j.label = 8;
120
+ entityData = _k.sent();
121
+ _k.label = 8;
118
122
  case 8:
119
123
  if (!countryIso2) {
120
124
  countryIso2 = entityData.country;
@@ -123,9 +127,9 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
123
127
  }
124
128
  return [4, API.entityService.retrieveEntityType()];
125
129
  case 9:
126
- entityTypes = _j.sent();
130
+ entityTypes = _k.sent();
127
131
  thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP'));
128
- _j.label = 10;
132
+ _k.label = 10;
129
133
  case 10: return [2, {
130
134
  data: data,
131
135
  individualData: individualData,
@@ -135,8 +139,8 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
135
139
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
136
140
  entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
137
141
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
138
- name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
139
- contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
142
+ name: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.names,
143
+ contact: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.contact,
140
144
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
141
145
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
142
146
  entityTypes: entityTypes,
@@ -166,7 +170,7 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
166
170
  });
167
171
  }); });
168
172
  export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
169
- var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes, boardInfoData, individualData, _b, board_id, board_info_id, _c, id_2, type_2, serviceCallBack, _d, boardRes, individualRes, entityId;
173
+ var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes, boardInfoData, individualData, _b, board_id, board_info_id, config, publicKey, _c, id_2, type_2, serviceCallBack, _d, boardRes, individualRes, entityId;
170
174
  var _e, _f, _g, _h, _j, _k, _l;
171
175
  return __generator(this, function (_m) {
172
176
  switch (_m.label) {
@@ -185,7 +189,11 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
185
189
  data = (_m.sent()).data;
186
190
  individualData = undefined;
187
191
  if (!!data.errors) return [3, 10];
188
- _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
192
+ _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
193
+ publicKey = config === null || config === void 0 ? void 0 : config.public_key;
194
+ if (publicKey) {
195
+ thunkApi.dispatch(handlePublicKey(publicKey));
196
+ }
189
197
  if (!board_id) return [3, 6];
190
198
  return [4, API.boardService.retrieveBoardDetails(board_id)];
191
199
  case 2:
@@ -69,16 +69,16 @@ var _a;
69
69
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
70
70
  import API from '../../../api';
71
71
  import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
72
- import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
72
+ import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
74
74
  import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType } from '../../../utils';
75
75
  export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
76
76
  var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
78
- var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, data_1, birthCountry, individuals, _c, is_authorized, data_state;
79
- var _d, _e, _f, _g, _h, _j, _k;
80
- return __generator(this, function (_l) {
81
- switch (_l.label) {
78
+ var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, publicKey, board_id, board_info_id, notification, _b, id, type, data_1, birthCountry, individuals, _c, is_authorized, data_state;
79
+ var _d, _e, _f, _g, _h, _j, _k, _l;
80
+ return __generator(this, function (_m) {
81
+ switch (_m.label) {
82
82
  case 0:
83
83
  payload = {
84
84
  service_name: 'tap_email',
@@ -87,7 +87,7 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
87
87
  settings = thunkApi.getState().settings;
88
88
  return [4, API.leadService.verifyLeadToken(payload)];
89
89
  case 1:
90
- data = (_l.sent()).data;
90
+ data = (_m.sent()).data;
91
91
  boardInfoStatus = undefined;
92
92
  countries = settings.data.countries;
93
93
  if (((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
@@ -98,6 +98,10 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
98
98
  countryCode = data === null || data === void 0 ? void 0 : data.country_code;
99
99
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
100
100
  }
101
+ publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
102
+ if (publicKey) {
103
+ thunkApi.dispatch(handlePublicKey(publicKey));
104
+ }
101
105
  if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
102
106
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
103
107
  return [3, 16];
@@ -108,54 +112,54 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
108
112
  if (!(board_id && board_info_id)) return [3, 5];
109
113
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
110
114
  case 3:
111
- boardInfoData = _l.sent();
115
+ boardInfoData = _m.sent();
112
116
  notification = (boardInfoData || {}).notification;
113
117
  _b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
114
118
  if (!(id && type)) return [3, 5];
115
119
  return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
116
120
  case 4:
117
- data_1 = (_l.sent()).data;
121
+ data_1 = (_m.sent()).data;
118
122
  individualData = data_1 || {};
119
- _l.label = 5;
123
+ _m.label = 5;
120
124
  case 5:
121
125
  if (!board_id) return [3, 7];
122
126
  return [4, API.boardService.retrieveBoardDetails(board_id)];
123
127
  case 6:
124
- boardData = _l.sent();
125
- _l.label = 7;
128
+ boardData = _m.sent();
129
+ _m.label = 7;
126
130
  case 7:
127
131
  if (!countryCode) {
128
- countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
132
+ countryCode = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
129
133
  if (countryCode)
130
134
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
131
135
  }
132
136
  if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
133
- if (!((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id)) return [3, 9];
134
- return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
137
+ if (!((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id)) return [3, 9];
138
+ return [4, thunkApi.dispatch(getIndividualList((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id))];
135
139
  case 8:
136
- _l.sent();
137
- _l.label = 9;
140
+ _m.sent();
141
+ _m.label = 9;
138
142
  case 9: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
139
143
  case 10:
140
- boardInfoStatus = _l.sent();
144
+ boardInfoStatus = _m.sent();
141
145
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
142
146
  return [3, 14];
143
147
  case 11:
144
- birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
148
+ birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
145
149
  if (!birthCountry) return [3, 13];
146
150
  return [4, thunkApi.dispatch(getCityList(birthCountry))];
147
151
  case 12:
148
- _l.sent();
149
- _l.label = 13;
152
+ _m.sent();
153
+ _m.label = 13;
150
154
  case 13:
151
155
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
152
- _l.label = 14;
156
+ _m.label = 14;
153
157
  case 14: return [3, 16];
154
158
  case 15:
155
159
  if (isUpdatePhoneInfo) {
156
160
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
157
161
  }
158
- _l.label = 16;
162
+ _m.label = 16;
159
163
  case 16:
160
164
  individuals = (boardData || {}).individuals;
161
165
  _c = individualData || {}, is_authorized = _c.is_authorized, data_state = _c.data_state;
@@ -167,8 +171,8 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
167
171
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
168
172
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
169
173
  merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
170
- name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
171
- contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
174
+ name: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.names,
175
+ contact: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.contact,
172
176
  individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
173
177
  countries: countries,
174
178
  countryCode: countryCode,
@@ -419,10 +423,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
419
423
  });
420
424
  }); });
421
425
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
422
- var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, boardInfoStatus, countryCode, notification, _c, id, type, data_3, birthCountry, individuals, _d, is_authorized, data_state;
423
- var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
424
- return __generator(this, function (_q) {
425
- switch (_q.label) {
426
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, boardInfoStatus, publicKey, countryCode, notification, _c, id, type, data_3, birthCountry, individuals, _d, is_authorized, data_state;
427
+ var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
428
+ return __generator(this, function (_r) {
429
+ switch (_r.label) {
426
430
  case 0:
427
431
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
428
432
  responseBody = individual.data.verify.responseBody;
@@ -437,55 +441,59 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
437
441
  };
438
442
  return [4, API.leadService.verifyLeadOTP(payload)];
439
443
  case 1:
440
- data = (_q.sent()).data;
444
+ data = (_r.sent()).data;
441
445
  boardInfoStatus = undefined;
442
446
  if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
443
447
  throw new Error(data.errors[0].description);
448
+ publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
449
+ if (publicKey) {
450
+ thunkApi.dispatch(handlePublicKey(publicKey));
451
+ }
444
452
  if (!board_id) return [3, 3];
445
453
  return [4, API.boardService.retrieveBoardDetails(board_id)];
446
454
  case 2:
447
- boardData = _q.sent();
448
- _q.label = 3;
455
+ boardData = _r.sent();
456
+ _r.label = 3;
449
457
  case 3:
450
- countryCode = (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.country;
458
+ countryCode = (_h = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _h === void 0 ? void 0 : _h.country;
451
459
  if (!(board_id && board_info_id)) return [3, 6];
452
460
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
453
461
  case 4:
454
- boardInfoData = _q.sent();
462
+ boardInfoData = _r.sent();
455
463
  notification = (boardInfoData || {}).notification;
456
464
  _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
457
465
  if (!(id && type)) return [3, 6];
458
466
  return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
459
467
  case 5:
460
- data_3 = (_q.sent()).data;
468
+ data_3 = (_r.sent()).data;
461
469
  individualData = data_3 || {};
462
- _q.label = 6;
470
+ _r.label = 6;
463
471
  case 6:
464
472
  if (countryCode)
465
473
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
466
474
  if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 10];
467
- if (!((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id)) return [3, 8];
468
- return [4, thunkApi.dispatch(getIndividualList((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id))];
475
+ if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 8];
476
+ return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
469
477
  case 7:
470
- _q.sent();
471
- _q.label = 8;
478
+ _r.sent();
479
+ _r.label = 8;
472
480
  case 8: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
473
481
  case 9:
474
- boardInfoStatus = _q.sent();
482
+ boardInfoStatus = _r.sent();
475
483
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
476
484
  return [3, 13];
477
485
  case 10:
478
- birthCountry = ((_k = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _k === void 0 ? void 0 : _k.country) || countryCode;
486
+ birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
479
487
  if (!birthCountry) return [3, 12];
480
488
  return [4, thunkApi.dispatch(getCityList(birthCountry))];
481
489
  case 11:
482
- _q.sent();
483
- _q.label = 12;
490
+ _r.sent();
491
+ _r.label = 12;
484
492
  case 12:
485
493
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
486
- _q.label = 13;
494
+ _r.label = 13;
487
495
  case 13:
488
- (_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, { otp: params.otp });
496
+ (_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, { otp: params.otp });
489
497
  individuals = (boardData || {}).individuals;
490
498
  _d = individualData || {}, is_authorized = _d.is_authorized, data_state = _d.data_state;
491
499
  return [2, {
@@ -496,8 +504,8 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
496
504
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
497
505
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
498
506
  merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
499
- name: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.names,
500
- contact: (_p = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _p === void 0 ? void 0 : _p.contact,
507
+ name: (_p = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _p === void 0 ? void 0 : _p.names,
508
+ contact: (_q = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _q === void 0 ? void 0 : _q.contact,
501
509
  individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
502
510
  countries: countries,
503
511
  countryCode: countryCode,
@@ -49,11 +49,11 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
52
+ import { handleCurrentActiveScreen, handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
54
54
  import { retrieveIndividualData } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, data, boardStatusData, boardInfoData, boardData, individualData, _a, board_id, board_info_id, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2, info, hasPasswordCompleted;
56
+ var payload, data, boardStatusData, boardInfoData, boardData, individualData, _a, board_id, board_info_id, config, publicKey, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2, info, hasPasswordCompleted;
57
57
  var _d, _e, _f, _g, _h;
58
58
  return __generator(this, function (_j) {
59
59
  switch (_j.label) {
@@ -67,7 +67,11 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
67
67
  data = (_j.sent()).data;
68
68
  individualData = undefined;
69
69
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
70
- _a = data || {}, board_id = _a.id, board_info_id = _a.board_info_id;
70
+ _a = data || {}, board_id = _a.id, board_info_id = _a.board_info_id, config = _a.config;
71
+ publicKey = config === null || config === void 0 ? void 0 : config.public_key;
72
+ if (publicKey) {
73
+ thunkApi.dispatch(handlePublicKey(publicKey));
74
+ }
71
75
  if (!board_id) return [3, 7];
72
76
  if (!board_info_id) return [3, 3];
73
77
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
@@ -145,10 +149,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails
145
149
  });
146
150
  }); });
147
151
  export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
148
- var _a, password, settings, responseBody, payload, data, flows, hasPasswordCompleted;
149
- var _b, _c, _d, _e;
150
- return __generator(this, function (_f) {
151
- switch (_f.label) {
152
+ var _a, password, settings, responseBody, payload, data, publicKey, flows, hasPasswordCompleted;
153
+ var _b, _c, _d, _e, _f;
154
+ return __generator(this, function (_g) {
155
+ switch (_g.label) {
152
156
  case 0:
153
157
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
154
158
  responseBody = password.data.verify.responseBody;
@@ -161,11 +165,15 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
161
165
  };
162
166
  return [4, API.leadService.verifyLeadOTP(payload)];
163
167
  case 1:
164
- data = (_f.sent()).data;
168
+ data = (_g.sent()).data;
165
169
  if (!data.errors) {
166
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
170
+ publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
171
+ if (publicKey) {
172
+ thunkApi.dispatch(handlePublicKey(publicKey));
173
+ }
174
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
167
175
  flows = (responseBody || {}).flows;
168
- hasPasswordCompleted = ((_e = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'password'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
176
+ hasPasswordCompleted = ((_f = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'password'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
169
177
  if (hasPasswordCompleted) {
170
178
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
171
179
  }
@@ -49,16 +49,16 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
- import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2, handlePrevScreenStep } from '../../../app/settings';
52
+ import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2, handlePrevScreenStep, handlePublicKey } from '../../../app/settings';
53
53
  import { TAX_STEP_NAMES } from '../../../constants';
54
54
  import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, boardData, boardInfoData, individualData, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2;
59
- var _d, _e, _f, _g;
60
- return __generator(this, function (_h) {
61
- switch (_h.label) {
58
+ var payload, data, boardData, boardInfoData, individualData, publicKey, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2;
59
+ var _d, _e, _f, _g, _h;
60
+ return __generator(this, function (_j) {
61
+ switch (_j.label) {
62
62
  case 0:
63
63
  payload = {
64
64
  service_name: 'tap_email',
@@ -66,31 +66,35 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
66
66
  };
67
67
  return [4, API.leadService.verifyLeadToken(payload)];
68
68
  case 1:
69
- data = (_h.sent()).data;
69
+ data = (_j.sent()).data;
70
70
  individualData = undefined;
71
71
  if (((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
72
72
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
73
73
  if (isInternally)
74
74
  data.step_name = TAX_STEP_NAMES.TAX_INFO;
75
+ publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
76
+ if (publicKey) {
77
+ thunkApi.dispatch(handlePublicKey(publicKey));
78
+ }
75
79
  if (!(data === null || data === void 0 ? void 0 : data.id)) return [3, 6];
76
80
  if (!data.board_info_id) return [3, 3];
77
81
  return [4, API.boardService.retrieveBoardInfo({ id: data.id, infoId: data.board_info_id })];
78
82
  case 2:
79
- boardInfoData = _h.sent();
80
- _h.label = 3;
83
+ boardInfoData = _j.sent();
84
+ _j.label = 3;
81
85
  case 3: return [4, API.boardService.retrieveBoardDetails(data.id)];
82
86
  case 4:
83
- boardData = _h.sent();
84
- _b = ((_e = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _e === void 0 ? void 0 : _e.recipient) || {}, id_1 = _b.id, type_1 = _b.type;
87
+ boardData = _j.sent();
88
+ _b = ((_f = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _f === void 0 ? void 0 : _f.recipient) || {}, id_1 = _b.id, type_1 = _b.type;
85
89
  serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
86
90
  return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
87
91
  case 5:
88
- _c = _h.sent(), boardRes = _c.boardRes, individualRes = _c.individualRes;
92
+ _c = _j.sent(), boardRes = _c.boardRes, individualRes = _c.individualRes;
89
93
  boardData = boardRes;
90
94
  individualData = individualRes;
91
- _h.label = 6;
95
+ _j.label = 6;
92
96
  case 6:
93
- countryIso2 = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
97
+ countryIso2 = (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.country;
94
98
  if (countryIso2)
95
99
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
96
100
  if (data.step_name === TAX_STEP_NAMES.PHONE_AUTH) {
@@ -102,7 +106,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
102
106
  return [2, {
103
107
  data: data,
104
108
  individualData: individualData,
105
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
109
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _h === void 0 ? void 0 : _h.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
106
110
  token: token
107
111
  }];
108
112
  }
@@ -153,10 +157,10 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveTaxEntityInfo', functi
153
157
  });
154
158
  }); });
155
159
  export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
156
- var _a, tax, settings, responseBody, payload, data;
157
- var _b, _c, _d, _e;
158
- return __generator(this, function (_f) {
159
- switch (_f.label) {
160
+ var _a, tax, settings, responseBody, payload, data, publicKey;
161
+ var _b, _c, _d, _e, _f;
162
+ return __generator(this, function (_g) {
163
+ switch (_g.label) {
160
164
  case 0:
161
165
  _a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
162
166
  responseBody = tax.data.verify.responseBody;
@@ -169,10 +173,14 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
169
173
  };
170
174
  return [4, API.leadService.verifyLeadOTP(payload)];
171
175
  case 1:
172
- data = (_f.sent()).data;
176
+ data = (_g.sent()).data;
173
177
  if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
174
178
  throw new Error(data.errors[0].description);
175
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
179
+ publicKey = (_d = data === null || data === void 0 ? void 0 : data.config) === null || _d === void 0 ? void 0 : _d.public_key;
180
+ if (publicKey) {
181
+ thunkApi.dispatch(handlePublicKey(publicKey));
182
+ }
183
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
176
184
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP')); });
177
185
  return [2, { data: data, formData: params }];
178
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.97-test",
3
+ "version": "2.4.99-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",