@tap-payments/auth-jsconnect 2.0.30-test → 2.0.32-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 (60) hide show
  1. package/build/@types/app.d.ts +3 -1
  2. package/build/@types/app.js +2 -0
  3. package/build/@types/form.d.ts +7 -0
  4. package/build/app/rootReducer.d.ts +2 -0
  5. package/build/app/rootReducer.js +5 -1
  6. package/build/app/store.d.ts +4 -0
  7. package/build/constants/app.d.ts +11 -0
  8. package/build/constants/app.js +49 -0
  9. package/build/features/app/entity/entityStore.d.ts +48 -0
  10. package/build/features/app/entity/entityStore.js +322 -0
  11. package/build/features/app/otp/otpStore.d.ts +28 -0
  12. package/build/features/app/otp/otpStore.js +153 -0
  13. package/build/features/entity/Entity.d.ts +7 -0
  14. package/build/features/entity/Entity.js +63 -0
  15. package/build/features/entity/index.d.ts +1 -0
  16. package/build/features/entity/index.js +1 -0
  17. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +5 -0
  18. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +6 -0
  19. package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +2 -0
  20. package/build/features/entity/screens/EntityInfoConfirm/index.js +2 -0
  21. package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  22. package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  23. package/build/features/entity/screens/ResetPasswordSuccess/index.d.ts +3 -0
  24. package/build/features/entity/screens/ResetPasswordSuccess/index.js +2 -0
  25. package/build/features/entity/screens/Success/Success.d.ts +5 -0
  26. package/build/features/entity/screens/Success/Success.js +16 -0
  27. package/build/features/entity/screens/Success/index.d.ts +3 -0
  28. package/build/features/entity/screens/Success/index.js +2 -0
  29. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  30. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +109 -0
  31. package/build/features/entity/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  32. package/build/features/entity/screens/SuccessWithFlowButtons/index.js +2 -0
  33. package/build/features/entity/screens/Verify/OTPInput.d.ts +7 -0
  34. package/build/features/entity/screens/Verify/OTPInput.js +47 -0
  35. package/build/features/entity/screens/Verify/Verify.d.ts +5 -0
  36. package/build/features/entity/screens/Verify/Verify.js +78 -0
  37. package/build/features/entity/screens/Verify/index.d.ts +2 -0
  38. package/build/features/entity/screens/Verify/index.js +2 -0
  39. package/build/features/entity/screens/Verify/validation.d.ts +8 -0
  40. package/build/features/entity/screens/Verify/validation.js +4 -0
  41. package/build/features/featuresScreens.d.ts +2 -0
  42. package/build/features/featuresScreens.js +31 -0
  43. package/build/features/otp/OTP.d.ts +7 -0
  44. package/build/features/otp/OTP.js +55 -0
  45. package/build/features/otp/index.d.ts +0 -0
  46. package/build/features/otp/index.js +1 -0
  47. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +6 -0
  48. package/build/features/otp/screens/OTPVerify/OTPInput.js +47 -0
  49. package/build/features/otp/screens/OTPVerify/Verify.d.ts +5 -0
  50. package/build/features/otp/screens/OTPVerify/Verify.js +50 -0
  51. package/build/features/otp/screens/OTPVerify/index.d.ts +2 -0
  52. package/build/features/otp/screens/OTPVerify/index.js +2 -0
  53. package/build/features/otp/screens/OTPVerify/validation.d.ts +8 -0
  54. package/build/features/otp/screens/OTPVerify/validation.js +4 -0
  55. package/build/features/shared/Background/Background.d.ts +2 -1
  56. package/build/features/shared/Background/Background.js +3 -3
  57. package/build/hooks/useAppDispatch.d.ts +2 -0
  58. package/build/index.d.ts +4 -2
  59. package/build/index.js +7 -1
  60. package/package.json +1 -1
@@ -187,7 +187,9 @@ export declare enum FlowsTypes {
187
187
  BUSINESS = "business",
188
188
  INDIVIDUAL = "individual",
189
189
  PASSWORD = "password",
190
- TAX = "tax"
190
+ TAX = "tax",
191
+ ENTITY = "entity",
192
+ OTP = "otp"
191
193
  }
192
194
  export declare type FlowInfo = {
193
195
  name: string;
@@ -17,4 +17,6 @@ export var FlowsTypes;
17
17
  FlowsTypes["INDIVIDUAL"] = "individual";
18
18
  FlowsTypes["PASSWORD"] = "password";
19
19
  FlowsTypes["TAX"] = "tax";
20
+ FlowsTypes["ENTITY"] = "entity";
21
+ FlowsTypes["OTP"] = "otp";
20
22
  })(FlowsTypes || (FlowsTypes = {}));
@@ -74,3 +74,10 @@ export declare type PasswordCreateFormValues = {
74
74
  password: string;
75
75
  confirmPassword: string;
76
76
  };
77
+ export declare type EntityFormValues = {
78
+ licenseNumber: string;
79
+ licenseName: string;
80
+ activities?: Array<Activity>;
81
+ salesChannels: Array<SalesChannel>;
82
+ operationStartDate: string;
83
+ };
@@ -7,5 +7,7 @@ declare const rootReducer: {
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
9
  signIn: import("redux").Reducer<import("../features/app/signIn/signInStore").SignInState, import("redux").AnyAction>;
10
+ entity: import("redux").Reducer<import("../features/app/entity/entityStore").EntityState, import("redux").AnyAction>;
11
+ otp: import("redux").Reducer<import("../features/app/otp/otpStore").OtpState, import("redux").AnyAction>;
10
12
  };
11
13
  export default rootReducer;
@@ -6,6 +6,8 @@ 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
8
  import signIn from '../features/app/signIn/signInStore';
9
+ import entity from '../features/app/entity/entityStore';
10
+ import otp from '../features/app/otp/otpStore';
9
11
  var rootReducer = {
10
12
  settings: settings,
11
13
  connect: connect,
@@ -14,6 +16,8 @@ var rootReducer = {
14
16
  tax: tax,
15
17
  individual: individual,
16
18
  password: password,
17
- signIn: signIn
19
+ signIn: signIn,
20
+ entity: entity,
21
+ otp: otp
18
22
  };
19
23
  export default rootReducer;
@@ -8,6 +8,8 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
8
8
  individual: import("../features/app/individual/individualStore").IndividualState;
9
9
  password: import("../features/app/password/passwordStore").PasswordState;
10
10
  signIn: import("../features/app/signIn/signInStore").SignInState;
11
+ entity: import("../features/app/entity/entityStore").EntityState;
12
+ otp: import("../features/app/otp/otpStore").OtpState;
11
13
  }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<{
12
14
  settings: import("./settings").SettingsState;
13
15
  connect: import("../features/app/connect/connectStore").ConnectState;
@@ -17,6 +19,8 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
17
19
  individual: import("../features/app/individual/individualStore").IndividualState;
18
20
  password: import("../features/app/password/passwordStore").PasswordState;
19
21
  signIn: import("../features/app/signIn/signInStore").SignInState;
22
+ entity: import("../features/app/entity/entityStore").EntityState;
23
+ otp: import("../features/app/otp/otpStore").OtpState;
20
24
  }, import("redux").AnyAction, undefined>]>>;
21
25
  export declare type AppDispatch = typeof store.dispatch;
22
26
  export declare type RootState = ReturnType<typeof store.getState>;
@@ -19,6 +19,8 @@ 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
21
  export declare const SigIn_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
22
+ export declare const ENTITY_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
23
+ export declare const OTP_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
22
24
  export declare const DefaultDeviceInfo: {
23
25
  source: string;
24
26
  device: {
@@ -121,6 +123,15 @@ export declare const PASSWORD_STEP_NAMES: {
121
123
  PASSWORD_SUCCESS: string;
122
124
  RESET_PASSWORD: string;
123
125
  };
126
+ export declare const ENTITY_STEP_NAMES: {
127
+ PHONE_AUTH: string;
128
+ ENTITY_INFO: string;
129
+ ENTITY_SUCCESS: string;
130
+ };
131
+ export declare const OTP_STEP_NAMES: {
132
+ PHONE_AUTH: string;
133
+ OTP_SUCCESS: string;
134
+ };
124
135
  export declare const RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
125
136
  export declare const ENCRYPTION_FLAG = "encryption_contract";
126
137
  export declare const BACKEND_ENCRYPTION_FLAG = "backend_encryption_contract";
@@ -279,6 +279,46 @@ export var SigIn_SCREENS_NAVIGATION = [
279
279
  order: 3
280
280
  }
281
281
  ];
282
+ export var ENTITY_SCREENS_NAVIGATION = [
283
+ {
284
+ name: 'ENTITY_VERIFY_STEP',
285
+ next: ['ENTITY_INFO_STEP', 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
286
+ prev: '',
287
+ order: 1
288
+ },
289
+ {
290
+ name: 'ENTITY_INFO_STEP',
291
+ next: 'ENTITY_DETAILS_SUCCESS_STEP',
292
+ prev: '',
293
+ order: 2
294
+ },
295
+ {
296
+ name: 'ENTITY_DETAILS_SUCCESS_STEP',
297
+ next: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
298
+ prev: 'ENTITY_INFO_STEP',
299
+ order: 3
300
+ },
301
+ {
302
+ name: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
303
+ next: 'ENTITY_RESET_PASSWORD_SUCCESS',
304
+ prev: '',
305
+ order: 4
306
+ },
307
+ {
308
+ name: 'ENTITY_RESET_PASSWORD_SUCCESS',
309
+ next: '',
310
+ prev: '',
311
+ order: 5
312
+ }
313
+ ];
314
+ export var OTP_SCREENS_NAVIGATION = [
315
+ {
316
+ name: 'OTP_VERIFY_STEP',
317
+ next: '',
318
+ prev: '',
319
+ order: 1
320
+ }
321
+ ];
282
322
  export var DefaultDeviceInfo = {
283
323
  source: 'browser',
284
324
  device: {
@@ -381,6 +421,15 @@ export var PASSWORD_STEP_NAMES = {
381
421
  PASSWORD_SUCCESS: 'password_completed',
382
422
  RESET_PASSWORD: 'reset_password'
383
423
  };
424
+ export var ENTITY_STEP_NAMES = {
425
+ PHONE_AUTH: 'entity_phone_auth',
426
+ ENTITY_INFO: 'entity_info',
427
+ ENTITY_SUCCESS: 'entity_completed'
428
+ };
429
+ export var OTP_STEP_NAMES = {
430
+ PHONE_AUTH: 'otp_phone_auth',
431
+ OTP_SUCCESS: 'otp_completed'
432
+ };
384
433
  export var RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
385
434
  export var ENCRYPTION_FLAG = 'encryption_contract';
386
435
  export var BACKEND_ENCRYPTION_FLAG = 'backend_encryption_contract';
@@ -0,0 +1,48 @@
1
+ import { RootState } from '../../../app/store';
2
+ import { EntityFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
+ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
+ data: any;
5
+ boardResponse: {
6
+ flows: {
7
+ name: string;
8
+ status: string;
9
+ url: string;
10
+ }[];
11
+ };
12
+ token: string;
13
+ }, string, {}>;
14
+ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
15
+ data: any;
16
+ }, void, {}>;
17
+ export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
18
+ data: any;
19
+ formData: OTPFormValues;
20
+ }, OTPFormValues, {}>;
21
+ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
22
+ data: any;
23
+ }, string, {}>;
24
+ export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
25
+ response: any;
26
+ formData: void;
27
+ } | undefined, void, {}>;
28
+ declare type VerifyData = {
29
+ token: string;
30
+ };
31
+ export interface EntityData {
32
+ verify: ResponseData & VerifyData;
33
+ otpData: OTPFormValues & ResponseData;
34
+ entityData: EntityFormValues & ResponseData;
35
+ flowName: FlowsTypes;
36
+ }
37
+ export interface EntityState extends SharedState<EntityData> {
38
+ customLoading?: boolean;
39
+ }
40
+ export declare const entitySlice: import("@reduxjs/toolkit").Slice<EntityState, {
41
+ clearError: (state: EntityState) => void;
42
+ stopLoader: (state: EntityState) => void;
43
+ resetOTPScreen: (state: EntityState) => void;
44
+ }, "entity/store">;
45
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
46
+ declare const _default: import("redux").Reducer<EntityState, import("redux").AnyAction>;
47
+ export default _default;
48
+ export declare const entitySelector: (state: RootState) => EntityState;
@@ -0,0 +1,322 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var _a;
49
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
+ import API from '../../../api';
51
+ import { FlowsTypes } from '../../../@types';
52
+ import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
53
+ import { ENTITY_STEP_NAMES, BUSINESS_FLOW_SUCCESS } from '../../../constants';
54
+ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var payload, data, boardInfoData, board_id, board_info_id, info, hasEntityCompleted;
56
+ var _a;
57
+ return __generator(this, function (_b) {
58
+ switch (_b.label) {
59
+ case 0:
60
+ payload = {
61
+ service_name: 'tap_email',
62
+ verify_token: token
63
+ };
64
+ return [4, API.leadService.verifyLeadToken(payload)];
65
+ case 1:
66
+ data = (_b.sent()).data;
67
+ boardInfoData = undefined;
68
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
69
+ board_id = data === null || data === void 0 ? void 0 : data.id;
70
+ board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
71
+ if (!(!!board_id && !!board_info_id)) return [3, 3];
72
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
73
+ case 2:
74
+ boardInfoData = _b.sent();
75
+ _b.label = 3;
76
+ case 3: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
77
+ case 4:
78
+ _b.sent();
79
+ info = boardInfoData.info;
80
+ hasEntityCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
81
+ if (data.step_name === ENTITY_STEP_NAMES.PHONE_AUTH) {
82
+ thunkApi.dispatch(handleCurrentActiveScreen('ENTITY_VERIFY_STEP'));
83
+ }
84
+ else if (hasEntityCompleted) {
85
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
86
+ }
87
+ else if (data.step_name === ENTITY_STEP_NAMES.ENTITY_INFO) {
88
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
89
+ }
90
+ _b.label = 5;
91
+ case 5: return [2, { data: data, boardResponse: { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) }, token: token }];
92
+ }
93
+ });
94
+ }); });
95
+ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
96
+ var entity, payload, data;
97
+ return __generator(this, function (_a) {
98
+ switch (_a.label) {
99
+ case 0:
100
+ entity = thunkApi.getState().entity;
101
+ payload = {
102
+ service_name: 'tap_email',
103
+ verify_token: entity.data.verify.token
104
+ };
105
+ return [4, API.leadService.verifyLeadToken(payload)];
106
+ case 1:
107
+ data = (_a.sent()).data;
108
+ return [2, { data: data }];
109
+ }
110
+ });
111
+ }); });
112
+ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
113
+ var _a, entity, settings, responseBody, flows, payload, data, hasEntityCompleted;
114
+ var _b, _c, _d, _e;
115
+ return __generator(this, function (_f) {
116
+ switch (_f.label) {
117
+ case 0:
118
+ _a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
119
+ responseBody = entity.data.verify.responseBody;
120
+ flows = (responseBody || {}).flows;
121
+ payload = {
122
+ data: params.otp,
123
+ service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
124
+ verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
125
+ step_name: ENTITY_STEP_NAMES.PHONE_AUTH,
126
+ encryption_contract: ['data']
127
+ };
128
+ return [4, API.leadService.verifyLeadOTP(payload)];
129
+ case 1:
130
+ data = (_f.sent()).data;
131
+ if (!data.errors) {
132
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
133
+ hasEntityCompleted = ((_e = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'entity'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
134
+ if (hasEntityCompleted) {
135
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
136
+ }
137
+ else {
138
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
139
+ }
140
+ }
141
+ return [2, { data: data, formData: params }];
142
+ }
143
+ });
144
+ }); });
145
+ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
146
+ var data;
147
+ var _a, _b;
148
+ return __generator(this, function (_c) {
149
+ switch (_c.label) {
150
+ case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
151
+ case 1:
152
+ data = _c.sent();
153
+ return [2, {
154
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
155
+ }];
156
+ }
157
+ });
158
+ }); });
159
+ export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
160
+ var _a, settings, entity, _b, id, infoId, payload, data;
161
+ var _c, _d, _e, _f;
162
+ return __generator(this, function (_g) {
163
+ switch (_g.label) {
164
+ case 0:
165
+ _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
166
+ _b = entity.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
167
+ if (!id)
168
+ return [2];
169
+ payload = {
170
+ lang: settings.data.language,
171
+ step_name: ENTITY_STEP_NAMES.ENTITY_SUCCESS,
172
+ id: id
173
+ };
174
+ return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
175
+ case 1:
176
+ data = _g.sent();
177
+ return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
178
+ case 2:
179
+ _g.sent();
180
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
181
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
182
+ thunkApi.dispatch(handleNextScreenStep());
183
+ return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info) }), formData: params }];
184
+ }
185
+ });
186
+ }); });
187
+ var initialState = {
188
+ error: null,
189
+ loading: false,
190
+ customLoading: false,
191
+ data: {
192
+ flowName: FlowsTypes.ENTITY,
193
+ verify: {
194
+ token: ''
195
+ },
196
+ otpData: {
197
+ otp: ''
198
+ },
199
+ entityData: {
200
+ licenseNumber: '',
201
+ licenseName: '',
202
+ activities: [],
203
+ salesChannels: [],
204
+ operationStartDate: ''
205
+ }
206
+ }
207
+ };
208
+ export var entitySlice = createSlice({
209
+ name: 'entity/store',
210
+ initialState: initialState,
211
+ reducers: {
212
+ clearError: function (state) {
213
+ state.error = null;
214
+ },
215
+ stopLoader: function (state) {
216
+ state.loading = false;
217
+ },
218
+ resetOTPScreen: function (state) {
219
+ state.data.otpData.otp = '';
220
+ }
221
+ },
222
+ extraReducers: function (builder) {
223
+ builder
224
+ .addCase(verifyLeadToken.pending, function (state) {
225
+ state.error = null;
226
+ state.customLoading = true;
227
+ })
228
+ .addCase(verifyLeadToken.fulfilled, function (state, action) {
229
+ var _a;
230
+ state.error = null;
231
+ state.customLoading = false;
232
+ var _b = action.payload, data = _b.data, token = _b.token, boardResponse = _b.boardResponse;
233
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
234
+ if (description) {
235
+ state.error = description;
236
+ return;
237
+ }
238
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
239
+ state.data.verify.token = token;
240
+ })
241
+ .addCase(verifyLeadToken.rejected, function (state, action) {
242
+ state.error = action.error.message;
243
+ state.customLoading = false;
244
+ })
245
+ .addCase(resendOTP.pending, function (state) {
246
+ state.error = null;
247
+ })
248
+ .addCase(resendOTP.fulfilled, function (state, action) {
249
+ var _a;
250
+ state.error = null;
251
+ var data = action.payload.data;
252
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
253
+ if (description) {
254
+ state.error = description;
255
+ return;
256
+ }
257
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
258
+ })
259
+ .addCase(resendOTP.rejected, function (state, action) {
260
+ state.error = action.error.message;
261
+ })
262
+ .addCase(verifyEntityLeadOTP.pending, function (state) {
263
+ state.loading = true;
264
+ state.error = null;
265
+ })
266
+ .addCase(verifyEntityLeadOTP.fulfilled, function (state, action) {
267
+ var _a;
268
+ state.loading = false;
269
+ state.error = null;
270
+ var _b = action.payload, data = _b.data, formData = _b.formData;
271
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
272
+ if (description) {
273
+ state.error = description;
274
+ return;
275
+ }
276
+ state.data.otpData = formData;
277
+ state.data.otpData.responseBody = data;
278
+ })
279
+ .addCase(verifyEntityLeadOTP.rejected, function (state, action) {
280
+ state.loading = false;
281
+ state.error = action.error.message;
282
+ })
283
+ .addCase(retrieveBoardDetails.pending, function (state) {
284
+ state.error = null;
285
+ state.loading = true;
286
+ })
287
+ .addCase(retrieveBoardDetails.fulfilled, function (state, action) {
288
+ state.error = null;
289
+ state.loading = false;
290
+ var data = (action.payload || {}).data;
291
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
292
+ })
293
+ .addCase(retrieveBoardDetails.rejected, function (state, action) {
294
+ state.error = action.error.message;
295
+ state.loading = false;
296
+ })
297
+ .addCase(updateBoardSuccess.fulfilled, function (state, action) {
298
+ var _a;
299
+ state.loading = false;
300
+ state.error = null;
301
+ var response = (action.payload || {}).response;
302
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
303
+ if (description) {
304
+ state.error = description;
305
+ return;
306
+ }
307
+ var flows = response.flows;
308
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
309
+ })
310
+ .addCase(updateBoardSuccess.pending, function (state) {
311
+ state.loading = true;
312
+ state.error = null;
313
+ })
314
+ .addCase(updateBoardSuccess.rejected, function (state, action) {
315
+ state.loading = false;
316
+ state.error = action.error.message;
317
+ });
318
+ }
319
+ });
320
+ export var clearError = (_a = entitySlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
321
+ export default entitySlice.reducer;
322
+ export var entitySelector = function (state) { return state.entity; };
@@ -0,0 +1,28 @@
1
+ import { RootState } from '../../../app/store';
2
+ import { FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
+ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
4
+ data: any;
5
+ }, void, {}>;
6
+ export declare const verifyOtpLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
7
+ formData: OTPFormValues;
8
+ }, OTPFormValues, {}>;
9
+ declare type VerifyData = {
10
+ token: string;
11
+ };
12
+ export interface OtpData {
13
+ verify: ResponseData & VerifyData;
14
+ otpData: OTPFormValues & ResponseData;
15
+ flowName: FlowsTypes;
16
+ }
17
+ export interface OtpState extends SharedState<OtpData> {
18
+ customLoading?: boolean;
19
+ }
20
+ export declare const otpSlice: import("@reduxjs/toolkit").Slice<OtpState, {
21
+ clearError: (state: OtpState) => void;
22
+ stopLoader: (state: OtpState) => void;
23
+ resetOTPScreen: (state: OtpState) => void;
24
+ }, "otp/store">;
25
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
26
+ declare const _default: import("redux").Reducer<OtpState, import("redux").AnyAction>;
27
+ export default _default;
28
+ export declare const otpSelector: (state: RootState) => OtpState;