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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +58 -52
  2. package/build/@types/app.d.ts +11 -2
  3. package/build/@types/app.js +9 -0
  4. package/build/@types/form.d.ts +2 -0
  5. package/build/api/auth.d.ts +22 -3
  6. package/build/api/axios.d.ts +2 -0
  7. package/build/api/axios.js +64 -0
  8. package/build/api/country.d.ts +1 -2
  9. package/build/api/country.js +7 -8
  10. package/build/api/firebase.d.ts +1 -1
  11. package/build/api/firebase.js +5 -2
  12. package/build/api/index.d.ts +7 -8
  13. package/build/api/ip.d.ts +1 -1
  14. package/build/api/ip.js +5 -2
  15. package/build/api/lead.d.ts +2 -0
  16. package/build/api/operator.d.ts +1 -1
  17. package/build/api/operator.js +60 -4
  18. package/build/app/rootReducer.d.ts +0 -1
  19. package/build/app/rootReducer.js +1 -3
  20. package/build/app/settings.d.ts +9 -12
  21. package/build/app/settings.js +87 -111
  22. package/build/app/store.d.ts +0 -2
  23. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  24. package/build/components/AnimationFlow/AnimationFlow.js +2 -2
  25. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  26. package/build/components/AnimationFlow/BottomSheet.js +16 -4
  27. package/build/components/AnimationFlow/Loader.js +1 -1
  28. package/build/constants/app.d.ts +6 -1
  29. package/build/constants/app.js +16 -12
  30. package/build/features/app/bank/bankStore.d.ts +5 -1
  31. package/build/features/app/bank/bankStore.js +41 -4
  32. package/build/features/app/business/businessStore.d.ts +5 -7
  33. package/build/features/app/business/businessStore.js +44 -46
  34. package/build/features/app/connect/connectStore.d.ts +2 -7
  35. package/build/features/app/connect/connectStore.js +23 -55
  36. package/build/features/app/individual/individualStore.d.ts +6 -7
  37. package/build/features/app/individual/individualStore.js +55 -50
  38. package/build/features/app/password/passwordStore.d.ts +34 -2
  39. package/build/features/app/password/passwordStore.js +218 -8
  40. package/build/features/app/tax/taxStore.d.ts +5 -1
  41. package/build/features/app/tax/taxStore.js +43 -6
  42. package/build/features/bank/Bank.js +8 -7
  43. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  44. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  45. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  46. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  47. package/build/features/bank/screens/BankDetails/validation.js +2 -1
  48. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  49. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  50. package/build/features/bank/screens/Verify/OTPInput.js +6 -1
  51. package/build/features/bank/screens/Verify/Verify.js +3 -2
  52. package/build/features/business/Business.js +9 -11
  53. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -5
  54. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  55. package/build/features/business/screens/Verify/OTPInput.js +6 -1
  56. package/build/features/business/screens/Verify/Verify.js +3 -2
  57. package/build/features/connect/Connect.js +7 -9
  58. package/build/features/connect/screens/Merchant/BrandName.js +3 -2
  59. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  60. package/build/features/featuresScreens.d.ts +0 -1
  61. package/build/features/featuresScreens.js +5 -7
  62. package/build/features/individual/Individual.js +9 -11
  63. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -2
  64. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  65. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  66. package/build/features/individual/screens/Verify/OTPInput.js +6 -1
  67. package/build/features/individual/screens/Verify/Verify.js +3 -2
  68. package/build/features/password/Password.js +16 -9
  69. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  70. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  71. package/build/features/password/screens/OTP/OTP.js +78 -0
  72. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  73. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  74. package/build/features/password/screens/OTP/index.d.ts +3 -0
  75. package/build/features/password/screens/OTP/index.js +2 -0
  76. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  77. package/build/features/password/screens/OTP/validation.js +4 -0
  78. package/build/features/password/screens/Success/Success.js +8 -2
  79. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -5
  80. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  81. package/build/features/password/screens/Verify/OTPInput.js +6 -1
  82. package/build/features/password/screens/Verify/Verify.js +3 -2
  83. package/build/features/shared/Background/Background.js +3 -2
  84. package/build/features/shared/Background/LogoBackground.d.ts +1 -4
  85. package/build/features/shared/Background/LogoBackground.js +4 -32
  86. package/build/features/shared/Button/AbsherButton.js +3 -8
  87. package/build/features/shared/Button/EmailProvidersButtons.js +2 -1
  88. package/build/features/shared/Button/FlowsButtons.d.ts +10 -1
  89. package/build/features/shared/Button/FlowsButtons.js +100 -7
  90. package/build/features/shared/Button/MobileButton.js +3 -8
  91. package/build/features/shared/Button/SuccessButton.js +17 -13
  92. package/build/features/shared/Footer/Footer.js +2 -3
  93. package/build/features/shared/OTP/OTP.d.ts +2 -1
  94. package/build/features/shared/OTP/OTP.js +10 -2
  95. package/build/features/tax/Tax.js +7 -6
  96. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  97. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  98. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  99. package/build/features/tax/screens/TaxDetails/TaxDetails.js +5 -2
  100. package/build/features/tax/screens/TaxDetails/VATId.js +13 -2
  101. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  102. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  103. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  104. package/build/features/tax/screens/Verify/OTPInput.js +6 -1
  105. package/build/features/tax/screens/Verify/Verify.js +3 -2
  106. package/build/hooks/index.d.ts +1 -0
  107. package/build/hooks/index.js +1 -0
  108. package/build/hooks/useAppConfig.d.ts +1 -4
  109. package/build/hooks/useAppConfig.js +13 -110
  110. package/build/hooks/useAppDispatch.d.ts +0 -1
  111. package/build/hooks/useAppTheme.js +3 -2
  112. package/build/hooks/useErrorListener.d.ts +1 -1
  113. package/build/hooks/useErrorListener.js +4 -6
  114. package/build/hooks/useStepStartedListener.d.ts +1 -0
  115. package/build/hooks/useStepStartedListener.js +10 -0
  116. package/build/index.d.ts +2 -3
  117. package/build/index.js +2 -5
  118. package/build/theme/theme.d.ts +1 -1
  119. package/build/theme/theme.js +1 -2
  120. package/build/utils/array.d.ts +3 -0
  121. package/build/utils/array.js +10 -0
  122. package/build/utils/string.d.ts +2 -0
  123. package/build/utils/string.js +23 -0
  124. package/package.json +127 -127
  125. package/build/features/Landing/Landing.d.ts +0 -7
  126. package/build/features/Landing/Landing.js +0 -55
  127. package/build/features/Landing/index.d.ts +0 -1
  128. package/build/features/Landing/index.js +0 -1
  129. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  130. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  131. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  132. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  133. package/build/features/app/landing/landingStore.d.ts +0 -22
  134. package/build/features/app/landing/landingStore.js +0 -103
@@ -58,27 +58,11 @@ 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';
62
- import { BUSINESS_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
- import { convertNumbers2English, getFlowUrl, hasKey, removeRequestHeaders } from '../../../utils';
61
+ import { BusinessType, FlowsTypes } from '../../../@types';
62
+ import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
+ import { convertNumbers2English, getFlowUrl, hasKey } from '../../../utils';
64
64
  import { handleNextScreenStep } from '../../../app/settings';
65
- export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
- var settings, countriesBody, businessCountry;
67
- return __generator(this, function (_a) {
68
- switch (_a.label) {
69
- case 0:
70
- settings = thunkApi.getState().settings;
71
- return [4, API.countryService.getAllCountries()];
72
- case 1:
73
- countriesBody = (_a.sent()).data;
74
- businessCountry = (countriesBody.list || []).find(function (country) {
75
- return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
76
- });
77
- return [2, { businessCountry: businessCountry, countries: (countriesBody === null || countriesBody === void 0 ? void 0 : countriesBody.list) || [] }];
78
- }
79
- });
80
- }); });
81
- export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
+ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
82
66
  var payload, data, leadResponse;
83
67
  return __generator(this, function (_a) {
84
68
  switch (_a.label) {
@@ -106,6 +90,23 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
106
90
  }
107
91
  });
108
92
  }); });
93
+ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
94
+ var business, payload, data;
95
+ return __generator(this, function (_a) {
96
+ switch (_a.label) {
97
+ case 0:
98
+ business = thunkApi.getState().business;
99
+ payload = {
100
+ service_name: 'tap_email',
101
+ verify_token: business.data.verify.token
102
+ };
103
+ return [4, API.leadService.verifyLeadToken(payload)];
104
+ case 1:
105
+ data = (_a.sent()).data;
106
+ return [2, { data: data }];
107
+ }
108
+ });
109
+ }); });
109
110
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
110
111
  var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted;
111
112
  var _b, _c, _d, _e;
@@ -174,7 +175,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
174
175
  identification_id: params.nid,
175
176
  identification_id_type: identification_id_type,
176
177
  date_of_birth: params.dob,
177
- country_code: business.data.businessCountry.iso2,
178
+ country_code: settings.data.businessCountry.iso2,
178
179
  step_name: stepName,
179
180
  encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
180
181
  };
@@ -310,7 +311,7 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
310
311
  }
311
312
  });
312
313
  }); });
313
- export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
314
+ export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
314
315
  var _a, customerBases, expectedSales, expectedCustomerSales;
315
316
  return __generator(this, function (_b) {
316
317
  switch (_b.label) {
@@ -350,7 +351,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
350
351
  agree_refund: params.refundPolicy,
351
352
  agree_chargeback: params.transactionPolicy,
352
353
  step_name: stepName,
353
- encryption_contract: ['customers_base[0]', 'customers_served_monthly', 'yearly_sales_range']
354
+ encryption_contract: ['customers_served_monthly', 'yearly_sales_range']
354
355
  };
355
356
  return [4, API.entityService.updateEntityInfo(requestBody)];
356
357
  case 1:
@@ -364,7 +365,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
364
365
  }
365
366
  });
366
367
  }); });
367
- export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
368
+ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
368
369
  var _a, settings, business, _b, steps, id, flowCompleted, payload, data;
369
370
  var _c, _d, _e, _f, _g;
370
371
  return __generator(this, function (_h) {
@@ -376,6 +377,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
376
377
  if (flowCompleted || !id)
377
378
  return [2];
378
379
  payload = {
380
+ lang: settings.data.language,
379
381
  step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
380
382
  id: id,
381
383
  flows: [
@@ -435,8 +437,7 @@ var initialState = {
435
437
  loading: false,
436
438
  customLoading: false,
437
439
  data: {
438
- businessCountry: defaultCountry,
439
- countries: [],
440
+ flowName: FlowsTypes.BUSINESS,
440
441
  verify: {
441
442
  token: ''
442
443
  },
@@ -482,23 +483,6 @@ export var businessSlice = createSlice({
482
483
  },
483
484
  extraReducers: function (builder) {
484
485
  builder
485
- .addCase(getCountries.fulfilled, function (state, action) {
486
- state.error = null;
487
- state.customLoading = false;
488
- var _a = action.payload, businessCountry = _a.businessCountry, countries = _a.countries;
489
- state.data.countries = countries
490
- .slice()
491
- .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
492
- state.data.businessCountry = businessCountry || defaultCountry;
493
- })
494
- .addCase(getCountries.pending, function (state) {
495
- state.error = null;
496
- state.customLoading = true;
497
- })
498
- .addCase(getCountries.rejected, function (state, action) {
499
- state.error = action.error.message;
500
- state.customLoading = false;
501
- })
502
486
  .addCase(verifyLeadToken.pending, function (state) {
503
487
  state.error = null;
504
488
  state.customLoading = true;
@@ -520,6 +504,23 @@ export var businessSlice = createSlice({
520
504
  .addCase(verifyLeadToken.rejected, function (state, action) {
521
505
  state.error = action.error.message;
522
506
  state.customLoading = false;
507
+ })
508
+ .addCase(resendOTP.pending, function (state) {
509
+ state.error = null;
510
+ })
511
+ .addCase(resendOTP.fulfilled, function (state, action) {
512
+ var _a;
513
+ state.error = null;
514
+ var data = action.payload.data;
515
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
516
+ if (description) {
517
+ state.error = description;
518
+ return;
519
+ }
520
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
521
+ })
522
+ .addCase(resendOTP.rejected, function (state, action) {
523
+ state.error = action.error.message;
523
524
  })
524
525
  .addCase(verifyLeadOTP.pending, function (state) {
525
526
  state.loading = true;
@@ -551,7 +552,6 @@ export var businessSlice = createSlice({
551
552
  .addCase(updateLeadIdentity.fulfilled, function (state, action) {
552
553
  var _a;
553
554
  state.loading = false;
554
- state.customLoading = false;
555
555
  state.error = null;
556
556
  var _b = action.payload, data = _b.data, formData = _b.formData;
557
557
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -566,7 +566,6 @@ export var businessSlice = createSlice({
566
566
  })
567
567
  .addCase(updateLeadIdentity.rejected, function (state, action) {
568
568
  state.loading = false;
569
- state.customLoading = false;
570
569
  state.error = action.error.message;
571
570
  })
572
571
  .addCase(retrieveEntityList.pending, function (state) {
@@ -773,7 +772,6 @@ export var businessSlice = createSlice({
773
772
  return;
774
773
  }
775
774
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), response);
776
- removeRequestHeaders();
777
775
  })
778
776
  .addCase(updateLeadSuccess.pending, function (state) {
779
777
  state.loading = true;
@@ -1,10 +1,6 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues } from '../../../@types';
2
+ import { ResponseData, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, FlowsTypes } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
- export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
5
- businessCountry: any;
6
- countries: any;
7
- }, void, {}>;
8
4
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
9
5
  response: any;
10
6
  formData: MobileFormValues & {
@@ -80,8 +76,6 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
80
76
  formData: void;
81
77
  }, void, {}>;
82
78
  export interface ConnectData {
83
- countries: Array<CountryCode>;
84
- businessCountry: CountryCode;
85
79
  mobileData: (MobileFormValues | undefined) & ResponseData;
86
80
  nidData: NIDFormValues & ResponseData & {
87
81
  type: string;
@@ -91,6 +85,7 @@ export interface ConnectData {
91
85
  };
92
86
  individualData: IndividualFormValues & ResponseData;
93
87
  brandData: BrandFormValues & ResponseData;
88
+ flowName: FlowsTypes;
94
89
  }
95
90
  export interface ConnectState extends SharedState<ConnectData> {
96
91
  }
@@ -57,26 +57,11 @@ 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';
63
- import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
64
- export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
- var settings, countriesBody, businessCountry;
66
- return __generator(this, function (_a) {
67
- switch (_a.label) {
68
- case 0:
69
- settings = thunkApi.getState().settings;
70
- return [4, API.countryService.getAllCountries()];
71
- case 1:
72
- countriesBody = (_a.sent()).data;
73
- businessCountry = (countriesBody.list || []).find(function (country) {
74
- return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
75
- });
76
- return [2, { businessCountry: businessCountry, countries: countriesBody.list }];
77
- }
78
- });
79
- }); });
64
+ import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord } from '../../../utils';
80
65
  export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
81
66
  var settings, requestBody, data;
82
67
  var _a, _b;
@@ -85,6 +70,7 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
85
70
  case 0:
86
71
  settings = thunkApi.getState().settings;
87
72
  requestBody = {
73
+ lang: settings.data.language,
88
74
  user_credentail: {
89
75
  phone: params.mobile || '',
90
76
  code: params.countryCode.idd_prefix.toString()
@@ -113,11 +99,12 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
113
99
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
114
100
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
115
101
  requestBody = {
102
+ lang: settings.data.language,
116
103
  user_credentail: {
117
104
  identification_id: params.nid,
118
105
  identification_id_type: identification_id_type,
119
106
  date_of_birth: params.dob,
120
- country_code: connect.data.businessCountry.iso2
107
+ country_code: settings.data.businessCountry.iso2
121
108
  },
122
109
  sign_in: false,
123
110
  step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
@@ -199,12 +186,12 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
199
186
  });
200
187
  }); });
201
188
  export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
202
- var connect, businessCountry, payload, brandPayload, _a, brandResponse, data;
189
+ var settings, businessCountry, payload, brandPayload, _a, brandResponse, data;
203
190
  return __generator(this, function (_b) {
204
191
  switch (_b.label) {
205
192
  case 0:
206
- connect = thunkApi.getState().connect;
207
- businessCountry = connect.data.businessCountry;
193
+ settings = thunkApi.getState().settings;
194
+ businessCountry = settings.data.businessCountry;
208
195
  payload = {
209
196
  individual_id: params.individualId,
210
197
  country_code: businessCountry.iso2
@@ -218,7 +205,9 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
218
205
  ])];
219
206
  case 1:
220
207
  _a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
221
- thunkApi.dispatch(handleNextScreenStep(params.stepName));
208
+ if (!data.errors) {
209
+ thunkApi.dispatch(handleNextScreenStep(params.stepName));
210
+ }
222
211
  return [2, { response: data, brandResponse: brandResponse, formData: params }];
223
212
  }
224
213
  });
@@ -290,14 +279,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
290
279
  id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
291
280
  terms_conditions_accepted: params.termAndConditionChecked,
292
281
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
293
- encryption_contract: [
294
- 'brand.name.en',
295
- 'brand.name.ar',
296
- 'brand.name.zh',
297
- 'brand.website',
298
- 'brand.social[0]',
299
- 'brand.social[1]'
300
- ]
282
+ encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'brand.website']
301
283
  };
302
284
  return [4, API.leadService.updateLead(payload)];
303
285
  case 1:
@@ -367,6 +349,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
367
349
  isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
368
350
  leadId = isExistingUser ? (_c = brandData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id : (_d = otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id;
369
351
  payload = {
352
+ lang: settings.data.language,
370
353
  step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
371
354
  flows: [
372
355
  {
@@ -391,8 +374,7 @@ var initialState = {
391
374
  loading: false,
392
375
  customLoading: false,
393
376
  data: {
394
- businessCountry: defaultCountry,
395
- countries: [],
377
+ flowName: FlowsTypes.CONNECT,
396
378
  mobileData: {
397
379
  countryCode: defaultCountry,
398
380
  mobile: null
@@ -452,24 +434,6 @@ export var connectSlice = createSlice({
452
434
  },
453
435
  extraReducers: function (builder) {
454
436
  builder
455
- .addCase(getCountries.fulfilled, function (state, action) {
456
- state.error = null;
457
- state.customLoading = false;
458
- var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
459
- state.data.countries = countries
460
- .slice()
461
- .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
462
- state.data.businessCountry = businessCountry || defaultCountry;
463
- state.data.mobileData.countryCode = businessCountry || defaultCountry;
464
- })
465
- .addCase(getCountries.pending, function (state) {
466
- state.error = null;
467
- state.customLoading = true;
468
- })
469
- .addCase(getCountries.rejected, function (state, action) {
470
- state.error = action.error.message;
471
- state.customLoading = false;
472
- })
473
437
  .addCase(createMobileAuth.fulfilled, function (state, action) {
474
438
  var _a;
475
439
  state.loading = false;
@@ -576,14 +540,19 @@ export var connectSlice = createSlice({
576
540
  state.error = null;
577
541
  var _c = action.payload, response = _c.response, brandResponse = _c.brandResponse;
578
542
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
579
- var brandError = ((_b = brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.errors) === null || _b === void 0 ? void 0 : _b[0]) || {};
580
- if (!!brandError && !description) {
581
- 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) : []) || [];
582
- state.data.brandData.responseBody = __assign({ brands: brandList }, response);
543
+ var brandError = (((_b = brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
544
+ if (description) {
545
+ state.error = description;
546
+ return;
547
+ }
548
+ var brandList = undefined;
549
+ if (!brandError) {
550
+ 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) : [];
583
551
  var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
584
552
  if (!!brand)
585
553
  state.data.brandData.selectedBrandItem = brand;
586
554
  }
555
+ state.data.brandData.responseBody = __assign({ brands: brandList || [] }, response);
587
556
  })
588
557
  .addCase(createLead.pending, function (state) {
589
558
  state.loading = true;
@@ -671,7 +640,6 @@ export var connectSlice = createSlice({
671
640
  state.error = description;
672
641
  return;
673
642
  }
674
- removeRequestHeaders();
675
643
  })
676
644
  .addCase(updateLeadSuccess.pending, function (state) {
677
645
  state.loading = true;
@@ -1,18 +1,18 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { CountryCode, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
- export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
4
- businessCountry: any;
5
- countries: any;
6
- }, void, {}>;
2
+ import { FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
7
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
8
4
  data: any;
9
5
  leadData: any;
10
6
  token: string;
11
7
  }, string, {}>;
8
+ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
+ data: any;
10
+ }, void, {}>;
12
11
  export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
13
12
  sourceIncome: any;
14
13
  monthlyIncome: any;
15
14
  countryCode: string;
15
+ countries: import("../../../@types").CountryCode[];
16
16
  }, string, {}>;
17
17
  export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
18
18
  data: any;
@@ -35,11 +35,10 @@ declare type VerifyData = {
35
35
  token: string;
36
36
  };
37
37
  export interface IndividualData {
38
- businessCountry: CountryCode;
39
- countries: Array<CountryCode>;
40
38
  verify: ResponseData & VerifyData;
41
39
  otpData: OTPFormValues & ResponseData;
42
40
  individualData: IndividualExtraFormValues & ResponseData;
41
+ flowName: FlowsTypes;
43
42
  }
44
43
  export interface IndividualState extends SharedState<IndividualData> {
45
44
  }
@@ -48,26 +48,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
- import { hasKey, removeRequestHeaders } from '../../../utils';
51
+ import { FlowsTypes } from '../../../@types';
52
+ import { hasKey } from '../../../utils';
52
53
  import { handleNextScreenStep } from '../../../app/settings';
53
- import { defaultCountry, INDIVIDUAl_STEP_NAMES } from '../../../constants';
54
- export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var settings, countriesBody, businessCountry;
56
- return __generator(this, function (_a) {
57
- switch (_a.label) {
58
- case 0:
59
- settings = thunkApi.getState().settings;
60
- return [4, API.countryService.getAllCountries()];
61
- case 1:
62
- countriesBody = (_a.sent()).data;
63
- businessCountry = (countriesBody.list || []).find(function (country) {
64
- return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
65
- });
66
- return [2, { businessCountry: businessCountry, countries: countriesBody.list }];
67
- }
68
- });
69
- }); });
70
- 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 () {
71
56
  var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
72
57
  var _b, _c;
73
58
  return __generator(this, function (_d) {
@@ -104,20 +89,41 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
104
89
  }
105
90
  });
106
91
  }); });
107
- export var retrieveDataList = createAsyncThunk('retrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
108
- var _a, sourceIncome, monthlyIncome;
92
+ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
93
+ var individual, payload, data;
94
+ return __generator(this, function (_a) {
95
+ switch (_a.label) {
96
+ case 0:
97
+ individual = thunkApi.getState().individual;
98
+ payload = {
99
+ service_name: 'tap_email',
100
+ verify_token: individual.data.verify.token
101
+ };
102
+ return [4, API.leadService.verifyLeadToken(payload)];
103
+ case 1:
104
+ data = (_a.sent()).data;
105
+ return [2, { data: data }];
106
+ }
107
+ });
108
+ }); });
109
+ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
110
+ var settings, _a, sourceIncome, monthlyIncome, countries;
109
111
  return __generator(this, function (_b) {
110
112
  switch (_b.label) {
111
- case 0: return [4, Promise.all([
112
- API.dataService.getSourceOfIncome(),
113
- API.dataService.getMonthlyIncome(countryCode)
114
- ])];
113
+ case 0:
114
+ settings = thunkApi.getState().settings;
115
+ return [4, Promise.all([
116
+ API.dataService.getSourceOfIncome(),
117
+ API.dataService.getMonthlyIncome(countryCode)
118
+ ])];
115
119
  case 1:
116
120
  _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data;
121
+ countries = settings.data.countries;
117
122
  return [2, {
118
123
  sourceIncome: sourceIncome,
119
124
  monthlyIncome: monthlyIncome,
120
- countryCode: countryCode
125
+ countryCode: countryCode,
126
+ countries: countries
121
127
  }];
122
128
  }
123
129
  });
@@ -185,7 +191,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
185
191
  actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
186
192
  is_relative_PEP: params.isPEP,
187
193
  is_influencer: params.isInfluencer,
188
- encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'source_income[0]'],
194
+ encryption_contract: ['employer_name', 'employer_city', 'actual_income'],
189
195
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
190
196
  };
191
197
  return [4, API.entityService.updateEntityInfo(requestBody)];
@@ -199,7 +205,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
199
205
  }
200
206
  });
201
207
  }); });
202
- export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
208
+ export var updateLeadSuccess = createAsyncThunk('individualUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
203
209
  var _a, settings, individual, id, payload, data;
204
210
  var _b, _c, _d, _e, _f;
205
211
  return __generator(this, function (_g) {
@@ -210,6 +216,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
210
216
  if (!id)
211
217
  return [2];
212
218
  payload = {
219
+ lang: settings.data.language,
213
220
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
214
221
  id: id,
215
222
  encryption_contract: []
@@ -231,8 +238,7 @@ var initialState = {
231
238
  error: null,
232
239
  loading: false,
233
240
  data: {
234
- countries: [],
235
- businessCountry: defaultCountry,
241
+ flowName: FlowsTypes.INDIVIDUAL,
236
242
  verify: {
237
243
  token: ''
238
244
  },
@@ -265,23 +271,6 @@ export var individualSlice = createSlice({
265
271
  },
266
272
  extraReducers: function (builder) {
267
273
  builder
268
- .addCase(getCountries.fulfilled, function (state, action) {
269
- state.error = null;
270
- state.customLoading = false;
271
- var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
272
- state.data.countries = countries
273
- .slice()
274
- .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
275
- state.data.businessCountry = businessCountry || defaultCountry;
276
- })
277
- .addCase(getCountries.pending, function (state) {
278
- state.error = null;
279
- state.customLoading = true;
280
- })
281
- .addCase(getCountries.rejected, function (state, action) {
282
- state.error = action.error.message;
283
- state.customLoading = false;
284
- })
285
274
  .addCase(verifyLeadToken.pending, function (state) {
286
275
  state.error = null;
287
276
  state.customLoading = true;
@@ -302,6 +291,23 @@ export var individualSlice = createSlice({
302
291
  .addCase(verifyLeadToken.rejected, function (state, action) {
303
292
  state.error = action.error.message;
304
293
  state.customLoading = false;
294
+ })
295
+ .addCase(resendOTP.pending, function (state) {
296
+ state.error = null;
297
+ })
298
+ .addCase(resendOTP.fulfilled, function (state, action) {
299
+ var _a;
300
+ state.error = null;
301
+ var data = action.payload.data;
302
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
303
+ if (description) {
304
+ state.error = description;
305
+ return;
306
+ }
307
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
308
+ })
309
+ .addCase(resendOTP.rejected, function (state, action) {
310
+ state.error = action.error.message;
305
311
  })
306
312
  .addCase(verifyLeadOTP.pending, function (state) {
307
313
  state.loading = true;
@@ -331,7 +337,7 @@ export var individualSlice = createSlice({
331
337
  .addCase(retrieveDataList.fulfilled, function (state, action) {
332
338
  state.loading = false;
333
339
  state.error = null;
334
- var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode;
340
+ var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode, countries = _a.countries;
335
341
  var data = state.data.individualData.responseBody;
336
342
  state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [] });
337
343
  var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
@@ -341,7 +347,7 @@ export var individualSlice = createSlice({
341
347
  if (!!selectedMonthlyIncome)
342
348
  state.data.individualData.monthlyIncome = selectedMonthlyIncome;
343
349
  if (!!countryCode) {
344
- var employerLocation = state.data.countries.find(function (country) { return country.iso2 === countryCode; });
350
+ var employerLocation = countries.find(function (country) { return country.iso2 === countryCode; });
345
351
  state.data.individualData.employerLocation = employerLocation;
346
352
  }
347
353
  })
@@ -402,7 +408,6 @@ export var individualSlice = createSlice({
402
408
  }
403
409
  var flows = response.flows, steps = response.steps;
404
410
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
405
- removeRequestHeaders();
406
411
  })
407
412
  .addCase(updateLeadSuccess.pending, function (state) {
408
413
  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, {}>;
@@ -22,13 +25,38 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
22
25
  response: any;
23
26
  formData: void;
24
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, {}>;
25
51
  declare type VerifyData = {
26
52
  token: string;
53
+ operationType?: string;
27
54
  };
28
55
  export interface PasswordData {
29
56
  verify: ResponseData & VerifyData;
30
57
  otpData: OTPFormValues & ResponseData;
31
58
  passwordData: PasswordCreateFormValues & ResponseData;
59
+ flowName: FlowsTypes;
32
60
  }
33
61
  export interface PasswordState extends SharedState<PasswordData> {
34
62
  }
@@ -36,8 +64,12 @@ export declare const passwordSlice: import("@reduxjs/toolkit").Slice<PasswordSta
36
64
  clearError: (state: PasswordState) => void;
37
65
  stopLoader: (state: PasswordState) => void;
38
66
  resetOTPScreen: (state: PasswordState) => void;
67
+ storePasswordScreen: (state: PasswordState, action: {
68
+ payload: any;
69
+ type: string;
70
+ }) => void;
39
71
  }, "password/store">;
40
- 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>;
41
73
  declare const _default: import("redux").Reducer<PasswordState, import("redux").AnyAction>;
42
74
  export default _default;
43
75
  export declare const passwordSelector: (state: RootState) => PasswordState;