@tap-payments/auth-jsconnect 1.0.94-test → 1.0.97-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.
Files changed (88) hide show
  1. package/build/@types/app.d.ts +7 -2
  2. package/build/@types/form.d.ts +2 -1
  3. package/build/api/auth.d.ts +22 -3
  4. package/build/api/axios.d.ts +2 -2
  5. package/build/api/axios.js +62 -0
  6. package/build/api/country.d.ts +1 -2
  7. package/build/api/country.js +7 -8
  8. package/build/api/data.d.ts +1 -0
  9. package/build/api/data.js +9 -2
  10. package/build/api/entity.d.ts +3 -1
  11. package/build/api/entity.js +11 -2
  12. package/build/api/firebase.d.ts +1 -1
  13. package/build/api/firebase.js +5 -2
  14. package/build/api/index.d.ts +10 -9
  15. package/build/api/ip.d.ts +1 -1
  16. package/build/api/ip.js +5 -2
  17. package/build/api/lead.d.ts +4 -1
  18. package/build/api/lead.js +14 -2
  19. package/build/api/operator.d.ts +1 -1
  20. package/build/api/operator.js +60 -4
  21. package/build/app/settings.d.ts +6 -15
  22. package/build/app/settings.js +82 -142
  23. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  24. package/build/components/AnimationFlow/AnimationFlow.js +2 -2
  25. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  26. package/build/components/AnimationFlow/BottomSheet.js +16 -4
  27. package/build/constants/api.d.ts +2 -1
  28. package/build/constants/api.js +5 -3
  29. package/build/constants/app.d.ts +6 -0
  30. package/build/constants/app.js +16 -4
  31. package/build/features/app/bank/bankStore.js +6 -4
  32. package/build/features/app/business/businessStore.d.ts +2 -4
  33. package/build/features/app/business/businessStore.js +66 -22
  34. package/build/features/app/connect/connectStore.d.ts +5 -10
  35. package/build/features/app/connect/connectStore.js +121 -27
  36. package/build/features/app/individual/individualStore.d.ts +3 -2
  37. package/build/features/app/individual/individualStore.js +27 -22
  38. package/build/features/app/password/passwordStore.d.ts +29 -1
  39. package/build/features/app/password/passwordStore.js +184 -8
  40. package/build/features/app/tax/taxStore.js +7 -5
  41. package/build/features/bank/Bank.js +4 -4
  42. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
  43. package/build/features/business/Business.js +4 -4
  44. package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
  45. package/build/features/business/screens/OTP/OTPInput.js +3 -9
  46. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +17 -6
  47. package/build/features/connect/Connect.js +1 -1
  48. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  49. package/build/features/connect/screens/NID/NID.js +1 -1
  50. package/build/features/connect/screens/OTP/OTPInput.js +3 -13
  51. package/build/features/featuresScreens.js +5 -0
  52. package/build/features/individual/Individual.js +4 -4
  53. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +7 -1
  54. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +10 -0
  55. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -0
  56. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -0
  57. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -0
  58. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
  59. package/build/features/password/Password.js +12 -6
  60. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  61. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  62. package/build/features/password/screens/OTP/OTP.js +78 -0
  63. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  64. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  65. package/build/features/password/screens/OTP/index.d.ts +3 -0
  66. package/build/features/password/screens/OTP/index.js +2 -0
  67. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  68. package/build/features/password/screens/OTP/validation.js +4 -0
  69. package/build/features/password/screens/Success/Success.js +8 -2
  70. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +17 -5
  71. package/build/features/password/screens/Verify/OTPInput.d.ts +2 -2
  72. package/build/features/password/screens/Verify/OTPInput.js +1 -1
  73. package/build/features/shared/Button/FlowsButtons.d.ts +8 -2
  74. package/build/features/shared/Button/FlowsButtons.js +94 -6
  75. package/build/features/shared/Button/SuccessButton.js +17 -13
  76. package/build/features/tax/Tax.js +3 -3
  77. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
  78. package/build/hooks/useAppConfig.d.ts +1 -4
  79. package/build/hooks/useAppConfig.js +13 -113
  80. package/build/hooks/useAppTheme.js +3 -2
  81. package/build/index.css +4 -0
  82. package/build/theme/theme.d.ts +1 -1
  83. package/build/theme/theme.js +1 -2
  84. package/build/utils/array.d.ts +3 -0
  85. package/build/utils/array.js +10 -0
  86. package/build/utils/string.d.ts +1 -0
  87. package/build/utils/string.js +4 -0
  88. package/package.json +1 -1
@@ -60,9 +60,9 @@ import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType, FlowsTypes } from '../../../@types';
62
62
  import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
- import { convertNumbers2English, getFlowUrl, hasKey, removeRequestHeaders } from '../../../utils';
63
+ import { convertNumbers2English, getFlowUrl, hasKey } from '../../../utils';
64
64
  import { handleNextScreenStep } from '../../../app/settings';
65
- export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
+ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var payload, data, leadResponse;
67
67
  return __generator(this, function (_a) {
68
68
  switch (_a.label) {
@@ -159,19 +159,16 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
159
159
  });
160
160
  }); });
161
161
  export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
162
- var _a, settings, business, identification_id_type, stepName, headers, requestBody, data;
163
- var _b, _c, _d, _e, _f;
164
- return __generator(this, function (_g) {
165
- switch (_g.label) {
162
+ var _a, settings, business, identification_id_type, stepName, requestBody, data;
163
+ var _b, _c, _d;
164
+ return __generator(this, function (_e) {
165
+ switch (_e.label) {
166
166
  case 0:
167
167
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
168
168
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
169
169
  stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
170
- headers = {
171
- lead_id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
172
- device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
173
- };
174
170
  requestBody = {
171
+ id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
175
172
  identification_id: params.nid,
176
173
  identification_id_type: identification_id_type,
177
174
  date_of_birth: params.dob,
@@ -179,18 +176,46 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
179
176
  step_name: stepName,
180
177
  encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
181
178
  };
182
- return [4, API.leadService.updateLeadIdentity(requestBody, { headers: headers })];
179
+ return [4, API.leadService.updateLeadIdentity(requestBody)];
183
180
  case 1:
184
- data = (_g.sent()).data;
185
- if (!data.errors && !params.isResend) {
181
+ data = (_e.sent()).data;
182
+ if (!data.errors) {
186
183
  thunkApi.dispatch(updateStepName(stepName));
187
184
  thunkApi.dispatch(handleNextScreenStep());
188
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
185
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
189
186
  }
190
187
  return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
191
188
  }
192
189
  });
193
190
  }); });
191
+ export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
192
+ var _a, settings, business, _b, nid, dob, type, stepName, requestBody, data;
193
+ var _c;
194
+ return __generator(this, function (_d) {
195
+ switch (_d.label) {
196
+ case 0:
197
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
198
+ _b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
199
+ stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
200
+ requestBody = {
201
+ id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
202
+ identification_id: nid,
203
+ identification_id_type: type,
204
+ date_of_birth: dob,
205
+ country_code: settings.data.businessCountry.iso2,
206
+ step_name: stepName,
207
+ encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
208
+ };
209
+ return [4, API.leadService.updateLeadIdentity(requestBody)];
210
+ case 1:
211
+ data = (_d.sent()).data;
212
+ if (!data.errors) {
213
+ thunkApi.dispatch(updateStepName(stepName));
214
+ }
215
+ return [2, data];
216
+ }
217
+ });
218
+ }); });
194
219
  export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
195
220
  var data;
196
221
  return __generator(this, function (_a) {
@@ -311,7 +336,7 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
311
336
  }
312
337
  });
313
338
  }); });
314
- export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
339
+ export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
315
340
  var _a, customerBases, expectedSales, expectedCustomerSales;
316
341
  return __generator(this, function (_b) {
317
342
  switch (_b.label) {
@@ -365,7 +390,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
365
390
  }
366
391
  });
367
392
  }); });
368
- export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
393
+ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
369
394
  var _a, settings, business, _b, steps, id, flowCompleted, payload, data;
370
395
  var _c, _d, _e, _f, _g;
371
396
  return __generator(this, function (_h) {
@@ -377,6 +402,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
377
402
  if (flowCompleted || !id)
378
403
  return [2];
379
404
  payload = {
405
+ lang: settings.data.language,
380
406
  step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
381
407
  id: id,
382
408
  flows: [
@@ -402,13 +428,15 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
402
428
  return [4, API.leadService.updateLead(payload)];
403
429
  case 1:
404
430
  data = (_h.sent()).data;
431
+ if (!!data.errors) return [3, 3];
405
432
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
406
433
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
407
434
  return [4, thunkApi.dispatch(retrieveEntityInfo((_g = data.entity) === null || _g === void 0 ? void 0 : _g.id))];
408
435
  case 2:
409
436
  _h.sent();
410
437
  thunkApi.dispatch(handleNextScreenStep());
411
- return [2, { response: data, formData: params }];
438
+ _h.label = 3;
439
+ case 3: return [2, { response: data, formData: params }];
412
440
  }
413
441
  });
414
442
  }); });
@@ -542,10 +570,8 @@ export var businessSlice = createSlice({
542
570
  state.loading = false;
543
571
  state.error = action.error.message;
544
572
  })
545
- .addCase(updateLeadIdentity.pending, function (state, action) {
546
- var _a;
547
- if (!((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend))
548
- state.loading = true;
573
+ .addCase(updateLeadIdentity.pending, function (state) {
574
+ state.loading = true;
549
575
  state.error = null;
550
576
  })
551
577
  .addCase(updateLeadIdentity.fulfilled, function (state, action) {
@@ -566,6 +592,25 @@ export var businessSlice = createSlice({
566
592
  .addCase(updateLeadIdentity.rejected, function (state, action) {
567
593
  state.loading = false;
568
594
  state.error = action.error.message;
595
+ })
596
+ .addCase(resendOTPLeadIdentity.pending, function (state) {
597
+ state.error = null;
598
+ })
599
+ .addCase(resendOTPLeadIdentity.fulfilled, function (state, action) {
600
+ var _a;
601
+ state.error = null;
602
+ var data = action.payload;
603
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
604
+ if (description) {
605
+ state.error = description;
606
+ return;
607
+ }
608
+ state.data.nidData.responseBody = data;
609
+ state.data.otpData.otp = '';
610
+ state.data.otpData.isNID = true;
611
+ })
612
+ .addCase(resendOTPLeadIdentity.rejected, function (state, action) {
613
+ state.error = action.error.message;
569
614
  })
570
615
  .addCase(retrieveEntityList.pending, function (state) {
571
616
  state.error = null;
@@ -771,7 +816,6 @@ export var businessSlice = createSlice({
771
816
  return;
772
817
  }
773
818
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), response);
774
- removeRequestHeaders();
775
819
  })
776
820
  .addCase(updateLeadSuccess.pending, function (state) {
777
821
  state.loading = true;
@@ -3,23 +3,18 @@ import { ResponseData, MobileFormValues, NIDFormValues, OTPFormValues, Individua
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  response: any;
6
- formData: MobileFormValues & {
7
- isResend: boolean;
8
- };
9
- }, MobileFormValues & {
10
- isResend: boolean;
11
- }, {}>;
6
+ formData: MobileFormValues;
7
+ }, MobileFormValues, {}>;
8
+ export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
12
9
  export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
13
10
  response: any;
14
11
  formData: {
15
12
  type: string;
16
13
  nid: string;
17
14
  dob: string;
18
- isResend: boolean;
19
15
  };
20
- }, NIDFormValues & {
21
- isResend: boolean;
22
- }, {}>;
16
+ }, NIDFormValues, {}>;
17
+ export declare const resendOTPNID: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
23
18
  export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
24
19
  response: any;
25
20
  formData: OTPFormValues;
@@ -61,7 +61,7 @@ import { FlowsTypes } from '../../../@types';
61
61
  import API from '../../../api';
62
62
  import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
- import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
64
+ import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord } from '../../../utils';
65
65
  export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var settings, requestBody, data;
67
67
  var _a, _b;
@@ -70,6 +70,7 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
70
70
  case 0:
71
71
  settings = thunkApi.getState().settings;
72
72
  requestBody = {
73
+ lang: settings.data.language,
73
74
  user_credentail: {
74
75
  phone: params.mobile || '',
75
76
  code: params.countryCode.idd_prefix.toString()
@@ -81,7 +82,7 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
81
82
  return [4, API.authService.createAuth(requestBody)];
82
83
  case 1:
83
84
  data = (_c.sent()).data;
84
- if (!data.errors && !params.isResend) {
85
+ if (!data.errors) {
85
86
  thunkApi.dispatch(handleNextScreenStep());
86
87
  (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
87
88
  }
@@ -89,15 +90,40 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
89
90
  }
90
91
  });
91
92
  }); });
92
- export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
93
- var _a, settings, connect, identification_id_type, requestBody, data;
94
- var _b, _c;
95
- return __generator(this, function (_d) {
96
- switch (_d.label) {
93
+ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
94
+ var _a, settings, connect, _b, mobile, countryCode, requestBody, data;
95
+ return __generator(this, function (_c) {
96
+ switch (_c.label) {
97
97
  case 0:
98
98
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
99
+ _b = connect.data.mobileData, mobile = _b.mobile, countryCode = _b.countryCode;
100
+ requestBody = {
101
+ lang: settings.data.language,
102
+ user_credentail: {
103
+ phone: mobile || '',
104
+ code: countryCode.idd_prefix.toString()
105
+ },
106
+ sign_in: false,
107
+ step_name: CONNECT_STEP_NAMES.CREATE_AUTH_MOBILE,
108
+ encryption_contract: ['user_credentail.phone', 'user_credentail.code']
109
+ };
110
+ return [4, API.authService.createAuth(requestBody)];
111
+ case 1:
112
+ data = (_c.sent()).data;
113
+ return [2, data];
114
+ }
115
+ });
116
+ }); });
117
+ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
118
+ var settings, identification_id_type, requestBody, data;
119
+ var _a, _b;
120
+ return __generator(this, function (_c) {
121
+ switch (_c.label) {
122
+ case 0:
123
+ settings = thunkApi.getState().settings;
99
124
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
100
125
  requestBody = {
126
+ lang: settings.data.language,
101
127
  user_credentail: {
102
128
  identification_id: params.nid,
103
129
  identification_id_type: identification_id_type,
@@ -115,15 +141,46 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
115
141
  };
116
142
  return [4, API.authService.createAuth(requestBody)];
117
143
  case 1:
118
- data = (_d.sent()).data;
119
- if (!data.errors && !params.isResend) {
144
+ data = (_c.sent()).data;
145
+ if (!data.errors) {
120
146
  thunkApi.dispatch(handleNextScreenStep());
121
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
147
+ (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
122
148
  }
123
149
  return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
124
150
  }
125
151
  });
126
152
  }); });
153
+ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
154
+ var _a, settings, connect, _b, nid, dob, type, requestBody, data;
155
+ return __generator(this, function (_c) {
156
+ switch (_c.label) {
157
+ case 0:
158
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
159
+ _b = connect.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
160
+ requestBody = {
161
+ lang: settings.data.language,
162
+ user_credentail: {
163
+ identification_id: nid,
164
+ identification_id_type: type,
165
+ date_of_birth: dob,
166
+ country_code: settings.data.businessCountry.iso2
167
+ },
168
+ sign_in: false,
169
+ step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
170
+ encryption_contract: [
171
+ 'user_credentail.country_code',
172
+ 'user_credentail.identification_id',
173
+ 'user_credentail.identification_id_type',
174
+ 'user_credentail.date_of_birth'
175
+ ]
176
+ };
177
+ return [4, API.authService.createAuth(requestBody)];
178
+ case 1:
179
+ data = (_c.sent()).data;
180
+ return [2, data];
181
+ }
182
+ });
183
+ }); });
127
184
  export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
128
185
  var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, payload, data, params_1, params_2;
129
186
  var _c, _d;
@@ -184,11 +241,11 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
184
241
  });
185
242
  }); });
186
243
  export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
187
- var _a, connect, settings, businessCountry, payload, brandPayload, _b, brandResponse, data;
188
- return __generator(this, function (_c) {
189
- switch (_c.label) {
244
+ var settings, businessCountry, payload, brandPayload, _a, brandResponse, data;
245
+ return __generator(this, function (_b) {
246
+ switch (_b.label) {
190
247
  case 0:
191
- _a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
248
+ settings = thunkApi.getState().settings;
192
249
  businessCountry = settings.data.businessCountry;
193
250
  payload = {
194
251
  individual_id: params.individualId,
@@ -202,7 +259,7 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
202
259
  API.leadService.createLead(payload)
203
260
  ])];
204
261
  case 1:
205
- _b = _c.sent(), brandResponse = _b[0].data, data = _b[1].data;
262
+ _a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
206
263
  if (!data.errors) {
207
264
  thunkApi.dispatch(handleNextScreenStep(params.stepName));
208
265
  }
@@ -277,7 +334,14 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
277
334
  id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
278
335
  terms_conditions_accepted: params.termAndConditionChecked,
279
336
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
280
- encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'brand.website']
337
+ encryption_contract: [
338
+ 'brand.name.en',
339
+ 'brand.name.ar',
340
+ 'brand.name.zh',
341
+ 'brand.website',
342
+ 'brand.social[0]',
343
+ 'brand.social[1]'
344
+ ]
281
345
  };
282
346
  return [4, API.leadService.updateLead(payload)];
283
347
  case 1:
@@ -347,6 +411,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
347
411
  isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
348
412
  leadId = isExistingUser ? (_c = brandData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id : (_d = otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id;
349
413
  payload = {
414
+ lang: settings.data.language,
350
415
  step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
351
416
  flows: [
352
417
  {
@@ -434,7 +499,6 @@ export var connectSlice = createSlice({
434
499
  .addCase(createMobileAuth.fulfilled, function (state, action) {
435
500
  var _a;
436
501
  state.loading = false;
437
- state.customLoading = false;
438
502
  state.error = null;
439
503
  var _b = action.payload, formData = _b.formData, response = _b.response;
440
504
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -446,16 +510,30 @@ export var connectSlice = createSlice({
446
510
  state.data.mobileData.responseBody = response;
447
511
  state.data.otpData.isAbsher = false;
448
512
  })
449
- .addCase(createMobileAuth.pending, function (state, action) {
450
- if (action.meta.arg.isResend)
451
- state.customLoading = true;
452
- if (!action.meta.arg.isResend)
453
- state.loading = true;
513
+ .addCase(createMobileAuth.pending, function (state) {
514
+ state.loading = true;
454
515
  state.error = null;
455
516
  })
456
517
  .addCase(createMobileAuth.rejected, function (state, action) {
457
518
  state.loading = false;
458
- state.customLoading = false;
519
+ state.error = action.error.message;
520
+ })
521
+ .addCase(resendOTPMobile.fulfilled, function (state, action) {
522
+ var _a;
523
+ state.error = null;
524
+ var response = action.payload;
525
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
526
+ if (description) {
527
+ state.error = description;
528
+ return;
529
+ }
530
+ state.data.mobileData.responseBody = response;
531
+ state.data.otpData.isAbsher = false;
532
+ })
533
+ .addCase(resendOTPMobile.pending, function (state) {
534
+ state.error = null;
535
+ })
536
+ .addCase(resendOTPMobile.rejected, function (state, action) {
459
537
  state.error = action.error.message;
460
538
  })
461
539
  .addCase(createNIDAuth.fulfilled, function (state, action) {
@@ -472,14 +550,31 @@ export var connectSlice = createSlice({
472
550
  state.data.nidData.responseBody = response;
473
551
  state.data.otpData.isAbsher = true;
474
552
  })
475
- .addCase(createNIDAuth.pending, function (state, action) {
476
- var _a;
477
- state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
553
+ .addCase(createNIDAuth.pending, function (state) {
554
+ state.loading = true;
478
555
  state.error = null;
479
556
  })
480
557
  .addCase(createNIDAuth.rejected, function (state, action) {
481
558
  state.loading = false;
482
559
  state.error = action.error.message;
560
+ })
561
+ .addCase(resendOTPNID.fulfilled, function (state, action) {
562
+ var _a;
563
+ state.error = null;
564
+ var response = action.payload;
565
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
566
+ if (description) {
567
+ state.error = description;
568
+ return;
569
+ }
570
+ state.data.nidData.responseBody = response;
571
+ state.data.otpData.isAbsher = true;
572
+ })
573
+ .addCase(resendOTPNID.pending, function (state) {
574
+ state.error = null;
575
+ })
576
+ .addCase(resendOTPNID.rejected, function (state, action) {
577
+ state.error = action.error.message;
483
578
  })
484
579
  .addCase(verifyAuth.fulfilled, function (state, action) {
485
580
  var _a;
@@ -637,7 +732,6 @@ export var connectSlice = createSlice({
637
732
  state.error = description;
638
733
  return;
639
734
  }
640
- removeRequestHeaders();
641
735
  })
642
736
  .addCase(updateLeadSuccess.pending, function (state) {
643
737
  state.loading = true;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  leadData: any;
@@ -12,7 +12,8 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
12
12
  sourceIncome: any;
13
13
  monthlyIncome: any;
14
14
  countryCode: string;
15
- countries: CountryCode[];
15
+ occupation: any;
16
+ countries: import("../../../@types").CountryCode[];
16
17
  }, string, {}>;
17
18
  export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
18
19
  data: any;
@@ -49,10 +49,10 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { hasKey, removeRequestHeaders } from '../../../utils';
52
+ import { hasKey } from '../../../utils';
53
53
  import { handleNextScreenStep } from '../../../app/settings';
54
54
  import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
55
- export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
+ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
56
  var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
57
57
  var _b, _c;
58
58
  return __generator(this, function (_d) {
@@ -106,23 +106,24 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
106
106
  }
107
107
  });
108
108
  }); });
109
- export var retrieveDataList = createAsyncThunk('retrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
110
- var settings, _a, sourceIncome, monthlyIncome, countries;
109
+ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
110
+ var _a, sourceIncome, monthlyIncome, occupation, settings, countries;
111
111
  return __generator(this, function (_b) {
112
112
  switch (_b.label) {
113
- case 0:
114
- settings = thunkApi.getState().settings;
115
- return [4, Promise.all([
116
- API.dataService.getSourceOfIncome(),
117
- API.dataService.getMonthlyIncome(countryCode)
118
- ])];
113
+ case 0: return [4, Promise.all([
114
+ API.dataService.getSourceOfIncome(),
115
+ API.dataService.getMonthlyIncome(countryCode),
116
+ API.dataService.getOccupation()
117
+ ])];
119
118
  case 1:
120
- _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data;
119
+ _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data, occupation = _a[2];
120
+ settings = thunkApi.getState().settings;
121
121
  countries = settings.data.countries;
122
122
  return [2, {
123
123
  sourceIncome: sourceIncome,
124
124
  monthlyIncome: monthlyIncome,
125
125
  countryCode: countryCode,
126
+ occupation: occupation,
126
127
  countries: countries
127
128
  }];
128
129
  }
@@ -157,7 +158,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
157
158
  return [4, API.leadService.verifyLeadOTP(payload)];
158
159
  case 1:
159
160
  data = (_g.sent()).data;
160
- if (!!data.errors) return [3, 5];
161
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 5];
161
162
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
162
163
  steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
163
164
  hasIndividualCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
@@ -184,20 +185,21 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
184
185
  case 0:
185
186
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
186
187
  requestBody = {
187
- id: (_c = (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
188
+ id: (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.individual_id,
189
+ occupation: (_c = params.occupation) === null || _c === void 0 ? void 0 : _c.id,
188
190
  employer_name: params.employerName,
189
- employer_city: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
191
+ employer_country: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
190
192
  source_income: [(_e = params.sourceIncome) === null || _e === void 0 ? void 0 : _e.id],
191
193
  actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
192
194
  is_relative_PEP: params.isPEP,
193
195
  is_influencer: params.isInfluencer,
194
- encryption_contract: ['employer_name', 'employer_city', 'actual_income'],
196
+ encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'source_income[0]'],
195
197
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
196
198
  };
197
- return [4, API.entityService.updateEntityInfo(requestBody)];
199
+ return [4, API.entityService.updateIndividualInfo(requestBody)];
198
200
  case 1:
199
201
  data = (_j.sent()).data;
200
- if (!data.errors) {
202
+ if (!(data === null || data === void 0 ? void 0 : data.errors)) {
201
203
  thunkApi.dispatch(handleNextScreenStep());
202
204
  (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
203
205
  }
@@ -205,7 +207,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
205
207
  }
206
208
  });
207
209
  }); });
208
- export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
210
+ export var updateLeadSuccess = createAsyncThunk('individualUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
209
211
  var _a, settings, individual, id, payload, data;
210
212
  var _b, _c, _d, _e, _f;
211
213
  return __generator(this, function (_g) {
@@ -216,6 +218,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
216
218
  if (!id)
217
219
  return [2];
218
220
  payload = {
221
+ lang: settings.data.language,
219
222
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
220
223
  id: id,
221
224
  encryption_contract: []
@@ -223,13 +226,15 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
223
226
  return [4, API.leadService.updateLead(payload)];
224
227
  case 1:
225
228
  data = (_g.sent()).data;
229
+ if (!!data.errors) return [3, 3];
226
230
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
227
231
  case 2:
228
232
  _g.sent();
229
233
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
230
234
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
231
235
  thunkApi.dispatch(handleNextScreenStep());
232
- return [2, { response: data, formData: params }];
236
+ _g.label = 3;
237
+ case 3: return [2, { response: data, formData: params }];
233
238
  }
234
239
  });
235
240
  }); });
@@ -245,6 +250,7 @@ var initialState = {
245
250
  otp: ''
246
251
  },
247
252
  individualData: {
253
+ occupation: undefined,
248
254
  sourceIncome: undefined,
249
255
  monthlyIncome: undefined,
250
256
  employerName: '',
@@ -336,9 +342,9 @@ export var individualSlice = createSlice({
336
342
  .addCase(retrieveDataList.fulfilled, function (state, action) {
337
343
  state.loading = false;
338
344
  state.error = null;
339
- var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode, countries = _a.countries;
345
+ var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode, countries = _a.countries, occupation = _a.occupation;
340
346
  var data = state.data.individualData.responseBody;
341
- state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [] });
347
+ state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [], occupationList: occupation || [] });
342
348
  var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
343
349
  if (!!selectedSourceIncome)
344
350
  state.data.individualData.sourceIncome = selectedSourceIncome;
@@ -407,7 +413,6 @@ export var individualSlice = createSlice({
407
413
  }
408
414
  var flows = response.flows, steps = response.steps;
409
415
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
410
- removeRequestHeaders();
411
416
  })
412
417
  .addCase(updateLeadSuccess.pending, function (state) {
413
418
  state.loading = true;