@tap-payments/auth-jsconnect 2.0.1 → 2.0.4

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 (76) hide show
  1. package/build/@types/app.d.ts +5 -0
  2. package/build/@types/form.d.ts +2 -1
  3. package/build/api/auth.d.ts +20 -3
  4. package/build/api/axios.js +8 -9
  5. package/build/api/data.d.ts +1 -0
  6. package/build/api/data.js +9 -2
  7. package/build/api/entity.d.ts +5 -1
  8. package/build/api/entity.js +11 -2
  9. package/build/api/index.d.ts +6 -4
  10. package/build/api/lead.d.ts +2 -1
  11. package/build/api/lead.js +14 -2
  12. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  13. package/build/components/AnimationFlow/AnimationFlow.js +2 -2
  14. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  15. package/build/components/AnimationFlow/BottomSheet.js +16 -4
  16. package/build/constants/api.d.ts +2 -1
  17. package/build/constants/api.js +5 -3
  18. package/build/constants/app.d.ts +5 -0
  19. package/build/constants/app.js +21 -5
  20. package/build/features/app/bank/bankStore.js +17 -10
  21. package/build/features/app/business/businessStore.d.ts +3 -5
  22. package/build/features/app/business/businessStore.js +140 -48
  23. package/build/features/app/connect/connectStore.d.ts +5 -10
  24. package/build/features/app/connect/connectStore.js +117 -25
  25. package/build/features/app/individual/individualStore.d.ts +3 -2
  26. package/build/features/app/individual/individualStore.js +42 -30
  27. package/build/features/app/password/passwordStore.d.ts +29 -1
  28. package/build/features/app/password/passwordStore.js +194 -14
  29. package/build/features/app/tax/taxStore.js +19 -12
  30. package/build/features/bank/Bank.js +3 -4
  31. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
  32. package/build/features/business/Business.js +3 -4
  33. package/build/features/business/screens/Activities/Activities.js +1 -1
  34. package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
  35. package/build/features/business/screens/OTP/OTPInput.js +3 -9
  36. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +17 -6
  37. package/build/features/connect/Connect.js +1 -1
  38. package/build/features/connect/screens/Mobile/Mobile.js +2 -2
  39. package/build/features/connect/screens/Mobile/MobileNumber.js +1 -1
  40. package/build/features/connect/screens/NID/IDNumber.js +1 -1
  41. package/build/features/connect/screens/NID/NID.js +2 -2
  42. package/build/features/connect/screens/OTP/OTPInput.js +3 -13
  43. package/build/features/featuresScreens.js +5 -0
  44. package/build/features/individual/Individual.js +3 -4
  45. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +7 -1
  46. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +10 -0
  47. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -0
  48. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -0
  49. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -0
  50. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
  51. package/build/features/password/Password.js +11 -6
  52. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  53. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  54. package/build/features/password/screens/OTP/OTP.js +78 -0
  55. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  56. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  57. package/build/features/password/screens/OTP/index.d.ts +3 -0
  58. package/build/features/password/screens/OTP/index.js +2 -0
  59. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  60. package/build/features/password/screens/OTP/validation.js +4 -0
  61. package/build/features/password/screens/Success/Success.js +8 -2
  62. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +17 -5
  63. package/build/features/password/screens/Verify/OTPInput.d.ts +2 -2
  64. package/build/features/password/screens/Verify/OTPInput.js +1 -1
  65. package/build/features/shared/Button/FlowsButtons.d.ts +8 -2
  66. package/build/features/shared/Button/FlowsButtons.js +92 -5
  67. package/build/features/shared/Button/SuccessButton.js +17 -13
  68. package/build/features/tax/Tax.js +3 -4
  69. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
  70. package/build/hooks/useAppTheme.js +3 -2
  71. package/build/index.css +4 -0
  72. package/build/theme/theme.d.ts +1 -1
  73. package/build/theme/theme.js +1 -2
  74. package/build/utils/string.d.ts +1 -0
  75. package/build/utils/string.js +4 -0
  76. package/package.json +1 -1
@@ -62,7 +62,7 @@ import { BusinessType, FlowsTypes } from '../../../@types';
62
62
  import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
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) {
@@ -108,7 +108,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
108
108
  });
109
109
  }); });
110
110
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
111
- var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted;
111
+ var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted;
112
112
  var _b, _c, _d, _e;
113
113
  return __generator(this, function (_f) {
114
114
  switch (_f.label) {
@@ -128,7 +128,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
128
128
  return [4, API.leadService.verifyLeadOTP(payload)];
129
129
  case 1:
130
130
  data = (_f.sent()).data;
131
- if (!!data.errors) return [3, 6];
131
+ if (!!data.errors) return [3, 9];
132
132
  thunkApi.dispatch(updateStepName(stepName));
133
133
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
134
134
  case 2:
@@ -136,42 +136,46 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
136
136
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
137
137
  steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
138
138
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
139
+ hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
139
140
  if (!isNID) return [3, 3];
140
141
  thunkApi.dispatch(handleNextScreenStep());
141
- return [3, 6];
142
+ return [3, 9];
142
143
  case 3:
143
144
  if (!hasBusinessCompleted) return [3, 5];
144
145
  return [4, thunkApi.dispatch(retrieveEntityInfo((_e = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.entity) === null || _e === void 0 ? void 0 : _e.id))];
145
146
  case 4:
146
147
  _f.sent();
147
148
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
148
- return [3, 6];
149
+ return [3, 9];
149
150
  case 5:
150
- if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
151
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
152
- }
153
- else {
154
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
155
- }
156
- _f.label = 6;
157
- case 6: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }) }];
151
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 6];
152
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
153
+ return [3, 9];
154
+ case 6:
155
+ if (!hasBusinessCRInfoCompleted) return [3, 8];
156
+ return [4, thunkApi.dispatch(retrieveChannels())];
157
+ case 7:
158
+ _f.sent();
159
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
160
+ return [3, 9];
161
+ case 8:
162
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
163
+ _f.label = 9;
164
+ case 9: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }) }];
158
165
  }
159
166
  });
160
167
  }); });
161
168
  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) {
169
+ var _a, settings, business, identification_id_type, stepName, requestBody, data;
170
+ var _b, _c, _d;
171
+ return __generator(this, function (_e) {
172
+ switch (_e.label) {
166
173
  case 0:
167
174
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
168
175
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
169
176
  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
177
  requestBody = {
178
+ id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
175
179
  identification_id: params.nid,
176
180
  identification_id_type: identification_id_type,
177
181
  date_of_birth: params.dob,
@@ -179,18 +183,57 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
179
183
  step_name: stepName,
180
184
  encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
181
185
  };
182
- return [4, API.leadService.updateLeadIdentity(requestBody, { headers: headers })];
186
+ return [4, API.leadService.updateLeadIdentity(requestBody)];
183
187
  case 1:
184
- data = (_g.sent()).data;
185
- if (!data.errors && !params.isResend) {
188
+ data = (_e.sent()).data;
189
+ if (!data.errors) {
186
190
  thunkApi.dispatch(updateStepName(stepName));
187
191
  thunkApi.dispatch(handleNextScreenStep());
188
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
192
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
189
193
  }
190
194
  return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
191
195
  }
192
196
  });
193
197
  }); });
198
+ export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
199
+ var _a, settings, business, _b, nid, dob, type, stepName, requestBody, data;
200
+ var _c;
201
+ return __generator(this, function (_d) {
202
+ switch (_d.label) {
203
+ case 0:
204
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
205
+ _b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
206
+ stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
207
+ requestBody = {
208
+ id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
209
+ identification_id: nid,
210
+ identification_id_type: type,
211
+ date_of_birth: dob,
212
+ country_code: settings.data.businessCountry.iso2,
213
+ step_name: stepName,
214
+ encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
215
+ };
216
+ return [4, API.leadService.updateLeadIdentity(requestBody)];
217
+ case 1:
218
+ data = (_d.sent()).data;
219
+ if (!data.errors) {
220
+ thunkApi.dispatch(updateStepName(stepName));
221
+ }
222
+ return [2, data];
223
+ }
224
+ });
225
+ }); });
226
+ export var retrieveChannels = createAsyncThunk('retrieveChannels', function () { return __awaiter(void 0, void 0, void 0, function () {
227
+ var data;
228
+ return __generator(this, function (_a) {
229
+ switch (_a.label) {
230
+ case 0: return [4, API.dataService.getChannelsOfServices()];
231
+ case 1:
232
+ data = (_a.sent()).data;
233
+ return [2, data];
234
+ }
235
+ });
236
+ }); });
194
237
  export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
195
238
  var data;
196
239
  return __generator(this, function (_a) {
@@ -242,7 +285,7 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
242
285
  });
243
286
  }); });
244
287
  export var createAccount = createAsyncThunk('createAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
245
- var _a, settings, business, requestBody, data, channels;
288
+ var _a, settings, business, requestBody, data;
246
289
  var _b, _c, _d;
247
290
  return __generator(this, function (_e) {
248
291
  switch (_e.label) {
@@ -261,15 +304,14 @@ export var createAccount = createAsyncThunk('createAccount', function (params, t
261
304
  return [4, API.accountService.createAccount(requestBody)];
262
305
  case 1:
263
306
  data = (_e.sent()).data;
264
- channels = undefined;
265
307
  if (!!data.errors) return [3, 3];
266
- return [4, API.dataService.getChannelsOfServices()];
308
+ return [4, thunkApi.dispatch(retrieveChannels())];
267
309
  case 2:
268
- channels = _e.sent();
310
+ _e.sent();
269
311
  thunkApi.dispatch(handleNextScreenStep());
270
312
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
271
313
  _e.label = 3;
272
- case 3: return [2, { data: data, channelsData: channels === null || channels === void 0 ? void 0 : channels.data }];
314
+ case 3: return [2, { data: data }];
273
315
  }
274
316
  });
275
317
  }); });
@@ -311,7 +353,7 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
311
353
  }
312
354
  });
313
355
  }); });
314
- export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
356
+ export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
315
357
  var _a, customerBases, expectedSales, expectedCustomerSales;
316
358
  return __generator(this, function (_b) {
317
359
  switch (_b.label) {
@@ -365,7 +407,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
365
407
  }
366
408
  });
367
409
  }); });
368
- export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
410
+ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
369
411
  var _a, settings, business, _b, steps, id, flowCompleted, payload, data;
370
412
  var _c, _d, _e, _f, _g;
371
413
  return __generator(this, function (_h) {
@@ -403,13 +445,15 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
403
445
  return [4, API.leadService.updateLead(payload)];
404
446
  case 1:
405
447
  data = (_h.sent()).data;
448
+ if (!!data.errors) return [3, 3];
406
449
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
407
450
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
408
451
  return [4, thunkApi.dispatch(retrieveEntityInfo((_g = data.entity) === null || _g === void 0 ? void 0 : _g.id))];
409
452
  case 2:
410
453
  _h.sent();
411
454
  thunkApi.dispatch(handleNextScreenStep());
412
- return [2, { response: data, formData: params }];
455
+ _h.label = 3;
456
+ case 3: return [2, { response: data, formData: params }];
413
457
  }
414
458
  });
415
459
  }); });
@@ -527,10 +571,10 @@ export var businessSlice = createSlice({
527
571
  state.error = null;
528
572
  })
529
573
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
530
- var _a;
574
+ var _a, _b;
531
575
  state.loading = false;
532
576
  state.error = null;
533
- var _b = action.payload, data = _b.data, formData = _b.formData;
577
+ var _c = action.payload, data = _c.data, formData = _c.formData;
534
578
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
535
579
  if (description) {
536
580
  state.error = description;
@@ -538,15 +582,24 @@ export var businessSlice = createSlice({
538
582
  }
539
583
  state.data.otpData = formData;
540
584
  state.data.otpData.responseBody = data;
585
+ var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities;
586
+ var issuingDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
587
+ if (!!issuingDate) {
588
+ var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
589
+ state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
590
+ }
591
+ var activities = entity_activities || [];
592
+ var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
593
+ if (!!selectedActivity)
594
+ state.data.activitiesData.activities = [selectedActivity];
595
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
541
596
  })
542
597
  .addCase(verifyLeadOTP.rejected, function (state, action) {
543
598
  state.loading = false;
544
599
  state.error = action.error.message;
545
600
  })
546
- .addCase(updateLeadIdentity.pending, function (state, action) {
547
- var _a;
548
- if (!((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend))
549
- state.loading = true;
601
+ .addCase(updateLeadIdentity.pending, function (state) {
602
+ state.loading = true;
550
603
  state.error = null;
551
604
  })
552
605
  .addCase(updateLeadIdentity.fulfilled, function (state, action) {
@@ -567,6 +620,25 @@ export var businessSlice = createSlice({
567
620
  .addCase(updateLeadIdentity.rejected, function (state, action) {
568
621
  state.loading = false;
569
622
  state.error = action.error.message;
623
+ })
624
+ .addCase(resendOTPLeadIdentity.pending, function (state) {
625
+ state.error = null;
626
+ })
627
+ .addCase(resendOTPLeadIdentity.fulfilled, function (state, action) {
628
+ var _a;
629
+ state.error = null;
630
+ var data = action.payload;
631
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
632
+ if (description) {
633
+ state.error = description;
634
+ return;
635
+ }
636
+ state.data.nidData.responseBody = data;
637
+ state.data.otpData.otp = '';
638
+ state.data.otpData.isNID = true;
639
+ })
640
+ .addCase(resendOTPLeadIdentity.rejected, function (state, action) {
641
+ state.error = action.error.message;
570
642
  })
571
643
  .addCase(retrieveEntityList.pending, function (state) {
572
644
  state.error = null;
@@ -594,7 +666,7 @@ export var businessSlice = createSlice({
594
666
  }
595
667
  }
596
668
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
597
- state.data.businessTypeData.responseBody = { licenseList: licenseList };
669
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: licenseList });
598
670
  var licenseNumber = (((_c = (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) || {}).number;
599
671
  var selectedLicense = ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
600
672
  var license = _a.license;
@@ -628,6 +700,30 @@ export var businessSlice = createSlice({
628
700
  .addCase(retrieveEntityInfo.rejected, function (state, action) {
629
701
  state.error = action.error.message;
630
702
  state.loading = false;
703
+ })
704
+ .addCase(retrieveChannels.pending, function (state) {
705
+ state.error = null;
706
+ state.loading = true;
707
+ })
708
+ .addCase(retrieveChannels.fulfilled, function (state, action) {
709
+ var _a;
710
+ state.error = null;
711
+ state.loading = false;
712
+ var data = action.payload || {};
713
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
714
+ if (description) {
715
+ state.error = description;
716
+ return;
717
+ }
718
+ var channels = data || [];
719
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { channelList: channels });
720
+ var selectedChannel = channels === null || channels === void 0 ? void 0 : channels[0];
721
+ if (!!selectedChannel)
722
+ state.data.activitiesData.salesChannels = [selectedChannel];
723
+ })
724
+ .addCase(retrieveChannels.rejected, function (state, action) {
725
+ state.error = action.error.message;
726
+ state.loading = false;
631
727
  })
632
728
  .addCase(updateLeadBusinessType.pending, function (state) {
633
729
  state.loading = true;
@@ -666,11 +762,11 @@ export var businessSlice = createSlice({
666
762
  state.error = null;
667
763
  })
668
764
  .addCase(createAccount.fulfilled, function (state, action) {
669
- var _a, _b;
765
+ var _a;
670
766
  state.loading = false;
671
767
  state.error = null;
672
- var _c = action.payload, data = _c.data, channelsData = _c.channelsData;
673
- var message = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = channelsData === null || channelsData === void 0 ? void 0 : channelsData.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).message;
768
+ var data = action.payload.data;
769
+ var message = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).message;
674
770
  if (message) {
675
771
  state.error = message;
676
772
  return;
@@ -679,11 +775,7 @@ export var businessSlice = createSlice({
679
775
  state.error = 'signup_user_exists_error';
680
776
  return;
681
777
  }
682
- var channels = channelsData || [];
683
- state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { channelList: channels });
684
- var selectedChannel = channels === null || channels === void 0 ? void 0 : channels[0];
685
- if (!!selectedChannel)
686
- state.data.activitiesData.salesChannels = [selectedChannel];
778
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), data);
687
779
  })
688
780
  .addCase(createAccount.rejected, function (state, action) {
689
781
  state.loading = false;
@@ -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;
@@ -82,7 +82,7 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
82
82
  return [4, API.authService.createAuth(requestBody)];
83
83
  case 1:
84
84
  data = (_c.sent()).data;
85
- if (!data.errors && !params.isResend) {
85
+ if (!data.errors) {
86
86
  thunkApi.dispatch(handleNextScreenStep());
87
87
  (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
88
88
  }
@@ -90,13 +90,37 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
90
90
  }
91
91
  });
92
92
  }); });
93
- export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
94
- var _a, settings, connect, identification_id_type, requestBody, data;
95
- var _b, _c;
96
- return __generator(this, function (_d) {
97
- 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) {
98
97
  case 0:
99
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;
100
124
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
101
125
  requestBody = {
102
126
  lang: settings.data.language,
@@ -117,15 +141,46 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
117
141
  };
118
142
  return [4, API.authService.createAuth(requestBody)];
119
143
  case 1:
120
- data = (_d.sent()).data;
121
- if (!data.errors && !params.isResend) {
144
+ data = (_c.sent()).data;
145
+ if (!data.errors) {
122
146
  thunkApi.dispatch(handleNextScreenStep());
123
- (_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);
124
148
  }
125
149
  return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
126
150
  }
127
151
  });
128
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
+ }); });
129
184
  export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
130
185
  var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, payload, data, params_1, params_2;
131
186
  var _c, _d;
@@ -186,11 +241,11 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
186
241
  });
187
242
  }); });
188
243
  export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
189
- var _a, connect, settings, businessCountry, payload, brandPayload, _b, brandResponse, data;
190
- return __generator(this, function (_c) {
191
- switch (_c.label) {
244
+ var settings, businessCountry, payload, brandPayload, _a, brandResponse, data;
245
+ return __generator(this, function (_b) {
246
+ switch (_b.label) {
192
247
  case 0:
193
- _a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
248
+ settings = thunkApi.getState().settings;
194
249
  businessCountry = settings.data.businessCountry;
195
250
  payload = {
196
251
  individual_id: params.individualId,
@@ -204,7 +259,7 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
204
259
  API.leadService.createLead(payload)
205
260
  ])];
206
261
  case 1:
207
- _b = _c.sent(), brandResponse = _b[0].data, data = _b[1].data;
262
+ _a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
208
263
  if (!data.errors) {
209
264
  thunkApi.dispatch(handleNextScreenStep(params.stepName));
210
265
  }
@@ -279,7 +334,14 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
279
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) || '',
280
335
  terms_conditions_accepted: params.termAndConditionChecked,
281
336
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
282
- 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
+ ]
283
345
  };
284
346
  return [4, API.leadService.updateLead(payload)];
285
347
  case 1:
@@ -437,7 +499,6 @@ export var connectSlice = createSlice({
437
499
  .addCase(createMobileAuth.fulfilled, function (state, action) {
438
500
  var _a;
439
501
  state.loading = false;
440
- state.customLoading = false;
441
502
  state.error = null;
442
503
  var _b = action.payload, formData = _b.formData, response = _b.response;
443
504
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -449,16 +510,30 @@ export var connectSlice = createSlice({
449
510
  state.data.mobileData.responseBody = response;
450
511
  state.data.otpData.isAbsher = false;
451
512
  })
452
- .addCase(createMobileAuth.pending, function (state, action) {
453
- if (action.meta.arg.isResend)
454
- state.customLoading = true;
455
- if (!action.meta.arg.isResend)
456
- state.loading = true;
513
+ .addCase(createMobileAuth.pending, function (state) {
514
+ state.loading = true;
457
515
  state.error = null;
458
516
  })
459
517
  .addCase(createMobileAuth.rejected, function (state, action) {
460
518
  state.loading = false;
461
- 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) {
462
537
  state.error = action.error.message;
463
538
  })
464
539
  .addCase(createNIDAuth.fulfilled, function (state, action) {
@@ -475,14 +550,31 @@ export var connectSlice = createSlice({
475
550
  state.data.nidData.responseBody = response;
476
551
  state.data.otpData.isAbsher = true;
477
552
  })
478
- .addCase(createNIDAuth.pending, function (state, action) {
479
- var _a;
480
- 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;
481
555
  state.error = null;
482
556
  })
483
557
  .addCase(createNIDAuth.rejected, function (state, action) {
484
558
  state.loading = false;
485
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;
486
578
  })
487
579
  .addCase(verifyAuth.fulfilled, function (state, action) {
488
580
  var _a;
@@ -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;