@tap-payments/auth-jsconnect 1.0.93-test → 1.0.96-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 (93) hide show
  1. package/build/@types/app.d.ts +7 -2
  2. package/build/@types/form.d.ts +2 -1
  3. package/build/api/auth.d.ts +22 -3
  4. package/build/api/axios.d.ts +2 -0
  5. package/build/api/axios.js +64 -0
  6. package/build/api/country.d.ts +1 -2
  7. package/build/api/country.js +7 -8
  8. package/build/api/data.d.ts +1 -0
  9. package/build/api/data.js +9 -2
  10. package/build/api/entity.d.ts +3 -1
  11. package/build/api/entity.js +11 -2
  12. package/build/api/firebase.d.ts +1 -1
  13. package/build/api/firebase.js +5 -2
  14. package/build/api/index.d.ts +10 -9
  15. package/build/api/ip.d.ts +1 -1
  16. package/build/api/ip.js +5 -2
  17. package/build/api/lead.d.ts +4 -1
  18. package/build/api/lead.js +14 -2
  19. package/build/api/operator.d.ts +1 -1
  20. package/build/api/operator.js +60 -4
  21. package/build/app/settings.d.ts +9 -12
  22. package/build/app/settings.js +87 -111
  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/api.d.ts +2 -1
  29. package/build/constants/api.js +5 -3
  30. package/build/constants/app.d.ts +6 -0
  31. package/build/constants/app.js +16 -4
  32. package/build/features/app/bank/bankStore.js +6 -4
  33. package/build/features/app/business/businessStore.d.ts +3 -11
  34. package/build/features/app/business/businessStore.js +69 -62
  35. package/build/features/app/connect/connectStore.d.ts +6 -17
  36. package/build/features/app/connect/connectStore.js +112 -61
  37. package/build/features/app/individual/individualStore.d.ts +3 -7
  38. package/build/features/app/individual/individualStore.js +28 -54
  39. package/build/features/app/password/passwordStore.d.ts +29 -1
  40. package/build/features/app/password/passwordStore.js +184 -8
  41. package/build/features/app/tax/taxStore.js +7 -5
  42. package/build/features/bank/Bank.js +4 -4
  43. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
  44. package/build/features/business/Business.js +5 -8
  45. package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
  46. package/build/features/business/screens/OTP/OTPInput.js +3 -9
  47. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
  48. package/build/features/connect/Connect.js +4 -8
  49. package/build/features/connect/screens/Merchant/BrandName.js +3 -2
  50. package/build/features/connect/screens/Mobile/Mobile.js +2 -2
  51. package/build/features/connect/screens/NID/NID.js +1 -1
  52. package/build/features/connect/screens/OTP/OTPInput.js +3 -13
  53. package/build/features/featuresScreens.js +5 -0
  54. package/build/features/individual/Individual.js +5 -8
  55. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +10 -2
  56. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +10 -0
  57. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -0
  58. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -0
  59. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -0
  60. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
  61. package/build/features/password/Password.js +12 -6
  62. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  63. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  64. package/build/features/password/screens/OTP/OTP.js +78 -0
  65. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  66. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  67. package/build/features/password/screens/OTP/index.d.ts +3 -0
  68. package/build/features/password/screens/OTP/index.js +2 -0
  69. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  70. package/build/features/password/screens/OTP/validation.js +4 -0
  71. package/build/features/password/screens/Success/Success.js +8 -2
  72. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  73. package/build/features/password/screens/Verify/OTPInput.d.ts +2 -2
  74. package/build/features/password/screens/Verify/OTPInput.js +1 -1
  75. package/build/features/shared/Background/Background.js +3 -2
  76. package/build/features/shared/Background/LogoBackground.d.ts +1 -4
  77. package/build/features/shared/Background/LogoBackground.js +4 -32
  78. package/build/features/shared/Button/FlowsButtons.d.ts +8 -2
  79. package/build/features/shared/Button/FlowsButtons.js +94 -6
  80. package/build/features/shared/Button/SuccessButton.js +17 -13
  81. package/build/features/shared/Footer/Footer.js +2 -3
  82. package/build/features/tax/Tax.js +3 -3
  83. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
  84. package/build/hooks/useAppConfig.d.ts +1 -4
  85. package/build/hooks/useAppConfig.js +13 -110
  86. package/build/hooks/useAppTheme.js +3 -2
  87. package/build/theme/theme.d.ts +1 -1
  88. package/build/theme/theme.js +1 -2
  89. package/build/utils/array.d.ts +3 -0
  90. package/build/utils/array.js +10 -0
  91. package/build/utils/string.d.ts +1 -0
  92. package/build/utils/string.js +4 -0
  93. package/package.json +1 -1
@@ -49,26 +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 { defaultCountry, INDIVIDUAl_STEP_NAMES } from '../../../constants';
55
- export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var settings, countriesBody, businessCountry;
57
- return __generator(this, function (_a) {
58
- switch (_a.label) {
59
- case 0:
60
- settings = thunkApi.getState().settings;
61
- return [4, API.countryService.getAllCountries()];
62
- case 1:
63
- countriesBody = (_a.sent()).data;
64
- businessCountry = (countriesBody.list || []).find(function (country) {
65
- return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
66
- });
67
- return [2, { businessCountry: businessCountry, countries: countriesBody.list }];
68
- }
69
- });
70
- }); });
71
- export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
54
+ import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
55
+ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
72
56
  var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
73
57
  var _b, _c;
74
58
  return __generator(this, function (_d) {
@@ -122,20 +106,25 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
122
106
  }
123
107
  });
124
108
  }); });
125
- export var retrieveDataList = createAsyncThunk('retrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
126
- var _a, sourceIncome, monthlyIncome;
109
+ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
110
+ var _a, sourceIncome, monthlyIncome, occupation, settings, countries;
127
111
  return __generator(this, function (_b) {
128
112
  switch (_b.label) {
129
113
  case 0: return [4, Promise.all([
130
114
  API.dataService.getSourceOfIncome(),
131
- API.dataService.getMonthlyIncome(countryCode)
115
+ API.dataService.getMonthlyIncome(countryCode),
116
+ API.dataService.getOccupation()
132
117
  ])];
133
118
  case 1:
134
- _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data;
119
+ _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data, occupation = _a[2];
120
+ settings = thunkApi.getState().settings;
121
+ countries = settings.data.countries;
135
122
  return [2, {
136
123
  sourceIncome: sourceIncome,
137
124
  monthlyIncome: monthlyIncome,
138
- countryCode: countryCode
125
+ countryCode: countryCode,
126
+ occupation: occupation,
127
+ countries: countries
139
128
  }];
140
129
  }
141
130
  });
@@ -169,7 +158,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
169
158
  return [4, API.leadService.verifyLeadOTP(payload)];
170
159
  case 1:
171
160
  data = (_g.sent()).data;
172
- if (!!data.errors) return [3, 5];
161
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 5];
173
162
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
174
163
  steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
175
164
  hasIndividualCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
@@ -196,9 +185,10 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
196
185
  case 0:
197
186
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
198
187
  requestBody = {
199
- id: (_c = (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
188
+ id: (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.individual_id,
189
+ occupation: (_c = params.occupation) === null || _c === void 0 ? void 0 : _c.id,
200
190
  employer_name: params.employerName,
201
- employer_city: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
191
+ employer_country: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
202
192
  source_income: [(_e = params.sourceIncome) === null || _e === void 0 ? void 0 : _e.id],
203
193
  actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
204
194
  is_relative_PEP: params.isPEP,
@@ -206,10 +196,10 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
206
196
  encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'source_income[0]'],
207
197
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
208
198
  };
209
- return [4, API.entityService.updateEntityInfo(requestBody)];
199
+ return [4, API.entityService.updateIndividualInfo(requestBody)];
210
200
  case 1:
211
201
  data = (_j.sent()).data;
212
- if (!data.errors) {
202
+ if (!(data === null || data === void 0 ? void 0 : data.errors)) {
213
203
  thunkApi.dispatch(handleNextScreenStep());
214
204
  (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
215
205
  }
@@ -217,7 +207,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
217
207
  }
218
208
  });
219
209
  }); });
220
- export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
210
+ export var updateLeadSuccess = createAsyncThunk('individualUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
221
211
  var _a, settings, individual, id, payload, data;
222
212
  var _b, _c, _d, _e, _f;
223
213
  return __generator(this, function (_g) {
@@ -228,6 +218,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
228
218
  if (!id)
229
219
  return [2];
230
220
  payload = {
221
+ lang: settings.data.language,
231
222
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
232
223
  id: id,
233
224
  encryption_contract: []
@@ -235,13 +226,15 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
235
226
  return [4, API.leadService.updateLead(payload)];
236
227
  case 1:
237
228
  data = (_g.sent()).data;
229
+ if (!!data.errors) return [3, 3];
238
230
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
239
231
  case 2:
240
232
  _g.sent();
241
233
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
242
234
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
243
235
  thunkApi.dispatch(handleNextScreenStep());
244
- return [2, { response: data, formData: params }];
236
+ _g.label = 3;
237
+ case 3: return [2, { response: data, formData: params }];
245
238
  }
246
239
  });
247
240
  }); });
@@ -250,8 +243,6 @@ var initialState = {
250
243
  loading: false,
251
244
  data: {
252
245
  flowName: FlowsTypes.INDIVIDUAL,
253
- countries: [],
254
- businessCountry: defaultCountry,
255
246
  verify: {
256
247
  token: ''
257
248
  },
@@ -259,6 +250,7 @@ var initialState = {
259
250
  otp: ''
260
251
  },
261
252
  individualData: {
253
+ occupation: undefined,
262
254
  sourceIncome: undefined,
263
255
  monthlyIncome: undefined,
264
256
  employerName: '',
@@ -284,23 +276,6 @@ export var individualSlice = createSlice({
284
276
  },
285
277
  extraReducers: function (builder) {
286
278
  builder
287
- .addCase(getCountries.fulfilled, function (state, action) {
288
- state.error = null;
289
- state.customLoading = false;
290
- var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
291
- state.data.countries = countries
292
- .slice()
293
- .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
294
- state.data.businessCountry = businessCountry || defaultCountry;
295
- })
296
- .addCase(getCountries.pending, function (state) {
297
- state.error = null;
298
- state.customLoading = true;
299
- })
300
- .addCase(getCountries.rejected, function (state, action) {
301
- state.error = action.error.message;
302
- state.customLoading = false;
303
- })
304
279
  .addCase(verifyLeadToken.pending, function (state) {
305
280
  state.error = null;
306
281
  state.customLoading = true;
@@ -367,9 +342,9 @@ export var individualSlice = createSlice({
367
342
  .addCase(retrieveDataList.fulfilled, function (state, action) {
368
343
  state.loading = false;
369
344
  state.error = null;
370
- var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode;
345
+ var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode, countries = _a.countries, occupation = _a.occupation;
371
346
  var data = state.data.individualData.responseBody;
372
- state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [] });
347
+ state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [], occupationList: occupation || [] });
373
348
  var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
374
349
  if (!!selectedSourceIncome)
375
350
  state.data.individualData.sourceIncome = selectedSourceIncome;
@@ -377,7 +352,7 @@ export var individualSlice = createSlice({
377
352
  if (!!selectedMonthlyIncome)
378
353
  state.data.individualData.monthlyIncome = selectedMonthlyIncome;
379
354
  if (!!countryCode) {
380
- var employerLocation = state.data.countries.find(function (country) { return country.iso2 === countryCode; });
355
+ var employerLocation = countries.find(function (country) { return country.iso2 === countryCode; });
381
356
  state.data.individualData.employerLocation = employerLocation;
382
357
  }
383
358
  })
@@ -438,7 +413,6 @@ export var individualSlice = createSlice({
438
413
  }
439
414
  var flows = response.flows, steps = response.steps;
440
415
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
441
- removeRequestHeaders();
442
416
  })
443
417
  .addCase(updateLeadSuccess.pending, function (state) {
444
418
  state.loading = true;
@@ -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: []
@@ -191,13 +192,104 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
191
192
  return [4, API.leadService.updateLead(payload)];
192
193
  case 1:
193
194
  data = (_g.sent()).data;
195
+ if (!!data.errors) return [3, 3];
194
196
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
195
197
  case 2:
196
198
  _g.sent();
197
199
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
198
200
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
199
201
  thunkApi.dispatch(handleNextScreenStep());
200
- return [2, { response: data, formData: params }];
202
+ _g.label = 3;
203
+ case 3: return [2, { response: data, formData: params }];
204
+ }
205
+ });
206
+ }); });
207
+ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
208
+ var token, leadId, payload, data;
209
+ var _a, _b;
210
+ return __generator(this, function (_c) {
211
+ switch (_c.label) {
212
+ case 0:
213
+ token = params.token, leadId = params.leadId;
214
+ payload = {
215
+ auth_type: 7,
216
+ auth_token: token
217
+ };
218
+ return [4, API.authService.verifyAuth(payload)];
219
+ case 1:
220
+ data = (_c.sent()).data;
221
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
222
+ if ((data === null || data === void 0 ? void 0 : data.errors) || (data === null || data === void 0 ? void 0 : data.mw_error)) {
223
+ 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);
224
+ }
225
+ return [2, { data: data, token: token, leadId: leadId }];
226
+ }
227
+ });
228
+ }); });
229
+ export var resendOperationOTP = createAsyncThunk('resendOperationOTPPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
230
+ var password, payload, data;
231
+ return __generator(this, function (_a) {
232
+ switch (_a.label) {
233
+ case 0:
234
+ password = thunkApi.getState().password;
235
+ payload = {
236
+ auth_type: 7,
237
+ auth_token: password.data.verify.token
238
+ };
239
+ return [4, API.authService.verifyAuth(payload)];
240
+ case 1:
241
+ data = (_a.sent()).data;
242
+ return [2, { data: data }];
243
+ }
244
+ });
245
+ }); });
246
+ export var resetPassword = createAsyncThunk('resetPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
247
+ var _a, password, settings, responseBody, passwordData, payload, data;
248
+ var _b, _c;
249
+ return __generator(this, function (_d) {
250
+ switch (_d.label) {
251
+ case 0:
252
+ _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
253
+ responseBody = password.data.verify.responseBody;
254
+ passwordData = password.data.passwordData;
255
+ payload = {
256
+ auth_type: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_type,
257
+ auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
258
+ step_name: PASSWORD_STEP_NAMES.RESET_PASSWORD,
259
+ user_credentail: {
260
+ otp: params.otp,
261
+ new_password: passwordData.password
262
+ },
263
+ encryption_contract: ['user_credentail.otp', 'user_credentail.new_password']
264
+ };
265
+ return [4, API.authService.verifyAuth(payload)];
266
+ case 1:
267
+ data = (_d.sent()).data;
268
+ if (!(data === null || data === void 0 ? void 0 : data.errors)) {
269
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
270
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, payload);
271
+ }
272
+ return [2, { data: data, formData: __assign(__assign({}, params), passwordData) }];
273
+ }
274
+ });
275
+ }); });
276
+ export var retrieveLead = createAsyncThunk('retrieveLeadPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
277
+ var _a, password, settings, id, data;
278
+ var _b, _c, _d, _e;
279
+ return __generator(this, function (_f) {
280
+ switch (_f.label) {
281
+ case 0:
282
+ _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
283
+ id = (password.data.verify.responseBody || { id: '' }).id;
284
+ return [4, API.leadService.retrieveLead(id)];
285
+ case 1:
286
+ data = (_f.sent()).data;
287
+ if (!(data === null || data === void 0 ? void 0 : data.errors)) {
288
+ thunkApi.dispatch(handleNextScreenStep());
289
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { id: id });
290
+ (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, { data: data });
291
+ }
292
+ return [2, data];
201
293
  }
202
294
  });
203
295
  }); });
@@ -230,12 +322,16 @@ export var passwordSlice = createSlice({
230
322
  },
231
323
  resetOTPScreen: function (state) {
232
324
  state.data.otpData.otp = '';
325
+ },
326
+ storePasswordScreen: function (state, action) {
327
+ state.data.passwordData = action.payload;
233
328
  }
234
329
  },
235
330
  extraReducers: function (builder) {
236
331
  builder
237
332
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
238
333
  var _a;
334
+ state.data.verify.operationType = PASSWORD_OPERATION_TYPE.SET_PASSWORD;
239
335
  state.error = null;
240
336
  state.customLoading = false;
241
337
  var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
@@ -346,7 +442,6 @@ export var passwordSlice = createSlice({
346
442
  }
347
443
  var flows = response.flows, steps = response.steps;
348
444
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
349
- removeRequestHeaders();
350
445
  })
351
446
  .addCase(updateLeadSuccess.pending, function (state) {
352
447
  state.loading = true;
@@ -355,9 +450,90 @@ export var passwordSlice = createSlice({
355
450
  .addCase(updateLeadSuccess.rejected, function (state, action) {
356
451
  state.loading = false;
357
452
  state.error = action.error.message;
453
+ })
454
+ .addCase(verifyOperationToken.fulfilled, function (state, action) {
455
+ var _a;
456
+ state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
457
+ state.error = null;
458
+ state.customLoading = false;
459
+ var _b = action.payload, data = _b.data, token = _b.token, leadId = _b.leadId;
460
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
461
+ if (description) {
462
+ state.error = description;
463
+ return;
464
+ }
465
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { id: leadId });
466
+ state.data.verify.token = token;
467
+ })
468
+ .addCase(verifyOperationToken.pending, function (state) {
469
+ state.customLoading = true;
470
+ state.error = null;
471
+ })
472
+ .addCase(verifyOperationToken.rejected, function (state, action) {
473
+ state.error = action.error.message;
474
+ state.customLoading = false;
475
+ })
476
+ .addCase(resendOperationOTP.pending, function (state) {
477
+ state.error = null;
478
+ })
479
+ .addCase(resendOperationOTP.fulfilled, function (state, action) {
480
+ var _a;
481
+ state.error = null;
482
+ var data = action.payload.data;
483
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
484
+ if (description) {
485
+ state.error = description;
486
+ return;
487
+ }
488
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
489
+ })
490
+ .addCase(resendOperationOTP.rejected, function (state, action) {
491
+ state.error = action.error.message;
492
+ })
493
+ .addCase(resetPassword.fulfilled, function (state, action) {
494
+ var _a;
495
+ state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
496
+ state.error = null;
497
+ state.loading = false;
498
+ var _b = action.payload, data = _b.data, formData = _b.formData;
499
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
500
+ if (description) {
501
+ state.error = description;
502
+ return;
503
+ }
504
+ state.data.passwordData = formData;
505
+ state.data.passwordData.responseBody = data;
506
+ })
507
+ .addCase(resetPassword.pending, function (state) {
508
+ state.loading = true;
509
+ state.error = null;
510
+ })
511
+ .addCase(resetPassword.rejected, function (state, action) {
512
+ state.error = action.error.message;
513
+ state.loading = false;
514
+ })
515
+ .addCase(retrieveLead.fulfilled, function (state, action) {
516
+ var _a;
517
+ state.loading = false;
518
+ state.error = null;
519
+ var data = action.payload;
520
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
521
+ if (description) {
522
+ state.error = description;
523
+ return;
524
+ }
525
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
526
+ })
527
+ .addCase(retrieveLead.pending, function (state) {
528
+ state.loading = true;
529
+ state.error = null;
530
+ })
531
+ .addCase(retrieveLead.rejected, function (state, action) {
532
+ state.loading = false;
533
+ state.error = action.error.message;
358
534
  });
359
535
  }
360
536
  });
361
- export var clearError = (_a = passwordSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
537
+ export var clearError = (_a = passwordSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, storePasswordScreen = _a.storePasswordScreen;
362
538
  export default passwordSlice.reducer;
363
539
  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: []
@@ -190,13 +191,15 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
190
191
  return [4, API.leadService.updateLead(payload)];
191
192
  case 1:
192
193
  data = (_g.sent()).data;
194
+ if (!!data.errors) return [3, 3];
193
195
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
194
196
  case 2:
195
197
  _g.sent();
196
198
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
197
199
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
198
200
  thunkApi.dispatch(handleNextScreenStep());
199
- return [2, { response: data, formData: params }];
201
+ _g.label = 3;
202
+ case 3: return [2, { response: data, formData: params }];
200
203
  }
201
204
  });
202
205
  }); });
@@ -345,7 +348,6 @@ export var taxSlice = createSlice({
345
348
  }
346
349
  var flows = response.flows, steps = response.steps;
347
350
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
348
- removeRequestHeaders();
349
351
  })
350
352
  .addCase(updateLeadSuccess.pending, function (state) {
351
353
  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);