@tap-payments/auth-jsconnect 2.8.93-development → 2.8.95-development

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/build/@types/form.d.ts +3 -0
  2. package/build/constants/app.d.ts +5 -0
  3. package/build/constants/app.js +43 -8
  4. package/build/features/app/auth/authStore.d.ts +6 -1
  5. package/build/features/app/auth/authStore.js +86 -28
  6. package/build/features/app/business/businessStore.d.ts +16 -3
  7. package/build/features/app/business/businessStore.js +54 -7
  8. package/build/features/app/connect/connectStore.d.ts +11 -2
  9. package/build/features/app/connect/connectStore.js +52 -5
  10. package/build/features/app/connectExpress/connectExpressStore.d.ts +23 -4
  11. package/build/features/app/connectExpress/connectExpressStore.js +73 -13
  12. package/build/features/auth/screens/DOB/DOB.d.ts +6 -0
  13. package/build/features/auth/screens/DOB/DOB.js +47 -0
  14. package/build/features/auth/screens/DOB/DOBForm.d.ts +5 -0
  15. package/build/features/auth/screens/DOB/DOBForm.js +59 -0
  16. package/build/features/auth/screens/DOB/index.d.ts +3 -0
  17. package/build/features/auth/screens/DOB/index.js +2 -0
  18. package/build/features/auth/screens/DOB/validation.d.ts +8 -0
  19. package/build/features/auth/screens/DOB/validation.js +4 -0
  20. package/build/features/business/screens/BusinessType/BusinessType.js +2 -2
  21. package/build/features/business/screens/DOB/DOB.d.ts +6 -0
  22. package/build/features/business/screens/DOB/DOB.js +45 -0
  23. package/build/features/business/screens/DOB/DOBForm.d.ts +5 -0
  24. package/build/features/business/screens/DOB/DOBForm.js +69 -0
  25. package/build/features/business/screens/DOB/index.d.ts +3 -0
  26. package/build/features/business/screens/DOB/index.js +2 -0
  27. package/build/features/business/screens/DOB/validation.d.ts +8 -0
  28. package/build/features/business/screens/DOB/validation.js +4 -0
  29. package/build/features/connect/screens/DOB/DOB.d.ts +6 -0
  30. package/build/features/connect/screens/DOB/DOB.js +47 -0
  31. package/build/features/connect/screens/DOB/DOBForm.d.ts +5 -0
  32. package/build/features/connect/screens/DOB/DOBForm.js +59 -0
  33. package/build/features/connect/screens/DOB/index.d.ts +3 -0
  34. package/build/features/connect/screens/DOB/index.js +2 -0
  35. package/build/features/connect/screens/DOB/validation.d.ts +8 -0
  36. package/build/features/connect/screens/DOB/validation.js +4 -0
  37. package/build/features/connect/screens/Individual/Individual.js +10 -3
  38. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +21 -4
  39. package/build/features/connectExpress/screens/DOB/DOB.d.ts +6 -0
  40. package/build/features/connectExpress/screens/DOB/DOB.js +47 -0
  41. package/build/features/connectExpress/screens/DOB/DOBForm.d.ts +5 -0
  42. package/build/features/connectExpress/screens/DOB/DOBForm.js +63 -0
  43. package/build/features/connectExpress/screens/DOB/index.d.ts +3 -0
  44. package/build/features/connectExpress/screens/DOB/index.js +2 -0
  45. package/build/features/connectExpress/screens/DOB/validation.d.ts +8 -0
  46. package/build/features/connectExpress/screens/DOB/validation.js +4 -0
  47. package/build/features/featuresScreens.js +20 -0
  48. package/package.json +1 -1
@@ -18,6 +18,9 @@ export declare type NIDFormValues = {
18
18
  dob?: any;
19
19
  termAndConditionChecked?: boolean;
20
20
  };
21
+ export declare type DOBFormValues = {
22
+ dob: any;
23
+ };
21
24
  export declare type CivilFormValues = {
22
25
  civilId: string;
23
26
  termAndConditionChecked?: boolean;
@@ -11,6 +11,7 @@ export declare const LOCAL_STORAGE_KEYS: {
11
11
  export declare const SCOPE_AUTH = "auth";
12
12
  export declare const DEFAULT_COUNTRY_ISO2 = "KW";
13
13
  export declare const NAFATH_VERIFICATION_FAILED = "nafath_verification_failed";
14
+ export declare const COLLECT_DOB_INFO_NAFATH = "collect_date_of_birth";
14
15
  export declare const EXTERNAL_LINKS: {
15
16
  TOS_EN: string;
16
17
  TOS_AR: string;
@@ -90,6 +91,7 @@ export declare const CONNECT_STEP_NAMES: {
90
91
  VERIFY_AUTH_MOBILE: string;
91
92
  CREATE_AUTH_NID: string;
92
93
  VERIFY_AUTH_NID: string;
94
+ UPDATE_LEAD_DOB: string;
93
95
  UPDATE_LEAD_INDIVIDUAL: string;
94
96
  UPDATE_LEAD_BRAND: string;
95
97
  UPDATE_BRAND_INFO: string;
@@ -106,6 +108,7 @@ export declare const AUTH_STEP_NAMES: {
106
108
  VERIFY_AUTH_EMAIL: string;
107
109
  CREATE_AUTH_NID: string;
108
110
  VERIFY_AUTH_NID: string;
111
+ UPDATE_DOB_INFO: string;
109
112
  };
110
113
  export declare const CONNECT_EXPRESS_STEP_NAMES: {
111
114
  CREATE_AUTH_MOBILE: string;
@@ -116,6 +119,7 @@ export declare const CONNECT_EXPRESS_STEP_NAMES: {
116
119
  VERIFY_AUTH_NID: string;
117
120
  IDENTITY_AUTH: string;
118
121
  VERIFY_IDENTITY_AUTH: string;
122
+ UPDATE_LEAD_DOB: string;
119
123
  UPDATE_LEAD_INDIVIDUAL: string;
120
124
  UPDATE_LEAD_BRAND_BUSINESS: string;
121
125
  UPDATE_BRAND_INFO: string;
@@ -137,6 +141,7 @@ export declare const BUSINESS_STEP_NAMES: {
137
141
  IDENTITY_AUTH: string;
138
142
  CREATE_AUTH_CIVIL_ID: string;
139
143
  IDENTITY_VERIFY_AUTH: string;
144
+ BUSINESS_DOB_INFO: string;
140
145
  BUSINESS_CR_INFO: string;
141
146
  BUSINESS_INFO_CONFIRM: string;
142
147
  BUSINESS_CR_ACTIVITIES: string;
@@ -11,6 +11,7 @@ export var LOCAL_STORAGE_KEYS = {
11
11
  export var SCOPE_AUTH = 'auth';
12
12
  export var DEFAULT_COUNTRY_ISO2 = 'KW';
13
13
  export var NAFATH_VERIFICATION_FAILED = 'nafath_verification_failed';
14
+ export var COLLECT_DOB_INFO_NAFATH = 'collect_date_of_birth';
14
15
  export var EXTERNAL_LINKS = {
15
16
  TOS_EN: '/en/terms-conditions',
16
17
  TOS_AR: '/ar/terms-conditions',
@@ -60,7 +61,7 @@ export var CONNECT_SCREENS_NAVIGATION = [
60
61
  },
61
62
  {
62
63
  name: 'CONNECT_VERIFY_NAFATH_STEP',
63
- next: 'CONNECT_INDIVIDUAL_STEP',
64
+ next: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_DOB_STEP'],
64
65
  prev: 'CONNECT_NID_STEP',
65
66
  order: 2
66
67
  },
@@ -70,10 +71,16 @@ export var CONNECT_SCREENS_NAVIGATION = [
70
71
  prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP'],
71
72
  order: 2
72
73
  },
74
+ {
75
+ name: 'CONNECT_DOB_STEP',
76
+ next: 'CONNECT_INDIVIDUAL_STEP',
77
+ prev: 'CONNECT_NID_STEP',
78
+ order: 2
79
+ },
73
80
  {
74
81
  name: 'CONNECT_INDIVIDUAL_STEP',
75
82
  next: 'CONNECT_MERCHANT_INFO_STEP',
76
- prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP', 'CONNECT_CIVIL_ID_STEP'],
83
+ prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP', 'CONNECT_CIVIL_ID_STEP', 'CONNECT_DOB_STEP'],
77
84
  order: 3
78
85
  },
79
86
  {
@@ -130,6 +137,7 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
130
137
  name: 'CONNECT_EXPRESS_VERIFY_NAFATH_STEP',
131
138
  next: [
132
139
  'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
140
+ 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
133
141
  'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
134
142
  'CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP'
135
143
  ],
@@ -190,7 +198,11 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
190
198
  },
191
199
  {
192
200
  name: 'CONNECT_EXPRESS_IDENTITY_VERIFY_NAFATH_STEP',
193
- next: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'],
201
+ next: [
202
+ 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
203
+ 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
204
+ 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'
205
+ ],
194
206
  prev: 'CONNECT_EXPRESS_NID_MISSED_STEP',
195
207
  order: 4
196
208
  },
@@ -200,6 +212,12 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
200
212
  prev: 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP',
201
213
  order: 4
202
214
  },
215
+ {
216
+ name: 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
217
+ next: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'],
218
+ prev: ['CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_NID_MISSED_STEP'],
219
+ order: 5
220
+ },
203
221
  {
204
222
  name: 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
205
223
  next: ['CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'],
@@ -208,7 +226,8 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
208
226
  'CONNECT_EXPRESS_NID_STEP',
209
227
  'CONNECT_EXPRESS_CIVIL_ID_STEP',
210
228
  'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP',
211
- 'CONNECT_EXPRESS_NID_MISSED_STEP'
229
+ 'CONNECT_EXPRESS_NID_MISSED_STEP',
230
+ 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
212
231
  ],
213
232
  order: 5
214
233
  },
@@ -294,7 +313,7 @@ export var AUTH_SCREENS_NAVIGATION = [
294
313
  },
295
314
  {
296
315
  name: 'AUTH_NAFATH_VERIFY_STEP',
297
- next: 'AUTH_PREPARING_DATA_STEP',
316
+ next: ['AUTH_PREPARING_DATA_STEP', 'AUTH_DOB_STEP'],
298
317
  prev: 'AUTH_NID_STEP',
299
318
  order: 2
300
319
  },
@@ -316,6 +335,12 @@ export var AUTH_SCREENS_NAVIGATION = [
316
335
  prev: 'AUTH_CIVIL_ID_STEP',
317
336
  order: 2
318
337
  },
338
+ {
339
+ name: 'AUTH_DOB_STEP',
340
+ next: 'AUTH_PREPARING_DATA_STEP',
341
+ prev: 'AUTH_NID_STEP',
342
+ order: 2
343
+ },
319
344
  {
320
345
  name: 'AUTH_PREPARING_DATA_STEP',
321
346
  next: ['AUTH_AUTHENTICATION_LIST_STEP', 'AUTH_ACCOUNT_NOT_FOUND_STEP'],
@@ -401,14 +426,20 @@ export var BUSINESS_SCREENS_NAVIGATION = [
401
426
  },
402
427
  {
403
428
  name: 'BUSINESS_VERIFY_NAFATH_STEP',
404
- next: 'BUSINESS_BUSINESS_TYPE_STEP',
429
+ next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_DOB_STEP'],
405
430
  prev: 'BUSINESS_IDBOD_STEP',
406
431
  order: 3
407
432
  },
433
+ {
434
+ name: 'BUSINESS_DOB_STEP',
435
+ next: 'BUSINESS_BUSINESS_TYPE_STEP',
436
+ prev: 'BUSINESS_IDBOD_STEP',
437
+ order: 2
438
+ },
408
439
  {
409
440
  name: 'BUSINESS_BUSINESS_TYPE_STEP',
410
441
  next: ['BUSINESS_ACTIVITIES_STEP', 'BUSINESS_VERIFY_BRAND_INFO'],
411
- prev: 'BUSINESS_IDBOD_STEP',
442
+ prev: ['BUSINESS_IDBOD_STEP', 'BUSINESS_DOB_STEP'],
412
443
  order: 2
413
444
  },
414
445
  {
@@ -881,6 +912,7 @@ export var CONNECT_STEP_NAMES = {
881
912
  VERIFY_AUTH_MOBILE: 'connect_verify_auth_mobile',
882
913
  CREATE_AUTH_NID: 'connect_create_auth_nid',
883
914
  VERIFY_AUTH_NID: 'connect_verify_auth_nid',
915
+ UPDATE_LEAD_DOB: 'connect_update_lead_dob',
884
916
  UPDATE_LEAD_INDIVIDUAL: 'connect_update_lead_individual',
885
917
  UPDATE_LEAD_BRAND: 'connect_update_lead_brand',
886
918
  UPDATE_BRAND_INFO: 'connect_update_brand_info',
@@ -896,7 +928,8 @@ export var AUTH_STEP_NAMES = {
896
928
  VERIFY_AUTH_MOBILE: 'auth_verify_auth_mobile',
897
929
  VERIFY_AUTH_EMAIL: 'auth_verify_auth_email',
898
930
  CREATE_AUTH_NID: 'auth_create_auth_nid',
899
- VERIFY_AUTH_NID: 'auth_verify_auth_nid'
931
+ VERIFY_AUTH_NID: 'auth_verify_auth_nid',
932
+ UPDATE_DOB_INFO: 'auth_update_dob_info'
900
933
  };
901
934
  export var CONNECT_EXPRESS_STEP_NAMES = {
902
935
  CREATE_AUTH_MOBILE: 'connect_express_create_auth_mobile',
@@ -907,6 +940,7 @@ export var CONNECT_EXPRESS_STEP_NAMES = {
907
940
  VERIFY_AUTH_NID: 'connect_express_verify_auth_nid',
908
941
  IDENTITY_AUTH: 'connect_express_identity_auth',
909
942
  VERIFY_IDENTITY_AUTH: 'connect_express_verify_identity_auth',
943
+ UPDATE_LEAD_DOB: 'connect_express_update_lead_dob',
910
944
  UPDATE_LEAD_INDIVIDUAL: 'connect_express_update_lead_individual',
911
945
  UPDATE_LEAD_BRAND_BUSINESS: 'connect_express_update_lead_brand_business',
912
946
  UPDATE_BRAND_INFO: 'connect_express_update_brand_info',
@@ -928,6 +962,7 @@ export var BUSINESS_STEP_NAMES = {
928
962
  IDENTITY_AUTH: 'business_identity_auth',
929
963
  CREATE_AUTH_CIVIL_ID: 'business_create_auth_civil_id',
930
964
  IDENTITY_VERIFY_AUTH: 'business_identity_auth_verify',
965
+ BUSINESS_DOB_INFO: 'business_dob_info',
931
966
  BUSINESS_CR_INFO: 'business_cr_info',
932
967
  BUSINESS_INFO_CONFIRM: 'business_info_confirm',
933
968
  BUSINESS_CR_ACTIVITIES: 'business_cr_activities',
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActionState, AuthEmailFormValues, AuthForType, AuthMerchantFormValues, AuthenticationListFormValues, CivilFormValues, CountryCode, FlowsTypes, MobileFormValues, NIDFormValues, OTPFormValues, PasswordFormValues, SharedState } from '../../../@types';
2
+ import { ActionState, AuthEmailFormValues, AuthForType, AuthMerchantFormValues, AuthenticationListFormValues, CivilFormValues, CountryCode, DOBFormValues, FlowsTypes, MobileFormValues, NIDFormValues, OTPFormValues, PasswordFormValues, SharedState } from '../../../@types';
3
3
  export declare const updateBusinessCountry: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
4
4
  export declare const retrieveLeadIdentityByIdAsync: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  data: any;
@@ -33,6 +33,10 @@ interface verifyNafathParams {
33
33
  onFailure?: () => void;
34
34
  }
35
35
  export declare const verifyNafath: import("@reduxjs/toolkit").AsyncThunk<any, verifyNafathParams, {}>;
36
+ export declare const updateLeadDOB: import("@reduxjs/toolkit").AsyncThunk<{
37
+ data: any;
38
+ formData: DOBFormValues;
39
+ }, DOBFormValues, {}>;
36
40
  export declare const createCivilIdAuth: import("@reduxjs/toolkit").AsyncThunk<{
37
41
  response: any;
38
42
  formData: CivilFormValues;
@@ -67,6 +71,7 @@ export interface authData {
67
71
  nidData: NIDFormValues;
68
72
  civilIdData: CivilFormValues;
69
73
  emailData: AuthEmailFormValues;
74
+ dobData: DOBFormValues;
70
75
  otpData: OTPFormValues & {
71
76
  authFor?: AuthForType;
72
77
  };
@@ -57,7 +57,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import { AuthForType, AuthTypeNumber, FlowsTypes, MigrationStatus } from '../../../@types';
60
- import { ADD_NEW_ENTITY, AUTH_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, SCOPE_AUTH, defaultCountry } from '../../../constants';
60
+ import { ADD_NEW_ENTITY, AUTH_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, SCOPE_AUTH, defaultCountry } from '../../../constants';
61
61
  import API from '../../../api';
62
62
  import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
63
63
  import { findCountryByIddPrefix, openConnect, sendCustomEventToGTM, sleep } from '../../../utils';
@@ -397,7 +397,7 @@ export var createNafathAuth = createAsyncThunk('auth/createNafathAuth', function
397
397
  });
398
398
  }); });
399
399
  export var verifyNafath = createAsyncThunk('auth/verifyNafath', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
400
- var _a, settings, auth, authResponse, expiry, scope, interval, maxCalls, count, data, isSuccess, isFailed;
400
+ var _a, settings, auth, authResponse, expiry, scope, interval, maxCalls, _loop_1, count, state_1;
401
401
  var _b, _c, _d, _e, _f;
402
402
  return __generator(this, function (_g) {
403
403
  switch (_g.label) {
@@ -408,39 +408,79 @@ export var verifyNafath = createAsyncThunk('auth/verifyNafath', function (params
408
408
  scope = settings.data.appConfig.scope;
409
409
  interval = 3;
410
410
  maxCalls = Math.floor(expiry / interval);
411
+ _loop_1 = function (count) {
412
+ var data, isSuccess, isFailed, screen_1;
413
+ return __generator(this, function (_h) {
414
+ switch (_h.label) {
415
+ case 0:
416
+ if (thunkApi.signal.aborted) {
417
+ return [2, "break"];
418
+ }
419
+ return [4, API.authService.getVerifyAuth(authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_token)];
420
+ case 1:
421
+ data = _h.sent();
422
+ isSuccess = ((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
423
+ isFailed = ((_c = data === null || data === void 0 ? void 0 : data.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'failed';
424
+ if (isFailed) {
425
+ (_d = params.onFailure) === null || _d === void 0 ? void 0 : _d.call(params);
426
+ return [2, { value: data }];
427
+ }
428
+ if (isSuccess) {
429
+ if (scope === 'merchant') {
430
+ openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
431
+ return [2, { value: data }];
432
+ }
433
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
434
+ screen_1 = data.step_name === COLLECT_DOB_INFO_NAFATH ? 'AUTH_DOB_STEP' : 'AUTH_PREPARING_DATA_STEP';
435
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(screen_1)); });
436
+ return [2, { value: data }];
437
+ }
438
+ return [4, sleep(interval * 1000)];
439
+ case 2:
440
+ _h.sent();
441
+ return [2];
442
+ }
443
+ });
444
+ };
411
445
  count = 1;
412
446
  _g.label = 1;
413
447
  case 1:
414
- if (!(count <= maxCalls)) return [3, 5];
415
- if (thunkApi.signal.aborted) {
416
- return [3, 5];
417
- }
418
- return [4, API.authService.getVerifyAuth(authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_token)];
448
+ if (!(count <= maxCalls)) return [3, 4];
449
+ return [5, _loop_1(count)];
419
450
  case 2:
420
- data = _g.sent();
421
- isSuccess = ((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
422
- isFailed = ((_c = data === null || data === void 0 ? void 0 : data.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'failed';
423
- if (isFailed) {
424
- (_d = params.onFailure) === null || _d === void 0 ? void 0 : _d.call(params);
425
- return [2, data];
426
- }
427
- if (isSuccess) {
428
- if (scope === 'merchant') {
429
- openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
430
- return [2, data];
431
- }
432
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
433
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_PREPARING_DATA_STEP')); });
434
- return [2, data];
435
- }
436
- return [4, sleep(interval * 1000)];
451
+ state_1 = _g.sent();
452
+ if (typeof state_1 === "object")
453
+ return [2, state_1.value];
454
+ if (state_1 === "break")
455
+ return [3, 4];
456
+ _g.label = 3;
437
457
  case 3:
438
- _g.sent();
439
- _g.label = 4;
440
- case 4:
441
458
  count++;
442
459
  return [3, 1];
443
- case 5: throw new Error(NAFATH_VERIFICATION_FAILED);
460
+ case 4: throw new Error(NAFATH_VERIFICATION_FAILED);
461
+ }
462
+ });
463
+ }); });
464
+ export var updateLeadDOB = createAsyncThunk('auth/updateLeadDOB', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
465
+ var _a, settings, auth, leadId, requestBody, data;
466
+ var _b, _c, _d, _e;
467
+ return __generator(this, function (_f) {
468
+ switch (_f.label) {
469
+ case 0:
470
+ _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
471
+ leadId = ((_c = (_b = auth.data.responseData) === null || _b === void 0 ? void 0 : _b.authResponse) === null || _c === void 0 ? void 0 : _c.lead_id) || '';
472
+ requestBody = {
473
+ id: leadId,
474
+ date_of_birth: params.dob,
475
+ step_name: AUTH_STEP_NAMES.UPDATE_DOB_INFO,
476
+ encryption_contract: ['date_of_birth']
477
+ };
478
+ return [4, API.leadService.updateLead(requestBody)];
479
+ case 1:
480
+ data = _f.sent();
481
+ thunkApi.dispatch(handleNextScreenStep());
482
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
483
+ return [2, { data: data, formData: params }];
444
484
  }
445
485
  });
446
486
  }); });
@@ -777,6 +817,9 @@ var initialState = {
777
817
  emailData: {
778
818
  email: ''
779
819
  },
820
+ dobData: {
821
+ dob: ''
822
+ },
780
823
  otpData: {
781
824
  otp: '',
782
825
  authFor: AuthForType.MOBILE
@@ -989,6 +1032,21 @@ export var authSlice = createSlice({
989
1032
  if (error !== 'Aborted') {
990
1033
  state.error = error;
991
1034
  }
1035
+ })
1036
+ .addCase(updateLeadDOB.pending, function (state, action) {
1037
+ state.loading = true;
1038
+ state.error = null;
1039
+ })
1040
+ .addCase(updateLeadDOB.fulfilled, function (state, action) {
1041
+ var _a;
1042
+ state.loading = false;
1043
+ var _b = action.payload, data = _b.data, formData = _b.formData;
1044
+ state.data.dobData = formData;
1045
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { leadResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.leadResponse), data) });
1046
+ })
1047
+ .addCase(updateLeadDOB.rejected, function (state, action) {
1048
+ state.loading = false;
1049
+ state.error = action.error.message;
992
1050
  })
993
1051
  .addCase(createCivilIdAuth.pending, function (state) {
994
1052
  state.loading = true;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, CivilFormValues, ActionState, AsyncThunkParams } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, CivilFormValues, ActionState, AsyncThunkParams, DOBFormValues } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  isicActivityList: any;
@@ -34,7 +34,13 @@ interface verifyNafathParams {
34
34
  onSuccess?: () => void;
35
35
  onFailure?: () => void;
36
36
  }
37
- export declare const verifyNafath: import("@reduxjs/toolkit").AsyncThunk<any, verifyNafathParams, {}>;
37
+ export declare const verifyNafath: import("@reduxjs/toolkit").AsyncThunk<{
38
+ response: any;
39
+ isNextScreenDob?: undefined;
40
+ } | {
41
+ response: any;
42
+ isNextScreenDob: boolean;
43
+ }, verifyNafathParams, {}>;
38
44
  interface verifyPACIParams {
39
45
  onSuccess?: () => void;
40
46
  }
@@ -54,6 +60,10 @@ export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
54
60
  termAndConditionChecked?: boolean | undefined;
55
61
  };
56
62
  }, NIDFormValues, {}>;
63
+ export declare const updateLeadDOB: import("@reduxjs/toolkit").AsyncThunk<{
64
+ data: any;
65
+ formData: DOBFormValues;
66
+ }, DOBFormValues, {}>;
57
67
  export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
58
68
  leadId: string;
59
69
  }, {}>;
@@ -109,7 +119,10 @@ export interface BusinessData {
109
119
  type: string;
110
120
  };
111
121
  civilIdData: CivilFormValues & ResponseData;
112
- businessTypeData: BusinessTypeFormValues & ResponseData;
122
+ dobData: DOBFormValues & ResponseData;
123
+ businessTypeData: BusinessTypeFormValues & ResponseData & {
124
+ isPrevDob?: boolean;
125
+ };
113
126
  activitiesData: ActivitiesFormValues & ResponseData;
114
127
  customersData: CustomersFormValues & ResponseData;
115
128
  flowName: FlowsTypes;
@@ -58,7 +58,7 @@ var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import API from '../../../api';
60
60
  import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
61
- import { BUSINESS_STEP_NAMES, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
61
+ import { BUSINESS_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
62
62
  import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM } from '../../../utils';
63
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 () {
@@ -308,7 +308,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
308
308
  });
309
309
  }); });
310
310
  export var verifyNafath = createAsyncThunk('business/verifyNafathParams', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
311
- var _a, settings, business, responseBody, expiry, interval, maxCalls, count, data, isSuccess, isFailed;
311
+ var _a, settings, business, responseBody, expiry, interval, maxCalls, count, data, isSuccess, isFailed, isNextScreenDob, screen_1;
312
312
  var _b, _c, _d, _e, _f, _g;
313
313
  return __generator(this, function (_h) {
314
314
  switch (_h.label) {
@@ -332,7 +332,7 @@ export var verifyNafath = createAsyncThunk('business/verifyNafathParams', functi
332
332
  isFailed = ((_c = data.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'failed';
333
333
  if (isFailed) {
334
334
  (_d = params.onFailure) === null || _d === void 0 ? void 0 : _d.call(params);
335
- return [2, data];
335
+ return [2, { response: data }];
336
336
  }
337
337
  if (!isSuccess) return [3, 5];
338
338
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: responseBody === null || responseBody === void 0 ? void 0 : responseBody.id }))];
@@ -343,8 +343,10 @@ export var verifyNafath = createAsyncThunk('business/verifyNafathParams', functi
343
343
  return [4, sleep(3000)];
344
344
  case 4:
345
345
  _h.sent();
346
- thunkApi.dispatch(handleNextScreenStep());
347
- return [2, { response: data }];
346
+ isNextScreenDob = data.step_name === COLLECT_DOB_INFO_NAFATH;
347
+ screen_1 = isNextScreenDob ? 'BUSINESS_DOB_STEP' : 'BUSINESS_BUSINESS_TYPE_STEP';
348
+ thunkApi.dispatch(handleNextScreenStep(screen_1));
349
+ return [2, { response: data, isNextScreenDob: isNextScreenDob }];
348
350
  case 5: return [4, sleep(interval * 1000)];
349
351
  case 6:
350
352
  _h.sent();
@@ -473,6 +475,30 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
473
475
  }
474
476
  });
475
477
  }); });
478
+ export var updateLeadDOB = createAsyncThunk('business/updateLeadDOB', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
479
+ var _a, settings, business, stepName, lead_id, requestBody, data;
480
+ var _b, _c;
481
+ return __generator(this, function (_d) {
482
+ switch (_d.label) {
483
+ case 0:
484
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
485
+ stepName = BUSINESS_STEP_NAMES.BUSINESS_DOB_INFO;
486
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
487
+ requestBody = {
488
+ id: lead_id || '',
489
+ date_of_birth: params.dob,
490
+ step_name: stepName,
491
+ encryption_contract: ['date_of_birth']
492
+ };
493
+ return [4, API.leadService.updateLead(requestBody)];
494
+ case 1:
495
+ data = _d.sent();
496
+ thunkApi.dispatch(handleNextScreenStep());
497
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
498
+ return [2, { data: data, formData: params }];
499
+ }
500
+ });
501
+ }); });
476
502
  export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
477
503
  var data;
478
504
  return __generator(this, function (_a) {
@@ -838,9 +864,13 @@ var initialState = {
838
864
  dob: '',
839
865
  type: ''
840
866
  },
867
+ dobData: {
868
+ dob: ''
869
+ },
841
870
  businessTypeData: {
842
871
  licenseNumber: '',
843
- entityLegalName: ''
872
+ entityLegalName: '',
873
+ isPrevDob: false
844
874
  },
845
875
  activitiesData: {
846
876
  activities: [],
@@ -1056,7 +1086,9 @@ export var businessSlice = createSlice({
1056
1086
  .addCase(verifyNafath.fulfilled, function (state, action) {
1057
1087
  state.loading = false;
1058
1088
  state.error = null;
1059
- state.data.otpData.responseBody = action.payload.response;
1089
+ var _a = action.payload, response = _a.response, isNextScreenDob = _a.isNextScreenDob;
1090
+ state.data.businessTypeData.isPrevDob = isNextScreenDob || false;
1091
+ state.data.otpData.responseBody = response;
1060
1092
  })
1061
1093
  .addCase(verifyNafath.rejected, function (state, action) {
1062
1094
  state.loading = false;
@@ -1064,6 +1096,21 @@ export var businessSlice = createSlice({
1064
1096
  if (error !== 'Aborted') {
1065
1097
  state.error = error;
1066
1098
  }
1099
+ })
1100
+ .addCase(updateLeadDOB.pending, function (state) {
1101
+ state.loading = true;
1102
+ state.error = null;
1103
+ })
1104
+ .addCase(updateLeadDOB.fulfilled, function (state, action) {
1105
+ state.loading = false;
1106
+ state.error = null;
1107
+ var _a = action.payload, data = _a.data, formData = _a.formData;
1108
+ state.data.dobData = formData;
1109
+ state.data.dobData.responseBody = data;
1110
+ })
1111
+ .addCase(updateLeadDOB.rejected, function (state, action) {
1112
+ state.loading = false;
1113
+ state.error = action.error.message;
1067
1114
  })
1068
1115
  .addCase(retrieveEntityList.pending, function (state) {
1069
1116
  state.error = null;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActionState, AuthForType, CivilFormValues, CountryCode, FlowsTypes, IndividualFormValues, MobileFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, BrandFormValues, BrandSegmentFormValues } from '../../../@types';
2
+ import { ActionState, AuthForType, CivilFormValues, CountryCode, FlowsTypes, IndividualFormValues, MobileFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, BrandFormValues, BrandSegmentFormValues, DOBFormValues } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const updateBusinessCountry: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
5
5
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
@@ -41,11 +41,17 @@ export declare const verifyNafath: import("@reduxjs/toolkit").AsyncThunk<{
41
41
  authResponse: any;
42
42
  countryCode: CountryCode;
43
43
  leadResponse?: undefined;
44
+ isNextScreenDob?: undefined;
44
45
  } | {
45
46
  authResponse: any;
46
47
  leadResponse: any;
47
48
  countryCode: CountryCode;
49
+ isNextScreenDob: boolean;
48
50
  }, verifyNafathParams, {}>;
51
+ export declare const updateLeadDOB: import("@reduxjs/toolkit").AsyncThunk<{
52
+ leadResponse: any;
53
+ formData: DOBFormValues;
54
+ }, DOBFormValues, {}>;
49
55
  export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
50
56
  leadResponse: any;
51
57
  formData: IndividualFormValues;
@@ -101,7 +107,10 @@ export interface ConnectData {
101
107
  otpData: OTPFormValues & ResponseData & {
102
108
  authFor: AuthForType;
103
109
  };
104
- individualData: IndividualFormValues & ResponseData;
110
+ dobData: DOBFormValues & ResponseData;
111
+ individualData: IndividualFormValues & ResponseData & {
112
+ isPrevDob?: boolean;
113
+ };
105
114
  brandData: BrandFormValues & ResponseData;
106
115
  brandSegmentData: Pick<BrandSegmentFormValues, 'teamSize'> & ResponseData;
107
116
  flowName: FlowsTypes;