@tap-payments/auth-jsconnect 2.3.39-test → 2.3.43-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.
- package/build/features/app/bank/bankStore.d.ts +0 -1
- package/build/features/app/bank/bankStore.js +21 -37
- package/build/features/app/entity/entityStore.d.ts +0 -2
- package/build/features/app/entity/entityStore.js +44 -62
- package/build/features/app/individual/individualStore.d.ts +0 -2
- package/build/features/app/individual/individualStore.js +71 -91
- package/build/features/app/tax/taxStore.js +18 -36
- package/build/features/bank/screens/Verify/OTPInput.js +5 -3
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +2 -2
- package/build/features/brand/screens/Verify/OTPInput.js +5 -3
- package/build/features/business/screens/Verify/OTPInput.js +5 -3
- package/build/features/entity/screens/Verify/OTPInput.js +5 -3
- package/build/features/individual/screens/Verify/OTPInput.js +5 -3
- package/build/features/password/screens/Verify/OTPInput.js +5 -3
- package/build/features/shared/Button/FlowsButtons.js +14 -19
- package/build/features/shared/OTP/OTP.d.ts +2 -1
- package/build/features/shared/OTP/OTP.js +2 -2
- package/build/features/tax/screens/Verify/OTPInput.js +5 -3
- package/build/utils/error.d.ts +1 -0
- package/build/utils/error.js +3 -0
- package/package.json +1 -1
|
@@ -55,10 +55,10 @@ import { hasNoneEditableValue, sleep } from '../../../utils';
|
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data,
|
|
59
|
-
var _b, _c, _d
|
|
60
|
-
return __generator(this, function (
|
|
61
|
-
switch (
|
|
58
|
+
var payload, data, boardData, board_id, countryIso2;
|
|
59
|
+
var _b, _c, _d;
|
|
60
|
+
return __generator(this, function (_e) {
|
|
61
|
+
switch (_e.label) {
|
|
62
62
|
case 0:
|
|
63
63
|
payload = {
|
|
64
64
|
service_name: 'tap_email',
|
|
@@ -66,37 +66,29 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
66
66
|
};
|
|
67
67
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
68
68
|
case 1:
|
|
69
|
-
data = (
|
|
69
|
+
data = (_e.sent()).data;
|
|
70
70
|
boardData = undefined;
|
|
71
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
71
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 4];
|
|
72
72
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
73
|
-
if (!board_id) return [3,
|
|
74
|
-
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
75
|
-
case 2:
|
|
76
|
-
boardInfoData = _f.sent();
|
|
73
|
+
if (!board_id) return [3, 3];
|
|
77
74
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
75
|
+
case 2:
|
|
76
|
+
boardData = _e.sent();
|
|
77
|
+
_e.label = 3;
|
|
78
78
|
case 3:
|
|
79
|
-
boardData = _f.sent();
|
|
80
|
-
_f.label = 4;
|
|
81
|
-
case 4:
|
|
82
79
|
countryIso2 = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
|
|
83
80
|
if (countryIso2)
|
|
84
81
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
85
|
-
info = (boardInfoData || {}).info;
|
|
86
82
|
if (isInternally)
|
|
87
83
|
data.step_name = BANK_STEP_NAMES.BANK_INFO;
|
|
88
|
-
hasBankCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'bank'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
|
|
89
84
|
if (data.step_name === BANK_STEP_NAMES.PHONE_AUTH) {
|
|
90
85
|
thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
|
|
91
86
|
}
|
|
92
|
-
else if (hasBankCompleted) {
|
|
93
|
-
thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
94
|
-
}
|
|
95
87
|
else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
|
|
96
88
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP')); });
|
|
97
89
|
}
|
|
98
|
-
|
|
99
|
-
case
|
|
90
|
+
_e.label = 4;
|
|
91
|
+
case 4: return [2, {
|
|
100
92
|
data: data,
|
|
101
93
|
boardResponse: {
|
|
102
94
|
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
@@ -104,11 +96,10 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
104
96
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
105
97
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
106
98
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
107
|
-
name: (
|
|
108
|
-
contact: (
|
|
99
|
+
name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
|
|
100
|
+
contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
|
|
109
101
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
110
|
-
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals
|
|
111
|
-
flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
|
|
102
|
+
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals
|
|
112
103
|
},
|
|
113
104
|
token: token
|
|
114
105
|
}];
|
|
@@ -134,14 +125,13 @@ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunk
|
|
|
134
125
|
});
|
|
135
126
|
}); });
|
|
136
127
|
export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
137
|
-
var _a, bank, settings, responseBody,
|
|
138
|
-
var _b, _c, _d
|
|
139
|
-
return __generator(this, function (
|
|
140
|
-
switch (
|
|
128
|
+
var _a, bank, settings, responseBody, payload, data;
|
|
129
|
+
var _b, _c, _d;
|
|
130
|
+
return __generator(this, function (_e) {
|
|
131
|
+
switch (_e.label) {
|
|
141
132
|
case 0:
|
|
142
133
|
_a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
|
|
143
134
|
responseBody = bank.data.verify.responseBody;
|
|
144
|
-
flows = (responseBody || {}).flows;
|
|
145
135
|
payload = {
|
|
146
136
|
data: params.otp,
|
|
147
137
|
service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
|
|
@@ -151,16 +141,10 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
|
|
|
151
141
|
};
|
|
152
142
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
153
143
|
case 1:
|
|
154
|
-
data = (
|
|
144
|
+
data = (_e.sent()).data;
|
|
155
145
|
if (!data.errors) {
|
|
156
146
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
157
|
-
|
|
158
|
-
if (hasBankCompleted) {
|
|
159
|
-
thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP')); });
|
|
163
|
-
}
|
|
147
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP')); });
|
|
164
148
|
}
|
|
165
149
|
return [2, { data: data, formData: params }];
|
|
166
150
|
}
|
|
@@ -16,7 +16,6 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
16
16
|
contact: any;
|
|
17
17
|
individuals: any;
|
|
18
18
|
business: any;
|
|
19
|
-
flows: any;
|
|
20
19
|
entityTypes: any;
|
|
21
20
|
};
|
|
22
21
|
token: string;
|
|
@@ -36,7 +35,6 @@ export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
36
35
|
contact: any;
|
|
37
36
|
individuals: any;
|
|
38
37
|
business: any;
|
|
39
|
-
flows: any;
|
|
40
38
|
entityTypes: any;
|
|
41
39
|
};
|
|
42
40
|
formData: OTPFormValues;
|
|
@@ -67,10 +67,10 @@ import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedVal
|
|
|
67
67
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
|
|
68
68
|
var token = _a.token, isInternally = _a.isInternally;
|
|
69
69
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
-
var payload, data, boardData, entityData,
|
|
71
|
-
var _b, _c, _d
|
|
72
|
-
return __generator(this, function (
|
|
73
|
-
switch (
|
|
70
|
+
var payload, data, boardData, entityData, entityTypes, countryIso2, board_id, entityId;
|
|
71
|
+
var _b, _c, _d;
|
|
72
|
+
return __generator(this, function (_e) {
|
|
73
|
+
switch (_e.label) {
|
|
74
74
|
case 0:
|
|
75
75
|
payload = {
|
|
76
76
|
service_name: 'tap_email',
|
|
@@ -78,9 +78,9 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
78
78
|
};
|
|
79
79
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
80
80
|
case 1:
|
|
81
|
-
data = (
|
|
81
|
+
data = (_e.sent()).data;
|
|
82
82
|
countryIso2 = undefined;
|
|
83
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
83
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 7];
|
|
84
84
|
if (isInternally)
|
|
85
85
|
data.step_name = ENTITY_STEP_NAMES.ENTITY_INFO;
|
|
86
86
|
if (data === null || data === void 0 ? void 0 : data.country_code) {
|
|
@@ -88,40 +88,32 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
88
88
|
if (countryIso2)
|
|
89
89
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
90
90
|
}
|
|
91
|
-
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
91
|
+
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 7];
|
|
92
92
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
93
|
-
if (!board_id) return [3,
|
|
94
|
-
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
95
|
-
case 2:
|
|
96
|
-
boardInfoData = _f.sent();
|
|
93
|
+
if (!board_id) return [3, 3];
|
|
97
94
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
95
|
+
case 2:
|
|
96
|
+
boardData = _e.sent();
|
|
97
|
+
_e.label = 3;
|
|
98
98
|
case 3:
|
|
99
|
-
boardData = _f.sent();
|
|
100
|
-
_f.label = 4;
|
|
101
|
-
case 4:
|
|
102
99
|
entityId = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.id;
|
|
103
|
-
if (!entityId) return [3,
|
|
100
|
+
if (!entityId) return [3, 5];
|
|
104
101
|
return [4, API.entityService.retrieveEntity(entityId)];
|
|
102
|
+
case 4:
|
|
103
|
+
entityData = _e.sent();
|
|
104
|
+
_e.label = 5;
|
|
105
105
|
case 5:
|
|
106
|
-
entityData = _f.sent();
|
|
107
|
-
_f.label = 6;
|
|
108
|
-
case 6:
|
|
109
106
|
if (!countryIso2) {
|
|
110
107
|
countryIso2 = entityData.country;
|
|
111
108
|
if (countryIso2)
|
|
112
109
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
113
110
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
118
|
-
return [3, 9];
|
|
119
|
-
case 7: return [4, API.entityService.retrieveEntityType()];
|
|
120
|
-
case 8:
|
|
121
|
-
entityTypes = _f.sent();
|
|
111
|
+
return [4, API.entityService.retrieveEntityType()];
|
|
112
|
+
case 6:
|
|
113
|
+
entityTypes = _e.sent();
|
|
122
114
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
|
|
123
|
-
|
|
124
|
-
case
|
|
115
|
+
_e.label = 7;
|
|
116
|
+
case 7: return [2, {
|
|
125
117
|
data: data,
|
|
126
118
|
boardResponse: {
|
|
127
119
|
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
@@ -129,11 +121,10 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
129
121
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
130
122
|
entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
|
|
131
123
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
132
|
-
name: (
|
|
133
|
-
contact: (
|
|
124
|
+
name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
|
|
125
|
+
contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
|
|
134
126
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
135
127
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
136
|
-
flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [],
|
|
137
128
|
entityTypes: entityTypes
|
|
138
129
|
},
|
|
139
130
|
token: token
|
|
@@ -160,10 +151,10 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
|
|
|
160
151
|
});
|
|
161
152
|
}); });
|
|
162
153
|
export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
163
|
-
var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes,
|
|
164
|
-
var _b, _c, _d, _e, _f, _g
|
|
165
|
-
return __generator(this, function (
|
|
166
|
-
switch (
|
|
154
|
+
var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes, board_id, entityId;
|
|
155
|
+
var _b, _c, _d, _e, _f, _g;
|
|
156
|
+
return __generator(this, function (_h) {
|
|
157
|
+
switch (_h.label) {
|
|
167
158
|
case 0:
|
|
168
159
|
_a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
|
|
169
160
|
responseBody = entity.data.verify.responseBody;
|
|
@@ -176,38 +167,30 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
176
167
|
};
|
|
177
168
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
178
169
|
case 1:
|
|
179
|
-
data = (
|
|
180
|
-
|
|
181
|
-
if (!!data.errors) return [3,
|
|
170
|
+
data = (_h.sent()).data;
|
|
171
|
+
entityTypes = undefined;
|
|
172
|
+
if (!!data.errors) return [3, 7];
|
|
182
173
|
board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
|
|
183
|
-
if (!board_id) return [3,
|
|
184
|
-
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
185
|
-
case 2:
|
|
186
|
-
boardInfoData = _j.sent();
|
|
174
|
+
if (!board_id) return [3, 3];
|
|
187
175
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
176
|
+
case 2:
|
|
177
|
+
boardData = _h.sent();
|
|
178
|
+
_h.label = 3;
|
|
188
179
|
case 3:
|
|
189
|
-
boardData = _j.sent();
|
|
190
|
-
_j.label = 4;
|
|
191
|
-
case 4:
|
|
192
180
|
entityId = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.id;
|
|
193
|
-
if (!entityId) return [3,
|
|
181
|
+
if (!entityId) return [3, 5];
|
|
194
182
|
return [4, API.entityService.retrieveEntity(entityId)];
|
|
183
|
+
case 4:
|
|
184
|
+
entityData = _h.sent();
|
|
185
|
+
_h.label = 5;
|
|
195
186
|
case 5:
|
|
196
|
-
entityData = _j.sent();
|
|
197
|
-
_j.label = 6;
|
|
198
|
-
case 6:
|
|
199
187
|
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
204
|
-
return [3, 9];
|
|
205
|
-
case 7: return [4, API.entityService.retrieveEntityType()];
|
|
206
|
-
case 8:
|
|
207
|
-
entityTypes = _j.sent();
|
|
188
|
+
return [4, API.entityService.retrieveEntityType()];
|
|
189
|
+
case 6:
|
|
190
|
+
entityTypes = _h.sent();
|
|
208
191
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
|
|
209
|
-
|
|
210
|
-
case
|
|
192
|
+
_h.label = 7;
|
|
193
|
+
case 7: return [2, {
|
|
211
194
|
data: data,
|
|
212
195
|
boardResponse: {
|
|
213
196
|
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
@@ -215,11 +198,10 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
215
198
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
216
199
|
entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
|
|
217
200
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
218
|
-
name: (
|
|
219
|
-
contact: (
|
|
201
|
+
name: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.names,
|
|
202
|
+
contact: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.contact,
|
|
220
203
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
221
204
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
222
|
-
flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [],
|
|
223
205
|
entityTypes: entityTypes
|
|
224
206
|
},
|
|
225
207
|
formData: params
|
|
@@ -21,7 +21,6 @@ export declare const verifyToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
21
21
|
countryCode: any;
|
|
22
22
|
notification: any;
|
|
23
23
|
business: any;
|
|
24
|
-
flows: any;
|
|
25
24
|
};
|
|
26
25
|
token: string;
|
|
27
26
|
}, VerifyLeadTokenProps, {}>;
|
|
@@ -79,7 +78,6 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
79
78
|
countryCode: any;
|
|
80
79
|
notification: any;
|
|
81
80
|
business: any;
|
|
82
|
-
flows: any;
|
|
83
81
|
};
|
|
84
82
|
formData: {
|
|
85
83
|
otp: string;
|
|
@@ -75,10 +75,10 @@ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountry
|
|
|
75
75
|
export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
|
|
76
76
|
var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
|
|
77
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
78
|
-
var payload, settings, data, boardData, individualData, countryCode, boardInfoData,
|
|
79
|
-
var _c, _d, _e, _f, _g, _h, _j
|
|
80
|
-
return __generator(this, function (
|
|
81
|
-
switch (
|
|
78
|
+
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, countries, board_id, board_info_id, notification, _b, id, type, data_1, birthCountry;
|
|
79
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
80
|
+
return __generator(this, function (_k) {
|
|
81
|
+
switch (_k.label) {
|
|
82
82
|
case 0:
|
|
83
83
|
payload = {
|
|
84
84
|
service_name: 'tap_email',
|
|
@@ -87,8 +87,8 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
87
87
|
settings = thunkApi.getState().settings;
|
|
88
88
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
89
89
|
case 1:
|
|
90
|
-
data = (
|
|
91
|
-
|
|
90
|
+
data = (_k.sent()).data;
|
|
91
|
+
boardInfoData = undefined;
|
|
92
92
|
countries = settings.data.countries;
|
|
93
93
|
if (((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
94
94
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
@@ -100,70 +100,61 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
100
100
|
}
|
|
101
101
|
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
|
|
102
102
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
|
|
103
|
-
return [3,
|
|
103
|
+
return [3, 15];
|
|
104
104
|
case 2:
|
|
105
|
-
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
105
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 14];
|
|
106
106
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
107
107
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
108
108
|
if (!(board_id && board_info_id)) return [3, 5];
|
|
109
109
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
110
110
|
case 3:
|
|
111
|
-
boardInfoData =
|
|
111
|
+
boardInfoData = _k.sent();
|
|
112
112
|
notification = (boardInfoData || {}).notification;
|
|
113
113
|
_b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
|
|
114
114
|
if (!(id && type)) return [3, 5];
|
|
115
115
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
116
116
|
case 4:
|
|
117
|
-
data_1 = (
|
|
117
|
+
data_1 = (_k.sent()).data;
|
|
118
118
|
individualData = data_1 || {};
|
|
119
|
-
|
|
119
|
+
_k.label = 5;
|
|
120
120
|
case 5:
|
|
121
|
-
if (!board_id) return [3,
|
|
121
|
+
if (!board_id) return [3, 7];
|
|
122
122
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
123
123
|
case 6:
|
|
124
|
-
boardData =
|
|
125
|
-
|
|
124
|
+
boardData = _k.sent();
|
|
125
|
+
_k.label = 7;
|
|
126
126
|
case 7:
|
|
127
|
-
boardInfoStatus = _l.sent();
|
|
128
|
-
_l.label = 8;
|
|
129
|
-
case 8:
|
|
130
127
|
if (!countryCode) {
|
|
131
128
|
countryCode = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
|
|
132
129
|
if (countryCode)
|
|
133
130
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
134
131
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
132
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 10];
|
|
133
|
+
if (!((_e = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _e === void 0 ? void 0 : _e.id)) return [3, 9];
|
|
134
|
+
return [4, thunkApi.dispatch(getIndividualList((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id))];
|
|
135
|
+
case 8:
|
|
136
|
+
_k.sent();
|
|
137
|
+
_k.label = 9;
|
|
140
138
|
case 9:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
|
|
139
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
140
|
+
return [3, 13];
|
|
144
141
|
case 10:
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
birthCountry = ((_g = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _g === void 0 ? void 0 : _g.country) || countryCode;
|
|
143
|
+
if (!birthCountry) return [3, 12];
|
|
144
|
+
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
147
145
|
case 11:
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
_k.sent();
|
|
147
|
+
_k.label = 12;
|
|
150
148
|
case 12:
|
|
151
|
-
birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
|
|
152
|
-
if (!birthCountry) return [3, 14];
|
|
153
|
-
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
154
|
-
case 13:
|
|
155
|
-
_l.sent();
|
|
156
|
-
_l.label = 14;
|
|
157
|
-
case 14:
|
|
158
149
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
159
|
-
|
|
160
|
-
case
|
|
161
|
-
case
|
|
150
|
+
_k.label = 13;
|
|
151
|
+
case 13: return [3, 15];
|
|
152
|
+
case 14:
|
|
162
153
|
if (isUpdatePhoneInfo) {
|
|
163
154
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
|
|
164
155
|
}
|
|
165
|
-
|
|
166
|
-
case
|
|
156
|
+
_k.label = 15;
|
|
157
|
+
case 15: return [2, {
|
|
167
158
|
data: data,
|
|
168
159
|
boardResponse: {
|
|
169
160
|
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
@@ -171,14 +162,13 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
171
162
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
172
163
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
173
164
|
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
174
|
-
name: (
|
|
175
|
-
contact: (
|
|
165
|
+
name: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.names,
|
|
166
|
+
contact: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.contact,
|
|
176
167
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
177
168
|
countries: countries,
|
|
178
169
|
countryCode: countryCode,
|
|
179
170
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
180
|
-
business: boardData === null || boardData === void 0 ? void 0 : boardData.business
|
|
181
|
-
flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
|
|
171
|
+
business: boardData === null || boardData === void 0 ? void 0 : boardData.business
|
|
182
172
|
},
|
|
183
173
|
token: token
|
|
184
174
|
}];
|
|
@@ -411,10 +401,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
411
401
|
});
|
|
412
402
|
}); });
|
|
413
403
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
414
|
-
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData,
|
|
415
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
416
|
-
return __generator(this, function (
|
|
417
|
-
switch (
|
|
404
|
+
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, notification, _c, id, type, data_3, birthCountry;
|
|
405
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
406
|
+
return __generator(this, function (_p) {
|
|
407
|
+
switch (_p.label) {
|
|
418
408
|
case 0:
|
|
419
409
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
420
410
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -429,62 +419,53 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
429
419
|
};
|
|
430
420
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
431
421
|
case 1:
|
|
432
|
-
data = (
|
|
433
|
-
|
|
422
|
+
data = (_p.sent()).data;
|
|
423
|
+
boardData = undefined;
|
|
434
424
|
if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
435
425
|
throw new Error(data.errors[0].description);
|
|
436
|
-
if (!board_id) return [3,
|
|
426
|
+
if (!board_id) return [3, 3];
|
|
437
427
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
438
428
|
case 2:
|
|
439
|
-
boardData =
|
|
440
|
-
|
|
429
|
+
boardData = _p.sent();
|
|
430
|
+
_p.label = 3;
|
|
441
431
|
case 3:
|
|
442
|
-
boardInfoStatus = _q.sent();
|
|
443
|
-
_q.label = 4;
|
|
444
|
-
case 4:
|
|
445
432
|
countryCode = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
|
|
446
|
-
if (!(board_id && board_info_id)) return [3,
|
|
433
|
+
if (!(board_id && board_info_id)) return [3, 6];
|
|
447
434
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
448
|
-
case
|
|
449
|
-
boardInfoData =
|
|
435
|
+
case 4:
|
|
436
|
+
boardInfoData = _p.sent();
|
|
450
437
|
notification = (boardInfoData || {}).notification;
|
|
451
438
|
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
452
|
-
if (!(id && type)) return [3,
|
|
439
|
+
if (!(id && type)) return [3, 6];
|
|
453
440
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
454
|
-
case
|
|
455
|
-
data_3 = (
|
|
441
|
+
case 5:
|
|
442
|
+
data_3 = (_p.sent()).data;
|
|
456
443
|
individualData = data_3 || {};
|
|
457
|
-
|
|
458
|
-
case
|
|
444
|
+
_p.label = 6;
|
|
445
|
+
case 6:
|
|
459
446
|
if (countryCode)
|
|
460
447
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
448
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 9];
|
|
449
|
+
if (!((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id)) return [3, 8];
|
|
450
|
+
return [4, thunkApi.dispatch(getIndividualList((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id))];
|
|
451
|
+
case 7:
|
|
452
|
+
_p.sent();
|
|
453
|
+
_p.label = 8;
|
|
466
454
|
case 8:
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
return [4, thunkApi.dispatch(getIndividualList((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id))];
|
|
455
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
456
|
+
return [3, 12];
|
|
470
457
|
case 9:
|
|
471
|
-
|
|
472
|
-
|
|
458
|
+
birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
|
|
459
|
+
if (!birthCountry) return [3, 11];
|
|
460
|
+
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
473
461
|
case 10:
|
|
474
|
-
|
|
475
|
-
|
|
462
|
+
_p.sent();
|
|
463
|
+
_p.label = 11;
|
|
476
464
|
case 11:
|
|
477
|
-
birthCountry = ((_k = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _k === void 0 ? void 0 : _k.country) || countryCode;
|
|
478
|
-
if (!birthCountry) return [3, 13];
|
|
479
|
-
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
480
|
-
case 12:
|
|
481
|
-
_q.sent();
|
|
482
|
-
_q.label = 13;
|
|
483
|
-
case 13:
|
|
484
465
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
485
|
-
|
|
486
|
-
case
|
|
487
|
-
(
|
|
466
|
+
_p.label = 12;
|
|
467
|
+
case 12:
|
|
468
|
+
(_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
|
|
488
469
|
return [2, {
|
|
489
470
|
data: data,
|
|
490
471
|
boardResponse: {
|
|
@@ -493,14 +474,13 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
493
474
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
494
475
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
495
476
|
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
496
|
-
name: (
|
|
497
|
-
contact: (
|
|
477
|
+
name: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.names,
|
|
478
|
+
contact: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.contact,
|
|
498
479
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
499
480
|
countries: countries,
|
|
500
481
|
countryCode: countryCode,
|
|
501
482
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
502
|
-
business: boardData === null || boardData === void 0 ? void 0 : boardData.business
|
|
503
|
-
flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
|
|
483
|
+
business: boardData === null || boardData === void 0 ? void 0 : boardData.business
|
|
504
484
|
},
|
|
505
485
|
formData: __assign({}, params)
|
|
506
486
|
}];
|
|
@@ -55,10 +55,10 @@ import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, sleep } from '..
|
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data, boardData,
|
|
59
|
-
var _b, _c, _d
|
|
60
|
-
return __generator(this, function (
|
|
61
|
-
switch (
|
|
58
|
+
var payload, data, boardData, countryIso2;
|
|
59
|
+
var _b, _c, _d;
|
|
60
|
+
return __generator(this, function (_e) {
|
|
61
|
+
switch (_e.label) {
|
|
62
62
|
case 0:
|
|
63
63
|
payload = {
|
|
64
64
|
service_name: 'tap_email',
|
|
@@ -66,30 +66,22 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
66
66
|
};
|
|
67
67
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
68
68
|
case 1:
|
|
69
|
-
data = (
|
|
70
|
-
|
|
69
|
+
data = (_e.sent()).data;
|
|
70
|
+
boardData = undefined;
|
|
71
71
|
if (((_b = data.errors) === null || _b === void 0 ? void 0 : _b.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
72
72
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
73
73
|
if (isInternally)
|
|
74
74
|
data.step_name = TAX_STEP_NAMES.TAX_INFO;
|
|
75
|
-
if (!data.id) return [3,
|
|
76
|
-
return [4, API.boardService.retrieveBoardInfoStatus(data.id)];
|
|
77
|
-
case 2:
|
|
78
|
-
boardInfoData = _f.sent();
|
|
75
|
+
if (!data.id) return [3, 3];
|
|
79
76
|
return [4, API.boardService.retrieveBoardDetails(data === null || data === void 0 ? void 0 : data.id)];
|
|
77
|
+
case 2:
|
|
78
|
+
boardData = _e.sent();
|
|
79
|
+
_e.label = 3;
|
|
80
80
|
case 3:
|
|
81
|
-
boardData = _f.sent();
|
|
82
|
-
_f.label = 4;
|
|
83
|
-
case 4:
|
|
84
|
-
info = (boardInfoData || {}).info;
|
|
85
81
|
countryIso2 = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
|
|
86
82
|
if (countryIso2)
|
|
87
83
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
88
|
-
|
|
89
|
-
if (hasTaxCompleted) {
|
|
90
|
-
thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
91
|
-
}
|
|
92
|
-
else if (data.step_name === TAX_STEP_NAMES.PHONE_AUTH) {
|
|
84
|
+
if (data.step_name === TAX_STEP_NAMES.PHONE_AUTH) {
|
|
93
85
|
thunkApi.dispatch(handleCurrentActiveScreen('TAX_VERIFY_STEP'));
|
|
94
86
|
}
|
|
95
87
|
else if (data.step_name === TAX_STEP_NAMES.TAX_INFO) {
|
|
@@ -97,7 +89,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
97
89
|
}
|
|
98
90
|
return [2, {
|
|
99
91
|
data: data,
|
|
100
|
-
boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), {
|
|
92
|
+
boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
|
|
101
93
|
token: token
|
|
102
94
|
}];
|
|
103
95
|
}
|
|
@@ -133,10 +125,10 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveTaxEntityInfo', functi
|
|
|
133
125
|
});
|
|
134
126
|
}); });
|
|
135
127
|
export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
136
|
-
var _a, tax, settings, responseBody, payload, data
|
|
137
|
-
var _b, _c, _d, _e
|
|
138
|
-
return __generator(this, function (
|
|
139
|
-
switch (
|
|
128
|
+
var _a, tax, settings, responseBody, payload, data;
|
|
129
|
+
var _b, _c, _d, _e;
|
|
130
|
+
return __generator(this, function (_f) {
|
|
131
|
+
switch (_f.label) {
|
|
140
132
|
case 0:
|
|
141
133
|
_a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
|
|
142
134
|
responseBody = tax.data.verify.responseBody;
|
|
@@ -149,22 +141,12 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
149
141
|
};
|
|
150
142
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
151
143
|
case 1:
|
|
152
|
-
data = (
|
|
144
|
+
data = (_f.sent()).data;
|
|
153
145
|
if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
154
146
|
throw new Error(data.errors[0].description);
|
|
155
147
|
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
156
|
-
flows = (responseBody || {}).flows;
|
|
157
|
-
hasTaxCompleted = ((_f = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'tax'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
|
|
158
|
-
if (!hasTaxCompleted) return [3, 3];
|
|
159
|
-
return [4, thunkApi.dispatch(retrieveEntityInfo((_g = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _g === void 0 ? void 0 : _g.id))];
|
|
160
|
-
case 2:
|
|
161
|
-
_h.sent();
|
|
162
|
-
thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
163
|
-
return [3, 4];
|
|
164
|
-
case 3:
|
|
165
148
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP')); });
|
|
166
|
-
|
|
167
|
-
case 4: return [2, { data: data, formData: params }];
|
|
149
|
+
return [2, { data: data, formData: params }];
|
|
168
150
|
}
|
|
169
151
|
});
|
|
170
152
|
}); });
|
|
@@ -17,8 +17,9 @@ import OTPField from '../../../shared/OTP';
|
|
|
17
17
|
import { useController, useFormContext } from 'react-hook-form';
|
|
18
18
|
import { useTranslation } from 'react-i18next';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
-
import {
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
|
+
import { resendOTP, bankSelector } from '../../../app/bank/bankStore';
|
|
22
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
24
|
var theme = _a.theme;
|
|
24
25
|
return ({
|
|
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
|
|
|
33
34
|
var t = useTranslation().t;
|
|
34
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(bankSelector).error;
|
|
36
38
|
var handleOnOTPChange = function (otp) {
|
|
37
39
|
otpControl.field.onChange(otp);
|
|
38
40
|
};
|
|
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
|
|
|
42
44
|
dispatch(resendOTP());
|
|
43
45
|
};
|
|
44
46
|
var otpValue = otpControl.field.value;
|
|
45
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
47
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
48
|
};
|
|
47
49
|
export default React.memo(OTPInput);
|
|
@@ -46,7 +46,7 @@ var BrandInfo = function (_a) {
|
|
|
46
46
|
var t = useTranslation().t;
|
|
47
47
|
var isAr = useLanguage().isAr;
|
|
48
48
|
var settingData = useAppSelector(settingsSelector).data;
|
|
49
|
-
var _e = useAppSelector(brandSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
49
|
+
var _e = useAppSelector(brandSelector), data = _e.data, loading = _e.loading, error = _e.error, uploadingBrandLogo = _e.uploadingBrandLogo;
|
|
50
50
|
var _f = data.brandData, brandName = _f.brandName, segment = _f.segment, teamSize = _f.teamSize, salesChannels = _f.salesChannels, brandLogoId = _f.brandLogoId, responseBody = _f.responseBody;
|
|
51
51
|
var _g = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}, logo_details = _g.logo_details, data_status = _g.data_status;
|
|
52
52
|
var methods = useForm({
|
|
@@ -77,7 +77,7 @@ var BrandInfo = function (_a) {
|
|
|
77
77
|
methods.setError('brandName', { message: 'brand_name_already_exist' });
|
|
78
78
|
}, [responseBody]);
|
|
79
79
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
80
|
-
var disabled = brandErrChecks || brandNameChecking;
|
|
80
|
+
var disabled = brandErrChecks || brandNameChecking || uploadingBrandLogo;
|
|
81
81
|
var handleMenuClick = function (flag) {
|
|
82
82
|
setListActive(flag);
|
|
83
83
|
};
|
|
@@ -17,8 +17,9 @@ import OTPField from '../../../shared/OTP';
|
|
|
17
17
|
import { useController, useFormContext } from 'react-hook-form';
|
|
18
18
|
import { useTranslation } from 'react-i18next';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
-
import { resendOTP } from '../../../app/brand/brandStore';
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { brandSelector, resendOTP } from '../../../app/brand/brandStore';
|
|
22
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
24
|
var theme = _a.theme;
|
|
24
25
|
return ({
|
|
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
|
|
|
33
34
|
var t = useTranslation().t;
|
|
34
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(brandSelector).error;
|
|
36
38
|
var handleOnOTPChange = function (otp) {
|
|
37
39
|
otpControl.field.onChange(otp);
|
|
38
40
|
};
|
|
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
|
|
|
42
44
|
dispatch(resendOTP());
|
|
43
45
|
};
|
|
44
46
|
var otpValue = otpControl.field.value;
|
|
45
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
47
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
48
|
};
|
|
47
49
|
export default React.memo(OTPInput);
|
|
@@ -11,14 +11,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
15
15
|
import Box from '@mui/material/Box/Box';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import OTPField from '../../../shared/OTP';
|
|
18
18
|
import { useController, useFormContext } from 'react-hook-form';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
20
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
21
|
-
import {
|
|
21
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
|
+
import { businessSelector, resendOTP } from '../../../app/business/businessStore';
|
|
22
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
24
|
var theme = _a.theme;
|
|
24
25
|
return ({
|
|
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
|
|
|
33
34
|
var t = useTranslation().t;
|
|
34
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(businessSelector).error;
|
|
36
38
|
var handleOnOTPChange = function (otp) {
|
|
37
39
|
otpControl.field.onChange(otp);
|
|
38
40
|
};
|
|
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
|
|
|
42
44
|
dispatch(resendOTP());
|
|
43
45
|
};
|
|
44
46
|
var otpValue = otpControl.field.value;
|
|
45
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
47
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
48
|
};
|
|
47
49
|
export default React.memo(OTPInput);
|
|
@@ -17,8 +17,9 @@ import OTPField from '../../../shared/OTP';
|
|
|
17
17
|
import { useController, useFormContext } from 'react-hook-form';
|
|
18
18
|
import { useTranslation } from 'react-i18next';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
-
import {
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
|
+
import { entitySelector, resendOTP } from '../../../app/entity/entityStore';
|
|
22
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
24
|
var theme = _a.theme;
|
|
24
25
|
return ({
|
|
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
|
|
|
33
34
|
var t = useTranslation().t;
|
|
34
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(entitySelector).error;
|
|
36
38
|
var handleOnOTPChange = function (otp) {
|
|
37
39
|
otpControl.field.onChange(otp);
|
|
38
40
|
};
|
|
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
|
|
|
42
44
|
dispatch(resendOTP());
|
|
43
45
|
};
|
|
44
46
|
var otpValue = otpControl.field.value;
|
|
45
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
47
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
48
|
};
|
|
47
49
|
export default React.memo(OTPInput);
|
|
@@ -11,14 +11,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
15
15
|
import Box from '@mui/material/Box/Box';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import OTPField from '../../../shared/OTP';
|
|
18
18
|
import { useController, useFormContext } from 'react-hook-form';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
20
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
21
|
-
import {
|
|
21
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
|
+
import { individualSelector, resendOTP } from '../../../app/individual/individualStore';
|
|
22
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
24
|
var theme = _a.theme;
|
|
24
25
|
return ({
|
|
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
|
|
|
33
34
|
var t = useTranslation().t;
|
|
34
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(individualSelector).error;
|
|
36
38
|
var handleOnOTPChange = function (otp) {
|
|
37
39
|
otpControl.field.onChange(otp);
|
|
38
40
|
};
|
|
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
|
|
|
42
44
|
dispatch(resendOTP());
|
|
43
45
|
};
|
|
44
46
|
var otpValue = otpControl.field.value;
|
|
45
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
47
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
48
|
};
|
|
47
49
|
export default React.memo(OTPInput);
|
|
@@ -11,14 +11,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
15
15
|
import Box from '@mui/material/Box/Box';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import OTPField from '../../../shared/OTP';
|
|
18
18
|
import { useController, useFormContext } from 'react-hook-form';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
20
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
21
|
-
import {
|
|
21
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
|
+
import { passwordSelector, resendOTP } from '../../../app/password/passwordStore';
|
|
22
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
24
|
var theme = _a.theme;
|
|
24
25
|
return ({
|
|
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
|
|
|
33
34
|
var t = useTranslation().t;
|
|
34
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(passwordSelector).error;
|
|
36
38
|
var handleOnOTPChange = function (otp) {
|
|
37
39
|
otpControl.field.onChange(otp);
|
|
38
40
|
};
|
|
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
|
|
|
42
44
|
dispatch(resendOTP());
|
|
43
45
|
};
|
|
44
46
|
var otpValue = otpControl.field.value;
|
|
45
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
47
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
48
|
};
|
|
47
49
|
export default React.memo(OTPInput);
|
|
@@ -79,36 +79,31 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
|
79
79
|
_b);
|
|
80
80
|
});
|
|
81
81
|
var ButtonStyled = styled(Button, {
|
|
82
|
-
shouldForwardProp: function (prop) { return prop !== 'isCompleted'; }
|
|
82
|
+
shouldForwardProp: function (prop) { return prop !== 'isCompleted' && prop !== 'hasUrl'; }
|
|
83
83
|
})(function (_a) {
|
|
84
84
|
var _b;
|
|
85
|
-
var theme = _a.theme, isCompleted = _a.isCompleted;
|
|
85
|
+
var theme = _a.theme, isCompleted = _a.isCompleted, hasUrl = _a.hasUrl;
|
|
86
86
|
return ({
|
|
87
87
|
'&.MuiButton-outlined': __assign(__assign({}, (isCompleted && {
|
|
88
88
|
paddingInlineEnd: theme.spacing(1.625),
|
|
89
89
|
color: theme.palette.success.main,
|
|
90
90
|
border: "1px solid ".concat(theme.palette.success.main)
|
|
91
|
-
})), (_b = { '&:hover': __assign({}, (isCompleted && {
|
|
92
|
-
backgroundColor: theme.palette.common.white,
|
|
93
|
-
border: "1px solid ".concat(theme.palette.success.main),
|
|
94
|
-
color: theme.palette.success.main,
|
|
95
|
-
cursor: 'initial',
|
|
96
|
-
img: {
|
|
91
|
+
})), (_b = { '&:hover': __assign({}, (isCompleted && __assign({ backgroundColor: hasUrl ? theme.palette.success.main : theme.palette.common.white, border: "1px solid ".concat(theme.palette.success.main), color: hasUrl ? theme.palette.common.white : theme.palette.success.main, cursor: hasUrl ? 'pointer' : 'initial', img: {
|
|
97
92
|
filter: 'none'
|
|
93
|
+
} }, (hasUrl && {
|
|
94
|
+
svg: {
|
|
95
|
+
filter: 'brightness(3)'
|
|
98
96
|
}
|
|
99
|
-
})) }, _b[theme.breakpoints.down('sm')] = {
|
|
97
|
+
})))) }, _b[theme.breakpoints.down('sm')] = {
|
|
100
98
|
'&:hover': __assign({ backgroundColor: theme.palette.common.white, border: "1px solid ".concat(theme.palette.primary.main), img: {
|
|
101
99
|
filter: 'none'
|
|
102
|
-
}, color: theme.palette.primary.main }, (isCompleted && {
|
|
103
|
-
backgroundColor: theme.palette.common.white,
|
|
104
|
-
border: "1px solid ".concat(theme.palette.success.main),
|
|
105
|
-
paddingInlineEnd: theme.spacing(1.625),
|
|
106
|
-
color: theme.palette.success.main,
|
|
107
|
-
cursor: 'initial',
|
|
108
|
-
img: {
|
|
100
|
+
}, color: theme.palette.primary.main }, (isCompleted && __assign({ backgroundColor: hasUrl ? theme.palette.success.main : theme.palette.common.white, border: "1px solid ".concat(theme.palette.success.main), paddingInlineEnd: theme.spacing(1.625), color: hasUrl ? theme.palette.common.white : theme.palette.success.main, cursor: hasUrl ? 'pointer' : 'initial', img: {
|
|
109
101
|
filter: 'none'
|
|
102
|
+
} }, (hasUrl && {
|
|
103
|
+
svg: {
|
|
104
|
+
filter: 'brightness(3)'
|
|
110
105
|
}
|
|
111
|
-
}))
|
|
106
|
+
}))))
|
|
112
107
|
}, _b['&:disabled'] = {
|
|
113
108
|
backgroundColor: theme.palette.common.white,
|
|
114
109
|
color: alpha(theme.palette.primary.main, 0.3)
|
|
@@ -153,7 +148,7 @@ export default function FlowsButtons(_a) {
|
|
|
153
148
|
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
|
154
149
|
var isAr = useLanguage().isAr;
|
|
155
150
|
var onRedirect = function (item) {
|
|
156
|
-
if (item.
|
|
151
|
+
if (!item.href)
|
|
157
152
|
return;
|
|
158
153
|
if (flowName === item.name && item.name !== 'password') {
|
|
159
154
|
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser)));
|
|
@@ -221,6 +216,6 @@ export default function FlowsButtons(_a) {
|
|
|
221
216
|
onResetPassword();
|
|
222
217
|
else
|
|
223
218
|
onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status, token: token });
|
|
224
|
-
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)' }, src: ICONS_NAMES.Arrow_filled_right_icon })), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
|
|
219
|
+
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)' }, src: ICONS_NAMES.Arrow_filled_right_icon })), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
|
|
225
220
|
}) }));
|
|
226
221
|
}
|
|
@@ -5,6 +5,7 @@ interface OTPProps extends OTPFieldProps {
|
|
|
5
5
|
onResetClick?: () => void;
|
|
6
6
|
timeEndLabel?: string;
|
|
7
7
|
loading?: boolean;
|
|
8
|
+
hasError?: boolean;
|
|
8
9
|
}
|
|
9
|
-
declare const _default: React.MemoExoticComponent<({ timeEndLabel, loading, timerInSeconds, onResetClick, ...props }: OTPProps) => JSX.Element>;
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ timeEndLabel, loading, timerInSeconds, onResetClick, hasError, ...props }: OTPProps) => JSX.Element>;
|
|
10
11
|
export default _default;
|
|
@@ -80,7 +80,7 @@ var LoaderBoxStyled = styled(OTPBox)(function (_a) {
|
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
82
|
var OTPInput = function (_a) {
|
|
83
|
-
var timeEndLabel = _a.timeEndLabel, loading = _a.loading, timerInSeconds = _a.timerInSeconds, onResetClick = _a.onResetClick, props = __rest(_a, ["timeEndLabel", "loading", "timerInSeconds", "onResetClick"]);
|
|
83
|
+
var timeEndLabel = _a.timeEndLabel, loading = _a.loading, timerInSeconds = _a.timerInSeconds, onResetClick = _a.onResetClick, hasError = _a.hasError, props = __rest(_a, ["timeEndLabel", "loading", "timerInSeconds", "onResetClick", "hasError"]);
|
|
84
84
|
var otpRef = React.useRef(null);
|
|
85
85
|
var width = useContainerDimensions(otpRef).width;
|
|
86
86
|
React.useEffect(function () {
|
|
@@ -88,6 +88,6 @@ var OTPInput = function (_a) {
|
|
|
88
88
|
if (el)
|
|
89
89
|
el.className = 'middle-input-element';
|
|
90
90
|
}, [props.value]);
|
|
91
|
-
return (_jsxs(_Fragment, { children: [_jsx(OTPBox, __assign({ id: 'otp-container', ref: otpRef }, { children: _jsx(OTPStyled, __assign({}, props, { parentWidth: width })) })), typeof timerInSeconds != 'undefined' && (_jsx(BoxStyled, { children: loading ? (_jsx(LoaderBoxStyled, { children: _jsx(CircularProgress, { size: 20, thickness: 5 }) })) : (_jsx(OTPTimer, { timeEndLabel: timeEndLabel || '', timeInSeconds: timerInSeconds, onResetClick: onResetClick })) }))] }));
|
|
91
|
+
return (_jsxs(_Fragment, { children: [_jsx(OTPBox, __assign({ id: 'otp-container', ref: otpRef }, { children: _jsx(OTPStyled, __assign({}, props, { parentWidth: width })) })), typeof timerInSeconds != 'undefined' && (_jsx(BoxStyled, { children: loading ? (_jsx(LoaderBoxStyled, { children: _jsx(CircularProgress, { size: 20, thickness: 5 }) })) : hasError ? (_jsx(_Fragment, {})) : (_jsx(OTPTimer, { timeEndLabel: timeEndLabel || '', timeInSeconds: timerInSeconds, onResetClick: onResetClick })) }))] }));
|
|
92
92
|
};
|
|
93
93
|
export default React.memo(OTPInput);
|
|
@@ -11,14 +11,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
15
15
|
import Box from '@mui/material/Box/Box';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import OTPField from '../../../shared/OTP';
|
|
18
18
|
import { useController, useFormContext } from 'react-hook-form';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
20
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
21
|
-
import {
|
|
21
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
|
+
import { resendOTP, taxSelector } from '../../../app/tax/taxStore';
|
|
22
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
24
|
var theme = _a.theme;
|
|
24
25
|
return ({
|
|
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
|
|
|
33
34
|
var t = useTranslation().t;
|
|
34
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(taxSelector).error;
|
|
36
38
|
var handleOnOTPChange = function (otp) {
|
|
37
39
|
otpControl.field.onChange(otp);
|
|
38
40
|
};
|
|
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
|
|
|
42
44
|
dispatch(resendOTP());
|
|
43
45
|
};
|
|
44
46
|
var otpValue = otpControl.field.value;
|
|
45
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
47
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
48
|
};
|
|
47
49
|
export default React.memo(OTPInput);
|
package/build/utils/error.d.ts
CHANGED
package/build/utils/error.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export var isNetworkError = function (error) {
|
|
2
2
|
return ['network error', 'network request failed'].includes((error || '').trim().toLowerCase());
|
|
3
3
|
};
|
|
4
|
+
export var isTokenExpired = function (error) {
|
|
5
|
+
return ['token expired'].includes((error || '').trim().toLowerCase());
|
|
6
|
+
};
|