@tap-payments/auth-jsconnect 1.0.91-test → 1.0.95-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +58 -52
  2. package/build/@types/app.d.ts +11 -2
  3. package/build/@types/app.js +9 -0
  4. package/build/@types/form.d.ts +2 -0
  5. package/build/api/auth.d.ts +22 -3
  6. package/build/api/axios.d.ts +2 -0
  7. package/build/api/axios.js +64 -0
  8. package/build/api/country.d.ts +1 -2
  9. package/build/api/country.js +7 -8
  10. package/build/api/firebase.d.ts +1 -1
  11. package/build/api/firebase.js +5 -2
  12. package/build/api/index.d.ts +7 -8
  13. package/build/api/ip.d.ts +1 -1
  14. package/build/api/ip.js +5 -2
  15. package/build/api/lead.d.ts +2 -0
  16. package/build/api/operator.d.ts +1 -1
  17. package/build/api/operator.js +60 -4
  18. package/build/app/rootReducer.d.ts +0 -1
  19. package/build/app/rootReducer.js +1 -3
  20. package/build/app/settings.d.ts +9 -12
  21. package/build/app/settings.js +87 -111
  22. package/build/app/store.d.ts +0 -2
  23. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  24. package/build/components/AnimationFlow/AnimationFlow.js +2 -2
  25. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  26. package/build/components/AnimationFlow/BottomSheet.js +16 -4
  27. package/build/components/AnimationFlow/Loader.js +1 -1
  28. package/build/constants/app.d.ts +6 -1
  29. package/build/constants/app.js +16 -12
  30. package/build/features/app/bank/bankStore.d.ts +5 -1
  31. package/build/features/app/bank/bankStore.js +41 -4
  32. package/build/features/app/business/businessStore.d.ts +5 -7
  33. package/build/features/app/business/businessStore.js +44 -46
  34. package/build/features/app/connect/connectStore.d.ts +2 -7
  35. package/build/features/app/connect/connectStore.js +23 -55
  36. package/build/features/app/individual/individualStore.d.ts +6 -7
  37. package/build/features/app/individual/individualStore.js +55 -50
  38. package/build/features/app/password/passwordStore.d.ts +34 -2
  39. package/build/features/app/password/passwordStore.js +218 -8
  40. package/build/features/app/tax/taxStore.d.ts +5 -1
  41. package/build/features/app/tax/taxStore.js +43 -6
  42. package/build/features/bank/Bank.js +8 -7
  43. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  44. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  45. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  46. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  47. package/build/features/bank/screens/BankDetails/validation.js +2 -1
  48. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  49. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  50. package/build/features/bank/screens/Verify/OTPInput.js +6 -1
  51. package/build/features/bank/screens/Verify/Verify.js +3 -2
  52. package/build/features/business/Business.js +9 -11
  53. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -5
  54. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  55. package/build/features/business/screens/Verify/OTPInput.js +6 -1
  56. package/build/features/business/screens/Verify/Verify.js +3 -2
  57. package/build/features/connect/Connect.js +7 -9
  58. package/build/features/connect/screens/Merchant/BrandName.js +3 -2
  59. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  60. package/build/features/featuresScreens.d.ts +0 -1
  61. package/build/features/featuresScreens.js +5 -7
  62. package/build/features/individual/Individual.js +9 -11
  63. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -2
  64. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  65. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  66. package/build/features/individual/screens/Verify/OTPInput.js +6 -1
  67. package/build/features/individual/screens/Verify/Verify.js +3 -2
  68. package/build/features/password/Password.js +16 -9
  69. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  70. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  71. package/build/features/password/screens/OTP/OTP.js +78 -0
  72. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  73. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  74. package/build/features/password/screens/OTP/index.d.ts +3 -0
  75. package/build/features/password/screens/OTP/index.js +2 -0
  76. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  77. package/build/features/password/screens/OTP/validation.js +4 -0
  78. package/build/features/password/screens/Success/Success.js +8 -2
  79. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -5
  80. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  81. package/build/features/password/screens/Verify/OTPInput.js +6 -1
  82. package/build/features/password/screens/Verify/Verify.js +3 -2
  83. package/build/features/shared/Background/Background.js +3 -2
  84. package/build/features/shared/Background/LogoBackground.d.ts +1 -4
  85. package/build/features/shared/Background/LogoBackground.js +4 -32
  86. package/build/features/shared/Button/AbsherButton.js +3 -8
  87. package/build/features/shared/Button/EmailProvidersButtons.js +2 -1
  88. package/build/features/shared/Button/FlowsButtons.d.ts +10 -1
  89. package/build/features/shared/Button/FlowsButtons.js +100 -7
  90. package/build/features/shared/Button/MobileButton.js +3 -8
  91. package/build/features/shared/Button/SuccessButton.js +17 -13
  92. package/build/features/shared/Footer/Footer.js +2 -3
  93. package/build/features/shared/OTP/OTP.d.ts +2 -1
  94. package/build/features/shared/OTP/OTP.js +10 -2
  95. package/build/features/tax/Tax.js +7 -6
  96. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  97. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  98. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  99. package/build/features/tax/screens/TaxDetails/TaxDetails.js +5 -2
  100. package/build/features/tax/screens/TaxDetails/VATId.js +13 -2
  101. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  102. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  103. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  104. package/build/features/tax/screens/Verify/OTPInput.js +6 -1
  105. package/build/features/tax/screens/Verify/Verify.js +3 -2
  106. package/build/hooks/index.d.ts +1 -0
  107. package/build/hooks/index.js +1 -0
  108. package/build/hooks/useAppConfig.d.ts +1 -4
  109. package/build/hooks/useAppConfig.js +13 -110
  110. package/build/hooks/useAppDispatch.d.ts +0 -1
  111. package/build/hooks/useAppTheme.js +3 -2
  112. package/build/hooks/useErrorListener.d.ts +1 -1
  113. package/build/hooks/useErrorListener.js +4 -6
  114. package/build/hooks/useStepStartedListener.d.ts +1 -0
  115. package/build/hooks/useStepStartedListener.js +10 -0
  116. package/build/index.d.ts +2 -3
  117. package/build/index.js +2 -5
  118. package/build/theme/theme.d.ts +1 -1
  119. package/build/theme/theme.js +1 -2
  120. package/build/utils/array.d.ts +3 -0
  121. package/build/utils/array.js +10 -0
  122. package/build/utils/string.d.ts +2 -0
  123. package/build/utils/string.js +23 -0
  124. package/package.json +127 -127
  125. package/build/features/Landing/Landing.d.ts +0 -7
  126. package/build/features/Landing/Landing.js +0 -55
  127. package/build/features/Landing/index.d.ts +0 -1
  128. package/build/features/Landing/index.js +0 -1
  129. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  130. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  131. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  132. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  133. package/build/features/app/landing/landingStore.d.ts +0 -22
  134. package/build/features/app/landing/landingStore.js +0 -103
@@ -48,10 +48,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
- import { hasKey, removeRequestHeaders } from '../../../utils';
51
+ import { FlowsTypes } from '../../../@types';
52
+ import { hasKey } from '../../../utils';
52
53
  import { handleNextScreenStep } from '../../../app/settings';
53
- import { PASSWORD_STEP_NAMES } from '../../../constants';
54
- export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
54
+ import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
55
+ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
56
  var payload, data, leadResponse, _a, steps, entity, hasCompleted;
56
57
  return __generator(this, function (_b) {
57
58
  switch (_b.label) {
@@ -85,6 +86,23 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
85
86
  }
86
87
  });
87
88
  }); });
89
+ export var resendOTP = createAsyncThunk('resendOTPPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
90
+ var password, payload, data;
91
+ return __generator(this, function (_a) {
92
+ switch (_a.label) {
93
+ case 0:
94
+ password = thunkApi.getState().password;
95
+ payload = {
96
+ service_name: 'tap_email',
97
+ verify_token: password.data.verify.token
98
+ };
99
+ return [4, API.leadService.verifyLeadToken(payload)];
100
+ case 1:
101
+ data = (_a.sent()).data;
102
+ return [2, { data: data }];
103
+ }
104
+ });
105
+ }); });
88
106
  export var retrieveEntityInfo = createAsyncThunk('retrievePasswordEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
89
107
  var data;
90
108
  return __generator(this, function (_a) {
@@ -148,14 +166,14 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
148
166
  case 1:
149
167
  data = (_f.sent()).data;
150
168
  if (!data.errors) {
151
- thunkApi.dispatch(handleNextScreenStep());
169
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
152
170
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
153
171
  }
154
172
  return [2, { data: data, formData: params }];
155
173
  }
156
174
  });
157
175
  }); });
158
- export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
176
+ export var updateLeadSuccess = createAsyncThunk('passwordUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
159
177
  var _a, settings, password, id, payload, data;
160
178
  var _b, _c, _d, _e, _f;
161
179
  return __generator(this, function (_g) {
@@ -166,6 +184,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
166
184
  if (!id)
167
185
  return [2];
168
186
  payload = {
187
+ lang: settings.data.language,
169
188
  step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS,
170
189
  id: id,
171
190
  encryption_contract: []
@@ -183,10 +202,100 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
183
202
  }
184
203
  });
185
204
  }); });
205
+ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
206
+ var token, leadId, payload, data;
207
+ var _a, _b;
208
+ return __generator(this, function (_c) {
209
+ switch (_c.label) {
210
+ case 0:
211
+ token = params.token, leadId = params.leadId;
212
+ payload = {
213
+ auth_type: 7,
214
+ auth_token: token
215
+ };
216
+ return [4, API.authService.verifyAuth(payload)];
217
+ case 1:
218
+ data = (_c.sent()).data;
219
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
220
+ if ((data === null || data === void 0 ? void 0 : data.errors) || (data === null || data === void 0 ? void 0 : data.mw_error)) {
221
+ alert((_b = (_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.description);
222
+ }
223
+ return [2, { data: data, token: token, leadId: leadId }];
224
+ }
225
+ });
226
+ }); });
227
+ export var resendOperationOTP = createAsyncThunk('resendOperationOTPPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
228
+ var password, payload, data;
229
+ return __generator(this, function (_a) {
230
+ switch (_a.label) {
231
+ case 0:
232
+ password = thunkApi.getState().password;
233
+ payload = {
234
+ auth_type: 7,
235
+ auth_token: password.data.verify.token
236
+ };
237
+ return [4, API.authService.verifyAuth(payload)];
238
+ case 1:
239
+ data = (_a.sent()).data;
240
+ return [2, { data: data }];
241
+ }
242
+ });
243
+ }); });
244
+ export var resetPassword = createAsyncThunk('resetPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
245
+ var _a, password, settings, responseBody, passwordData, payload, data;
246
+ var _b, _c;
247
+ return __generator(this, function (_d) {
248
+ switch (_d.label) {
249
+ case 0:
250
+ _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
251
+ responseBody = password.data.verify.responseBody;
252
+ passwordData = password.data.passwordData;
253
+ payload = {
254
+ auth_type: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_type,
255
+ auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
256
+ step_name: PASSWORD_STEP_NAMES.RESET_PASSWORD,
257
+ user_credentail: {
258
+ otp: params.otp,
259
+ new_password: passwordData.password
260
+ },
261
+ encryption_contract: ['user_credentail.otp', 'user_credentail.new_password']
262
+ };
263
+ return [4, API.authService.verifyAuth(payload)];
264
+ case 1:
265
+ data = (_d.sent()).data;
266
+ if (!(data === null || data === void 0 ? void 0 : data.errors)) {
267
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
268
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, payload);
269
+ }
270
+ return [2, { data: data, formData: __assign(__assign({}, params), passwordData) }];
271
+ }
272
+ });
273
+ }); });
274
+ export var retrieveLead = createAsyncThunk('retrieveLeadPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
275
+ var _a, password, settings, id, data;
276
+ var _b, _c, _d, _e;
277
+ return __generator(this, function (_f) {
278
+ switch (_f.label) {
279
+ case 0:
280
+ _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
281
+ id = (password.data.verify.responseBody || { id: '' }).id;
282
+ return [4, API.leadService.retrieveLead(id)];
283
+ case 1:
284
+ data = (_f.sent()).data;
285
+ if (!(data === null || data === void 0 ? void 0 : data.errors)) {
286
+ thunkApi.dispatch(handleNextScreenStep());
287
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { id: id });
288
+ (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, { data: data });
289
+ }
290
+ return [2, data];
291
+ }
292
+ });
293
+ }); });
186
294
  var initialState = {
187
295
  error: null,
188
296
  loading: false,
189
297
  data: {
298
+ flowName: FlowsTypes.PASSWORD,
190
299
  verify: {
191
300
  token: ''
192
301
  },
@@ -211,12 +320,16 @@ export var passwordSlice = createSlice({
211
320
  },
212
321
  resetOTPScreen: function (state) {
213
322
  state.data.otpData.otp = '';
323
+ },
324
+ storePasswordScreen: function (state, action) {
325
+ state.data.passwordData = action.payload;
214
326
  }
215
327
  },
216
328
  extraReducers: function (builder) {
217
329
  builder
218
330
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
219
331
  var _a;
332
+ state.data.verify.operationType = PASSWORD_OPERATION_TYPE.SET_PASSWORD;
220
333
  state.error = null;
221
334
  state.customLoading = false;
222
335
  var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
@@ -228,13 +341,30 @@ export var passwordSlice = createSlice({
228
341
  state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
229
342
  state.data.verify.token = token;
230
343
  })
231
- .addCase(verifyLeadToken.pending, function (state, action) {
344
+ .addCase(verifyLeadToken.pending, function (state) {
232
345
  state.customLoading = true;
233
346
  state.error = null;
234
347
  })
235
348
  .addCase(verifyLeadToken.rejected, function (state, action) {
236
349
  state.error = action.error.message;
237
350
  state.customLoading = false;
351
+ })
352
+ .addCase(resendOTP.pending, function (state) {
353
+ state.error = null;
354
+ })
355
+ .addCase(resendOTP.fulfilled, function (state, action) {
356
+ var _a;
357
+ state.error = null;
358
+ var data = action.payload.data;
359
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
360
+ if (description) {
361
+ state.error = description;
362
+ return;
363
+ }
364
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
365
+ })
366
+ .addCase(resendOTP.rejected, function (state, action) {
367
+ state.error = action.error.message;
238
368
  })
239
369
  .addCase(verifyPasswordLeadOTP.pending, function (state) {
240
370
  state.loading = true;
@@ -310,7 +440,6 @@ export var passwordSlice = createSlice({
310
440
  }
311
441
  var flows = response.flows, steps = response.steps;
312
442
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
313
- removeRequestHeaders();
314
443
  })
315
444
  .addCase(updateLeadSuccess.pending, function (state) {
316
445
  state.loading = true;
@@ -319,9 +448,90 @@ export var passwordSlice = createSlice({
319
448
  .addCase(updateLeadSuccess.rejected, function (state, action) {
320
449
  state.loading = false;
321
450
  state.error = action.error.message;
451
+ })
452
+ .addCase(verifyOperationToken.fulfilled, function (state, action) {
453
+ var _a;
454
+ state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
455
+ state.error = null;
456
+ state.customLoading = false;
457
+ var _b = action.payload, data = _b.data, token = _b.token, leadId = _b.leadId;
458
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
459
+ if (description) {
460
+ state.error = description;
461
+ return;
462
+ }
463
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { id: leadId });
464
+ state.data.verify.token = token;
465
+ })
466
+ .addCase(verifyOperationToken.pending, function (state) {
467
+ state.customLoading = true;
468
+ state.error = null;
469
+ })
470
+ .addCase(verifyOperationToken.rejected, function (state, action) {
471
+ state.error = action.error.message;
472
+ state.customLoading = false;
473
+ })
474
+ .addCase(resendOperationOTP.pending, function (state) {
475
+ state.error = null;
476
+ })
477
+ .addCase(resendOperationOTP.fulfilled, function (state, action) {
478
+ var _a;
479
+ state.error = null;
480
+ var data = action.payload.data;
481
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
482
+ if (description) {
483
+ state.error = description;
484
+ return;
485
+ }
486
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
487
+ })
488
+ .addCase(resendOperationOTP.rejected, function (state, action) {
489
+ state.error = action.error.message;
490
+ })
491
+ .addCase(resetPassword.fulfilled, function (state, action) {
492
+ var _a;
493
+ state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
494
+ state.error = null;
495
+ state.loading = false;
496
+ var _b = action.payload, data = _b.data, formData = _b.formData;
497
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
498
+ if (description) {
499
+ state.error = description;
500
+ return;
501
+ }
502
+ state.data.passwordData = formData;
503
+ state.data.passwordData.responseBody = data;
504
+ })
505
+ .addCase(resetPassword.pending, function (state) {
506
+ state.loading = true;
507
+ state.error = null;
508
+ })
509
+ .addCase(resetPassword.rejected, function (state, action) {
510
+ state.error = action.error.message;
511
+ state.loading = false;
512
+ })
513
+ .addCase(retrieveLead.fulfilled, function (state, action) {
514
+ var _a;
515
+ state.loading = false;
516
+ state.error = null;
517
+ var data = action.payload;
518
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
519
+ if (description) {
520
+ state.error = description;
521
+ return;
522
+ }
523
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
524
+ })
525
+ .addCase(retrieveLead.pending, function (state) {
526
+ state.loading = true;
527
+ state.error = null;
528
+ })
529
+ .addCase(retrieveLead.rejected, function (state, action) {
530
+ state.loading = false;
531
+ state.error = action.error.message;
322
532
  });
323
533
  }
324
534
  });
325
- export var clearError = (_a = passwordSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
535
+ export var clearError = (_a = passwordSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, storePasswordScreen = _a.storePasswordScreen;
326
536
  export default passwordSlice.reducer;
327
537
  export var passwordSelector = function (state) { return state.password; };
@@ -1,10 +1,13 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { OTPFormValues, ResponseData, SharedState, TaxFormValues } from '../../../@types';
2
+ import { FlowsTypes, OTPFormValues, ResponseData, SharedState, TaxFormValues } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  leadData: any;
6
6
  token: string;
7
7
  }, string, {}>;
8
+ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
+ data: any;
10
+ }, void, {}>;
8
11
  export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
9
12
  data: any;
10
13
  }, string, {}>;
@@ -27,6 +30,7 @@ export interface TaxData {
27
30
  verify: ResponseData & VerifyData;
28
31
  otpData: OTPFormValues & ResponseData;
29
32
  taxData: TaxFormValues & ResponseData;
33
+ flowName: FlowsTypes;
30
34
  }
31
35
  export interface TaxState extends SharedState<TaxData> {
32
36
  }
@@ -48,10 +48,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
- import { hasKey, removeRequestHeaders } from '../../../utils';
51
+ import { FlowsTypes } from '../../../@types';
52
+ import { hasKey } from '../../../utils';
52
53
  import { handleNextScreenStep } from '../../../app/settings';
53
54
  import { TAX_STEP_NAMES } from '../../../constants';
54
- export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
+ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
56
  var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
56
57
  return __generator(this, function (_b) {
57
58
  switch (_b.label) {
@@ -85,6 +86,23 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
85
86
  }
86
87
  });
87
88
  }); });
89
+ export var resendOTP = createAsyncThunk('resendOTPTax', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
90
+ var tax, payload, data;
91
+ return __generator(this, function (_a) {
92
+ switch (_a.label) {
93
+ case 0:
94
+ tax = thunkApi.getState().tax;
95
+ payload = {
96
+ service_name: 'tap_email',
97
+ verify_token: tax.data.verify.token
98
+ };
99
+ return [4, API.leadService.verifyLeadToken(payload)];
100
+ case 1:
101
+ data = (_a.sent()).data;
102
+ return [2, { data: data }];
103
+ }
104
+ });
105
+ }); });
88
106
  export var retrieveEntityInfo = createAsyncThunk('retrieveTaxEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
89
107
  var data;
90
108
  return __generator(this, function (_a) {
@@ -154,7 +172,7 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
154
172
  }
155
173
  });
156
174
  }); });
157
- export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
175
+ export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
158
176
  var _a, settings, tax, id, payload, data;
159
177
  var _b, _c, _d, _e, _f;
160
178
  return __generator(this, function (_g) {
@@ -165,6 +183,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
165
183
  if (!id)
166
184
  return [2];
167
185
  payload = {
186
+ lang: settings.data.language,
168
187
  step_name: TAX_STEP_NAMES.TAX_SUCCESS,
169
188
  id: id,
170
189
  encryption_contract: []
@@ -186,6 +205,7 @@ var initialState = {
186
205
  error: null,
187
206
  loading: false,
188
207
  data: {
208
+ flowName: FlowsTypes.TAX,
189
209
  verify: {
190
210
  token: ''
191
211
  },
@@ -193,7 +213,8 @@ var initialState = {
193
213
  otp: ''
194
214
  },
195
215
  taxData: {
196
- vatId: ''
216
+ vatId: '',
217
+ confirmPolicy: false
197
218
  }
198
219
  }
199
220
  };
@@ -226,13 +247,30 @@ export var taxSlice = createSlice({
226
247
  state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
227
248
  state.data.verify.token = token;
228
249
  })
229
- .addCase(verifyLeadToken.pending, function (state, action) {
250
+ .addCase(verifyLeadToken.pending, function (state) {
230
251
  state.error = null;
231
252
  state.customLoading = true;
232
253
  })
233
254
  .addCase(verifyLeadToken.rejected, function (state, action) {
234
255
  state.error = action.error.message;
235
256
  state.customLoading = false;
257
+ })
258
+ .addCase(resendOTP.pending, function (state) {
259
+ state.error = null;
260
+ })
261
+ .addCase(resendOTP.fulfilled, function (state, action) {
262
+ var _a;
263
+ state.error = null;
264
+ var data = action.payload.data;
265
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
266
+ if (description) {
267
+ state.error = description;
268
+ return;
269
+ }
270
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
271
+ })
272
+ .addCase(resendOTP.rejected, function (state, action) {
273
+ state.error = action.error.message;
236
274
  })
237
275
  .addCase(verifyTaxLeadOTP.pending, function (state) {
238
276
  state.loading = true;
@@ -308,7 +346,6 @@ export var taxSlice = createSlice({
308
346
  }
309
347
  var flows = response.flows, steps = response.steps;
310
348
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
311
- removeRequestHeaders();
312
349
  })
313
350
  .addCase(updateLeadSuccess.pending, function (state) {
314
351
  state.loading = true;
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo, useEffect } from 'react';
14
- import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig } from '../../hooks';
14
+ import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig, useStepStartedListener } from '../../hooks';
15
15
  import { handleLanguage, settingsSelector } from '../../app/settings';
16
16
  import AnimationFlow from '../../components/AnimationFlow';
17
17
  import { store } from '../../app/store';
@@ -28,9 +28,10 @@ var Bank = memo(function (props) {
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
- var customLoading = useAppSelector(bankSelector).customLoading;
32
- var loading = useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props)).loading;
33
- useErrorListener();
31
+ var _b = useAppSelector(bankSelector), customLoading = _b.customLoading, bankError = _b.error;
32
+ useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props));
33
+ useErrorListener(bankError || error);
34
+ useStepStartedListener();
34
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
35
36
  var verifyToken = function () {
36
37
  var token = getParameterByName('token');
@@ -43,10 +44,10 @@ var Bank = memo(function (props) {
43
44
  dispatch(verifyLeadToken(token));
44
45
  };
45
46
  useEffect(function () {
46
- if (!loading)
47
+ if (!settingLoading)
47
48
  verifyToken();
48
- }, [loading]);
49
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
49
+ }, [settingLoading]);
50
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
50
51
  var Element = _a.element, name = _a.name;
51
52
  var isActive = activeScreen.name === name;
52
53
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -26,6 +26,7 @@ import { styled } from '@mui/material/styles';
26
26
  import { bankSelector, createBankAccount } from '../../../app/bank/bankStore';
27
27
  import Form from '../../../../components/Form';
28
28
  import { handleCurrentActiveScreen } from '../../../../app/settings';
29
+ import ConfirmPolicy from './ConfirmPolicy';
29
30
  var FormStyled = styled(Form)(function () { return ({
30
31
  display: 'flex',
31
32
  flexDirection: 'column',
@@ -55,6 +56,6 @@ var BankDetails = function () {
55
56
  dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
56
57
  };
57
58
  var disabled = ibanChecking || !methods.formState.isValid;
58
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
59
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
59
60
  };
60
61
  export default BankDetails;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const ConfirmPolicy: () => JSX.Element;
3
+ export default ConfirmPolicy;
@@ -0,0 +1,67 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useTranslation } from 'react-i18next';
14
+ import { useController, useFormContext } from 'react-hook-form';
15
+ import { ScreenContainer } from '../../../shared/Containers';
16
+ import { styled, alpha } from '@mui/material/styles';
17
+ import Box from '@mui/material/Box';
18
+ import CheckBox from '../../../../components/CheckBox';
19
+ import Text from '../../../../components/Text';
20
+ import Warning from '../../../../components/Warning';
21
+ import Collapse from '../../../../components/Collapse';
22
+ var ConfirmContainerStyled = styled(Box)(function (_a) {
23
+ var theme = _a.theme;
24
+ return ({
25
+ display: 'flex',
26
+ flexDirection: 'row',
27
+ alignItems: 'center',
28
+ padding: theme.spacing(0, 2.5, 1.5, 2.5),
29
+ marginBlockStart: theme.spacing(3)
30
+ });
31
+ });
32
+ var TextStyled = styled(Text)(function (_a) {
33
+ var theme = _a.theme;
34
+ return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre-line', height: 'fit-content' }, theme.typography.body2));
35
+ });
36
+ var CheckboxStyled = styled(CheckBox)(function (_a) {
37
+ var theme = _a.theme;
38
+ return ({
39
+ margin: theme.spacing(0),
40
+ padding: theme.spacing(0),
41
+ marginInlineEnd: theme.spacing(1.5),
42
+ color: theme.palette.primary.main,
43
+ '& .MuiSvgIcon-root': {
44
+ fontSize: theme.spacing(3.75)
45
+ },
46
+ '&.Mui-checked': {
47
+ color: theme.palette.text.primary,
48
+ borderRadius: theme.spacing(2.5)
49
+ }
50
+ });
51
+ });
52
+ var CollapseStyled = styled(Collapse)(function () { return ({
53
+ width: '100%'
54
+ }); });
55
+ var ConfirmPolicy = function () {
56
+ var _a;
57
+ var t = useTranslation().t;
58
+ var control = useFormContext().control;
59
+ var confirmControl = useController({ control: control, name: 'confirmPolicy' });
60
+ var confirmChecked = confirmControl.field.value;
61
+ var warningMessage = (_a = confirmControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
62
+ var handleConfirmCheckedChange = function (event, checked) {
63
+ confirmControl.field.onChange(checked);
64
+ };
65
+ return (_jsxs(ScreenContainer, { children: [_jsxs(ConfirmContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: confirmChecked, onChange: handleConfirmCheckedChange }), _jsx(TextStyled, { children: t('bank_confirm_information') })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
66
+ };
67
+ export default ConfirmPolicy;
@@ -3,12 +3,15 @@ export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").A
3
3
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
4
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
5
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
6
7
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
8
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
9
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
10
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
+ confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
10
12
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
13
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
14
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
13
15
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
16
+ confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
14
17
  }>>>;
@@ -11,5 +11,6 @@ export var BankValidation = yup.object().shape({
11
11
  beneficiaryName: yup
12
12
  .string()
13
13
  .matches(REGEX_BENEFICIARY_NAME, 'beneficiary_name_invalid')
14
- .required('beneficiary_name_required')
14
+ .required('beneficiary_name_required'),
15
+ confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
15
16
  });
@@ -14,14 +14,15 @@ import React, { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
- import { ICONS_NAMES } from '../../../../constants';
17
+ import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { allAreTruthy, showLastFour } from '../../../../utils';
19
+ import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
20
20
  import { bankSelector } from '../../../app/bank/bankStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
23
23
  import Container from '../../../shared/Containers/ScreenContainer';
24
24
  import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
+ import { settingsSelector } from '../../../../app/settings';
25
26
  var TitleStyled = styled(Text)(function (_a) {
26
27
  var _b;
27
28
  var theme = _a.theme;
@@ -57,10 +58,13 @@ var SuccessWithFlowButtons = function () {
57
58
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
58
59
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
59
60
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
61
+ var settings = useAppSelector(settingsSelector);
62
+ var _h = data.verify.responseBody || { contact: {}, id: '' }, contact = _h.contact, id = _h.id;
63
+ var email = (contact || { email: '' }).email;
64
+ var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
60
65
  var reMapFlowData = function (flows) {
61
66
  if (flows === void 0) { flows = []; }
62
67
  var images = ICONS_NAMES;
63
- var statuses = [];
64
68
  var mappedFlows = flows.map(function (_a) {
65
69
  var name = _a.name, url = _a.url, status = _a.status;
66
70
  var type = status === 'initiated' ? 'pending' : 'completed';
@@ -79,6 +83,8 @@ var SuccessWithFlowButtons = function () {
79
83
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
80
84
  var hoverSrc = "".concat(name, "_white_icon");
81
85
  return {
86
+ name: name,
87
+ status: status,
82
88
  title: title,
83
89
  href: url,
84
90
  src: images[src],
@@ -96,6 +102,10 @@ var SuccessWithFlowButtons = function () {
96
102
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
97
103
  reMapFlowData(flows);
98
104
  }, [flows, isAr]);
99
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
105
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
106
+ flowName: data.flowName,
107
+ email: email,
108
+ emailUrl: url
109
+ } }) })] }));
100
110
  };
101
111
  export default memo(SuccessWithFlowButtons);