@tap-payments/auth-jsconnect 2.0.42 → 2.0.43
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/business/businessStore.d.ts +11 -2
- package/build/features/app/business/businessStore.js +156 -168
- package/build/features/app/entity/entityStore.js +4 -6
- package/build/features/app/individual/individualStore.js +0 -14
- package/build/features/bank/screens/BankDetails/IBAN.js +4 -1
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/business/screens/Activities/validation.js +4 -1
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/connect/screens/Merchant/Merchant.js +10 -4
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +2 -1
- package/build/features/connect/screens/Merchant/SalesChannels.js +4 -6
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +3 -1
- package/build/features/connect/screens/Merchant/SocialMedia.js +7 -33
- package/build/features/connect/screens/Merchant/validation.js +3 -5
- package/build/features/connect/screens/ThankYou/ThankYou.js +8 -2
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/shared/Button/Button.js +1 -0
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +1 -1
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/utils/array.d.ts +1 -0
- package/build/utils/array.js +8 -0
- package/build/utils/date.d.ts +1 -0
- package/build/utils/date.js +5 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +14 -2
- package/package.json +129 -129
|
@@ -4,8 +4,16 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
4
4
|
data: any;
|
|
5
5
|
leadData: any;
|
|
6
6
|
token: string;
|
|
7
|
-
|
|
7
|
+
brandData: any;
|
|
8
8
|
boardId: any;
|
|
9
|
+
isRequireOTP?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
data: any;
|
|
12
|
+
isRequireOTP: boolean;
|
|
13
|
+
leadData?: undefined;
|
|
14
|
+
token?: undefined;
|
|
15
|
+
brandData?: undefined;
|
|
16
|
+
boardId?: undefined;
|
|
9
17
|
}, string, {}>;
|
|
10
18
|
export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
11
19
|
data: any;
|
|
@@ -16,7 +24,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
16
24
|
isNID: boolean;
|
|
17
25
|
otp: string;
|
|
18
26
|
};
|
|
19
|
-
|
|
27
|
+
brand: any;
|
|
20
28
|
leadData: any;
|
|
21
29
|
}, OTPFormValues, {}>;
|
|
22
30
|
interface verifyPACIParams {
|
|
@@ -68,6 +76,7 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
68
76
|
customerBases: any;
|
|
69
77
|
expectedSales: any;
|
|
70
78
|
expectedCustomerSales: any;
|
|
79
|
+
countryISO2: string;
|
|
71
80
|
}, void, {}>;
|
|
72
81
|
export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
73
82
|
data: any;
|
|
@@ -60,13 +60,13 @@ import moment from 'moment';
|
|
|
60
60
|
import API from '../../../api';
|
|
61
61
|
import { BusinessType, FlowsTypes } from '../../../@types';
|
|
62
62
|
import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
63
|
-
import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW, isSA } from '../../../utils';
|
|
63
|
+
import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW, isSA, dateFormat } from '../../../utils';
|
|
64
64
|
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
65
65
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
var payload, data,
|
|
67
|
-
var _a
|
|
68
|
-
return __generator(this, function (
|
|
69
|
-
switch (
|
|
66
|
+
var payload, data, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id, board_info_id, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, activityList;
|
|
67
|
+
var _a;
|
|
68
|
+
return __generator(this, function (_b) {
|
|
69
|
+
switch (_b.label) {
|
|
70
70
|
case 0:
|
|
71
71
|
payload = {
|
|
72
72
|
service_name: 'tap_email',
|
|
@@ -74,101 +74,100 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
74
74
|
};
|
|
75
75
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
76
76
|
case 1:
|
|
77
|
-
data = (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
77
|
+
data = (_b.sent()).data;
|
|
78
|
+
if ((_a = data.errors) === null || _a === void 0 ? void 0 : _a.length)
|
|
79
|
+
throw new Error(data.errors[0].description);
|
|
80
|
+
if (data.mw_error)
|
|
81
|
+
throw new Error(data.mw_error);
|
|
82
|
+
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
83
|
+
if (countryIso2)
|
|
85
84
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 20];
|
|
86
|
+
boardData = undefined;
|
|
87
|
+
brandData = undefined;
|
|
88
88
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
89
89
|
case 2:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
95
|
-
}
|
|
90
|
+
leadData = (_b.sent()).data;
|
|
91
|
+
countryIso2 = leadData === null || leadData === void 0 ? void 0 : leadData.country_code;
|
|
92
|
+
if (!countryIso2)
|
|
93
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
96
94
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
|
|
97
95
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
|
|
98
96
|
}
|
|
99
97
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
|
|
100
98
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
101
99
|
}
|
|
102
|
-
if (!(data.step_name ===
|
|
103
|
-
|
|
104
|
-
brandID =
|
|
100
|
+
if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 19];
|
|
101
|
+
entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id, board_info_id = leadData.board_info_id;
|
|
102
|
+
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
105
103
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
106
|
-
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) &&
|
|
107
|
-
hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
|
|
104
|
+
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
|
|
108
105
|
hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
|
|
109
106
|
hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
|
|
110
|
-
entity_activities = leadResponse.data.entity_activities;
|
|
111
107
|
if (!(!entity_activities && hasBusinessCRInfoCompleted)) return [3, 4];
|
|
112
108
|
return [4, API.dataService.getActivities()];
|
|
113
109
|
case 3:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
activityList = (_b.sent()).list;
|
|
111
|
+
leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
|
|
112
|
+
_b.label = 4;
|
|
117
113
|
case 4:
|
|
118
|
-
if (!hasBusinessCompleted) return [3,
|
|
119
|
-
|
|
120
|
-
board_info_id = (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_info_id;
|
|
121
|
-
if (!(!!board_id && !!board_info_id)) return [3, 6];
|
|
114
|
+
if (!hasBusinessCompleted) return [3, 9];
|
|
115
|
+
if (!(board_id && board_info_id)) return [3, 6];
|
|
122
116
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
123
117
|
case 5:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
case 6:
|
|
118
|
+
boardData = _b.sent();
|
|
119
|
+
_b.label = 6;
|
|
120
|
+
case 6:
|
|
121
|
+
if (!board_id) return [3, 8];
|
|
122
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
127
123
|
case 7:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return [3, 18];
|
|
124
|
+
_b.sent();
|
|
125
|
+
_b.label = 8;
|
|
131
126
|
case 8:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return [3, 18];
|
|
127
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
128
|
+
return [3, 19];
|
|
135
129
|
case 9:
|
|
136
|
-
if (!
|
|
137
|
-
thunkApi.dispatch(handleNextScreenStep('
|
|
138
|
-
return [3,
|
|
130
|
+
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 10];
|
|
131
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
132
|
+
return [3, 19];
|
|
139
133
|
case 10:
|
|
140
|
-
if (!
|
|
141
|
-
|
|
134
|
+
if (!hasBusinessCustomersCompleted) return [3, 11];
|
|
135
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
|
|
136
|
+
return [3, 19];
|
|
142
137
|
case 11:
|
|
143
|
-
|
|
138
|
+
if (!hasBusinessCRActivitiesCompleted) return [3, 14];
|
|
139
|
+
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
140
|
+
case 12:
|
|
141
|
+
_b.sent();
|
|
144
142
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
145
143
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
146
|
-
case 12:
|
|
147
|
-
brandInfo = _h.sent();
|
|
148
|
-
return [3, 18];
|
|
149
144
|
case 13:
|
|
150
|
-
|
|
151
|
-
return [
|
|
145
|
+
brandData = _b.sent();
|
|
146
|
+
return [3, 19];
|
|
152
147
|
case 14:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return [3, 18];
|
|
148
|
+
if (!hasBusinessCRInfoCompleted) return [3, 16];
|
|
149
|
+
return [4, API.brandService.retrieveBrand(brandID)];
|
|
156
150
|
case 15:
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
brandData = _b.sent();
|
|
152
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
153
|
+
return [3, 19];
|
|
159
154
|
case 16:
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
if (!isSA(countryIso2)) return [3, 18];
|
|
156
|
+
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
162
157
|
case 17:
|
|
158
|
+
_b.sent();
|
|
159
|
+
_b.label = 18;
|
|
160
|
+
case 18:
|
|
163
161
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
164
|
-
|
|
165
|
-
case
|
|
162
|
+
_b.label = 19;
|
|
163
|
+
case 19: return [2, {
|
|
166
164
|
data: data,
|
|
167
|
-
leadData: __assign(__assign({},
|
|
165
|
+
leadData: __assign(__assign({}, leadData), { flows: BUSINESS_FLOW_SUCCESS.concat((boardData === null || boardData === void 0 ? void 0 : boardData.info) || []) }),
|
|
168
166
|
token: token,
|
|
169
|
-
|
|
170
|
-
boardId:
|
|
167
|
+
brandData: brandData,
|
|
168
|
+
boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
|
|
171
169
|
}];
|
|
170
|
+
case 20: return [2, { data: data, isRequireOTP: true }];
|
|
172
171
|
}
|
|
173
172
|
});
|
|
174
173
|
}); });
|
|
@@ -190,8 +189,8 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
190
189
|
});
|
|
191
190
|
}); });
|
|
192
191
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
193
|
-
var _a, business, settings, isNID, responseBody, stepName, payload, data,
|
|
194
|
-
var _c, _d, _e, _f, _g, _h;
|
|
192
|
+
var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id, board_info_id, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, activityList, boardResponse;
|
|
193
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
195
194
|
return __generator(this, function (_j) {
|
|
196
195
|
switch (_j.label) {
|
|
197
196
|
case 0:
|
|
@@ -201,22 +200,22 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
201
200
|
stepName = isNID ? BUSINESS_STEP_NAMES.IDENTITY_VERIFY_AUTH : BUSINESS_STEP_NAMES.PHONE_AUTH;
|
|
202
201
|
payload = {
|
|
203
202
|
data: params.otp,
|
|
204
|
-
service_name: ((
|
|
205
|
-
verify_token: ((
|
|
203
|
+
service_name: ((_c = (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.service_name) || ((_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name),
|
|
204
|
+
verify_token: ((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _e === void 0 ? void 0 : _e.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
|
|
206
205
|
step_name: stepName,
|
|
207
206
|
encryption_contract: ['data']
|
|
208
207
|
};
|
|
209
208
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
210
209
|
case 1:
|
|
211
210
|
data = (_j.sent()).data;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
|
|
212
|
+
throw new Error(data.errors[0].description);
|
|
213
|
+
brandData = undefined;
|
|
215
214
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
216
215
|
case 2:
|
|
217
|
-
|
|
216
|
+
leadData = (_j.sent()).data;
|
|
218
217
|
thunkApi.dispatch(updateStepName(stepName));
|
|
219
|
-
|
|
218
|
+
brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, board_info_id = leadData.board_info_id;
|
|
220
219
|
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
221
220
|
countryIso2 = country_code;
|
|
222
221
|
if (countryIso2)
|
|
@@ -233,12 +232,12 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
233
232
|
_j.sent();
|
|
234
233
|
_j.label = 4;
|
|
235
234
|
case 4:
|
|
236
|
-
entity_activities =
|
|
235
|
+
entity_activities = leadData.entity_activities;
|
|
237
236
|
if (!(!entity_activities && hasBusinessCRInfoCompleted)) return [3, 6];
|
|
238
237
|
return [4, API.dataService.getActivities()];
|
|
239
238
|
case 5:
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
activityList = (_j.sent()).list;
|
|
240
|
+
leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
|
|
242
241
|
_j.label = 6;
|
|
243
242
|
case 6:
|
|
244
243
|
if (!isNID) return [3, 7];
|
|
@@ -250,11 +249,11 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
250
249
|
return [3, 20];
|
|
251
250
|
case 8:
|
|
252
251
|
if (!hasBusinessCompleted) return [3, 12];
|
|
253
|
-
if (!(
|
|
252
|
+
if (!(board_id && board_info_id)) return [3, 10];
|
|
254
253
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
255
254
|
case 9:
|
|
256
255
|
boardResponse = _j.sent();
|
|
257
|
-
|
|
256
|
+
leadData = __assign(__assign({}, leadData), { flows: BUSINESS_FLOW_SUCCESS.concat((boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || []) });
|
|
258
257
|
_j.label = 10;
|
|
259
258
|
case 10: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
260
259
|
case 11:
|
|
@@ -277,19 +276,19 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
277
276
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
278
277
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
279
278
|
case 16:
|
|
280
|
-
|
|
279
|
+
brandData = _j.sent();
|
|
281
280
|
return [3, 20];
|
|
282
281
|
case 17:
|
|
283
282
|
if (!hasBusinessCRInfoCompleted) return [3, 19];
|
|
284
283
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
285
284
|
case 18:
|
|
286
|
-
|
|
285
|
+
brandData = _j.sent();
|
|
287
286
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
288
287
|
return [3, 20];
|
|
289
288
|
case 19:
|
|
290
289
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
291
290
|
_j.label = 20;
|
|
292
|
-
case 20: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }),
|
|
291
|
+
case 20: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
|
|
293
292
|
}
|
|
294
293
|
});
|
|
295
294
|
}); });
|
|
@@ -573,17 +572,18 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
|
|
|
573
572
|
});
|
|
574
573
|
}); });
|
|
575
574
|
export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
576
|
-
var settings, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
|
|
575
|
+
var settings, countryISO2, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
|
|
577
576
|
return __generator(this, function (_b) {
|
|
578
577
|
switch (_b.label) {
|
|
579
578
|
case 0:
|
|
580
579
|
settings = thunkApi.getState().settings;
|
|
580
|
+
countryISO2 = settings.data.businessCountry.iso2;
|
|
581
581
|
dataBody = {
|
|
582
582
|
page: 0
|
|
583
583
|
};
|
|
584
584
|
salesDataBody = {
|
|
585
585
|
page: 0,
|
|
586
|
-
country_code: [
|
|
586
|
+
country_code: [countryISO2]
|
|
587
587
|
};
|
|
588
588
|
return [4, Promise.all([
|
|
589
589
|
API.dataService.getCustomerBases(dataBody),
|
|
@@ -591,11 +591,12 @@ export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', funct
|
|
|
591
591
|
API.dataService.getExpectedCustomerSales(dataBody)
|
|
592
592
|
])];
|
|
593
593
|
case 1:
|
|
594
|
-
_a = _b.sent(), customerBases = _a[0], expectedSales = _a[1], expectedCustomerSales = _a[2];
|
|
594
|
+
_a = _b.sent(), customerBases = _a[0].list, expectedSales = _a[1].list, expectedCustomerSales = _a[2].list;
|
|
595
595
|
return [2, {
|
|
596
596
|
customerBases: customerBases,
|
|
597
597
|
expectedSales: expectedSales,
|
|
598
|
-
expectedCustomerSales: expectedCustomerSales
|
|
598
|
+
expectedCustomerSales: expectedCustomerSales,
|
|
599
|
+
countryISO2: countryISO2
|
|
599
600
|
}];
|
|
600
601
|
}
|
|
601
602
|
});
|
|
@@ -723,7 +724,7 @@ var initialState = {
|
|
|
723
724
|
},
|
|
724
725
|
activitiesData: {
|
|
725
726
|
activities: [],
|
|
726
|
-
operationStartDate: new Date().
|
|
727
|
+
operationStartDate: moment(new Date()).format('YYYY-MM-DD')
|
|
727
728
|
},
|
|
728
729
|
customersData: {
|
|
729
730
|
customerLocations: [],
|
|
@@ -755,49 +756,46 @@ export var businessSlice = createSlice({
|
|
|
755
756
|
state.customLoading = true;
|
|
756
757
|
})
|
|
757
758
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
758
|
-
var _a, _b
|
|
759
|
+
var _a, _b;
|
|
759
760
|
state.error = null;
|
|
760
761
|
state.customLoading = false;
|
|
761
|
-
var
|
|
762
|
-
var
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
}
|
|
767
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id });
|
|
768
|
-
state.data.verify.token = token;
|
|
762
|
+
var _c = action.payload, data = _c.data, boardId = _c.boardId, brandData = _c.brandData, leadData = _c.leadData, token = _c.token, isRequireOTP = _c.isRequireOTP;
|
|
763
|
+
var responseBody = state.data.verify.responseBody;
|
|
764
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id });
|
|
765
|
+
if (token)
|
|
766
|
+
state.data.verify.token = token;
|
|
769
767
|
state.data.otpData.isNID = false;
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
if (
|
|
775
|
-
|
|
776
|
-
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
777
|
-
}
|
|
768
|
+
if (isRequireOTP)
|
|
769
|
+
return;
|
|
770
|
+
var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type, business_name = _d.business_name;
|
|
771
|
+
var issuingDate = (brandData === null || brandData === void 0 ? void 0 : brandData.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date);
|
|
772
|
+
if (issuingDate)
|
|
773
|
+
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
778
774
|
var activities = entity_activities || [];
|
|
779
775
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
780
|
-
var
|
|
781
|
-
return
|
|
776
|
+
var activities = brandData.activities;
|
|
777
|
+
return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
|
|
782
778
|
});
|
|
783
|
-
|
|
784
|
-
state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
|
|
779
|
+
state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
|
|
785
780
|
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
|
|
786
781
|
state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
var
|
|
790
|
-
var
|
|
782
|
+
var license = (entity || {}).license;
|
|
783
|
+
if (license) {
|
|
784
|
+
var number_1 = license.number;
|
|
785
|
+
var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
|
|
786
|
+
var licenseList = (busResData || {}).licenseList;
|
|
791
787
|
var selectedLicenseData = selectedLicense;
|
|
792
|
-
if (
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
788
|
+
if (number_1) {
|
|
789
|
+
var findFL = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
|
|
790
|
+
var license = _a.license;
|
|
791
|
+
return (license === null || license === void 0 ? void 0 : license.number) === number_1;
|
|
792
|
+
});
|
|
793
|
+
if (findFL || business_type === BusinessType.FL) {
|
|
794
|
+
selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: number_1 } });
|
|
795
|
+
}
|
|
796
|
+
else
|
|
797
|
+
selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: number_1 } });
|
|
798
|
+
state.data.businessTypeData.licenseNumber = number_1;
|
|
801
799
|
}
|
|
802
800
|
state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
|
|
803
801
|
}
|
|
@@ -828,49 +826,42 @@ export var businessSlice = createSlice({
|
|
|
828
826
|
state.error = null;
|
|
829
827
|
})
|
|
830
828
|
.addCase(verifyLeadOTP.fulfilled, function (state, action) {
|
|
831
|
-
var _a, _b
|
|
829
|
+
var _a, _b;
|
|
832
830
|
state.loading = false;
|
|
833
831
|
state.error = null;
|
|
834
|
-
var
|
|
835
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
836
|
-
if (description) {
|
|
837
|
-
state.error = description;
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
832
|
+
var _c = action.payload, data = _c.data, formData = _c.formData, brand = _c.brand, leadData = _c.leadData;
|
|
840
833
|
state.data.otpData = formData;
|
|
841
834
|
state.data.otpData.responseBody = data;
|
|
842
|
-
state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: leadData === null || leadData === void 0 ? void 0 : leadData.flows });
|
|
843
|
-
var
|
|
844
|
-
var issuingDate = (
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
if (!!issuingDate) {
|
|
848
|
-
var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
|
|
849
|
-
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
850
|
-
}
|
|
835
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
|
|
836
|
+
var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type, business_name = _d.business_name;
|
|
837
|
+
var issuingDate = (brand === null || brand === void 0 ? void 0 : brand.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date);
|
|
838
|
+
if (issuingDate)
|
|
839
|
+
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
851
840
|
var activities = entity_activities || [];
|
|
852
841
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
853
|
-
var
|
|
854
|
-
return
|
|
842
|
+
var activities = brand.activities;
|
|
843
|
+
return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return value.id === activity.id; });
|
|
855
844
|
});
|
|
856
|
-
|
|
857
|
-
state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
|
|
845
|
+
state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
|
|
858
846
|
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
|
|
859
847
|
state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
var
|
|
863
|
-
var
|
|
848
|
+
var license = (entity || {}).license;
|
|
849
|
+
if (license) {
|
|
850
|
+
var number_2 = license.number;
|
|
851
|
+
var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
|
|
852
|
+
var licenseList = (busResData || {}).licenseList;
|
|
864
853
|
var selectedLicenseData = selectedLicense;
|
|
865
|
-
if (
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
854
|
+
if (number_2) {
|
|
855
|
+
var findFL = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
|
|
856
|
+
var license = _a.license;
|
|
857
|
+
return (license === null || license === void 0 ? void 0 : license.number) === number_2;
|
|
858
|
+
});
|
|
859
|
+
if (findFL || business_type === BusinessType.FL) {
|
|
860
|
+
selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: number_2 } });
|
|
861
|
+
}
|
|
862
|
+
else
|
|
863
|
+
selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: number_2 } });
|
|
864
|
+
state.data.businessTypeData.licenseNumber = number_2;
|
|
874
865
|
}
|
|
875
866
|
state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
|
|
876
867
|
}
|
|
@@ -1029,9 +1020,6 @@ export var businessSlice = createSlice({
|
|
|
1029
1020
|
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
1030
1021
|
}
|
|
1031
1022
|
var activities = entity_activities || [];
|
|
1032
|
-
var selectedActivity = activities[0];
|
|
1033
|
-
if (!!selectedActivity)
|
|
1034
|
-
state.data.activitiesData.activities = [selectedActivity];
|
|
1035
1023
|
state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
|
|
1036
1024
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: entity });
|
|
1037
1025
|
})
|
|
@@ -1073,19 +1061,19 @@ export var businessSlice = createSlice({
|
|
|
1073
1061
|
state.error = null;
|
|
1074
1062
|
})
|
|
1075
1063
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
1076
|
-
var _a, _b
|
|
1064
|
+
var _a, _b;
|
|
1077
1065
|
state.loading = false;
|
|
1078
1066
|
state.error = null;
|
|
1079
|
-
var
|
|
1080
|
-
var
|
|
1081
|
-
var
|
|
1082
|
-
var
|
|
1083
|
-
var
|
|
1084
|
-
var expectedCustomerSales = ((_e = payload.expectedCustomerSales) === null || _e === void 0 ? void 0 : _e.list) || [];
|
|
1085
|
-
var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
|
|
1067
|
+
var _c = action.payload, customerBases = _c.customerBases, expectedSales = _c.expectedSales, expectedCustomerSales = _c.expectedCustomerSales, countryISO2 = _c.countryISO2;
|
|
1068
|
+
var regional = customerBases.at(1);
|
|
1069
|
+
var local = customerBases.at(0);
|
|
1070
|
+
var expectedSale = (_b = (_a = expectedSales.at(0)) === null || _a === void 0 ? void 0 : _a.sub) === null || _b === void 0 ? void 0 : _b.at(4);
|
|
1071
|
+
var expectedCustomerSale = expectedCustomerSales.at(3);
|
|
1086
1072
|
state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
|
|
1087
|
-
if (
|
|
1088
|
-
state.data.customersData.customerLocations = [
|
|
1073
|
+
if (local && isKW(countryISO2))
|
|
1074
|
+
state.data.customersData.customerLocations = [local];
|
|
1075
|
+
if (regional && local && isSA(countryISO2))
|
|
1076
|
+
state.data.customersData.customerLocations = [regional, local];
|
|
1089
1077
|
if (!!expectedSale)
|
|
1090
1078
|
state.data.customersData.expectedSale = expectedSale;
|
|
1091
1079
|
if (!!expectedCustomerSale)
|
|
@@ -421,7 +421,7 @@ var initialState = {
|
|
|
421
421
|
licenseNumber: '',
|
|
422
422
|
licenseType: BusinessType.CR,
|
|
423
423
|
activities: [],
|
|
424
|
-
operationStartDate: '',
|
|
424
|
+
operationStartDate: moment(new Date()).format('YYYY-MM-DD'),
|
|
425
425
|
uploading: false
|
|
426
426
|
},
|
|
427
427
|
customersData: {
|
|
@@ -485,9 +485,8 @@ export var entitySlice = createSlice({
|
|
|
485
485
|
var _a;
|
|
486
486
|
return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
|
|
487
487
|
});
|
|
488
|
-
|
|
489
|
-
state.data.entityData.
|
|
490
|
-
state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, operationStartDate: startDate || issuingDate, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities });
|
|
488
|
+
state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
|
|
489
|
+
state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, operationStartDate: startDate || issuingDate, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [] });
|
|
491
490
|
})
|
|
492
491
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
493
492
|
state.error = action.error.message;
|
|
@@ -547,8 +546,7 @@ export var entitySlice = createSlice({
|
|
|
547
546
|
var _a;
|
|
548
547
|
return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
|
|
549
548
|
});
|
|
550
|
-
|
|
551
|
-
state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities, operationStartDate: startDate || issuingDate });
|
|
549
|
+
state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [], operationStartDate: startDate || issuingDate });
|
|
552
550
|
})
|
|
553
551
|
.addCase(verifyEntityLeadOTP.rejected, function (state, action) {
|
|
554
552
|
state.loading = false;
|