@tap-payments/auth-jsconnect 1.0.89 → 1.0.93-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 (117) hide show
  1. package/README.md +86 -135
  2. package/build/@types/app.d.ts +9 -0
  3. package/build/@types/app.js +9 -0
  4. package/build/@types/form.d.ts +2 -0
  5. package/build/api/availabilityServices.d.ts +2 -0
  6. package/build/api/axios.js +1 -2
  7. package/build/api/index.d.ts +2 -2
  8. package/build/api/index.js +2 -2
  9. package/build/app/rootReducer.d.ts +0 -1
  10. package/build/app/rootReducer.js +1 -3
  11. package/build/app/store.d.ts +0 -2
  12. package/build/components/AnimationFlow/BottomSheet.js +1 -1
  13. package/build/components/Button/Button.d.ts +6 -1
  14. package/build/components/Button/Button.js +61 -23
  15. package/build/components/Footer/Footer.d.ts +0 -2
  16. package/build/components/Footer/Footer.js +0 -1
  17. package/build/constants/api.d.ts +3 -1
  18. package/build/constants/api.js +6 -2
  19. package/build/constants/app.d.ts +0 -1
  20. package/build/constants/app.js +0 -8
  21. package/build/features/app/bank/bankStore.d.ts +5 -1
  22. package/build/features/app/bank/bankStore.js +38 -1
  23. package/build/features/app/business/businessStore.d.ts +5 -1
  24. package/build/features/app/business/businessStore.js +40 -5
  25. package/build/features/app/connect/connectStore.d.ts +2 -1
  26. package/build/features/app/connect/connectStore.js +19 -8
  27. package/build/features/app/individual/individualStore.d.ts +5 -1
  28. package/build/features/app/individual/individualStore.js +36 -0
  29. package/build/features/app/password/passwordStore.d.ts +5 -1
  30. package/build/features/app/password/passwordStore.js +37 -1
  31. package/build/features/app/tax/taxStore.d.ts +5 -1
  32. package/build/features/app/tax/taxStore.js +39 -2
  33. package/build/features/bank/Bank.js +9 -4
  34. package/build/features/bank/screens/BankDetails/BankDetails.js +6 -1
  35. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  36. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  37. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  38. package/build/features/bank/screens/BankDetails/validation.js +2 -1
  39. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  40. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  41. package/build/features/bank/screens/Verify/OTPInput.js +6 -1
  42. package/build/features/bank/screens/Verify/Verify.js +3 -2
  43. package/build/features/business/Business.js +9 -4
  44. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  45. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  46. package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
  47. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -1
  48. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  49. package/build/features/business/screens/Verify/OTPInput.js +6 -1
  50. package/build/features/business/screens/Verify/Verify.js +3 -2
  51. package/build/features/connect/Connect.js +5 -3
  52. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  53. package/build/features/connect/screens/NID/NID.js +1 -1
  54. package/build/features/featuresScreens.d.ts +0 -1
  55. package/build/features/featuresScreens.js +0 -7
  56. package/build/features/individual/Individual.js +9 -4
  57. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +3 -3
  58. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  59. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  60. package/build/features/individual/screens/Verify/OTPInput.js +6 -1
  61. package/build/features/individual/screens/Verify/Verify.js +3 -2
  62. package/build/features/password/Password.js +9 -4
  63. package/build/features/password/screens/CreatePassword/CreatePassword.js +5 -1
  64. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  65. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  66. package/build/features/password/screens/Verify/OTPInput.js +6 -1
  67. package/build/features/password/screens/Verify/Verify.js +3 -2
  68. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +1 -1
  69. package/build/features/shared/Background/Background.js +3 -3
  70. package/build/features/shared/Background/LogoBackground.js +1 -4
  71. package/build/features/shared/Button/AbsherButton.d.ts +1 -2
  72. package/build/features/shared/Button/AbsherButton.js +5 -32
  73. package/build/features/shared/Button/EmailProvidersButtons.js +13 -48
  74. package/build/features/shared/Button/FlowsButtons.d.ts +4 -1
  75. package/build/features/shared/Button/FlowsButtons.js +51 -46
  76. package/build/features/shared/Button/MobileButton.d.ts +1 -2
  77. package/build/features/shared/Button/MobileButton.js +3 -29
  78. package/build/features/shared/Button/SuccessButton.js +18 -16
  79. package/build/features/shared/Footer/Footer.js +1 -1
  80. package/build/features/shared/OTP/OTP.d.ts +2 -1
  81. package/build/features/shared/OTP/OTP.js +10 -2
  82. package/build/features/tax/Tax.js +9 -4
  83. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  84. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  85. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  86. package/build/features/tax/screens/TaxDetails/TaxDetails.js +9 -2
  87. package/build/features/tax/screens/TaxDetails/VATId.js +13 -2
  88. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  89. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  90. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  91. package/build/features/tax/screens/Verify/OTPInput.js +6 -1
  92. package/build/features/tax/screens/Verify/Verify.js +3 -2
  93. package/build/hooks/index.d.ts +1 -0
  94. package/build/hooks/index.js +1 -0
  95. package/build/hooks/useAppConfig.js +11 -1
  96. package/build/hooks/useAppDispatch.d.ts +0 -1
  97. package/build/hooks/useErrorListener.d.ts +1 -1
  98. package/build/hooks/useErrorListener.js +4 -6
  99. package/build/hooks/useStepStartedListener.d.ts +1 -0
  100. package/build/hooks/useStepStartedListener.js +10 -0
  101. package/build/index.d.ts +2 -3
  102. package/build/index.js +2 -5
  103. package/build/theme/theme.js +10 -0
  104. package/build/utils/locale.js +2 -2
  105. package/build/utils/string.d.ts +3 -1
  106. package/build/utils/string.js +35 -2
  107. package/package.json +127 -126
  108. package/build/features/Landing/Landing.d.ts +0 -7
  109. package/build/features/Landing/Landing.js +0 -55
  110. package/build/features/Landing/index.d.ts +0 -1
  111. package/build/features/Landing/index.js +0 -1
  112. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  113. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  114. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  115. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  116. package/build/features/app/landing/landingStore.d.ts +0 -22
  117. package/build/features/app/landing/landingStore.js +0 -103
@@ -48,6 +48,7 @@ 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 { FlowsTypes } from '../../../@types';
51
52
  import { hasKey, removeRequestHeaders } from '../../../utils';
52
53
  import { handleNextScreenStep } from '../../../app/settings';
53
54
  import { BANK_STEP_NAMES } from '../../../constants';
@@ -85,6 +86,23 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
85
86
  }
86
87
  });
87
88
  }); });
89
+ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
90
+ var bank, payload, data;
91
+ return __generator(this, function (_a) {
92
+ switch (_a.label) {
93
+ case 0:
94
+ bank = thunkApi.getState().bank;
95
+ payload = {
96
+ service_name: 'tap_email',
97
+ verify_token: bank.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 verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
89
107
  var _a, bank, settings, responseBody, payload, data, steps, hasCompleted;
90
108
  var _b, _c, _d, _e;
@@ -215,6 +233,7 @@ var initialState = {
215
233
  loading: false,
216
234
  customLoading: false,
217
235
  data: {
236
+ flowName: FlowsTypes.BANK,
218
237
  verify: {
219
238
  token: ''
220
239
  },
@@ -224,7 +243,8 @@ var initialState = {
224
243
  bankData: {
225
244
  iban: '',
226
245
  beneficiaryName: '',
227
- bankName: ''
246
+ bankName: '',
247
+ confirmPolicy: false
228
248
  }
229
249
  }
230
250
  };
@@ -264,6 +284,23 @@ export var bankSlice = createSlice({
264
284
  .addCase(verifyLeadToken.rejected, function (state, action) {
265
285
  state.error = action.error.message;
266
286
  state.customLoading = false;
287
+ })
288
+ .addCase(resendOTP.pending, function (state) {
289
+ state.error = null;
290
+ })
291
+ .addCase(resendOTP.fulfilled, function (state, action) {
292
+ var _a;
293
+ state.error = null;
294
+ var data = action.payload.data;
295
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
296
+ if (description) {
297
+ state.error = description;
298
+ return;
299
+ }
300
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
301
+ })
302
+ .addCase(resendOTP.rejected, function (state, action) {
303
+ state.error = action.error.message;
267
304
  })
268
305
  .addCase(verifyBankLeadOTP.pending, function (state) {
269
306
  state.loading = true;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, CountryCode, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, CountryCode, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes } from '../../../@types';
3
3
  export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  businessCountry: any;
5
5
  countries: any;
@@ -9,6 +9,9 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
9
9
  leadData: any;
10
10
  token: string;
11
11
  }, string, {}>;
12
+ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
13
+ data: any;
14
+ }, void, {}>;
12
15
  export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
13
16
  data: any;
14
17
  formData: {
@@ -81,6 +84,7 @@ export interface BusinessData {
81
84
  businessTypeData: BusinessTypeFormValues & ResponseData;
82
85
  activitiesData: ActivitiesFormValues & ResponseData;
83
86
  customersData: CustomersFormValues & ResponseData;
87
+ flowName: FlowsTypes;
84
88
  }
85
89
  export interface BusinessState extends SharedState<BusinessData> {
86
90
  }
@@ -58,7 +58,7 @@ var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import moment from 'moment';
60
60
  import API from '../../../api';
61
- import { BusinessType } from '../../../@types';
61
+ import { BusinessType, FlowsTypes } from '../../../@types';
62
62
  import { BUSINESS_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
63
  import { convertNumbers2English, getFlowUrl, hasKey, removeRequestHeaders } from '../../../utils';
64
64
  import { handleNextScreenStep } from '../../../app/settings';
@@ -106,6 +106,23 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
106
106
  }
107
107
  });
108
108
  }); });
109
+ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
110
+ var business, payload, data;
111
+ return __generator(this, function (_a) {
112
+ switch (_a.label) {
113
+ case 0:
114
+ business = thunkApi.getState().business;
115
+ payload = {
116
+ service_name: 'tap_email',
117
+ verify_token: business.data.verify.token
118
+ };
119
+ return [4, API.leadService.verifyLeadToken(payload)];
120
+ case 1:
121
+ data = (_a.sent()).data;
122
+ return [2, { data: data }];
123
+ }
124
+ });
125
+ }); });
109
126
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
110
127
  var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted;
111
128
  var _b, _c, _d, _e;
@@ -381,19 +398,19 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
381
398
  flows: [
382
399
  {
383
400
  name: 'tax',
384
- url: getFlowUrl('/tax')
401
+ url: getFlowUrl('/tax', settings.data.language)
385
402
  },
386
403
  {
387
404
  name: 'bank',
388
- url: getFlowUrl('/bank')
405
+ url: getFlowUrl('/bank', settings.data.language)
389
406
  },
390
407
  {
391
408
  name: 'individual',
392
- url: getFlowUrl('/individual')
409
+ url: getFlowUrl('/individual', settings.data.language)
393
410
  },
394
411
  {
395
412
  name: 'password',
396
- url: getFlowUrl('/password')
413
+ url: getFlowUrl('/password', settings.data.language)
397
414
  }
398
415
  ],
399
416
  encryption_contract: []
@@ -435,6 +452,7 @@ var initialState = {
435
452
  loading: false,
436
453
  customLoading: false,
437
454
  data: {
455
+ flowName: FlowsTypes.BUSINESS,
438
456
  businessCountry: defaultCountry,
439
457
  countries: [],
440
458
  verify: {
@@ -520,6 +538,23 @@ export var businessSlice = createSlice({
520
538
  .addCase(verifyLeadToken.rejected, function (state, action) {
521
539
  state.error = action.error.message;
522
540
  state.customLoading = false;
541
+ })
542
+ .addCase(resendOTP.pending, function (state) {
543
+ state.error = null;
544
+ })
545
+ .addCase(resendOTP.fulfilled, function (state, action) {
546
+ var _a;
547
+ state.error = null;
548
+ var data = action.payload.data;
549
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
550
+ if (description) {
551
+ state.error = description;
552
+ return;
553
+ }
554
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
555
+ })
556
+ .addCase(resendOTP.rejected, function (state, action) {
557
+ state.error = action.error.message;
523
558
  })
524
559
  .addCase(verifyLeadOTP.pending, function (state) {
525
560
  state.loading = true;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues } from '../../../@types';
2
+ import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, FlowsTypes } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  businessCountry: any;
@@ -91,6 +91,7 @@ export interface ConnectData {
91
91
  };
92
92
  individualData: IndividualFormValues & ResponseData;
93
93
  brandData: BrandFormValues & ResponseData;
94
+ flowName: FlowsTypes;
94
95
  }
95
96
  export interface ConnectState extends SharedState<ConnectData> {
96
97
  }
@@ -57,6 +57,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import { handleNextScreenStep } from '../../../app/settings';
60
+ import { FlowsTypes } from '../../../@types';
60
61
  import API from '../../../api';
61
62
  import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
62
63
  import { defaultCountry } from '../../../constants';
@@ -218,7 +219,9 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
218
219
  ])];
219
220
  case 1:
220
221
  _a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
221
- thunkApi.dispatch(handleNextScreenStep(params.stepName));
222
+ if (!data.errors) {
223
+ thunkApi.dispatch(handleNextScreenStep(params.stepName));
224
+ }
222
225
  return [2, { response: data, brandResponse: brandResponse, formData: params }];
223
226
  }
224
227
  });
@@ -318,7 +321,8 @@ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', f
318
321
  switch (_b.label) {
319
322
  case 0:
320
323
  requestBody = {
321
- email: email
324
+ email: email,
325
+ encryption_contract: ['email']
322
326
  };
323
327
  return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
324
328
  case 1:
@@ -339,7 +343,8 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
339
343
  switch (_b.label) {
340
344
  case 0:
341
345
  requestBody = {
342
- profile_name: name
346
+ profile_name: name,
347
+ encryption_contract: ['profile_name']
343
348
  };
344
349
  return [4, API.availabilityServices.checkBrand(requestBody, { cancelToken: cancelToken })];
345
350
  case 1:
@@ -369,7 +374,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
369
374
  flows: [
370
375
  {
371
376
  name: 'business',
372
- url: getFlowUrl('/business')
377
+ url: getFlowUrl('/business', settings.data.language)
373
378
  }
374
379
  ],
375
380
  id: leadId,
@@ -389,6 +394,7 @@ var initialState = {
389
394
  loading: false,
390
395
  customLoading: false,
391
396
  data: {
397
+ flowName: FlowsTypes.CONNECT,
392
398
  businessCountry: defaultCountry,
393
399
  countries: [],
394
400
  mobileData: {
@@ -574,14 +580,19 @@ export var connectSlice = createSlice({
574
580
  state.error = null;
575
581
  var _c = action.payload, response = _c.response, brandResponse = _c.brandResponse;
576
582
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
577
- var brandError = ((_b = brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.errors) === null || _b === void 0 ? void 0 : _b[0]) || {};
578
- if (!!brandError && !description) {
579
- var brandList = (Array.isArray(brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands) ? __spreadArray(__spreadArray([], brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands, true), [OTHER_BRAND], false) : []) || [];
580
- state.data.brandData.responseBody = __assign({ brands: brandList }, response);
583
+ var brandError = (((_b = brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
584
+ if (description) {
585
+ state.error = description;
586
+ return;
587
+ }
588
+ var brandList = undefined;
589
+ if (!brandError) {
590
+ brandList = Array.isArray(brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands) ? __spreadArray(__spreadArray([], brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands, true), [OTHER_BRAND], false) : [];
581
591
  var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
582
592
  if (!!brand)
583
593
  state.data.brandData.selectedBrandItem = brand;
584
594
  }
595
+ state.data.brandData.responseBody = __assign({ brands: brandList || [] }, response);
585
596
  })
586
597
  .addCase(createLead.pending, function (state) {
587
598
  state.loading = true;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { CountryCode, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  businessCountry: any;
5
5
  countries: any;
@@ -9,6 +9,9 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
9
9
  leadData: any;
10
10
  token: string;
11
11
  }, string, {}>;
12
+ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
13
+ data: any;
14
+ }, void, {}>;
12
15
  export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
13
16
  sourceIncome: any;
14
17
  monthlyIncome: any;
@@ -40,6 +43,7 @@ export interface IndividualData {
40
43
  verify: ResponseData & VerifyData;
41
44
  otpData: OTPFormValues & ResponseData;
42
45
  individualData: IndividualExtraFormValues & ResponseData;
46
+ flowName: FlowsTypes;
43
47
  }
44
48
  export interface IndividualState extends SharedState<IndividualData> {
45
49
  }
@@ -48,6 +48,7 @@ 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 { FlowsTypes } from '../../../@types';
51
52
  import { hasKey, removeRequestHeaders } from '../../../utils';
52
53
  import { handleNextScreenStep } from '../../../app/settings';
53
54
  import { defaultCountry, INDIVIDUAl_STEP_NAMES } from '../../../constants';
@@ -104,6 +105,23 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
104
105
  }
105
106
  });
106
107
  }); });
108
+ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
109
+ var individual, payload, data;
110
+ return __generator(this, function (_a) {
111
+ switch (_a.label) {
112
+ case 0:
113
+ individual = thunkApi.getState().individual;
114
+ payload = {
115
+ service_name: 'tap_email',
116
+ verify_token: individual.data.verify.token
117
+ };
118
+ return [4, API.leadService.verifyLeadToken(payload)];
119
+ case 1:
120
+ data = (_a.sent()).data;
121
+ return [2, { data: data }];
122
+ }
123
+ });
124
+ }); });
107
125
  export var retrieveDataList = createAsyncThunk('retrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
108
126
  var _a, sourceIncome, monthlyIncome;
109
127
  return __generator(this, function (_b) {
@@ -231,6 +249,7 @@ var initialState = {
231
249
  error: null,
232
250
  loading: false,
233
251
  data: {
252
+ flowName: FlowsTypes.INDIVIDUAL,
234
253
  countries: [],
235
254
  businessCountry: defaultCountry,
236
255
  verify: {
@@ -302,6 +321,23 @@ export var individualSlice = createSlice({
302
321
  .addCase(verifyLeadToken.rejected, function (state, action) {
303
322
  state.error = action.error.message;
304
323
  state.customLoading = false;
324
+ })
325
+ .addCase(resendOTP.pending, function (state) {
326
+ state.error = null;
327
+ })
328
+ .addCase(resendOTP.fulfilled, function (state, action) {
329
+ var _a;
330
+ state.error = null;
331
+ var data = action.payload.data;
332
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
333
+ if (description) {
334
+ state.error = description;
335
+ return;
336
+ }
337
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
338
+ })
339
+ .addCase(resendOTP.rejected, function (state, action) {
340
+ state.error = action.error.message;
305
341
  })
306
342
  .addCase(verifyLeadOTP.pending, function (state) {
307
343
  state.loading = true;
@@ -1,10 +1,13 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { OTPFormValues, PasswordCreateFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { FlowsTypes, OTPFormValues, PasswordCreateFormValues, ResponseData, SharedState } 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, {}>;
@@ -29,6 +32,7 @@ export interface PasswordData {
29
32
  verify: ResponseData & VerifyData;
30
33
  otpData: OTPFormValues & ResponseData;
31
34
  passwordData: PasswordCreateFormValues & ResponseData;
35
+ flowName: FlowsTypes;
32
36
  }
33
37
  export interface PasswordState extends SharedState<PasswordData> {
34
38
  }
@@ -48,6 +48,7 @@ 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 { FlowsTypes } from '../../../@types';
51
52
  import { hasKey, removeRequestHeaders } from '../../../utils';
52
53
  import { handleNextScreenStep } from '../../../app/settings';
53
54
  import { PASSWORD_STEP_NAMES } from '../../../constants';
@@ -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) {
@@ -187,6 +205,7 @@ var initialState = {
187
205
  error: null,
188
206
  loading: false,
189
207
  data: {
208
+ flowName: FlowsTypes.PASSWORD,
190
209
  verify: {
191
210
  token: ''
192
211
  },
@@ -228,13 +247,30 @@ export var passwordSlice = createSlice({
228
247
  state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
229
248
  state.data.verify.token = token;
230
249
  })
231
- .addCase(verifyLeadToken.pending, function (state, action) {
250
+ .addCase(verifyLeadToken.pending, function (state) {
232
251
  state.customLoading = true;
233
252
  state.error = null;
234
253
  })
235
254
  .addCase(verifyLeadToken.rejected, function (state, action) {
236
255
  state.error = action.error.message;
237
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;
238
274
  })
239
275
  .addCase(verifyPasswordLeadOTP.pending, function (state) {
240
276
  state.loading = true;
@@ -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,6 +48,7 @@ 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 { FlowsTypes } from '../../../@types';
51
52
  import { hasKey, removeRequestHeaders } from '../../../utils';
52
53
  import { handleNextScreenStep } from '../../../app/settings';
53
54
  import { TAX_STEP_NAMES } from '../../../constants';
@@ -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) {
@@ -186,6 +204,7 @@ var initialState = {
186
204
  error: null,
187
205
  loading: false,
188
206
  data: {
207
+ flowName: FlowsTypes.TAX,
189
208
  verify: {
190
209
  token: ''
191
210
  },
@@ -193,7 +212,8 @@ var initialState = {
193
212
  otp: ''
194
213
  },
195
214
  taxData: {
196
- vatId: ''
215
+ vatId: '',
216
+ confirmPolicy: false
197
217
  }
198
218
  }
199
219
  };
@@ -226,13 +246,30 @@ export var taxSlice = createSlice({
226
246
  state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
227
247
  state.data.verify.token = token;
228
248
  })
229
- .addCase(verifyLeadToken.pending, function (state, action) {
249
+ .addCase(verifyLeadToken.pending, function (state) {
230
250
  state.error = null;
231
251
  state.customLoading = true;
232
252
  })
233
253
  .addCase(verifyLeadToken.rejected, function (state, action) {
234
254
  state.error = action.error.message;
235
255
  state.customLoading = false;
256
+ })
257
+ .addCase(resendOTP.pending, function (state) {
258
+ state.error = null;
259
+ })
260
+ .addCase(resendOTP.fulfilled, function (state, action) {
261
+ var _a;
262
+ state.error = null;
263
+ var data = action.payload.data;
264
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
265
+ if (description) {
266
+ state.error = description;
267
+ return;
268
+ }
269
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
270
+ })
271
+ .addCase(resendOTP.rejected, function (state, action) {
272
+ state.error = action.error.message;
236
273
  })
237
274
  .addCase(verifyTaxLeadOTP.pending, function (state) {
238
275
  state.loading = true;
@@ -11,8 +11,8 @@ 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';
15
- import { settingsSelector } from '../../app/settings';
14
+ import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig, useStepStartedListener } from '../../hooks';
15
+ import { handleLanguage, settingsSelector } from '../../app/settings';
16
16
  import AnimationFlow from '../../components/AnimationFlow';
17
17
  import { store } from '../../app/store';
18
18
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
@@ -28,14 +28,19 @@ 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;
31
+ var _b = useAppSelector(bankSelector), customLoading = _b.customLoading, bankError = _b.error;
32
32
  var loading = useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props)).loading;
33
- useErrorListener();
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');
38
+ var lang = getParameterByName('lang');
37
39
  if (!token)
38
40
  throw new Error('Auth token is not found!');
41
+ if (!lang)
42
+ throw new Error('Language is not found!');
43
+ dispatch(handleLanguage(lang));
39
44
  dispatch(verifyLeadToken(token));
40
45
  };
41
46
  useEffect(function () {
@@ -25,6 +25,8 @@ import { useLanguage } from '../../../../hooks';
25
25
  import { styled } from '@mui/material/styles';
26
26
  import { bankSelector, createBankAccount } from '../../../app/bank/bankStore';
27
27
  import Form from '../../../../components/Form';
28
+ import { handleCurrentActiveScreen } from '../../../../app/settings';
29
+ import ConfirmPolicy from './ConfirmPolicy';
28
30
  var FormStyled = styled(Form)(function () { return ({
29
31
  display: 'flex',
30
32
  flexDirection: 'column',
@@ -50,7 +52,10 @@ var BankDetails = function () {
50
52
  };
51
53
  var t = useTranslation().t;
52
54
  var isAr = useLanguage().isAr;
55
+ var onBack = function () {
56
+ dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
57
+ };
53
58
  var disabled = ibanChecking || !methods.formState.isValid;
54
- 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({ disableBack: true, 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') }))] })) })) }));
55
60
  };
56
61
  export default BankDetails;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const ConfirmPolicy: () => JSX.Element;
3
+ export default ConfirmPolicy;