@tap-payments/auth-jsconnect 1.0.91-test → 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 (90) hide show
  1. package/README.md +58 -52
  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/app/rootReducer.d.ts +0 -1
  6. package/build/app/rootReducer.js +1 -3
  7. package/build/app/store.d.ts +0 -2
  8. package/build/components/AnimationFlow/BottomSheet.js +1 -1
  9. package/build/constants/app.d.ts +0 -1
  10. package/build/constants/app.js +0 -8
  11. package/build/features/app/bank/bankStore.d.ts +5 -1
  12. package/build/features/app/bank/bankStore.js +38 -1
  13. package/build/features/app/business/businessStore.d.ts +5 -1
  14. package/build/features/app/business/businessStore.js +36 -1
  15. package/build/features/app/connect/connectStore.d.ts +2 -1
  16. package/build/features/app/connect/connectStore.js +14 -5
  17. package/build/features/app/individual/individualStore.d.ts +5 -1
  18. package/build/features/app/individual/individualStore.js +36 -0
  19. package/build/features/app/password/passwordStore.d.ts +5 -1
  20. package/build/features/app/password/passwordStore.js +37 -1
  21. package/build/features/app/tax/taxStore.d.ts +5 -1
  22. package/build/features/app/tax/taxStore.js +39 -2
  23. package/build/features/bank/Bank.js +4 -3
  24. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  25. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  26. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  27. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  28. package/build/features/bank/screens/BankDetails/validation.js +2 -1
  29. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  30. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  31. package/build/features/bank/screens/Verify/OTPInput.js +6 -1
  32. package/build/features/bank/screens/Verify/Verify.js +3 -2
  33. package/build/features/business/Business.js +4 -3
  34. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -1
  35. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  36. package/build/features/business/screens/Verify/OTPInput.js +6 -1
  37. package/build/features/business/screens/Verify/Verify.js +3 -2
  38. package/build/features/connect/Connect.js +5 -3
  39. package/build/features/featuresScreens.d.ts +0 -1
  40. package/build/features/featuresScreens.js +0 -7
  41. package/build/features/individual/Individual.js +4 -3
  42. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  43. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  44. package/build/features/individual/screens/Verify/OTPInput.js +6 -1
  45. package/build/features/individual/screens/Verify/Verify.js +3 -2
  46. package/build/features/password/Password.js +4 -3
  47. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  48. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  49. package/build/features/password/screens/Verify/OTPInput.js +6 -1
  50. package/build/features/password/screens/Verify/Verify.js +3 -2
  51. package/build/features/shared/Button/AbsherButton.js +3 -8
  52. package/build/features/shared/Button/EmailProvidersButtons.js +2 -1
  53. package/build/features/shared/Button/FlowsButtons.d.ts +4 -1
  54. package/build/features/shared/Button/FlowsButtons.js +10 -5
  55. package/build/features/shared/Button/MobileButton.js +3 -8
  56. package/build/features/shared/OTP/OTP.d.ts +2 -1
  57. package/build/features/shared/OTP/OTP.js +10 -2
  58. package/build/features/tax/Tax.js +4 -3
  59. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  60. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  61. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  62. package/build/features/tax/screens/TaxDetails/TaxDetails.js +5 -2
  63. package/build/features/tax/screens/TaxDetails/VATId.js +13 -2
  64. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  65. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  66. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  67. package/build/features/tax/screens/Verify/OTPInput.js +6 -1
  68. package/build/features/tax/screens/Verify/Verify.js +3 -2
  69. package/build/hooks/index.d.ts +1 -0
  70. package/build/hooks/index.js +1 -0
  71. package/build/hooks/useAppDispatch.d.ts +0 -1
  72. package/build/hooks/useErrorListener.d.ts +1 -1
  73. package/build/hooks/useErrorListener.js +4 -6
  74. package/build/hooks/useStepStartedListener.d.ts +1 -0
  75. package/build/hooks/useStepStartedListener.js +10 -0
  76. package/build/index.d.ts +2 -3
  77. package/build/index.js +2 -5
  78. package/build/utils/string.d.ts +1 -0
  79. package/build/utils/string.js +19 -0
  80. package/package.json +127 -127
  81. package/build/features/Landing/Landing.d.ts +0 -7
  82. package/build/features/Landing/Landing.js +0 -55
  83. package/build/features/Landing/index.d.ts +0 -1
  84. package/build/features/Landing/index.js +0 -1
  85. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  86. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  87. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  88. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  89. package/build/features/app/landing/landingStore.d.ts +0 -22
  90. package/build/features/app/landing/landingStore.js +0 -103
package/README.md CHANGED
@@ -59,9 +59,6 @@ const App = () => {
59
59
  onStepCompleted={(name, data) => {
60
60
  console.log(name, data)
61
61
  }}
62
- onStepError={(name, error) => {
63
- console.log(name, error)
64
- }}
65
62
  onStepStarted={(name) => {
66
63
  console.log(name)
67
64
  }}
@@ -86,42 +83,51 @@ const App = () => {
86
83
  <body>
87
84
  <div id="root"></div>
88
85
  <script>
89
- const { renderConnectLib } = window.TapAuth
90
- renderConnectLib(
91
- {
92
- open: true,
93
- merchantDomain: window.location.origin,
94
- publicKey: "pk_test_lat64TEDSvHrUOYAxVRe28PQ",
95
- appInfo: {
96
- identifier: "tap_connect_demo",
97
- name: "Tap Connect Demo",
98
- version: "V2.0.0"
99
- },
100
- businessCountryCode: "SA",
101
- language: "en",
102
- onError: (error) => {
103
- alert(JSON.stringify({ error }))
104
- },
105
- onFlowCompleted: (data) => {
106
- console.log(data)
107
- },
108
- onReady: () => {
109
- console.log("ready!")
110
- },
111
- onStepCompleted: (name, data) => {
112
- console.log(name, data)
86
+ const { renderConnectLib, unmountConnectLib } = window.TapAuth
87
+ const startConnect = () => {
88
+ renderConnectLib(
89
+ {
90
+ open: true,
91
+ merchantDomain: window.location.origin,
92
+ publicKey: "pk_test_lat64TEDSvHrUOYAxVRe28PQ",
93
+ appInfo: {
94
+ identifier: "tap_connect_demo",
95
+ name: "Tap Connect Demo",
96
+ version: "V2.0.0"
97
+ },
98
+ businessCountryCode: "SA",
99
+ language: "en",
100
+ onError: (error) => {
101
+ alert(JSON.stringify({ error }))
102
+ },
103
+ onFlowCompleted: (data) => {
104
+ console.log(data)
105
+ },
106
+ onReady: () => {
107
+ console.log("ready!")
108
+ },
109
+ onStepCompleted: (name, data) => {
110
+ console.log(name, data)
111
+ },
112
+ onStepError: (name, error) => {
113
+ console.log(name, error)
114
+ },
115
+ onStepStarted: (name) => {
116
+ console.log(name)
117
+ },
118
+ scope: []
113
119
  },
114
- onStepError: (name, error) => {
115
- console.log(name, error)
116
- },
117
- onStepStarted: (name) => {
118
- console.log(name)
119
- },
120
- scope: []
121
- },
122
- "root"
123
- )
120
+
121
+ "root"
122
+ )
123
+ }
124
+ const stopConnect = () => {
125
+ unmountConnectLib("root")
126
+ }
127
+
124
128
  </script>
129
+ <button onclick="startConnect()">Start</button>
130
+ <button onclick="stopConnect()">Stop</button>
125
131
  </body>
126
132
  </html>
127
133
  ```
@@ -129,6 +135,7 @@ const App = () => {
129
135
  ```
130
136
 
131
137
  ## Connect
138
+ - Help our merchants to create a account with Tap Payments
132
139
 
133
140
  ## Business
134
141
 
@@ -144,18 +151,17 @@ const App = () => {
144
151
 
145
152
  ## Properties
146
153
 
147
- | name | functionality |
148
- | ------------------------------ | --------------------------- |
149
- | open `required` | BadRequest |
150
- | merchantDomain `required` | Unauthorized |
151
- | publicKey `required` | PaymentRequired |
152
- | appInfo `required` | Forbidden |
153
- | businessCountryCode `required` | NotFound |
154
- | language `required` | MethodNotAllowed |
155
- | onError `required` | NotAcceptable |
156
- | onFlowCompleted `required` | ProxyAuthenticationRequired |
157
- | onReady `required` | RequestTimeout |
158
- | onStepCompleted `required` | Conflict |
159
- | onStepError `required` | Gone |
160
- | onStepStarted `required` | LengthRequired |
161
- | scope `required` | UnsupportedMediaType |
154
+ | name | description |
155
+ | ----------------------------------------- | ----------------------------------------------------------------------- |
156
+ | open `required` - `boolean` | open/close the library |
157
+ | merchantDomain `required` - `string` | domain name `https://expamle.com` |
158
+ | publicKey `required` - `string` | merchant public key |
159
+ | appInfo `required` | it's an object from type `AppInfo` |
160
+ | businessCountryCode `required` - `string` | merchant country code and it should be the ISO2 of the country |
161
+ | language `required` - `string` | it can be `en`or `ar` |
162
+ | onError `required` - `function` | callback function will call in case of any error happened |
163
+ | onFlowCompleted `required` - `function` | callback function will called after completing the flow |
164
+ | onReady `required` - `function` | callback function will call after loading library configuration |
165
+ | onStepError `required` - `function` | callback function will call in case if any error happened in the screen |
166
+ | onStepStarted `required` - `function` | callback function will call in the begging of each step |
167
+ | scope `required` - `array` | it's an array include merchant scope |
@@ -102,6 +102,7 @@ interface LibCallbacks {
102
102
  onError: (err: any) => void;
103
103
  onStepCompleted?: (name: string, info: any) => void;
104
104
  onReady?: () => void;
105
+ onStepStarted?: (name: string) => void;
105
106
  }
106
107
  export interface LibConfig extends LibCallbacks {
107
108
  publicKey: string;
@@ -174,4 +175,12 @@ export declare type BrandInfo = {
174
175
  website: string;
175
176
  social: Array<string>;
176
177
  };
178
+ export declare enum FlowsTypes {
179
+ CONNECT = "connect",
180
+ BANK = "bank",
181
+ BUSINESS = "business",
182
+ INDIVIDUAL = "individual",
183
+ PASSWORD = "password",
184
+ TAX = "tax"
185
+ }
177
186
  export {};
@@ -9,3 +9,12 @@ export var BusinessType;
9
9
  BusinessType["CR"] = "company";
10
10
  BusinessType["FL"] = "freelancer";
11
11
  })(BusinessType || (BusinessType = {}));
12
+ export var FlowsTypes;
13
+ (function (FlowsTypes) {
14
+ FlowsTypes["CONNECT"] = "connect";
15
+ FlowsTypes["BANK"] = "bank";
16
+ FlowsTypes["BUSINESS"] = "business";
17
+ FlowsTypes["INDIVIDUAL"] = "individual";
18
+ FlowsTypes["PASSWORD"] = "password";
19
+ FlowsTypes["TAX"] = "tax";
20
+ })(FlowsTypes || (FlowsTypes = {}));
@@ -49,9 +49,11 @@ export declare type BankFormValues = {
49
49
  iban: string;
50
50
  beneficiaryName: string;
51
51
  bankName: string;
52
+ confirmPolicy: boolean;
52
53
  };
53
54
  export declare type TaxFormValues = {
54
55
  vatId: string;
56
+ confirmPolicy: false;
55
57
  };
56
58
  export declare type IndividualExtraFormValues = {
57
59
  sourceIncome: SourceOfIncome | undefined;
@@ -6,6 +6,5 @@ declare const rootReducer: {
6
6
  tax: import("redux").Reducer<import("../features/app/tax/taxStore").TaxState, import("redux").AnyAction>;
7
7
  individual: import("redux").Reducer<import("../features/app/individual/individualStore").IndividualState, import("redux").AnyAction>;
8
8
  password: import("redux").Reducer<import("../features/app/password/passwordStore").PasswordState, import("redux").AnyAction>;
9
- landing: import("redux").Reducer<import("../features/app/landing/landingStore").LandingState, import("redux").AnyAction>;
10
9
  };
11
10
  export default rootReducer;
@@ -5,7 +5,6 @@ import bank from '../features/app/bank/bankStore';
5
5
  import tax from '../features/app/tax/taxStore';
6
6
  import individual from '../features/app/individual/individualStore';
7
7
  import password from '../features/app/password/passwordStore';
8
- import landing from '../features/app/landing/landingStore';
9
8
  var rootReducer = {
10
9
  settings: settings,
11
10
  connect: connect,
@@ -13,7 +12,6 @@ var rootReducer = {
13
12
  bank: bank,
14
13
  tax: tax,
15
14
  individual: individual,
16
- password: password,
17
- landing: landing
15
+ password: password
18
16
  };
19
17
  export default rootReducer;
@@ -7,7 +7,6 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
7
7
  tax: import("../features/app/tax/taxStore").TaxState;
8
8
  individual: import("../features/app/individual/individualStore").IndividualState;
9
9
  password: import("../features/app/password/passwordStore").PasswordState;
10
- landing: import("../features/app/landing/landingStore").LandingState;
11
10
  }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<{
12
11
  settings: import("./settings").SettingsState;
13
12
  connect: import("../features/app/connect/connectStore").ConnectState;
@@ -16,7 +15,6 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
16
15
  tax: import("../features/app/tax/taxStore").TaxState;
17
16
  individual: import("../features/app/individual/individualStore").IndividualState;
18
17
  password: import("../features/app/password/passwordStore").PasswordState;
19
- landing: import("../features/app/landing/landingStore").LandingState;
20
18
  }, import("redux").AnyAction, undefined>]>>;
21
19
  export declare type AppDispatch = typeof store.dispatch;
22
20
  export declare type RootState = ReturnType<typeof store.getState>;
@@ -62,7 +62,7 @@ var BottomSheetComponent = function (_a) {
62
62
  var open = _a.open, children = _a.children, rest = __rest(_a, ["open", "children"]);
63
63
  var getMinHeight = function (maxHeight) {
64
64
  var element = document.getElementById('main-feature-container');
65
- var height = element ? element.clientHeight + 40 : 0;
65
+ var height = element ? element.clientHeight : 0;
66
66
  return height || maxHeight * 0.7;
67
67
  };
68
68
  return (_jsx(BottomSheetStyled, __assign({ open: open, snapPoints: function (_a) {
@@ -18,7 +18,6 @@ export declare const INDIVIDUAL_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
18
18
  export declare const PASSWORD_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
19
19
  export declare const BANK_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
20
20
  export declare const TAX_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
21
- export declare const LANDING_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
22
21
  export declare const DefaultDeviceInfo: {
23
22
  source: string;
24
23
  device: {
@@ -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
1
  import { RootState } from '../../../app/store';
2
- import { BankFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
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
  }
@@ -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;
@@ -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
  });
@@ -391,6 +394,7 @@ var initialState = {
391
394
  loading: false,
392
395
  customLoading: false,
393
396
  data: {
397
+ flowName: FlowsTypes.CONNECT,
394
398
  businessCountry: defaultCountry,
395
399
  countries: [],
396
400
  mobileData: {
@@ -576,14 +580,19 @@ export var connectSlice = createSlice({
576
580
  state.error = null;
577
581
  var _c = action.payload, response = _c.response, brandResponse = _c.brandResponse;
578
582
  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);
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) : [];
583
591
  var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
584
592
  if (!!brand)
585
593
  state.data.brandData.selectedBrandItem = brand;
586
594
  }
595
+ state.data.brandData.responseBody = __assign({ brands: brandList || [] }, response);
587
596
  })
588
597
  .addCase(createLead.pending, function (state) {
589
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
  }