@tap-payments/auth-jsconnect 2.3.2 → 2.3.3

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.
Files changed (24) hide show
  1. package/build/app/settings.js +5 -2
  2. package/build/components/ArabicDatePicker/ArabicDatePicker.js +6 -4
  3. package/build/components/ArabicDatePicker/style.css +2 -1
  4. package/build/features/app/bank/bankStore.js +17 -9
  5. package/build/features/app/brand/brandStore.js +25 -17
  6. package/build/features/app/business/businessStore.js +47 -39
  7. package/build/features/app/entity/entityStore.js +29 -21
  8. package/build/features/app/individual/individualStore.js +61 -51
  9. package/build/features/app/password/passwordStore.js +18 -10
  10. package/build/features/app/tax/taxStore.js +28 -20
  11. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +1 -1
  12. package/build/features/connect/Connect.d.ts +1 -0
  13. package/build/features/connect/Connect.js +9 -5
  14. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +1 -0
  15. package/build/features/entity/screens/EntityCapital/ActivityList.js +5 -1
  16. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +1 -1
  17. package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +1 -1
  18. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +1 -1
  19. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +1 -0
  20. package/build/features/entity/screens/EntityName/EntityTypeList.js +6 -2
  21. package/build/features/entity/screens/EntityName/ExpiryDate.js +2 -1
  22. package/build/features/entity/screens/EntityName/IssuingDate.js +2 -1
  23. package/build/features/entity/screens/EntityName/LegalName.js +1 -1
  24. package/package.json +1 -1
@@ -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) {
@@ -86,7 +86,9 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
86
86
  if (typeof maturity_1 === 'boolean')
87
87
  matureData = maturity_1 ? 'full' : 'express';
88
88
  thunkApi.dispatch(handleSetAppConfig(configInfo));
89
- thunkApi.dispatch(handleLanguage(config.language || lang));
89
+ thunkApi.dispatch(handleLanguage(language_1 || lang));
90
+ if (public_key)
91
+ thunkApi.dispatch(handlePublicKey(public_key));
90
92
  if (typeof board_maturity === 'boolean')
91
93
  thunkApi.dispatch(handelBoardMaturity(board_maturity));
92
94
  onVerifyConfigTokenSuccess === null || onVerifyConfigTokenSuccess === void 0 ? void 0 : onVerifyConfigTokenSuccess(config);
@@ -190,6 +192,7 @@ export var settingsSlice = createSlice({
190
192
  if (!action.payload)
191
193
  return;
192
194
  state.data.appConfig.publicKey = action.payload;
195
+ setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), { authorization: encryptString(action.payload) }));
193
196
  },
194
197
  handleSwitchCalender: function (state, action) {
195
198
  state.data.isHijri = action.payload;
@@ -41,12 +41,14 @@ var ContainerIcon = styled(Icon, { shouldForwardProp: function (prop) { return p
41
41
  var theme = _a.theme, disabled = _a.disabled;
42
42
  return (__assign(__assign({ marginInlineStart: theme.spacing(2.5) }, theme.typography.h6), { cursor: disabled ? 'auto' : 'pointer', width: theme.spacing(2), height: theme.spacing(2) }));
43
43
  });
44
- var Container = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
45
- var theme = _a.theme, disabled = _a.disabled;
44
+ var Container = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'disabled' && prop !== 'openCalender'; } })(function (_a) {
45
+ var theme = _a.theme, disabled = _a.disabled, openCalender = _a.openCalender;
46
46
  return ({
47
+ transition: 'min-height 0.5s',
47
48
  cursor: disabled ? 'auto' : 'pointer',
48
49
  opacity: disabled ? '0.6' : '1',
49
- fontFamily: theme.typography.fontFamily
50
+ fontFamily: theme.typography.fontFamily,
51
+ minHeight: openCalender ? '345px' : '46px'
50
52
  });
51
53
  });
52
54
  var InputFieldStyled = styled(Input)(function (_a) {
@@ -106,7 +108,7 @@ var DatePicker = function (_a) {
106
108
  var dateObject = toDateObject(date);
107
109
  return dateObject.convert(arabic).format(DATE_FORMAT);
108
110
  };
109
- return (_jsxs(Container, __assign({ disabled: disabled, id: 'arabic-container-calendar' }, { children: [_jsx(InputFieldStyled, { endAdornment: _jsx(ArrowIcon, __assign({ disabled: disabled }, { children: getEndAdornment() })), value: date ? formateDate(date) : '', placeholder: DATE_FORMAT, onClick: function (e) {
111
+ return (_jsxs(Container, __assign({ openCalender: openCalender, disabled: disabled, id: 'arabic-container-calendar' }, { children: [_jsx(InputFieldStyled, { endAdornment: _jsx(ArrowIcon, __assign({ disabled: disabled }, { children: getEndAdornment() })), value: date ? formateDate(date) : '', placeholder: DATE_FORMAT, onClick: function (e) {
110
112
  if (!disabled)
111
113
  toggleCalender(e);
112
114
  }, startAdornment: calenderIcon, disabled: disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in: openCalender }, { children: [_jsx(Calendar, __assign({ calendar: arabic, locale: dir === 'rtl' ? arabic_ar : arabic_en, maxDate: rest.maxDate || defaultMax, minDate: defaultMin, format: DATE_FORMAT, onChange: handleOnDateChange, value: date || (isDob ? new Date(getEighteenYearsAgo()) : undefined), className: 'custom-container' }, rest)), _jsx(Divider, {})] }))] })));
@@ -13,6 +13,8 @@
13
13
 
14
14
  .rmdp-calendar {
15
15
  width: 100%;
16
+ padding-bottom: 15px !important;
17
+ padding-top: 12px !important;
16
18
  }
17
19
 
18
20
  .rmdp-day.rmdp-selected span:not(.highlight) {
@@ -51,7 +53,6 @@
51
53
  }
52
54
  .rmdp-header {
53
55
  margin-bottom: 12px;
54
- margin-top: 10px !important;
55
56
  }
56
57
  .rmdp-day-picker .rmdp-day {
57
58
  height: 36px !important;
@@ -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: