@tap-payments/auth-jsconnect 1.0.94-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 (67) hide show
  1. package/build/@types/app.d.ts +2 -2
  2. package/build/api/auth.d.ts +22 -3
  3. package/build/api/axios.d.ts +2 -2
  4. package/build/api/axios.js +62 -0
  5. package/build/api/country.d.ts +1 -2
  6. package/build/api/country.js +7 -8
  7. package/build/api/firebase.d.ts +1 -1
  8. package/build/api/firebase.js +5 -2
  9. package/build/api/index.d.ts +7 -8
  10. package/build/api/ip.d.ts +1 -1
  11. package/build/api/ip.js +5 -2
  12. package/build/api/lead.d.ts +2 -0
  13. package/build/api/operator.d.ts +1 -1
  14. package/build/api/operator.js +60 -4
  15. package/build/app/settings.d.ts +6 -15
  16. package/build/app/settings.js +82 -142
  17. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  18. package/build/components/AnimationFlow/AnimationFlow.js +2 -2
  19. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  20. package/build/components/AnimationFlow/BottomSheet.js +16 -4
  21. package/build/constants/app.d.ts +6 -0
  22. package/build/constants/app.js +16 -4
  23. package/build/features/app/bank/bankStore.js +3 -3
  24. package/build/features/app/business/businessStore.js +5 -5
  25. package/build/features/app/connect/connectStore.js +9 -7
  26. package/build/features/app/individual/individualStore.d.ts +2 -2
  27. package/build/features/app/individual/individualStore.js +5 -5
  28. package/build/features/app/password/passwordStore.d.ts +29 -1
  29. package/build/features/app/password/passwordStore.js +181 -7
  30. package/build/features/app/tax/taxStore.js +4 -4
  31. package/build/features/bank/Bank.js +4 -4
  32. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
  33. package/build/features/business/Business.js +4 -4
  34. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
  35. package/build/features/connect/Connect.js +1 -1
  36. package/build/features/featuresScreens.js +5 -0
  37. package/build/features/individual/Individual.js +4 -4
  38. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
  39. package/build/features/password/Password.js +12 -6
  40. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  41. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  42. package/build/features/password/screens/OTP/OTP.js +78 -0
  43. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  44. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  45. package/build/features/password/screens/OTP/index.d.ts +3 -0
  46. package/build/features/password/screens/OTP/index.js +2 -0
  47. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  48. package/build/features/password/screens/OTP/validation.js +4 -0
  49. package/build/features/password/screens/Success/Success.js +8 -2
  50. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  51. package/build/features/password/screens/Verify/OTPInput.d.ts +2 -2
  52. package/build/features/password/screens/Verify/OTPInput.js +1 -1
  53. package/build/features/shared/Button/FlowsButtons.d.ts +8 -2
  54. package/build/features/shared/Button/FlowsButtons.js +94 -6
  55. package/build/features/shared/Button/SuccessButton.js +17 -13
  56. package/build/features/tax/Tax.js +3 -3
  57. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
  58. package/build/hooks/useAppConfig.d.ts +1 -4
  59. package/build/hooks/useAppConfig.js +13 -113
  60. package/build/hooks/useAppTheme.js +3 -2
  61. package/build/theme/theme.d.ts +1 -1
  62. package/build/theme/theme.js +1 -2
  63. package/build/utils/array.d.ts +3 -0
  64. package/build/utils/array.js +10 -0
  65. package/build/utils/string.d.ts +1 -0
  66. package/build/utils/string.js +4 -0
  67. package/package.json +1 -1
@@ -25,8 +25,32 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
25
25
  response: any;
26
26
  formData: void;
27
27
  } | undefined, void, {}>;
28
+ export declare const verifyOperationToken: import("@reduxjs/toolkit").AsyncThunk<{
29
+ data: any;
30
+ token: string;
31
+ leadId: string;
32
+ }, {
33
+ token: string;
34
+ leadId: string;
35
+ }, {}>;
36
+ export declare const resendOperationOTP: import("@reduxjs/toolkit").AsyncThunk<{
37
+ data: any;
38
+ }, void, {}>;
39
+ export declare const resetPassword: import("@reduxjs/toolkit").AsyncThunk<{
40
+ data: any;
41
+ formData: {
42
+ password: string;
43
+ confirmPassword: string;
44
+ responseBody?: {
45
+ [key: string]: any;
46
+ } | undefined;
47
+ otp: string;
48
+ };
49
+ }, OTPFormValues, {}>;
50
+ export declare const retrieveLead: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
28
51
  declare type VerifyData = {
29
52
  token: string;
53
+ operationType?: string;
30
54
  };
31
55
  export interface PasswordData {
32
56
  verify: ResponseData & VerifyData;
@@ -40,8 +64,12 @@ export declare const passwordSlice: import("@reduxjs/toolkit").Slice<PasswordSta
40
64
  clearError: (state: PasswordState) => void;
41
65
  stopLoader: (state: PasswordState) => void;
42
66
  resetOTPScreen: (state: PasswordState) => void;
67
+ storePasswordScreen: (state: PasswordState, action: {
68
+ payload: any;
69
+ type: string;
70
+ }) => void;
43
71
  }, "password/store">;
44
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
72
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, storePasswordScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
45
73
  declare const _default: import("redux").Reducer<PasswordState, import("redux").AnyAction>;
46
74
  export default _default;
47
75
  export declare const passwordSelector: (state: RootState) => PasswordState;
@@ -49,10 +49,10 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { hasKey, removeRequestHeaders } from '../../../utils';
52
+ import { hasKey } from '../../../utils';
53
53
  import { handleNextScreenStep } from '../../../app/settings';
54
- import { PASSWORD_STEP_NAMES } from '../../../constants';
55
- 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 () {
56
56
  var payload, data, leadResponse, _a, steps, entity, hasCompleted;
57
57
  return __generator(this, function (_b) {
58
58
  switch (_b.label) {
@@ -166,14 +166,14 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
166
166
  case 1:
167
167
  data = (_f.sent()).data;
168
168
  if (!data.errors) {
169
- thunkApi.dispatch(handleNextScreenStep());
169
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
170
170
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
171
171
  }
172
172
  return [2, { data: data, formData: params }];
173
173
  }
174
174
  });
175
175
  }); });
176
- 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 () {
177
177
  var _a, settings, password, id, payload, data;
178
178
  var _b, _c, _d, _e, _f;
179
179
  return __generator(this, function (_g) {
@@ -184,6 +184,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
184
184
  if (!id)
185
185
  return [2];
186
186
  payload = {
187
+ lang: settings.data.language,
187
188
  step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS,
188
189
  id: id,
189
190
  encryption_contract: []
@@ -201,6 +202,95 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
201
202
  }
202
203
  });
203
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
+ }); });
204
294
  var initialState = {
205
295
  error: null,
206
296
  loading: false,
@@ -230,12 +320,16 @@ export var passwordSlice = createSlice({
230
320
  },
231
321
  resetOTPScreen: function (state) {
232
322
  state.data.otpData.otp = '';
323
+ },
324
+ storePasswordScreen: function (state, action) {
325
+ state.data.passwordData = action.payload;
233
326
  }
234
327
  },
235
328
  extraReducers: function (builder) {
236
329
  builder
237
330
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
238
331
  var _a;
332
+ state.data.verify.operationType = PASSWORD_OPERATION_TYPE.SET_PASSWORD;
239
333
  state.error = null;
240
334
  state.customLoading = false;
241
335
  var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
@@ -346,7 +440,6 @@ export var passwordSlice = createSlice({
346
440
  }
347
441
  var flows = response.flows, steps = response.steps;
348
442
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
349
- removeRequestHeaders();
350
443
  })
351
444
  .addCase(updateLeadSuccess.pending, function (state) {
352
445
  state.loading = true;
@@ -355,9 +448,90 @@ export var passwordSlice = createSlice({
355
448
  .addCase(updateLeadSuccess.rejected, function (state, action) {
356
449
  state.loading = false;
357
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;
358
532
  });
359
533
  }
360
534
  });
361
- 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;
362
536
  export default passwordSlice.reducer;
363
537
  export var passwordSelector = function (state) { return state.password; };
@@ -49,10 +49,10 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { hasKey, removeRequestHeaders } from '../../../utils';
52
+ import { hasKey } from '../../../utils';
53
53
  import { handleNextScreenStep } from '../../../app/settings';
54
54
  import { TAX_STEP_NAMES } from '../../../constants';
55
- 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 () {
56
56
  var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
57
57
  return __generator(this, function (_b) {
58
58
  switch (_b.label) {
@@ -172,7 +172,7 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
172
172
  }
173
173
  });
174
174
  }); });
175
- 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 () {
176
176
  var _a, settings, tax, id, payload, data;
177
177
  var _b, _c, _d, _e, _f;
178
178
  return __generator(this, function (_g) {
@@ -183,6 +183,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
183
183
  if (!id)
184
184
  return [2];
185
185
  payload = {
186
+ lang: settings.data.language,
186
187
  step_name: TAX_STEP_NAMES.TAX_SUCCESS,
187
188
  id: id,
188
189
  encryption_contract: []
@@ -345,7 +346,6 @@ export var taxSlice = createSlice({
345
346
  }
346
347
  var flows = response.flows, steps = response.steps;
347
348
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
348
- removeRequestHeaders();
349
349
  })
350
350
  .addCase(updateLeadSuccess.pending, function (state) {
351
351
  state.loading = true;
@@ -29,7 +29,7 @@ var Bank = memo(function (props) {
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var _b = useAppSelector(bankSelector), customLoading = _b.customLoading, bankError = _b.error;
32
- var loading = useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props)).loading;
32
+ useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props));
33
33
  useErrorListener(bankError || error);
34
34
  useStepStartedListener();
35
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
@@ -44,10 +44,10 @@ var Bank = memo(function (props) {
44
44
  dispatch(verifyLeadToken(token));
45
45
  };
46
46
  useEffect(function () {
47
- if (!loading)
47
+ if (!settingLoading)
48
48
  verifyToken();
49
- }, [loading]);
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, {}) }, { 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) {
51
51
  var Element = _a.element, name = _a.name;
52
52
  var isActive = activeScreen.name === name;
53
53
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -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,6 +58,10 @@ 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;
@@ -79,6 +84,7 @@ var SuccessWithFlowButtons = function () {
79
84
  var hoverSrc = "".concat(name, "_white_icon");
80
85
  return {
81
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, flowName: data.flowName }) })] }));
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);
@@ -29,7 +29,7 @@ var Business = memo(function (props) {
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var _b = useAppSelector(businessSelector), customLoading = _b.customLoading, businessError = _b.error;
32
- var loading = useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props)).loading;
32
+ useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props));
33
33
  useErrorListener(businessError || error);
34
34
  useStepStartedListener();
35
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
@@ -44,10 +44,10 @@ var Business = memo(function (props) {
44
44
  dispatch(verifyLeadToken(token));
45
45
  };
46
46
  useEffect(function () {
47
- if (!loading)
47
+ if (!settingLoading)
48
48
  verifyToken();
49
- }, [loading]);
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, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.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: businessFeatureScreens.map(function (_a, index) {
51
51
  var Element = _a.element, name = _a.name;
52
52
  var isActive = activeScreen.name === name;
53
53
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -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';
18
- import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
17
+ import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
19
  import { businessSelector } from '../../../app/business/businessStore';
20
- import { allAreTruthy, showLastFour } from '../../../../utils';
20
+ import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
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;
@@ -46,7 +47,6 @@ var SuccessWithFlowButtons = function () {
46
47
  var _a, _b, _c;
47
48
  var t = useTranslation().t;
48
49
  var isAr = useLanguage().isAr;
49
- var dispatch = useAppDispatch();
50
50
  var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
51
51
  var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
52
52
  var data = useAppSelector(businessSelector).data;
@@ -58,6 +58,10 @@ var SuccessWithFlowButtons = function () {
58
58
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
59
59
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
60
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);
61
65
  var reMapFlowData = function (flows) {
62
66
  if (flows === void 0) { flows = []; }
63
67
  var images = ICONS_NAMES;
@@ -80,6 +84,7 @@ var SuccessWithFlowButtons = function () {
80
84
  var hoverSrc = "".concat(name, "_white_icon");
81
85
  return {
82
86
  name: name,
87
+ status: status,
83
88
  title: title,
84
89
  href: url,
85
90
  src: images[src],
@@ -97,6 +102,10 @@ var SuccessWithFlowButtons = function () {
97
102
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
98
103
  reMapFlowData(flows);
99
104
  }, [flows, isAr]);
100
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, flowName: data.flowName }) })] }));
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
+ } }) })] }));
101
110
  };
102
111
  export default memo(SuccessWithFlowButtons);
@@ -32,7 +32,7 @@ var Connect = memo(function (props) {
32
32
  useErrorListener(connectError || error);
33
33
  useStepStartedListener();
34
34
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
35
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
35
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
36
36
  var Element = _a.element, name = _a.name;
37
37
  var isActive = activeScreen.name === name;
38
38
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -14,6 +14,7 @@ import SuccessPage from './business/screens/Success';
14
14
  import SuccessWithFlowButtonsPage from './business/screens/SuccessWithFlowButtons';
15
15
  import PasswordVerifyPage from './password/screens/Verify';
16
16
  import CreatePasswordPage from './password/screens/CreatePassword';
17
+ import PasswordOTPPage from './password/screens/OTP';
17
18
  import SuccessPasswordPage from './password/screens/Success';
18
19
  import PasswordSuccessWithFlowPage from './password/screens/SuccessWithFlowButtons';
19
20
  import IndividualVerifyPage from './individual/screens/Verify';
@@ -91,6 +92,10 @@ export var passwordFeatureScreens = [
91
92
  name: 'PASSWORD_CREATE_PASSWORD_STEP',
92
93
  element: CreatePasswordPage
93
94
  },
95
+ {
96
+ name: 'PASSWORD_RESET_PASSWORD_OTP_STEP',
97
+ element: PasswordOTPPage
98
+ },
94
99
  {
95
100
  name: 'PASSWORD_SUCCESS_STEP',
96
101
  element: SuccessPasswordPage
@@ -29,7 +29,7 @@ var Individual = memo(function (props) {
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var _b = useAppSelector(individualSelector), customLoading = _b.customLoading, individualError = _b.error;
32
- var loading = useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props)).loading;
32
+ useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props));
33
33
  useErrorListener(individualError || error);
34
34
  useStepStartedListener();
35
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
@@ -44,10 +44,10 @@ var Individual = memo(function (props) {
44
44
  dispatch(verifyLeadToken(token));
45
45
  };
46
46
  useEffect(function () {
47
- if (!loading)
47
+ if (!settingLoading)
48
48
  verifyToken();
49
- }, [loading]);
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, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.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: individualFeatureScreens.map(function (_a, index) {
51
51
  var Element = _a.element, name = _a.name;
52
52
  var isActive = activeScreen.name === name;
53
53
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -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 { individualSelector } from '../../../app/individual/individualStore';
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,6 +58,10 @@ 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;
@@ -79,6 +84,7 @@ var SuccessWithFlowButtons = function () {
79
84
  var hoverSrc = "".concat(name, "_white_icon");
80
85
  return {
81
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, flowName: data.flowName }) })] }));
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);
@@ -19,9 +19,9 @@ import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
19
  import Collapse from '../../components/Collapse';
20
20
  import { FeatureContainer } from '../shared/Containers';
21
21
  import { getParameterByName, reactElement } from '../../utils';
22
- import { PASSWORD_SCREENS_NAVIGATION } from '../../constants';
22
+ import { PASSWORD_OPERATION_TYPE, PASSWORD_SCREENS_NAVIGATION } from '../../constants';
23
23
  import { passwordFeatureScreens } from '../featuresScreens';
24
- import { passwordSelector, verifyLeadToken } from '../app/password/passwordStore';
24
+ import { passwordSelector, verifyLeadToken, verifyOperationToken } from '../app/password/passwordStore';
25
25
  import CustomFooter from '../shared/Footer';
26
26
  import Background from '../shared/Background';
27
27
  var Password = memo(function (props) {
@@ -29,25 +29,31 @@ var Password = memo(function (props) {
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var _b = useAppSelector(passwordSelector), customLoading = _b.customLoading, passwordError = _b.error;
32
- var loading = useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION }, props)).loading;
32
+ useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION }, props));
33
33
  useErrorListener(passwordError || error);
34
34
  useStepStartedListener();
35
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
36
36
  var verifyToken = function () {
37
37
  var token = getParameterByName('token');
38
38
  var lang = getParameterByName('lang');
39
+ var operationType = getParameterByName('operation_type');
40
+ var leadId = getParameterByName('lead_id') || '';
39
41
  if (!token)
40
42
  throw new Error('Auth token is not found!');
41
43
  if (!lang)
42
44
  throw new Error('Language is not found!');
43
45
  dispatch(handleLanguage(lang));
46
+ if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
47
+ dispatch(verifyOperationToken({ token: token, leadId: leadId }));
48
+ return;
49
+ }
44
50
  dispatch(verifyLeadToken(token));
45
51
  };
46
52
  useEffect(function () {
47
- if (!loading)
53
+ if (!settingLoading)
48
54
  verifyToken();
49
- }, [loading]);
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, {}) }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
55
+ }, [settingLoading]);
56
+ 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: passwordFeatureScreens.map(function (_a, index) {
51
57
  var Element = _a.element, name = _a.name;
52
58
  var isActive = activeScreen.name === name;
53
59
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));