@tap-payments/auth-jsconnect 2.8.74-development → 2.8.75-beta

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 (104) hide show
  1. package/build/@types/form.d.ts +1 -1
  2. package/build/api/auth.d.ts +0 -13
  3. package/build/api/index.d.ts +2 -2
  4. package/build/api/lead.d.ts +0 -6
  5. package/build/assets/locales/ar.json +1 -10
  6. package/build/assets/locales/en.json +1 -10
  7. package/build/components/Tooltip/Tooltip.js +1 -1
  8. package/build/constants/api.d.ts +1 -0
  9. package/build/constants/api.js +2 -0
  10. package/build/constants/app.d.ts +2 -1
  11. package/build/constants/app.js +14 -35
  12. package/build/constants/assets.d.ts +0 -2
  13. package/build/constants/assets.js +0 -2
  14. package/build/features/app/auth/authStore.d.ts +15 -5
  15. package/build/features/app/auth/authStore.js +113 -58
  16. package/build/features/app/business/businessStore.d.ts +11 -16
  17. package/build/features/app/business/businessStore.js +44 -58
  18. package/build/features/app/connect/connectStore.d.ts +12 -19
  19. package/build/features/app/connect/connectStore.js +82 -151
  20. package/build/features/app/connectExpress/connectExpressStore.d.ts +33 -10
  21. package/build/features/app/connectExpress/connectExpressStore.js +251 -156
  22. package/build/features/app/individual/individualStore.js +2 -4
  23. package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +2 -2
  24. package/build/features/auth/screens/NID/DOB.d.ts +6 -0
  25. package/build/features/auth/screens/NID/DOB.js +47 -0
  26. package/build/features/auth/screens/NID/IDNumber.js +1 -1
  27. package/build/features/auth/screens/NID/NID.js +10 -4
  28. package/build/features/auth/screens/NID/validation.d.ts +3 -0
  29. package/build/features/auth/screens/NID/validation.js +1 -0
  30. package/build/features/auth/screens/OTP/OTP.js +5 -1
  31. package/build/features/auth/screens/OTP/OTPInput.js +13 -2
  32. package/build/features/business/screens/OTP/OTP.d.ts +8 -0
  33. package/build/features/business/screens/OTP/OTP.js +90 -0
  34. package/build/features/business/screens/OTP/OTPInput.d.ts +5 -0
  35. package/build/features/business/screens/OTP/OTPInput.js +49 -0
  36. package/build/features/business/screens/OTP/index.d.ts +3 -0
  37. package/build/features/business/screens/OTP/index.js +2 -0
  38. package/build/features/business/screens/OTP/validation.d.ts +8 -0
  39. package/build/features/business/screens/OTP/validation.js +4 -0
  40. package/build/features/connect/screens/Mobile/Mobile.js +2 -2
  41. package/build/features/connect/screens/NID/DOB.d.ts +5 -0
  42. package/build/features/connect/screens/NID/DOB.js +47 -0
  43. package/build/features/connect/screens/NID/IDNumber.d.ts +0 -1
  44. package/build/features/connect/screens/NID/IDNumber.js +2 -2
  45. package/build/features/connect/screens/NID/NID.js +11 -5
  46. package/build/features/connect/screens/NID/validation.d.ts +3 -0
  47. package/build/features/connect/screens/NID/validation.js +1 -0
  48. package/build/features/connect/screens/OTP/OTPInput.js +11 -3
  49. package/build/features/{auth/screens/VerifyNafath/VerifyNafath.d.ts → connectExpress/screens/IdentityOTP/OTP.d.ts} +2 -2
  50. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +88 -0
  51. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.d.ts +5 -0
  52. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +56 -0
  53. package/build/features/connectExpress/screens/IdentityOTP/index.d.ts +3 -0
  54. package/build/features/connectExpress/screens/IdentityOTP/index.js +2 -0
  55. package/build/features/connectExpress/screens/IdentityOTP/validation.d.ts +8 -0
  56. package/build/features/connectExpress/screens/IdentityOTP/validation.js +4 -0
  57. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
  58. package/build/features/connectExpress/screens/NID/DOB.d.ts +6 -0
  59. package/build/features/connectExpress/screens/NID/DOB.js +47 -0
  60. package/build/features/connectExpress/screens/NID/IDNumber.d.ts +0 -1
  61. package/build/features/connectExpress/screens/NID/IDNumber.js +2 -2
  62. package/build/features/connectExpress/screens/NID/NID.js +9 -4
  63. package/build/features/connectExpress/screens/NID/validation.d.ts +3 -0
  64. package/build/features/connectExpress/screens/NID/validation.js +2 -0
  65. package/build/features/connectExpress/screens/NIDMissed/NID.js +2 -2
  66. package/build/features/connectExpress/screens/OTP/OTP.js +13 -5
  67. package/build/features/connectExpress/screens/OTP/OTPInput.js +11 -3
  68. package/build/features/entity/screens/EntityName/LicenseNumber.js +2 -2
  69. package/build/features/featuresScreens.js +6 -21
  70. package/build/features/shared/Button/AbsherButton.d.ts +7 -0
  71. package/build/features/shared/Button/{NafathButton.js → AbsherButton.js} +3 -13
  72. package/build/features/shared/Button/index.d.ts +2 -2
  73. package/build/features/shared/Button/index.js +2 -2
  74. package/build/theme/palette.js +1 -2
  75. package/build/utils/common.js +4 -4
  76. package/package.json +2 -2
  77. package/build/features/auth/screens/VerifyNafath/VerifyNafath.js +0 -34
  78. package/build/features/auth/screens/VerifyNafath/index.d.ts +0 -3
  79. package/build/features/auth/screens/VerifyNafath/index.js +0 -2
  80. package/build/features/business/screens/VerifyNafath/VerifyNafath.d.ts +0 -5
  81. package/build/features/business/screens/VerifyNafath/VerifyNafath.js +0 -34
  82. package/build/features/business/screens/VerifyNafath/index.d.ts +0 -3
  83. package/build/features/business/screens/VerifyNafath/index.js +0 -2
  84. package/build/features/connect/screens/VerifyNafath/VerifyNafath.d.ts +0 -5
  85. package/build/features/connect/screens/VerifyNafath/VerifyNafath.js +0 -34
  86. package/build/features/connect/screens/VerifyNafath/index.d.ts +0 -3
  87. package/build/features/connect/screens/VerifyNafath/index.js +0 -2
  88. package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.d.ts +0 -5
  89. package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.js +0 -34
  90. package/build/features/connectExpress/screens/IdentityVerifyNafath/index.d.ts +0 -3
  91. package/build/features/connectExpress/screens/IdentityVerifyNafath/index.js +0 -2
  92. package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.d.ts +0 -5
  93. package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +0 -34
  94. package/build/features/connectExpress/screens/VerifyNafath/index.d.ts +0 -3
  95. package/build/features/connectExpress/screens/VerifyNafath/index.js +0 -2
  96. package/build/features/shared/Button/NafathButton.d.ts +0 -7
  97. package/build/features/shared/NafathVerification/NafathVerification.d.ts +0 -13
  98. package/build/features/shared/NafathVerification/NafathVerification.js +0 -92
  99. package/build/features/shared/NafathVerification/VerifyNafathLoading.d.ts +0 -8
  100. package/build/features/shared/NafathVerification/VerifyNafathLoading.js +0 -53
  101. package/build/features/shared/NafathVerification/VerifyNafathSuccess.d.ts +0 -5
  102. package/build/features/shared/NafathVerification/VerifyNafathSuccess.js +0 -8
  103. package/build/features/shared/NafathVerification/index.d.ts +0 -2
  104. package/build/features/shared/NafathVerification/index.js +0 -2
@@ -307,51 +307,6 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
307
307
  }
308
308
  });
309
309
  }); });
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, _b, business_id, entity, expiry, interval, maxCalls, count, data, isSuccess;
312
- var _c, _d, _e, _f;
313
- return __generator(this, function (_g) {
314
- switch (_g.label) {
315
- case 0:
316
- _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
317
- responseBody = business.data.nidData.responseBody;
318
- _b = business.data.verify.responseBody || {}, business_id = _b.business_id, entity = _b.entity;
319
- expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
320
- interval = 5;
321
- maxCalls = Math.floor(expiry / interval);
322
- if (thunkApi.signal.aborted) {
323
- return [2, { response: null }];
324
- }
325
- count = 1;
326
- _g.label = 1;
327
- case 1:
328
- if (!(count <= maxCalls)) return [3, 8];
329
- return [4, API.authService.getTokenVerify(responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token)];
330
- case 2:
331
- data = _g.sent();
332
- isSuccess = ((_c = data.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'completed';
333
- if (!isSuccess) return [3, 5];
334
- return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
335
- case 3:
336
- _g.sent();
337
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
338
- (_f = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _f === void 0 ? void 0 : _f.call(params);
339
- return [4, sleep(3000)];
340
- case 4:
341
- _g.sent();
342
- thunkApi.dispatch(handleNextScreenStep());
343
- return [2, { response: data }];
344
- case 5: return [4, sleep(interval * 1000)];
345
- case 6:
346
- _g.sent();
347
- _g.label = 7;
348
- case 7:
349
- count++;
350
- return [3, 1];
351
- case 8: throw new Error('nafath_verification_failed');
352
- }
353
- });
354
- }); });
355
310
  export var verifyPACI = createAsyncThunk('businessVerifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
356
311
  var _a, settings, business, responseBody, _b, business_id, entity, expiry, interval, maxCalls, count, data, isSuccess;
357
312
  var _c, _d, _e, _f;
@@ -432,7 +387,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
432
387
  switch (_d.label) {
433
388
  case 0:
434
389
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
435
- identification_id_type = IDENTIFICATION_TYPE.NAFATH;
390
+ identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
436
391
  stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
437
392
  lead_id = (business.data.verify.responseBody || {}).lead_id;
438
393
  countryIso2 = settings.data.businessCountry.iso2;
@@ -455,7 +410,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
455
410
  case 1:
456
411
  data = _d.sent();
457
412
  business_id = data.business_id, entity = data.entity;
458
- screen = 'BUSINESS_VERIFY_NAFATH_STEP';
413
+ screen = 'BUSINESS_OTP_STEP';
459
414
  if (!isOtherThanKWOrSA(countryIso2)) return [3, 4];
460
415
  screen = 'BUSINESS_BUSINESS_TYPE_STEP';
461
416
  return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
@@ -473,6 +428,34 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
473
428
  }
474
429
  });
475
430
  }); });
431
+ export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
432
+ var _a, settings, business, _b, nid, dob, type, stepName, lead_id, date_of_birth, requestBody, data;
433
+ return __generator(this, function (_c) {
434
+ switch (_c.label) {
435
+ case 0:
436
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
437
+ _b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
438
+ stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
439
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
440
+ date_of_birth = dateFormat(new Date(dob));
441
+ requestBody = {
442
+ id: lead_id || '',
443
+ identification: {
444
+ id: nid,
445
+ issued_country_code: settings.data.businessCountry.iso2,
446
+ type: type
447
+ },
448
+ date_of_birth: date_of_birth,
449
+ step_name: stepName,
450
+ encryption_contract: ['identification.issued_country_code', 'identification.id', 'identification.type', 'date_of_birth']
451
+ };
452
+ return [4, API.leadService.updateLead(requestBody)];
453
+ case 1:
454
+ data = _c.sent();
455
+ return [2, data];
456
+ }
457
+ });
458
+ }); });
476
459
  export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
477
460
  var data;
478
461
  return __generator(this, function (_a) {
@@ -1049,21 +1032,24 @@ export var businessSlice = createSlice({
1049
1032
  state.loading = false;
1050
1033
  state.error = action.error.message;
1051
1034
  })
1052
- .addCase(verifyNafath.pending, function (state) {
1053
- state.loading = true;
1035
+ .addCase(resendOTPLeadIdentity.pending, function (state) {
1054
1036
  state.error = null;
1055
1037
  })
1056
- .addCase(verifyNafath.fulfilled, function (state, action) {
1057
- state.loading = false;
1038
+ .addCase(resendOTPLeadIdentity.fulfilled, function (state, action) {
1039
+ var _a;
1058
1040
  state.error = null;
1059
- state.data.otpData.responseBody = action.payload.response;
1060
- })
1061
- .addCase(verifyNafath.rejected, function (state, action) {
1062
- state.loading = false;
1063
- var error = action.error.message;
1064
- if (error !== 'Aborted') {
1065
- state.error = error;
1041
+ var data = action.payload;
1042
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
1043
+ if (description) {
1044
+ state.error = description;
1045
+ return;
1066
1046
  }
1047
+ state.data.nidData.responseBody = data;
1048
+ state.data.otpData.otp = '';
1049
+ state.data.otpData.isNID = true;
1050
+ })
1051
+ .addCase(resendOTPLeadIdentity.rejected, function (state, action) {
1052
+ state.error = action.error.message;
1067
1053
  })
1068
1054
  .addCase(retrieveEntityList.pending, function (state) {
1069
1055
  state.error = null;
@@ -47,12 +47,22 @@ export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any,
47
47
  fulfilledMeta?: unknown;
48
48
  rejectedMeta?: unknown;
49
49
  }>;
50
- export declare const createNafathAuth: import("@reduxjs/toolkit").AsyncThunk<{
50
+ export declare const resendOTPNID: import("@reduxjs/toolkit").AsyncThunk<any, void, {
51
+ state?: unknown;
52
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
53
+ extra?: unknown;
54
+ rejectValue?: unknown;
55
+ serializedErrorType?: unknown;
56
+ pendingMeta?: unknown;
57
+ fulfilledMeta?: unknown;
58
+ rejectedMeta?: unknown;
59
+ }>;
60
+ export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
51
61
  response: any;
52
62
  formData: {
53
63
  type: string;
54
64
  nid: string;
55
- dob?: any;
65
+ dob: string;
56
66
  termAndConditionChecked?: boolean | undefined;
57
67
  };
58
68
  }, NIDFormValues, {
@@ -96,23 +106,6 @@ export declare const verifyPACI: import("@reduxjs/toolkit").AsyncThunk<{
96
106
  fulfilledMeta?: unknown;
97
107
  rejectedMeta?: unknown;
98
108
  }>;
99
- interface verifyNafathParams {
100
- onSuccess?: () => void;
101
- }
102
- export declare const verifyNafath: import("@reduxjs/toolkit").AsyncThunk<{
103
- authResponse: any;
104
- leadResponse: any;
105
- countryCode: CountryCode;
106
- }, verifyNafathParams, {
107
- state?: unknown;
108
- dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
109
- extra?: unknown;
110
- rejectValue?: unknown;
111
- serializedErrorType?: unknown;
112
- pendingMeta?: unknown;
113
- fulfilledMeta?: unknown;
114
- rejectedMeta?: unknown;
115
- }>;
116
109
  export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
117
110
  leadResponse: any;
118
111
  formData: IndividualFormValues;
@@ -173,33 +173,75 @@ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (param
173
173
  }
174
174
  });
175
175
  }); });
176
- export var createNafathAuth = createAsyncThunk('connect/createNafathAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
177
- var settings, requestBody, data;
176
+ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
177
+ var _a, settings, connect, _b, nid, dob, identification_id_type, requestBody, data;
178
+ return __generator(this, function (_c) {
179
+ switch (_c.label) {
180
+ case 0:
181
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
182
+ _b = connect.data.nidData, nid = _b.nid, dob = _b.dob;
183
+ identification_id_type = nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
184
+ requestBody = {
185
+ country: settings.data.businessCountry.iso2,
186
+ scope: settings.data.appConfig.scope,
187
+ lang: settings.data.language,
188
+ user_credentail: {
189
+ identification_id: nid,
190
+ identification_id_type: identification_id_type,
191
+ date_of_birth: dob,
192
+ country_code: settings.data.businessCountry.iso2
193
+ },
194
+ sign_in: false,
195
+ is_lead: true,
196
+ step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
197
+ encryption_contract: [
198
+ 'user_credentail.country_code',
199
+ 'user_credentail.identification_id',
200
+ 'user_credentail.identification_id_type',
201
+ 'user_credentail.date_of_birth'
202
+ ]
203
+ };
204
+ return [4, API.authService.createAuth(requestBody)];
205
+ case 1:
206
+ data = _c.sent();
207
+ return [2, data];
208
+ }
209
+ });
210
+ }); });
211
+ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
212
+ var settings, identification_id_type, requestBody, data;
178
213
  var _a, _b;
179
214
  return __generator(this, function (_c) {
180
215
  switch (_c.label) {
181
216
  case 0:
182
217
  settings = thunkApi.getState().settings;
218
+ identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
183
219
  requestBody = {
184
220
  country: settings.data.businessCountry.iso2,
185
221
  scope: settings.data.appConfig.scope,
186
222
  lang: settings.data.language,
187
223
  user_credentail: {
188
224
  identification_id: params.nid,
189
- identification_id_type: IDENTIFICATION_TYPE.NAFATH,
225
+ identification_id_type: identification_id_type,
226
+ date_of_birth: params.dob,
190
227
  country_code: settings.data.businessCountry.iso2
191
228
  },
192
229
  sign_in: false,
193
230
  is_lead: true,
194
231
  step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
195
- encryption_contract: ['user_credentail.country_code', 'user_credentail.identification_id', 'user_credentail.identification_id_type']
232
+ encryption_contract: [
233
+ 'user_credentail.country_code',
234
+ 'user_credentail.identification_id',
235
+ 'user_credentail.identification_id_type',
236
+ 'user_credentail.date_of_birth'
237
+ ]
196
238
  };
197
- return [4, API.authService.createAuthKitNID(requestBody)];
239
+ return [4, API.authService.createAuth(requestBody)];
198
240
  case 1:
199
241
  data = _c.sent();
200
242
  thunkApi.dispatch(handleNextScreenStep());
201
- (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody);
202
- return [2, { response: data, formData: __assign(__assign({}, params), { type: IDENTIFICATION_TYPE.NAFATH }) }];
243
+ (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
244
+ return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
203
245
  }
204
246
  });
205
247
  }); });
@@ -358,85 +400,6 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
358
400
  }
359
401
  });
360
402
  }); });
361
- export var verifyNafath = createAsyncThunk('connect/verifyNafath', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
362
- var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, brand, err_5, brands, err_6, phone;
363
- var _b, _c, _d, _e, _f;
364
- return __generator(this, function (_g) {
365
- switch (_g.label) {
366
- case 0:
367
- _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
368
- responseBody = connect.data.nidData.responseBody;
369
- expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
370
- interval = 3;
371
- maxCalls = Math.floor(expiry / interval);
372
- count = 1;
373
- _g.label = 1;
374
- case 1:
375
- if (!(count <= maxCalls)) return [3, 16];
376
- if (thunkApi.signal.aborted) {
377
- return [3, 16];
378
- }
379
- return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
380
- case 2:
381
- authResponse = _g.sent();
382
- isSuccess = ((_b = authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'completed';
383
- if (!isSuccess) return [3, 13];
384
- lead_id = authResponse.lead_id;
385
- if (!lead_id)
386
- throw new Error('Lead id is missing');
387
- return [4, API.leadService.retrieveLead(lead_id)];
388
- case 3:
389
- leadResponse = (_g.sent()).data;
390
- if ((_c = leadResponse.errors) === null || _c === void 0 ? void 0 : _c.length)
391
- throw new Error(leadResponse.errors[0].description);
392
- countryCode = settings.data.businessCountry;
393
- return [4, API.dataService.getChannelsOfServices({ page: 0 })];
394
- case 4:
395
- channels = (_g.sent()).list;
396
- leadResponse.channel_list = channels;
397
- _g.label = 5;
398
- case 5:
399
- _g.trys.push([5, 7, , 8]);
400
- return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
401
- case 6:
402
- brand = (_g.sent()).brand;
403
- leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
404
- return [3, 8];
405
- case 7:
406
- err_5 = _g.sent();
407
- return [3, 8];
408
- case 8:
409
- _g.trys.push([8, 10, , 11]);
410
- return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
411
- case 9:
412
- brands = (_g.sent()).brands;
413
- leadResponse.brand_list = fixBrandList(brands, channels);
414
- return [3, 11];
415
- case 10:
416
- err_6 = _g.sent();
417
- return [3, 11];
418
- case 11:
419
- (_d = params.onSuccess) === null || _d === void 0 ? void 0 : _d.call(params);
420
- return [4, sleep(3000)];
421
- case 12:
422
- _g.sent();
423
- phone = (leadResponse.contact || {}).phone;
424
- if (phone === null || phone === void 0 ? void 0 : phone.country_code)
425
- countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
426
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
427
- thunkApi.dispatch(handleNextScreenStep());
428
- return [2, { authResponse: authResponse, leadResponse: leadResponse, countryCode: countryCode }];
429
- case 13: return [4, sleep(interval * 1000)];
430
- case 14:
431
- _g.sent();
432
- _g.label = 15;
433
- case 15:
434
- count++;
435
- return [3, 1];
436
- case 16: throw new Error('nafath_verification_failed');
437
- }
438
- });
439
- }); });
440
403
  export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
441
404
  var _a, settings, connect, lead_id, brandData, phoneCountry, payload, leadResponse;
442
405
  var _b, _c, _d, _e, _f;
@@ -500,7 +463,7 @@ export var retrieveLead = createAsyncThunk('connect/retrieveLead', function (par
500
463
  });
501
464
  }); });
502
465
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
503
- var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, team, err_7, brandNameBody, payload, lead, brandReqBody, brand, team, err_8;
466
+ var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, team, err_5, brandNameBody, payload, lead, brandReqBody, brand, team, err_6;
504
467
  var _b, _c, _d, _e, _f;
505
468
  return __generator(this, function (_g) {
506
469
  switch (_g.label) {
@@ -559,7 +522,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
559
522
  brand_1.team_size_list = (team === null || team === void 0 ? void 0 : team.list) || [];
560
523
  return [3, 7];
561
524
  case 6:
562
- err_7 = _g.sent();
525
+ err_5 = _g.sent();
563
526
  return [3, 7];
564
527
  case 7:
565
528
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
@@ -605,7 +568,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
605
568
  brand.team_size_list = (team === null || team === void 0 ? void 0 : team.list) || [];
606
569
  return [3, 14];
607
570
  case 13:
608
- err_8 = _g.sent();
571
+ err_6 = _g.sent();
609
572
  return [3, 14];
610
573
  case 14:
611
574
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
@@ -728,6 +691,7 @@ var initialState = {
728
691
  },
729
692
  nidData: {
730
693
  nid: '',
694
+ dob: '',
731
695
  type: ''
732
696
  },
733
697
  civilIdData: {
@@ -895,27 +859,7 @@ export var connectSlice = createSlice({
895
859
  state.error = error;
896
860
  }
897
861
  })
898
- .addCase(createNafathAuth.fulfilled, function (state, action) {
899
- state.loading = false;
900
- state.error = null;
901
- var _a = action.payload, formData = _a.formData, response = _a.response;
902
- state.data.nidData = formData;
903
- state.data.nidData.responseBody = response;
904
- state.data.otpData.authFor = AuthForType.NATIONAL_ID;
905
- })
906
- .addCase(createNafathAuth.pending, function (state) {
907
- state.loading = true;
908
- state.error = null;
909
- })
910
- .addCase(createNafathAuth.rejected, function (state, action) {
911
- state.loading = false;
912
- state.error = action.error.message;
913
- })
914
- .addCase(verifyNafath.pending, function (state) {
915
- state.loading = true;
916
- state.error = null;
917
- })
918
- .addCase(verifyNafath.fulfilled, function (state, action) {
862
+ .addCase(verifyAuth.fulfilled, function (state, action) {
919
863
  var _a;
920
864
  state.loading = false;
921
865
  state.error = null;
@@ -951,56 +895,41 @@ export var connectSlice = createSlice({
951
895
  };
952
896
  state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact, leadData: leadResponse });
953
897
  })
954
- .addCase(verifyNafath.rejected, function (state, action) {
898
+ .addCase(verifyAuth.pending, function (state) {
899
+ state.loading = true;
900
+ state.error = null;
901
+ })
902
+ .addCase(verifyAuth.rejected, function (state, action) {
955
903
  state.loading = false;
956
- var error = action.error.message;
957
- if (error !== 'Aborted') {
958
- state.error = error;
959
- }
904
+ state.error = action.error.message;
960
905
  })
961
- .addCase(verifyAuth.fulfilled, function (state, action) {
962
- var _a;
906
+ .addCase(createNIDAuth.fulfilled, function (state, action) {
963
907
  state.loading = false;
964
908
  state.error = null;
965
- var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, countryCode = _b.countryCode;
966
- var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id;
967
- var _c = contact || {}, email = _c.email, phone = _c.phone;
968
- var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
969
- if (!!fullName) {
970
- var capitalizedName = capitalizeTheFirstLetterOfEachWord(fullName);
971
- state.data.individualData.name = capitalizedName;
972
- }
973
- if (email)
974
- state.data.individualData.email = email;
975
- if (phone === null || phone === void 0 ? void 0 : phone.number)
976
- state.data.individualData.mobile = phone.number;
977
- if (!!countryCode)
978
- state.data.individualData.countryCode = countryCode;
979
- if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
980
- state.data.brandData.brandName = brand.name.en;
981
- var brandList = [];
982
- if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
983
- var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
984
- brandList = __spreadArray([], brand_list, true);
985
- if (!isBrandExist && brand)
986
- brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: (brand === null || brand === void 0 ? void 0 : brand.channel_services) || [] })], false);
987
- brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
988
- state.data.brandData.selectedBrandItem = brandList[0];
989
- }
990
- state.data.brandData.responseBody = {
991
- brand_list: brandList,
992
- channel_list: channel_list,
993
- brandData: brand
994
- };
995
- state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact, leadData: leadResponse });
909
+ var _a = action.payload, formData = _a.formData, response = _a.response;
910
+ state.data.nidData = formData;
911
+ state.data.nidData.responseBody = response;
912
+ state.data.otpData.authFor = AuthForType.NATIONAL_ID;
996
913
  })
997
- .addCase(verifyAuth.pending, function (state) {
914
+ .addCase(createNIDAuth.pending, function (state) {
998
915
  state.loading = true;
999
916
  state.error = null;
1000
917
  })
1001
- .addCase(verifyAuth.rejected, function (state, action) {
918
+ .addCase(createNIDAuth.rejected, function (state, action) {
1002
919
  state.loading = false;
1003
920
  state.error = action.error.message;
921
+ })
922
+ .addCase(resendOTPNID.fulfilled, function (state, action) {
923
+ state.error = null;
924
+ var response = action.payload;
925
+ state.data.nidData.responseBody = response;
926
+ state.data.otpData.authFor = AuthForType.NATIONAL_ID;
927
+ })
928
+ .addCase(resendOTPNID.pending, function (state) {
929
+ state.error = null;
930
+ })
931
+ .addCase(resendOTPNID.rejected, function (state, action) {
932
+ state.error = action.error.message;
1004
933
  })
1005
934
  .addCase(updateLeadIndividual.fulfilled, function (state, action) {
1006
935
  var _a, _b, _c;
@@ -1117,7 +1046,7 @@ export var connectSlice = createSlice({
1117
1046
  state.customLoading = false;
1118
1047
  state.error = null;
1119
1048
  var _b = action.payload, data = _b.data, countryCode = _b.countryCode;
1120
- var _c = data || {}, name = _c.name, contact = _c.contact, brand = _c.brand, identification = _c.identification;
1049
+ var _c = data || {}, name = _c.name, contact = _c.contact, brand = _c.brand, identification = _c.identification, date_of_birth = _c.date_of_birth;
1121
1050
  var _d = contact || {}, email = _d.email, phone = _d.phone;
1122
1051
  var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
1123
1052
  if (!!fullName) {
@@ -1138,6 +1067,8 @@ export var connectSlice = createSlice({
1138
1067
  state.data.brandData.brandName = brand.name.en;
1139
1068
  if (identification === null || identification === void 0 ? void 0 : identification.id)
1140
1069
  state.data.nidData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
1070
+ if (date_of_birth)
1071
+ state.data.nidData.dob = date_of_birth;
1141
1072
  })
1142
1073
  .addCase(retrieveLead.pending, function (state) {
1143
1074
  state.customLoading = true;
@@ -109,14 +109,9 @@ export declare const resendMobileAuthOTP: import("@reduxjs/toolkit").AsyncThunk<
109
109
  fulfilledMeta?: unknown;
110
110
  rejectedMeta?: unknown;
111
111
  }>;
112
- export declare const createNafathAuth: import("@reduxjs/toolkit").AsyncThunk<{
112
+ export declare const createNIDAuthAsync: import("@reduxjs/toolkit").AsyncThunk<{
113
113
  response: any;
114
- formData: {
115
- type: string;
116
- nid: string;
117
- dob?: any;
118
- termAndConditionChecked?: boolean | undefined;
119
- };
114
+ formData: NIDFormValues;
120
115
  }, NIDFormValues, {
121
116
  state?: unknown;
122
117
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
@@ -127,7 +122,10 @@ export declare const createNafathAuth: import("@reduxjs/toolkit").AsyncThunk<{
127
122
  fulfilledMeta?: unknown;
128
123
  rejectedMeta?: unknown;
129
124
  }>;
130
- export declare const verifyNafathAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {
125
+ export declare const resendNIDAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
126
+ response: any;
127
+ formData: NIDFormValues;
128
+ }, NIDFormValues, {
131
129
  state?: unknown;
132
130
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
133
131
  extra?: unknown;
@@ -160,6 +158,16 @@ export declare const verifyMobileOtpAsync: import("@reduxjs/toolkit").AsyncThunk
160
158
  fulfilledMeta?: unknown;
161
159
  rejectedMeta?: unknown;
162
160
  }>;
161
+ export declare const verifyNIDOtpAsync: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {
162
+ state?: unknown;
163
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
164
+ extra?: unknown;
165
+ rejectValue?: unknown;
166
+ serializedErrorType?: unknown;
167
+ pendingMeta?: unknown;
168
+ fulfilledMeta?: unknown;
169
+ rejectedMeta?: unknown;
170
+ }>;
163
171
  export declare const verifyPACIAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {
164
172
  state?: unknown;
165
173
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
@@ -183,7 +191,22 @@ export declare const createCivilIDAuthIdentityAsync: import("@reduxjs/toolkit").
183
191
  fulfilledMeta?: unknown;
184
192
  rejectedMeta?: unknown;
185
193
  }>;
186
- export declare const createNIDNafathAuthIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<{
194
+ export declare const createNIDAuthIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<{
195
+ response: {
196
+ verify_token: any;
197
+ };
198
+ formData: NIDFormValues;
199
+ }, NIDFormValues, {
200
+ state?: unknown;
201
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
202
+ extra?: unknown;
203
+ rejectValue?: unknown;
204
+ serializedErrorType?: unknown;
205
+ pendingMeta?: unknown;
206
+ fulfilledMeta?: unknown;
207
+ rejectedMeta?: unknown;
208
+ }>;
209
+ export declare const resendNIDAuthIdentityOTP: import("@reduxjs/toolkit").AsyncThunk<{
187
210
  response: {
188
211
  verify_token: any;
189
212
  };
@@ -198,7 +221,7 @@ export declare const createNIDNafathAuthIdentityAsync: import("@reduxjs/toolkit"
198
221
  fulfilledMeta?: unknown;
199
222
  rejectedMeta?: unknown;
200
223
  }>;
201
- export declare const verifyNafathIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {
224
+ export declare const verifyNIDOtpLeadIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {
202
225
  state?: unknown;
203
226
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
204
227
  extra?: unknown;