@tap-payments/auth-jsconnect 1.0.90-test → 2.0.0

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 (220) hide show
  1. package/README.md +60 -54
  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/account.js +1 -1
  6. package/build/api/auth.js +1 -1
  7. package/build/api/availabilityServices.js +1 -1
  8. package/build/api/axios.js +2 -2
  9. package/build/api/country.js +1 -1
  10. package/build/api/data.js +1 -1
  11. package/build/api/entity.js +1 -1
  12. package/build/api/firebase.js +1 -1
  13. package/build/api/individual.js +1 -1
  14. package/build/api/ip.js +1 -1
  15. package/build/api/lead.js +1 -1
  16. package/build/api/operator.js +1 -1
  17. package/build/app/rootReducer.d.ts +6 -7
  18. package/build/app/rootReducer.js +7 -9
  19. package/build/app/settings.d.ts +3 -3
  20. package/build/app/settings.js +5 -5
  21. package/build/app/store.d.ts +0 -2
  22. package/build/components/AnimationFlow/BottomSheet.js +1 -1
  23. package/build/components/AnimationFlow/Dialog.js +2 -2
  24. package/build/components/DatePicker/DatePicker.js +3 -3
  25. package/build/components/DatePicker/customStyle.css +86 -0
  26. package/build/components/Footer/Footer.d.ts +0 -2
  27. package/build/components/Footer/Footer.js +3 -4
  28. package/build/components/Input/Input.js +2 -2
  29. package/build/components/OTPTimer/OTPTimer.js +1 -1
  30. package/build/components/Providers/ThemeProvider.d.ts +1 -1
  31. package/build/components/SimpleList/SimpleList.js +1 -1
  32. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +1 -1
  33. package/build/components/SocialMediaGroup/SocialMediaGroup.js +2 -2
  34. package/build/constants/app.d.ts +1 -2
  35. package/build/constants/app.js +1 -9
  36. package/build/features/app/bank/bankStore.d.ts +6 -2
  37. package/build/features/app/bank/bankStore.js +42 -5
  38. package/build/features/app/business/businessStore.d.ts +8 -4
  39. package/build/features/app/business/businessStore.js +41 -6
  40. package/build/features/app/connect/connectStore.d.ts +3 -2
  41. package/build/features/app/connect/connectStore.js +20 -18
  42. package/build/features/app/individual/individualStore.d.ts +6 -2
  43. package/build/features/app/individual/individualStore.js +41 -5
  44. package/build/features/app/password/passwordStore.d.ts +6 -2
  45. package/build/features/app/password/passwordStore.js +41 -5
  46. package/build/features/app/tax/taxStore.d.ts +6 -2
  47. package/build/features/app/tax/taxStore.js +43 -6
  48. package/build/features/bank/Bank.d.ts +1 -1
  49. package/build/features/bank/Bank.js +13 -12
  50. package/build/features/bank/screens/BankDetails/BankDetails.js +10 -9
  51. package/build/features/bank/screens/BankDetails/BankName.js +8 -8
  52. package/build/features/bank/screens/BankDetails/Beneficiary.js +7 -7
  53. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  54. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  55. package/build/features/bank/screens/BankDetails/IBAN.js +8 -8
  56. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  57. package/build/features/bank/screens/BankDetails/validation.js +3 -2
  58. package/build/features/bank/screens/Success/Success.js +3 -3
  59. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -10
  60. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  61. package/build/features/bank/screens/Verify/OTPInput.js +8 -3
  62. package/build/features/bank/screens/Verify/Verify.js +12 -11
  63. package/build/features/business/Business.d.ts +1 -1
  64. package/build/features/business/Business.js +13 -12
  65. package/build/features/business/screens/Activities/Activities.js +7 -7
  66. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  67. package/build/features/business/screens/Activities/ActivitiesList.js +9 -9
  68. package/build/features/business/screens/Activities/OperationStartDate.js +2 -2
  69. package/build/features/business/screens/Activities/SalesChannels.d.ts +1 -1
  70. package/build/features/business/screens/Activities/SalesChannels.js +7 -7
  71. package/build/features/business/screens/BusinessType/BusinessType.js +8 -8
  72. package/build/features/business/screens/BusinessType/LicenseList.js +10 -10
  73. package/build/features/business/screens/BusinessType/LicenseNumber.js +8 -8
  74. package/build/features/business/screens/BusinessType/SelectType.js +6 -6
  75. package/build/features/business/screens/BusinessType/validation.js +2 -2
  76. package/build/features/business/screens/Customers/CustomerLocations.d.ts +1 -1
  77. package/build/features/business/screens/Customers/CustomerLocations.js +8 -8
  78. package/build/features/business/screens/Customers/Customers.js +8 -8
  79. package/build/features/business/screens/Customers/ExpectedCustomers.js +6 -6
  80. package/build/features/business/screens/Customers/ExpectedSalesRange.js +7 -7
  81. package/build/features/business/screens/Customers/RefundPolicy.d.ts +2 -2
  82. package/build/features/business/screens/Customers/RefundPolicy.js +7 -7
  83. package/build/features/business/screens/Customers/TransactionPolicy.js +5 -5
  84. package/build/features/business/screens/IDBOD/DOB.js +5 -5
  85. package/build/features/business/screens/IDBOD/ID.js +6 -6
  86. package/build/features/business/screens/IDBOD/IDBOD.js +6 -6
  87. package/build/features/business/screens/OTP/OTP.js +9 -9
  88. package/build/features/business/screens/OTP/OTPInput.js +4 -4
  89. package/build/features/business/screens/Success/Success.js +3 -3
  90. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -9
  91. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  92. package/build/features/business/screens/Verify/OTPInput.js +8 -3
  93. package/build/features/business/screens/Verify/Verify.js +12 -11
  94. package/build/features/connect/Connect.d.ts +1 -1
  95. package/build/features/connect/Connect.js +13 -11
  96. package/build/features/connect/screens/Individual/Email.js +7 -7
  97. package/build/features/connect/screens/Individual/Individual.js +9 -9
  98. package/build/features/connect/screens/Individual/MobileNumber.d.ts +1 -1
  99. package/build/features/connect/screens/Individual/MobileNumber.js +11 -11
  100. package/build/features/connect/screens/Individual/Name.js +6 -6
  101. package/build/features/connect/screens/Individual/validation.js +1 -1
  102. package/build/features/connect/screens/Merchant/BrandList.d.ts +1 -1
  103. package/build/features/connect/screens/Merchant/BrandList.js +8 -8
  104. package/build/features/connect/screens/Merchant/BrandName.js +10 -10
  105. package/build/features/connect/screens/Merchant/Merchant.js +7 -7
  106. package/build/features/connect/screens/Merchant/SocialMedia.js +9 -9
  107. package/build/features/connect/screens/Merchant/TAC.js +7 -7
  108. package/build/features/connect/screens/Merchant/validation.js +1 -1
  109. package/build/features/connect/screens/Mobile/Mobile.js +10 -10
  110. package/build/features/connect/screens/Mobile/MobileNumber.d.ts +1 -1
  111. package/build/features/connect/screens/Mobile/MobileNumber.js +12 -12
  112. package/build/features/connect/screens/Mobile/Title.js +2 -2
  113. package/build/features/connect/screens/NID/DOB.js +5 -5
  114. package/build/features/connect/screens/NID/IDNumber.js +8 -8
  115. package/build/features/connect/screens/NID/NID.js +9 -9
  116. package/build/features/connect/screens/OTP/OTP.js +9 -9
  117. package/build/features/connect/screens/OTP/OTPInput.js +4 -4
  118. package/build/features/connect/screens/ThankYou/ThankYou.js +3 -3
  119. package/build/features/featuresScreens.d.ts +1 -2
  120. package/build/features/featuresScreens.js +30 -37
  121. package/build/features/individual/Individual.d.ts +1 -1
  122. package/build/features/individual/Individual.js +13 -12
  123. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +8 -8
  124. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.d.ts +1 -1
  125. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +8 -8
  126. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.js +6 -6
  127. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +6 -6
  128. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +1 -1
  129. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +9 -9
  130. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +6 -6
  131. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +1 -1
  132. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +8 -8
  133. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -1
  134. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.js +6 -6
  135. package/build/features/individual/screens/ShowIndividualInfo/info.js +1 -1
  136. package/build/features/individual/screens/Success/Success.js +3 -3
  137. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -10
  138. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  139. package/build/features/individual/screens/Verify/OTPInput.js +8 -3
  140. package/build/features/individual/screens/Verify/Verify.js +12 -11
  141. package/build/features/password/Password.d.ts +1 -1
  142. package/build/features/password/Password.js +13 -12
  143. package/build/features/password/screens/CreatePassword/ConditionText.js +1 -1
  144. package/build/features/password/screens/CreatePassword/ConfirmPassword.js +3 -3
  145. package/build/features/password/screens/CreatePassword/CreatePassword.js +7 -7
  146. package/build/features/password/screens/CreatePassword/Password.js +6 -6
  147. package/build/features/password/screens/Success/Success.js +3 -3
  148. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -10
  149. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  150. package/build/features/password/screens/Verify/OTPInput.js +8 -3
  151. package/build/features/password/screens/Verify/Verify.js +12 -11
  152. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +4 -4
  153. package/build/features/shared/Background/LogoBackground.js +4 -7
  154. package/build/features/shared/Button/AbsherButton.d.ts +2 -3
  155. package/build/features/shared/Button/AbsherButton.js +7 -12
  156. package/build/features/shared/Button/Button.d.ts +1 -1
  157. package/build/features/shared/Button/Button.js +7 -7
  158. package/build/features/shared/Button/EmailProvidersButtons.d.ts +1 -1
  159. package/build/features/shared/Button/EmailProvidersButtons.js +4 -3
  160. package/build/features/shared/Button/FlowsButtons.d.ts +5 -2
  161. package/build/features/shared/Button/FlowsButtons.js +14 -9
  162. package/build/features/shared/Button/MobileButton.d.ts +2 -3
  163. package/build/features/shared/Button/MobileButton.js +7 -12
  164. package/build/features/shared/Button/SuccessButton.js +1 -1
  165. package/build/features/shared/Footer/Footer.js +5 -5
  166. package/build/features/shared/Input/Input.d.ts +1 -1
  167. package/build/features/shared/Input/Input.js +2 -2
  168. package/build/features/shared/OTP/OTP.d.ts +3 -2
  169. package/build/features/shared/OTP/OTP.js +13 -5
  170. package/build/features/shared/Search/Search.js +1 -1
  171. package/build/features/shared/SearchIcon/SearchIcon.js +2 -2
  172. package/build/features/shared/SuccessScreen/SuccessScreen.js +5 -5
  173. package/build/features/tax/Tax.d.ts +1 -1
  174. package/build/features/tax/Tax.js +13 -12
  175. package/build/features/tax/screens/Success/Success.js +3 -3
  176. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -10
  177. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  178. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  179. package/build/features/tax/screens/TaxDetails/TaxDetails.js +11 -8
  180. package/build/features/tax/screens/TaxDetails/VATId.js +18 -7
  181. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  182. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  183. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  184. package/build/features/tax/screens/Verify/OTPInput.js +8 -3
  185. package/build/features/tax/screens/Verify/Verify.js +12 -11
  186. package/build/hooks/index.d.ts +1 -0
  187. package/build/hooks/index.js +1 -0
  188. package/build/hooks/useAppConfig.d.ts +1 -1
  189. package/build/hooks/useAppConfig.js +4 -4
  190. package/build/hooks/useAppDispatch.d.ts +0 -1
  191. package/build/hooks/useAppSelector.d.ts +1 -1
  192. package/build/hooks/useAppTheme.d.ts +1 -1
  193. package/build/hooks/useAppTheme.js +3 -3
  194. package/build/hooks/useErrorListener.d.ts +1 -1
  195. package/build/hooks/useErrorListener.js +5 -7
  196. package/build/hooks/useLanguage.js +1 -1
  197. package/build/hooks/useRedirectionListener.js +1 -1
  198. package/build/hooks/useStepStartedListener.d.ts +1 -0
  199. package/build/hooks/useStepStartedListener.js +10 -0
  200. package/build/i18n.js +1 -1
  201. package/build/index.css +135 -0
  202. package/build/index.d.ts +8 -9
  203. package/build/index.js +8 -11
  204. package/build/theme/theme.d.ts +1 -1
  205. package/build/utils/locale.d.ts +1 -1
  206. package/build/utils/locale.js +1 -1
  207. package/build/utils/rsa.js +1 -1
  208. package/build/utils/string.d.ts +2 -1
  209. package/build/utils/string.js +22 -3
  210. package/package.json +1 -1
  211. package/build/features/Landing/Landing.d.ts +0 -7
  212. package/build/features/Landing/Landing.js +0 -55
  213. package/build/features/Landing/index.d.ts +0 -1
  214. package/build/features/Landing/index.js +0 -1
  215. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  216. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  217. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  218. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  219. package/build/features/app/landing/landingStore.d.ts +0 -22
  220. package/build/features/app/landing/landingStore.js +0 -103
@@ -1,4 +1,4 @@
1
- import { BusinessType } from '@types';
1
+ import { BusinessType } from '../@types';
2
2
  export var CLIENT_ORIGIN = window.location.origin;
3
3
  export var LOCAL_STORAGE_KEYS = {
4
4
  themeMode: 'themeMode',
@@ -210,14 +210,6 @@ export var TAX_SCREENS_NAVIGATION = [
210
210
  order: 4
211
211
  }
212
212
  ];
213
- export var LANDING_SCREENS_NAVIGATION = [
214
- {
215
- name: 'LANDING_VERIFY_AND_REDIRECT_STEP',
216
- next: '',
217
- prev: '',
218
- order: 1
219
- }
220
- ];
221
213
  export var DefaultDeviceInfo = {
222
214
  source: 'browser',
223
215
  device: {
@@ -1,11 +1,14 @@
1
- import { RootState } from '@store';
2
- import { BankFormValues, OTPFormValues, ResponseData, SharedState } from '@types';
1
+ import { RootState } from '../../../app/store';
2
+ import { BankFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  data: any;
6
6
  leadData: any;
7
7
  token: string;
8
8
  }, string, {}>;
9
+ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
10
+ data: any;
11
+ }, void, {}>;
9
12
  export declare const verifyBankLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
10
13
  data: any;
11
14
  formData: OTPFormValues;
@@ -35,6 +38,7 @@ export interface BankData {
35
38
  verify: ResponseData & VerifyData;
36
39
  otpData: OTPFormValues & ResponseData;
37
40
  bankData: BankFormValues & ResponseData;
41
+ flowName: FlowsTypes;
38
42
  }
39
43
  export interface BankState extends SharedState<BankData> {
40
44
  }
@@ -47,10 +47,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import API from '@api';
51
- import { hasKey, removeRequestHeaders } from '@utils';
52
- import { handleNextScreenStep } from '@app/settings';
53
- import { BANK_STEP_NAMES } from '@src/constants';
50
+ import API from '../../../api';
51
+ import { FlowsTypes } from '../../../@types';
52
+ import { hasKey, removeRequestHeaders } from '../../../utils';
53
+ import { handleNextScreenStep } from '../../../app/settings';
54
+ import { BANK_STEP_NAMES } from '../../../constants';
54
55
  export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
56
  var payload, data, leadResponse, _a, steps, entity, hasCompleted;
56
57
  return __generator(this, function (_b) {
@@ -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
- import { RootState } from '@store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, CountryCode, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '@types';
1
+ import { RootState } from '../../../app/store';
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: {
@@ -44,8 +47,8 @@ export declare const createAccount: import("@reduxjs/toolkit").AsyncThunk<{
44
47
  export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk<{
45
48
  data: any;
46
49
  formData: {
47
- activities: import("@types").Activity[] | undefined;
48
- salesChannels: import("@types").SalesChannel[];
50
+ activities: import("../../../@types").Activity[] | undefined;
51
+ salesChannels: import("../../../@types").SalesChannel[];
49
52
  operationStartDate: string;
50
53
  };
51
54
  }, ActivitiesFormValues, {}>;
@@ -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
  }
@@ -57,11 +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 moment from 'moment';
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';
64
- import { handleNextScreenStep } from '@app/settings';
60
+ import API from '../../../api';
61
+ import { BusinessType, FlowsTypes } 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';
64
+ import { handleNextScreenStep } from '../../../app/settings';
65
65
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var settings, countriesBody, businessCountry;
67
67
  return __generator(this, function (_a) {
@@ -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;
@@ -350,7 +367,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
350
367
  agree_refund: params.refundPolicy,
351
368
  agree_chargeback: params.transactionPolicy,
352
369
  step_name: stepName,
353
- encryption_contract: ['customers_base[0]', 'customers_served_monthly', 'yearly_sales_range']
370
+ encryption_contract: ['customers_served_monthly', 'yearly_sales_range']
354
371
  };
355
372
  return [4, API.entityService.updateEntityInfo(requestBody)];
356
373
  case 1:
@@ -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
- import { RootState } from '@app/store';
2
- import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues } from '@types';
1
+ import { RootState } from '../../../app/store';
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
  }
@@ -56,11 +56,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
56
56
  };
57
57
  var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
- import { handleNextScreenStep } from '@app/settings';
60
- import API from '@api';
61
- import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '@constants';
62
- import { defaultCountry } from '@constants';
63
- import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '@utils';
59
+ import { handleNextScreenStep } from '../../../app/settings';
60
+ import { FlowsTypes } from '../../../@types';
61
+ import API from '../../../api';
62
+ import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
63
+ import { defaultCountry } from '../../../constants';
64
+ import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
64
65
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
66
  var settings, countriesBody, businessCountry;
66
67
  return __generator(this, function (_a) {
@@ -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
  });
@@ -290,14 +293,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
290
293
  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
294
  terms_conditions_accepted: params.termAndConditionChecked,
292
295
  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
- ]
296
+ encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'brand.website']
301
297
  };
302
298
  return [4, API.leadService.updateLead(payload)];
303
299
  case 1:
@@ -391,6 +387,7 @@ var initialState = {
391
387
  loading: false,
392
388
  customLoading: false,
393
389
  data: {
390
+ flowName: FlowsTypes.CONNECT,
394
391
  businessCountry: defaultCountry,
395
392
  countries: [],
396
393
  mobileData: {
@@ -576,14 +573,19 @@ export var connectSlice = createSlice({
576
573
  state.error = null;
577
574
  var _c = action.payload, response = _c.response, brandResponse = _c.brandResponse;
578
575
  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);
576
+ var brandError = (((_b = brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
577
+ if (description) {
578
+ state.error = description;
579
+ return;
580
+ }
581
+ var brandList = undefined;
582
+ if (!brandError) {
583
+ 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
584
  var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
584
585
  if (!!brand)
585
586
  state.data.brandData.selectedBrandItem = brand;
586
587
  }
588
+ state.data.brandData.responseBody = __assign({ brands: brandList || [] }, response);
587
589
  })
588
590
  .addCase(createLead.pending, function (state) {
589
591
  state.loading = true;
@@ -1,5 +1,5 @@
1
- import { RootState } from '@store';
2
- import { CountryCode, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '@types';
1
+ import { RootState } from '../../../app/store';
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
  }
@@ -47,10 +47,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import API from '@api';
51
- import { hasKey, removeRequestHeaders } from '@utils';
52
- import { handleNextScreenStep } from '@app/settings';
53
- import { defaultCountry, INDIVIDUAl_STEP_NAMES } from '@constants';
50
+ import API from '../../../api';
51
+ import { FlowsTypes } from '../../../@types';
52
+ import { hasKey, removeRequestHeaders } from '../../../utils';
53
+ import { handleNextScreenStep } from '../../../app/settings';
54
+ import { defaultCountry, INDIVIDUAl_STEP_NAMES } from '../../../constants';
54
55
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
56
  var settings, countriesBody, businessCountry;
56
57
  return __generator(this, function (_a) {
@@ -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) {
@@ -185,7 +203,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
185
203
  actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
186
204
  is_relative_PEP: params.isPEP,
187
205
  is_influencer: params.isInfluencer,
188
- encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'source_income[0]'],
206
+ encryption_contract: ['employer_name', 'employer_city', 'actual_income'],
189
207
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
190
208
  };
191
209
  return [4, API.entityService.updateEntityInfo(requestBody)];
@@ -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
- import { RootState } from '@store';
2
- import { OTPFormValues, PasswordCreateFormValues, ResponseData, SharedState } from '@types';
1
+ import { RootState } from '../../../app/store';
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
  }
@@ -47,10 +47,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import API from '@api';
51
- import { hasKey, removeRequestHeaders } from '@utils';
52
- import { handleNextScreenStep } from '@app/settings';
53
- import { PASSWORD_STEP_NAMES } from '@constants';
50
+ import API from '../../../api';
51
+ import { FlowsTypes } from '../../../@types';
52
+ import { hasKey, removeRequestHeaders } from '../../../utils';
53
+ import { handleNextScreenStep } from '../../../app/settings';
54
+ import { PASSWORD_STEP_NAMES } from '../../../constants';
54
55
  export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
56
  var payload, data, leadResponse, _a, steps, entity, hasCompleted;
56
57
  return __generator(this, function (_b) {
@@ -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
- import { RootState } from '@store';
2
- import { OTPFormValues, ResponseData, SharedState, TaxFormValues } from '@types';
1
+ import { RootState } from '../../../app/store';
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
  }