@tap-payments/auth-jsconnect 2.11.31-development → 2.12.0-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 (109) hide show
  1. package/build/api/lead.d.ts +2 -2
  2. package/build/assets/locales/ar.json +3 -3
  3. package/build/constants/app.js +60 -3
  4. package/build/constants/flows.d.ts +1 -0
  5. package/build/constants/flows.js +2 -1
  6. package/build/features/app/bank/bankStore.d.ts +7 -0
  7. package/build/features/app/bank/bankStore.js +84 -0
  8. package/build/features/app/board/boardStore.d.ts +5 -0
  9. package/build/features/app/board/boardStore.js +81 -0
  10. package/build/features/app/brand/brandStore.d.ts +7 -0
  11. package/build/features/app/brand/brandStore.js +83 -1
  12. package/build/features/app/business/businessStore.d.ts +10 -0
  13. package/build/features/app/business/businessStore.js +83 -1
  14. package/build/features/app/entity/entityStore.d.ts +7 -0
  15. package/build/features/app/entity/entityStore.js +85 -1
  16. package/build/features/app/individual/individualStore.d.ts +9 -0
  17. package/build/features/app/individual/individualStore.js +85 -1
  18. package/build/features/app/password/passwordStore.d.ts +9 -0
  19. package/build/features/app/password/passwordStore.js +82 -0
  20. package/build/features/app/tax/taxStore.d.ts +7 -0
  21. package/build/features/app/tax/taxStore.js +81 -0
  22. package/build/features/app/terminal/terminalStore.d.ts +9 -0
  23. package/build/features/app/terminal/terminalStore.js +76 -0
  24. package/build/features/auth/screens/OTPSessionExpired/OTPSessionExpired.js +2 -2
  25. package/build/features/bank/Bank.js +3 -2
  26. package/build/features/bank/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  27. package/build/features/bank/screens/OTPSessionExpired/OTPInput.js +51 -0
  28. package/build/features/bank/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  29. package/build/features/bank/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
  30. package/build/features/bank/screens/OTPSessionExpired/index.d.ts +2 -0
  31. package/build/features/bank/screens/OTPSessionExpired/index.js +2 -0
  32. package/build/features/bank/screens/OTPSessionExpired/validation.d.ts +8 -0
  33. package/build/features/bank/screens/OTPSessionExpired/validation.js +4 -0
  34. package/build/features/board/Board.js +5 -4
  35. package/build/features/board/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  36. package/build/features/board/screens/OTPSessionExpired/OTPInput.js +51 -0
  37. package/build/features/board/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  38. package/build/features/board/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
  39. package/build/features/board/screens/OTPSessionExpired/index.d.ts +2 -0
  40. package/build/features/board/screens/OTPSessionExpired/index.js +2 -0
  41. package/build/features/board/screens/OTPSessionExpired/validation.d.ts +8 -0
  42. package/build/features/board/screens/OTPSessionExpired/validation.js +4 -0
  43. package/build/features/brand/Brand.js +3 -2
  44. package/build/features/brand/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  45. package/build/features/brand/screens/OTPSessionExpired/OTPInput.js +51 -0
  46. package/build/features/brand/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  47. package/build/features/brand/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
  48. package/build/features/brand/screens/OTPSessionExpired/index.d.ts +2 -0
  49. package/build/features/brand/screens/OTPSessionExpired/index.js +2 -0
  50. package/build/features/brand/screens/OTPSessionExpired/validation.d.ts +8 -0
  51. package/build/features/brand/screens/OTPSessionExpired/validation.js +4 -0
  52. package/build/features/business/Business.js +3 -2
  53. package/build/features/business/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  54. package/build/features/business/screens/OTPSessionExpired/OTPInput.js +51 -0
  55. package/build/features/business/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  56. package/build/features/business/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
  57. package/build/features/business/screens/OTPSessionExpired/index.d.ts +2 -0
  58. package/build/features/business/screens/OTPSessionExpired/index.js +2 -0
  59. package/build/features/business/screens/OTPSessionExpired/validation.d.ts +8 -0
  60. package/build/features/business/screens/OTPSessionExpired/validation.js +4 -0
  61. package/build/features/connect/screens/OTPSessionExpired/OTPSessionExpired.js +2 -2
  62. package/build/features/connectExpress/screens/OTPSessionExpired/OTPSessionExpired.js +2 -2
  63. package/build/features/entity/Entity.js +3 -2
  64. package/build/features/entity/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  65. package/build/features/entity/screens/OTPSessionExpired/OTPInput.js +51 -0
  66. package/build/features/entity/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  67. package/build/features/entity/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
  68. package/build/features/entity/screens/OTPSessionExpired/index.d.ts +2 -0
  69. package/build/features/entity/screens/OTPSessionExpired/index.js +2 -0
  70. package/build/features/entity/screens/OTPSessionExpired/validation.d.ts +8 -0
  71. package/build/features/entity/screens/OTPSessionExpired/validation.js +4 -0
  72. package/build/features/featuresScreens.js +45 -0
  73. package/build/features/individual/Individual.js +3 -2
  74. package/build/features/individual/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  75. package/build/features/individual/screens/OTPSessionExpired/OTPInput.js +51 -0
  76. package/build/features/individual/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  77. package/build/features/individual/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
  78. package/build/features/individual/screens/OTPSessionExpired/index.d.ts +2 -0
  79. package/build/features/individual/screens/OTPSessionExpired/index.js +2 -0
  80. package/build/features/individual/screens/OTPSessionExpired/validation.d.ts +8 -0
  81. package/build/features/individual/screens/OTPSessionExpired/validation.js +4 -0
  82. package/build/features/password/Password.js +3 -2
  83. package/build/features/password/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  84. package/build/features/password/screens/OTPSessionExpired/OTPInput.js +51 -0
  85. package/build/features/password/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  86. package/build/features/password/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
  87. package/build/features/password/screens/OTPSessionExpired/index.d.ts +2 -0
  88. package/build/features/password/screens/OTPSessionExpired/index.js +2 -0
  89. package/build/features/password/screens/OTPSessionExpired/validation.d.ts +8 -0
  90. package/build/features/password/screens/OTPSessionExpired/validation.js +4 -0
  91. package/build/features/tax/Tax.js +3 -2
  92. package/build/features/tax/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  93. package/build/features/tax/screens/OTPSessionExpired/OTPInput.js +51 -0
  94. package/build/features/tax/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  95. package/build/features/tax/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
  96. package/build/features/tax/screens/OTPSessionExpired/index.d.ts +2 -0
  97. package/build/features/tax/screens/OTPSessionExpired/index.js +2 -0
  98. package/build/features/tax/screens/OTPSessionExpired/validation.d.ts +8 -0
  99. package/build/features/tax/screens/OTPSessionExpired/validation.js +4 -0
  100. package/build/features/terminal/Terminal.js +3 -2
  101. package/build/features/terminal/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
  102. package/build/features/terminal/screens/OTPSessionExpired/OTPInput.js +51 -0
  103. package/build/features/terminal/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
  104. package/build/features/terminal/screens/OTPSessionExpired/OTPSessionExpired.js +89 -0
  105. package/build/features/terminal/screens/OTPSessionExpired/index.d.ts +2 -0
  106. package/build/features/terminal/screens/OTPSessionExpired/index.js +2 -0
  107. package/build/features/terminal/screens/OTPSessionExpired/validation.d.ts +8 -0
  108. package/build/features/terminal/screens/OTPSessionExpired/validation.js +4 -0
  109. package/package.json +1 -1
@@ -80,7 +80,7 @@ export declare type UpdateLeadBody = {
80
80
  date_of_birth?: string;
81
81
  };
82
82
  export declare type LeadVerifyBody = {
83
- verify_token: string;
83
+ verify_token?: string;
84
84
  service_name: string;
85
85
  notification?: {
86
86
  sms: boolean;
@@ -88,7 +88,7 @@ export declare type LeadVerifyBody = {
88
88
  };
89
89
  export declare type CreateVerifyTokenBody = {
90
90
  service_name: string;
91
- board_id: string;
91
+ board_id?: string;
92
92
  notification?: {
93
93
  sms: boolean;
94
94
  };
@@ -681,7 +681,7 @@
681
681
  "yes": "نعم",
682
682
  "your_brand_details": "تفاصيل علامتك التجارية",
683
683
  "يرجى التحقق من اسم تطبيق ابل": "",
684
- "session_expired_otp": "Session expired. Please verify your phone number to continue.",
685
- "code_sent_to": "Code sent to ",
686
- "session_invalid": "Session Invalid"
684
+ "session_expired_otp": "انتهت صلاحية العملية. يرجى إدخال رمز التحقق المرسل للمتابعة.",
685
+ "code_sent_to": "تم إرسال الرمز إلى ",
686
+ "session_invalid": "رمز التحقق غير صالح"
687
687
  }
@@ -593,13 +593,15 @@ export var BUSINESS_SCREENS_NAVIGATION = [
593
593
  name: 'BUSINESS_VERIFY_PACI_STEP',
594
594
  next: 'BUSINESS_BUSINESS_TYPE_STEP',
595
595
  prev: 'BUSINESS_CIVIL_ID_STEP',
596
- order: 3
596
+ order: 3,
597
+ back: 'BUSINESS_CIVIL_ID_STEP'
597
598
  },
598
599
  {
599
600
  name: 'BUSINESS_VERIFY_NAFATH_STEP',
600
601
  next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_DOB_STEP', 'BUSINESS_MOBILE_OWNERSHIP'],
601
602
  prev: 'BUSINESS_IDBOD_STEP',
602
- order: 3
603
+ order: 3,
604
+ back: 'BUSINESS_IDBOD_STEP'
603
605
  },
604
606
  {
605
607
  name: 'BUSINESS_DOB_STEP',
@@ -666,6 +668,12 @@ export var BUSINESS_SCREENS_NAVIGATION = [
666
668
  next: '',
667
669
  prev: '',
668
670
  order: 9
671
+ },
672
+ {
673
+ name: 'BUSINESS_SESSION_EXPIRED_OTP_STEP',
674
+ next: '',
675
+ prev: '',
676
+ order: 10
669
677
  }
670
678
  ];
671
679
  export var INDIVIDUAL_SCREENS_NAVIGATION = [
@@ -739,6 +747,12 @@ export var INDIVIDUAL_SCREENS_NAVIGATION = [
739
747
  next: '',
740
748
  prev: '',
741
749
  order: 7
750
+ },
751
+ {
752
+ name: 'INDIVIDUAL_SESSION_EXPIRED_OTP_STEP',
753
+ next: '',
754
+ prev: '',
755
+ order: 8
742
756
  }
743
757
  ];
744
758
  export var PASSWORD_SCREENS_NAVIGATION = [
@@ -770,7 +784,8 @@ export var PASSWORD_SCREENS_NAVIGATION = [
770
784
  name: 'PASSWORD_RESET_PASSWORD_OTP_STEP',
771
785
  next: ['PASSWORD_SUCCESS_STEP', 'PASSWORD_OTP_VERIFY_SECURITY_ERROR_STEP'],
772
786
  prev: 'PASSWORD_CREATE_PASSWORD_STEP',
773
- order: 3
787
+ order: 3,
788
+ back: 'PASSWORD_CREATE_PASSWORD_STEP'
774
789
  },
775
790
  {
776
791
  name: 'PASSWORD_SUCCESS_STEP',
@@ -795,6 +810,12 @@ export var PASSWORD_SCREENS_NAVIGATION = [
795
810
  next: '',
796
811
  prev: '',
797
812
  order: 7
813
+ },
814
+ {
815
+ name: 'PASSWORD_SESSION_EXPIRED_OTP_STEP',
816
+ next: '',
817
+ prev: '',
818
+ order: 8
798
819
  }
799
820
  ];
800
821
  export var BANK_SCREENS_NAVIGATION = [
@@ -845,6 +866,12 @@ export var BANK_SCREENS_NAVIGATION = [
845
866
  next: '',
846
867
  prev: '',
847
868
  order: 6
869
+ },
870
+ {
871
+ name: 'BANK_SESSION_EXPIRED_OTP_STEP',
872
+ next: '',
873
+ prev: '',
874
+ order: 7
848
875
  }
849
876
  ];
850
877
  export var BOARD_SCREENS_NAVIGATION = [
@@ -883,6 +910,12 @@ export var BOARD_SCREENS_NAVIGATION = [
883
910
  next: '',
884
911
  prev: '',
885
912
  order: 4
913
+ },
914
+ {
915
+ name: 'BOARD_SESSION_EXPIRED_OTP_STEP',
916
+ next: '',
917
+ prev: '',
918
+ order: 5
886
919
  }
887
920
  ];
888
921
  export var TAX_SCREENS_NAVIGATION = [
@@ -933,6 +966,12 @@ export var TAX_SCREENS_NAVIGATION = [
933
966
  next: '',
934
967
  prev: '',
935
968
  order: 6
969
+ },
970
+ {
971
+ name: 'TAX_SESSION_EXPIRED_OTP_STEP',
972
+ next: '',
973
+ prev: '',
974
+ order: 7
936
975
  }
937
976
  ];
938
977
  export var SigIn_SCREENS_NAVIGATION = [
@@ -1021,6 +1060,12 @@ export var ENTITY_SCREENS_NAVIGATION = [
1021
1060
  next: '',
1022
1061
  prev: '',
1023
1062
  order: 6
1063
+ },
1064
+ {
1065
+ name: 'ENTITY_SESSION_EXPIRED_OTP_STEP',
1066
+ next: '',
1067
+ prev: '',
1068
+ order: 7
1024
1069
  }
1025
1070
  ];
1026
1071
  export var BRAND_SCREENS_NAVIGATION = [
@@ -1083,6 +1128,12 @@ export var BRAND_SCREENS_NAVIGATION = [
1083
1128
  next: '',
1084
1129
  prev: '',
1085
1130
  order: 7
1131
+ },
1132
+ {
1133
+ name: 'BRAND_SESSION_EXPIRED_OTP_STEP',
1134
+ next: '',
1135
+ prev: '',
1136
+ order: 8
1086
1137
  }
1087
1138
  ];
1088
1139
  export var TERMINAL_SCREENS_NAVIGATION = [
@@ -1169,6 +1220,12 @@ export var TERMINAL_SCREENS_NAVIGATION = [
1169
1220
  next: '',
1170
1221
  prev: '',
1171
1222
  order: 7
1223
+ },
1224
+ {
1225
+ name: CONNECT_FLOWS.terminal.otpSessionExpired,
1226
+ next: '',
1227
+ prev: '',
1228
+ order: 8
1172
1229
  }
1173
1230
  ];
1174
1231
  export var DefaultDeviceInfo = {
@@ -26,5 +26,6 @@ export declare const CONNECT_FLOWS: {
26
26
  resetPassword: string;
27
27
  posDeviceList: string;
28
28
  otpVerifySecurityError: string;
29
+ otpSessionExpired: string;
29
30
  };
30
31
  };
@@ -25,6 +25,7 @@ export var CONNECT_FLOWS = {
25
25
  board: 'TERMINAL_BOARD_STEP',
26
26
  resetPassword: 'TERMINAL_RESET_PASSWORD',
27
27
  posDeviceList: 'TERMINAL_POS_DEVICE_LIST_STEP',
28
- otpVerifySecurityError: 'TERMINAL_OTP_VERIFY_SECURITY_ERROR_STEP'
28
+ otpVerifySecurityError: 'TERMINAL_OTP_VERIFY_SECURITY_ERROR_STEP',
29
+ otpSessionExpired: 'TERMINAL_SESSION_EXPIRED_OTP_STEP'
29
30
  }
30
31
  };
@@ -18,6 +18,13 @@ export declare const verifyBankLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
18
18
  bankData: any;
19
19
  formData: OTPFormValues;
20
20
  }, OTPFormValues, {}>;
21
+ export declare const verifyTokenSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
22
+ data: any;
23
+ }, boolean, {}>;
24
+ export declare const verifyBankLeadOTPSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
25
+ data: any;
26
+ formData: OTPFormValues;
27
+ }, OTPFormValues, {}>;
21
28
  export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<{
22
29
  flows: any;
23
30
  }, void, {}>;
@@ -193,6 +193,58 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
193
193
  }
194
194
  });
195
195
  }); });
196
+ export var verifyTokenSessionExpired = createAsyncThunk('bank/verifyTokenSessionExpired', function (redirect, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
197
+ var bank, payload, data;
198
+ return __generator(this, function (_a) {
199
+ switch (_a.label) {
200
+ case 0:
201
+ bank = thunkApi.getState().bank;
202
+ payload = {
203
+ service_name: 'tap_email',
204
+ verify_token: bank.data.verify.token
205
+ };
206
+ return [4, API.leadService.verifyToken(payload)];
207
+ case 1:
208
+ data = _a.sent();
209
+ setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
210
+ if (redirect)
211
+ thunkApi.dispatch(handleCurrentActiveScreen('BANK_SESSION_EXPIRED_OTP_STEP'));
212
+ return [2, { data: data }];
213
+ }
214
+ });
215
+ }); });
216
+ export var verifyBankLeadOTPSessionExpired = createAsyncThunk('bank/verifyBankLeadOTPSessionExpired', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
217
+ var _a, bank, settings, session, responseBody, payload, data;
218
+ var _b, _c, _d;
219
+ return __generator(this, function (_e) {
220
+ switch (_e.label) {
221
+ case 0:
222
+ _a = thunkApi.getState(), bank = _a.bank, settings = _a.settings, session = _a.session;
223
+ responseBody = bank.data.verify.responseBody;
224
+ payload = {
225
+ data: params.otp,
226
+ service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
227
+ verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
228
+ step_name: BANK_STEP_NAMES.PHONE_AUTH,
229
+ encryption_contract: ['data']
230
+ };
231
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
232
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
233
+ thunkApi.dispatch(handleCurrentActiveScreen('BANK_OTP_VERIFY_SECURITY_ERROR_STEP'));
234
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
235
+ })];
236
+ case 1:
237
+ data = _e.sent();
238
+ setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
239
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
240
+ thunkApi.dispatch(handleCurrentActiveScreen(session.data.nextScreen));
241
+ return [2, {
242
+ data: data,
243
+ formData: params
244
+ }];
245
+ }
246
+ });
247
+ }); });
196
248
  export var retrieveBoardStatus = createAsyncThunk('bank/retrieveBoardStatus', function (parmas, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
197
249
  var bank, _a, board_id, board_info_id, recipient, _b, id, type, data;
198
250
  return __generator(this, function (_c) {
@@ -478,6 +530,38 @@ export var bankSlice = createSlice({
478
530
  state.loading = false;
479
531
  if (!isAuthenticationVerificationFailed(message))
480
532
  state.error = message;
533
+ })
534
+ .addCase(verifyTokenSessionExpired.pending, function (state) {
535
+ state.error = null;
536
+ state.loading = true;
537
+ })
538
+ .addCase(verifyTokenSessionExpired.fulfilled, function (state, action) {
539
+ state.error = null;
540
+ state.loading = false;
541
+ var data = (action.payload || {}).data;
542
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
543
+ })
544
+ .addCase(verifyTokenSessionExpired.rejected, function (state, action) {
545
+ state.error = action.error.message;
546
+ state.loading = false;
547
+ })
548
+ .addCase(verifyBankLeadOTPSessionExpired.pending, function (state) {
549
+ state.loading = true;
550
+ state.error = null;
551
+ })
552
+ .addCase(verifyBankLeadOTPSessionExpired.fulfilled, function (state, action) {
553
+ state.loading = false;
554
+ state.error = null;
555
+ var _a = action.payload, data = _a.data, formData = _a.formData;
556
+ state.data.otpData = formData;
557
+ state.data.otpData.responseBody = data;
558
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
559
+ })
560
+ .addCase(verifyBankLeadOTPSessionExpired.rejected, function (state, _a) {
561
+ var message = _a.error.message;
562
+ state.loading = false;
563
+ if (!isAuthenticationVerificationFailed(message))
564
+ state.error = message;
481
565
  })
482
566
  .addCase(retrieveBoardDetails.pending, function (state) {
483
567
  state.error = null;
@@ -12,6 +12,11 @@ export declare const verifyBoardLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
12
12
  data: any;
13
13
  formData: OTPFormValues;
14
14
  }, OTPFormValues, {}>;
15
+ export declare const createVerifyTokenSessionExpired: import("@reduxjs/toolkit").AsyncThunk<any, boolean, {}>;
16
+ export declare const verifyOTPSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
17
+ data: any;
18
+ formData: OTPFormValues;
19
+ }, OTPFormValues, {}>;
15
20
  export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
16
21
  data: any;
17
22
  }, {
@@ -156,6 +156,57 @@ export var verifyBoardLeadOTP = createAsyncThunk('board/verifyBoardLeadOTP', fun
156
156
  }
157
157
  });
158
158
  }); });
159
+ export var createVerifyTokenSessionExpired = createAsyncThunk('board/createVerifyTokenAuthExpired', function (redirect, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
160
+ var settings, payload, data;
161
+ var _a, _b;
162
+ return __generator(this, function (_c) {
163
+ switch (_c.label) {
164
+ case 0:
165
+ settings = thunkApi.getState().settings;
166
+ payload = {
167
+ service_name: 'tap_email'
168
+ };
169
+ return [4, API.leadService.createVerifyTokenByBoardId(payload)];
170
+ case 1:
171
+ data = _c.sent();
172
+ setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
173
+ (_b = (_a = settings.data.appConfig).onFlowCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, { boardId: data.id, boardInfoId: data.board_info_id });
174
+ if (redirect)
175
+ thunkApi.dispatch(handleCurrentActiveScreen('BOARD_SESSION_EXPIRED_OTP_STEP'));
176
+ return [2, __assign({}, data)];
177
+ }
178
+ });
179
+ }); });
180
+ export var verifyOTPSessionExpired = createAsyncThunk('board/verifyOTPSessionExpired', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
181
+ var _a, board, settings, session, responseBody, payload, data;
182
+ var _b, _c, _d, _e, _f;
183
+ return __generator(this, function (_g) {
184
+ switch (_g.label) {
185
+ case 0:
186
+ _a = thunkApi.getState(), board = _a.board, settings = _a.settings, session = _a.session;
187
+ responseBody = board.data.verify.responseBody;
188
+ payload = {
189
+ data: params.otp,
190
+ service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
191
+ verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
192
+ step_name: BOARD_STEP_STEPS.PHONE_AUTH,
193
+ encryption_contract: ['data']
194
+ };
195
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
196
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
197
+ thunkApi.dispatch(handleCurrentActiveScreen('BOARD_OTP_VERIFY_SECURITY_ERROR_STEP'));
198
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
199
+ })];
200
+ case 1:
201
+ data = _g.sent();
202
+ setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
203
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
204
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { boardId: responseBody === null || responseBody === void 0 ? void 0 : responseBody.id, boardInfoId: responseBody === null || responseBody === void 0 ? void 0 : responseBody.board_info_id });
205
+ thunkApi.dispatch(handleCurrentActiveScreen(session.data.nextScreen));
206
+ return [2, { data: data, formData: params }];
207
+ }
208
+ });
209
+ }); });
159
210
  export var retrieveBoardDetails = createAsyncThunk('board/retrieveBoardDetails', function (_a) {
160
211
  var boardId = _a.boardId, boardInfoId = _a.boardInfoId;
161
212
  return __awaiter(void 0, void 0, void 0, function () {
@@ -258,6 +309,36 @@ export var boardSlice = createSlice({
258
309
  state.loading = false;
259
310
  if (!isAuthenticationVerificationFailed(message))
260
311
  state.error = message;
312
+ })
313
+ .addCase(createVerifyTokenSessionExpired.pending, function (state) {
314
+ state.error = null;
315
+ state.loading = true;
316
+ })
317
+ .addCase(createVerifyTokenSessionExpired.fulfilled, function (state, action) {
318
+ state.error = null;
319
+ state.loading = false;
320
+ state.data.verify = __assign(__assign({}, state.data.verify), { responseBody: __assign(__assign({}, state.data.verify.responseBody), action.payload) });
321
+ })
322
+ .addCase(createVerifyTokenSessionExpired.rejected, function (state, action) {
323
+ state.error = action.error.message;
324
+ state.loading = false;
325
+ })
326
+ .addCase(verifyOTPSessionExpired.pending, function (state) {
327
+ state.loading = true;
328
+ state.error = null;
329
+ })
330
+ .addCase(verifyOTPSessionExpired.fulfilled, function (state, action) {
331
+ state.loading = false;
332
+ state.error = null;
333
+ var _a = action.payload, data = _a.data, formData = _a.formData;
334
+ state.data.otpData = formData;
335
+ state.data.otpData.responseBody = data;
336
+ })
337
+ .addCase(verifyOTPSessionExpired.rejected, function (state, _a) {
338
+ var message = _a.error.message;
339
+ state.loading = false;
340
+ if (!isAuthenticationVerificationFailed(message))
341
+ state.error = message;
261
342
  })
262
343
  .addCase(retrieveBoardDetails.pending, function (state) {
263
344
  state.error = null;
@@ -22,6 +22,13 @@ export declare const verifyBrandLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
22
22
  entityInfoId: any;
23
23
  formData: OTPFormValues;
24
24
  }, OTPFormValues, {}>;
25
+ export declare const verifyTokenSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
26
+ data: any;
27
+ }, boolean, {}>;
28
+ export declare const verifyTokenSessionExpiredOTP: import("@reduxjs/toolkit").AsyncThunk<{
29
+ data: any;
30
+ formData: OTPFormValues;
31
+ }, OTPFormValues, {}>;
25
32
  export declare const retrieveSegmentDataList: import("@reduxjs/toolkit").AsyncThunk<{
26
33
  segmentLocation: any;
27
34
  segmentProfit: any;
@@ -60,7 +60,7 @@ var _a;
60
60
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
61
61
  import API, { setAuthSessionToGlobalHeaders } from '../../../api';
62
62
  import { FlowsTypes } from '../../../@types';
63
- import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
63
+ import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
64
64
  import { BRAND_STEP_NAMES, EXPECTED_SALES_LIST } from '../../../constants';
65
65
  import { hasNoneEditableValue, isAuthenticationVerificationFailed, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
66
66
  export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function (_a, thunkApi) {
@@ -202,6 +202,58 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
202
202
  }
203
203
  });
204
204
  }); });
205
+ export var verifyTokenSessionExpired = createAsyncThunk('brand/verifyTokenSessionExpired', function (redirect, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
206
+ var brand, payload, data;
207
+ return __generator(this, function (_a) {
208
+ switch (_a.label) {
209
+ case 0:
210
+ brand = thunkApi.getState().brand;
211
+ payload = {
212
+ service_name: 'tap_email',
213
+ verify_token: brand.data.verify.token
214
+ };
215
+ return [4, API.leadService.verifyToken(payload)];
216
+ case 1:
217
+ data = _a.sent();
218
+ setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
219
+ if (redirect)
220
+ thunkApi.dispatch(handleCurrentActiveScreen('BRAND_SESSION_EXPIRED_OTP_STEP'));
221
+ return [2, { data: data }];
222
+ }
223
+ });
224
+ }); });
225
+ export var verifyTokenSessionExpiredOTP = createAsyncThunk('brand/verifyTokenSessionExpiredOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
226
+ var _a, brand, settings, session, responseBody, payload, data;
227
+ var _b, _c, _d;
228
+ return __generator(this, function (_e) {
229
+ switch (_e.label) {
230
+ case 0:
231
+ _a = thunkApi.getState(), brand = _a.brand, settings = _a.settings, session = _a.session;
232
+ responseBody = brand.data.verify.responseBody;
233
+ payload = {
234
+ data: params.otp,
235
+ service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
236
+ verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
237
+ step_name: BRAND_STEP_NAMES.PHONE_AUTH,
238
+ encryption_contract: ['data']
239
+ };
240
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
241
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
242
+ thunkApi.dispatch(handleCurrentActiveScreen('BRAND_OTP_VERIFY_SECURITY_ERROR_STEP'));
243
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
244
+ })];
245
+ case 1:
246
+ data = _e.sent();
247
+ setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
248
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
249
+ thunkApi.dispatch(handleCurrentActiveScreen(session.data.nextScreen));
250
+ return [2, {
251
+ data: data,
252
+ formData: params
253
+ }];
254
+ }
255
+ });
256
+ }); });
205
257
  export var retrieveSegmentDataList = createAsyncThunk('brandRetrieveSegmentDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
206
258
  var dataBody, _a, team, location, profit, tech;
207
259
  return __generator(this, function (_b) {
@@ -691,6 +743,36 @@ export var brandSlice = createSlice({
691
743
  state.loading = false;
692
744
  if (!isAuthenticationVerificationFailed(message))
693
745
  state.error = message;
746
+ })
747
+ .addCase(verifyTokenSessionExpired.pending, function (state) {
748
+ state.error = null;
749
+ state.loading = true;
750
+ })
751
+ .addCase(verifyTokenSessionExpired.fulfilled, function (state, action) {
752
+ state.error = null;
753
+ state.loading = false;
754
+ var data = action.payload.data;
755
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
756
+ })
757
+ .addCase(verifyTokenSessionExpired.rejected, function (state, action) {
758
+ state.error = action.error.message;
759
+ state.customLoading = false;
760
+ })
761
+ .addCase(verifyTokenSessionExpiredOTP.pending, function (state) {
762
+ state.loading = true;
763
+ state.error = null;
764
+ })
765
+ .addCase(verifyTokenSessionExpiredOTP.fulfilled, function (state, action) {
766
+ state.loading = false;
767
+ state.error = null;
768
+ var data = action.payload.data;
769
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
770
+ })
771
+ .addCase(verifyTokenSessionExpiredOTP.rejected, function (state, _a) {
772
+ var message = _a.error.message;
773
+ state.loading = false;
774
+ if (!isAuthenticationVerificationFailed(message))
775
+ state.error = message;
694
776
  })
695
777
  .addCase(checkBrandNameAvailability.fulfilled, function (state, action) {
696
778
  var _a;
@@ -34,6 +34,16 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
34
34
  brand: any;
35
35
  leadData: any;
36
36
  }, OTPFormValues, {}>;
37
+ export declare const verifyLeadTokenSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
38
+ data: any;
39
+ }, boolean, {}>;
40
+ export declare const verifyLeadOTPSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
41
+ data: any;
42
+ formData: {
43
+ isNID: boolean;
44
+ otp: string;
45
+ };
46
+ }, OTPFormValues, {}>;
37
47
  interface verifyNafathParams {
38
48
  onSuccess?: () => void;
39
49
  onFailure?: () => void;
@@ -60,7 +60,7 @@ import API, { setAuthSessionToGlobalHeaders } from '../../../api';
60
60
  import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
61
61
  import { BUSINESS_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE, defaultCountry } from '../../../constants';
62
62
  import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM, findCountryByIddPrefix, isNetworkError, isTimeoutError, isAuthenticationVerificationFailed } from '../../../utils';
63
- import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
63
+ import { handleCurrentActiveScreen, handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
65
  var payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
66
66
  var _b, _c;
@@ -319,6 +319,56 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
319
319
  }
320
320
  });
321
321
  }); });
322
+ export var verifyLeadTokenSessionExpired = createAsyncThunk('business/verifyLeadTokenSessionExpired', function (redirect, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
323
+ var business, payload, data;
324
+ return __generator(this, function (_a) {
325
+ switch (_a.label) {
326
+ case 0:
327
+ business = thunkApi.getState().business;
328
+ payload = {
329
+ service_name: 'tap_email',
330
+ verify_token: business.data.verify.token
331
+ };
332
+ return [4, API.leadService.verifyToken(payload)];
333
+ case 1:
334
+ data = _a.sent();
335
+ setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
336
+ if (redirect)
337
+ thunkApi.dispatch(handleCurrentActiveScreen('BUSINESS_SESSION_EXPIRED_OTP_STEP'));
338
+ return [2, { data: data }];
339
+ }
340
+ });
341
+ }); });
342
+ export var verifyLeadOTPSessionExpired = createAsyncThunk('business/verifyLeadOTPSessionExpired', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
343
+ var _a, business, settings, session, isNID, responseBody, payload, data;
344
+ var _b, _c, _d, _e, _f, _g;
345
+ return __generator(this, function (_h) {
346
+ switch (_h.label) {
347
+ case 0:
348
+ _a = thunkApi.getState(), business = _a.business, settings = _a.settings, session = _a.session;
349
+ isNID = business.data.otpData.isNID;
350
+ responseBody = (isNID ? business.data.nidData : business.data.verify).responseBody;
351
+ payload = {
352
+ data: params.otp,
353
+ service_name: ((_c = (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.service_name) || ((_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name),
354
+ verify_token: ((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _e === void 0 ? void 0 : _e.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
355
+ step_name: BUSINESS_STEP_NAMES.PHONE_AUTH,
356
+ encryption_contract: ['data']
357
+ };
358
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
359
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
360
+ thunkApi.dispatch(handleCurrentActiveScreen('BUSINESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
361
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
362
+ })];
363
+ case 1:
364
+ data = _h.sent();
365
+ setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
366
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, { otp: params.otp });
367
+ thunkApi.dispatch(handleCurrentActiveScreen(session.data.nextScreen));
368
+ return [2, { data: data, formData: __assign(__assign({}, params), { isNID: false }) }];
369
+ }
370
+ });
371
+ }); });
322
372
  export var verifyNafath = createAsyncThunk('business/verifyNafathParams', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
323
373
  var _a, settings, business, responseBody, expiry, interval, maxCalls, count, data, error_1, isSuccess, isFailed, isNextScreenDob, isNextScreenCollectMobileOwnership, screen_1;
324
374
  var _b, _c, _d, _e, _f, _g;
@@ -1144,6 +1194,38 @@ export var businessSlice = createSlice({
1144
1194
  state.loading = false;
1145
1195
  if (!isAuthenticationVerificationFailed(message))
1146
1196
  state.error = message;
1197
+ })
1198
+ .addCase(verifyLeadTokenSessionExpired.pending, function (state) {
1199
+ state.error = null;
1200
+ state.loading = true;
1201
+ })
1202
+ .addCase(verifyLeadTokenSessionExpired.fulfilled, function (state, action) {
1203
+ state.error = null;
1204
+ state.loading = false;
1205
+ var data = action.payload.data;
1206
+ var responseBody = state.data.verify.responseBody;
1207
+ state.data.verify.responseBody = __assign(__assign({}, responseBody), data);
1208
+ })
1209
+ .addCase(verifyLeadTokenSessionExpired.rejected, function (state, action) {
1210
+ state.error = action.error.message;
1211
+ state.loading = false;
1212
+ })
1213
+ .addCase(verifyLeadOTPSessionExpired.pending, function (state) {
1214
+ state.loading = true;
1215
+ state.error = null;
1216
+ })
1217
+ .addCase(verifyLeadOTPSessionExpired.fulfilled, function (state, action) {
1218
+ state.loading = false;
1219
+ state.error = null;
1220
+ var _a = action.payload, data = _a.data, formData = _a.formData;
1221
+ state.data.otpData = formData;
1222
+ state.data.otpData.responseBody = data;
1223
+ })
1224
+ .addCase(verifyLeadOTPSessionExpired.rejected, function (state, _a) {
1225
+ var message = _a.error.message;
1226
+ state.loading = false;
1227
+ if (!isAuthenticationVerificationFailed(message))
1228
+ state.error = message;
1147
1229
  })
1148
1230
  .addCase(createCivilIdAuth.pending, function (state) {
1149
1231
  state.loading = true;
@@ -19,6 +19,13 @@ export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<
19
19
  entityTypes: any;
20
20
  formData: OTPFormValues;
21
21
  }, OTPFormValues, {}>;
22
+ export declare const verifyLeadTokenSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
23
+ data: any;
24
+ }, boolean, {}>;
25
+ export declare const verifyEntityLeadOTPSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
26
+ data: any;
27
+ formData: OTPFormValues;
28
+ }, OTPFormValues, {}>;
22
29
  export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<{
23
30
  flows: any;
24
31
  }, void, {}>;