@tap-payments/auth-jsconnect 2.0.108-test → 2.0.110-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/@types/form.d.ts +6 -4
- package/build/api/entity.d.ts +23 -0
- package/build/api/entity.js +17 -1
- package/build/api/index.d.ts +4 -2
- package/build/assets/locales/ar.json +3 -1
- package/build/assets/locales/en.json +3 -1
- package/build/constants/app.js +1 -1
- package/build/constants/assets.d.ts +3 -0
- package/build/constants/assets.js +3 -0
- package/build/features/app/entity/entityStore.d.ts +27 -7
- package/build/features/app/entity/entityStore.js +205 -141
- package/build/features/connect/screens/Mobile/Mobile.js +8 -4
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +1 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +21 -11
- package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
- package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +25 -6
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +25 -4
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +9 -17
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +12 -51
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -10
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/entity/screens/Verify/Verify.js +4 -4
- package/build/features/shared/UploadFile/UploadFile.d.ts +2 -1
- package/build/features/shared/UploadFile/UploadFile.js +3 -3
- package/package.json +1 -1
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -115
|
@@ -49,15 +49,15 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import {
|
|
53
|
-
import { ENTITY_STEP_NAMES
|
|
52
|
+
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
|
+
import { ENTITY_STEP_NAMES } from '../../../constants';
|
|
54
54
|
import moment from 'moment';
|
|
55
55
|
import { convertNumbers2English } from '../../../utils';
|
|
56
56
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var payload, data, boardInfoData, board_id, board_info_id, info, hasEntityCompleted;
|
|
58
|
-
var _a;
|
|
59
|
-
return __generator(this, function (
|
|
60
|
-
switch (
|
|
57
|
+
var payload, data, boardData, entityData, boardInfoData, board_id, board_info_id, entityId, info, hasEntityCompleted;
|
|
58
|
+
var _a, _b, _c, _d;
|
|
59
|
+
return __generator(this, function (_e) {
|
|
60
|
+
switch (_e.label) {
|
|
61
61
|
case 0:
|
|
62
62
|
payload = {
|
|
63
63
|
service_name: 'tap_email',
|
|
@@ -65,36 +65,54 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
65
65
|
};
|
|
66
66
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
67
67
|
case 1:
|
|
68
|
-
data = (
|
|
69
|
-
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
70
|
-
case 2:
|
|
71
|
-
_b.sent();
|
|
68
|
+
data = (_e.sent()).data;
|
|
72
69
|
boardInfoData = undefined;
|
|
73
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
70
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
|
|
71
|
+
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 8];
|
|
74
72
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
75
73
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
76
|
-
if (!(
|
|
74
|
+
if (!(board_id && board_info_id)) return [3, 3];
|
|
77
75
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
76
|
+
case 2:
|
|
77
|
+
boardInfoData = _e.sent();
|
|
78
|
+
_e.label = 3;
|
|
78
79
|
case 3:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
case 4:
|
|
80
|
+
if (!board_id) return [3, 5];
|
|
81
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
82
|
+
case 4:
|
|
83
|
+
boardData = _e.sent();
|
|
84
|
+
_e.label = 5;
|
|
82
85
|
case 5:
|
|
83
|
-
|
|
86
|
+
entityId = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.id;
|
|
87
|
+
if (!entityId) return [3, 7];
|
|
88
|
+
return [4, API.entityService.retrieveEntity(entityId)];
|
|
89
|
+
case 6:
|
|
90
|
+
entityData = _e.sent();
|
|
91
|
+
_e.label = 7;
|
|
92
|
+
case 7:
|
|
84
93
|
info = boardInfoData.info;
|
|
85
|
-
hasEntityCompleted = ((
|
|
86
|
-
|
|
87
|
-
if (data.step_name === ENTITY_STEP_NAMES.PHONE_AUTH) {
|
|
88
|
-
thunkApi.dispatch(handleCurrentActiveScreen('ENTITY_INFO_STEP'));
|
|
89
|
-
}
|
|
90
|
-
else if (hasEntityCompleted) {
|
|
94
|
+
hasEntityCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
|
|
95
|
+
if (hasEntityCompleted) {
|
|
91
96
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
92
97
|
}
|
|
93
|
-
else
|
|
98
|
+
else {
|
|
94
99
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
|
|
95
100
|
}
|
|
96
|
-
|
|
97
|
-
case
|
|
101
|
+
_e.label = 8;
|
|
102
|
+
case 8: return [2, {
|
|
103
|
+
data: data,
|
|
104
|
+
boardResponse: {
|
|
105
|
+
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
106
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
107
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
108
|
+
entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
|
|
109
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
110
|
+
name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
|
|
111
|
+
contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
|
|
112
|
+
flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info
|
|
113
|
+
},
|
|
114
|
+
token: token
|
|
115
|
+
}];
|
|
98
116
|
}
|
|
99
117
|
});
|
|
100
118
|
}); });
|
|
@@ -116,14 +134,13 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
|
|
|
116
134
|
});
|
|
117
135
|
}); });
|
|
118
136
|
export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
|
-
var _a, entity, settings, responseBody,
|
|
120
|
-
var _b, _c, _d, _e;
|
|
121
|
-
return __generator(this, function (
|
|
122
|
-
switch (
|
|
137
|
+
var _a, entity, settings, responseBody, payload, data, boardData, entityData, boardInfoData, board_id, board_info_id, entityId, info, hasEntityCompleted;
|
|
138
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
139
|
+
return __generator(this, function (_j) {
|
|
140
|
+
switch (_j.label) {
|
|
123
141
|
case 0:
|
|
124
142
|
_a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
|
|
125
143
|
responseBody = entity.data.verify.responseBody;
|
|
126
|
-
flows = (responseBody || {}).flows;
|
|
127
144
|
payload = {
|
|
128
145
|
data: params.otp,
|
|
129
146
|
service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
|
|
@@ -133,18 +150,54 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
133
150
|
};
|
|
134
151
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
135
152
|
case 1:
|
|
136
|
-
data = (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
153
|
+
data = (_j.sent()).data;
|
|
154
|
+
boardInfoData = undefined;
|
|
155
|
+
if (!!data.errors) return [3, 8];
|
|
156
|
+
board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
|
|
157
|
+
board_info_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.board_info_id;
|
|
158
|
+
if (!(board_id && board_info_id)) return [3, 3];
|
|
159
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
160
|
+
case 2:
|
|
161
|
+
boardInfoData = _j.sent();
|
|
162
|
+
_j.label = 3;
|
|
163
|
+
case 3:
|
|
164
|
+
if (!board_id) return [3, 5];
|
|
165
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
166
|
+
case 4:
|
|
167
|
+
boardData = _j.sent();
|
|
168
|
+
_j.label = 5;
|
|
169
|
+
case 5:
|
|
170
|
+
entityId = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.id;
|
|
171
|
+
if (!entityId) return [3, 7];
|
|
172
|
+
return [4, API.entityService.retrieveEntity(entityId)];
|
|
173
|
+
case 6:
|
|
174
|
+
entityData = _j.sent();
|
|
175
|
+
_j.label = 7;
|
|
176
|
+
case 7:
|
|
177
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
178
|
+
info = boardInfoData.info;
|
|
179
|
+
hasEntityCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
|
|
180
|
+
if (hasEntityCompleted) {
|
|
181
|
+
thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
146
182
|
}
|
|
147
|
-
|
|
183
|
+
else {
|
|
184
|
+
thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
|
|
185
|
+
}
|
|
186
|
+
_j.label = 8;
|
|
187
|
+
case 8: return [2, {
|
|
188
|
+
data: data,
|
|
189
|
+
boardResponse: {
|
|
190
|
+
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
191
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
192
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
193
|
+
entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
|
|
194
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
195
|
+
name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
|
|
196
|
+
contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
|
|
197
|
+
flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info
|
|
198
|
+
},
|
|
199
|
+
formData: params
|
|
200
|
+
}];
|
|
148
201
|
}
|
|
149
202
|
});
|
|
150
203
|
}); });
|
|
@@ -157,40 +210,84 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
157
210
|
case 1:
|
|
158
211
|
data = _c.sent();
|
|
159
212
|
return [2, {
|
|
160
|
-
data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.
|
|
213
|
+
data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
|
|
161
214
|
}];
|
|
162
215
|
}
|
|
163
216
|
});
|
|
164
217
|
}); });
|
|
165
|
-
export var
|
|
166
|
-
var _a, settings, entity,
|
|
218
|
+
export var updateEntity = createAsyncThunk('entityUpdateEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
219
|
+
var _a, settings, entity, id, documentData, articleId, payload, documentBody, data;
|
|
167
220
|
var _b, _c, _d, _e, _f;
|
|
168
221
|
return __generator(this, function (_g) {
|
|
169
222
|
switch (_g.label) {
|
|
170
223
|
case 0:
|
|
171
224
|
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
172
|
-
|
|
173
|
-
|
|
225
|
+
id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
|
|
226
|
+
documentData = undefined;
|
|
227
|
+
articleId = entity.data.entityData.articleId;
|
|
228
|
+
payload = {
|
|
229
|
+
id: id,
|
|
174
230
|
activities: (_d = (params.activities || [])) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
|
|
175
231
|
var id = _a.id;
|
|
176
|
-
return ({ id: id });
|
|
232
|
+
return ({ id: id, action: 'add' });
|
|
177
233
|
}),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
234
|
+
license: {
|
|
235
|
+
issuing_date: moment(params.operationStartDate).format('x'),
|
|
236
|
+
number: params.licenseNumber
|
|
237
|
+
},
|
|
238
|
+
legal_name: {
|
|
239
|
+
ar: params.licenseName,
|
|
240
|
+
en: params.licenseName
|
|
241
|
+
},
|
|
242
|
+
encryption_contract: ['license.issuing_date', 'license.number', 'legal_name.ar', 'legal_name.en']
|
|
243
|
+
};
|
|
244
|
+
if (!articleId) return [3, 2];
|
|
245
|
+
documentBody = {
|
|
246
|
+
entity_id: id || '',
|
|
247
|
+
documents: [
|
|
248
|
+
{
|
|
249
|
+
images: [articleId]
|
|
250
|
+
}
|
|
251
|
+
]
|
|
182
252
|
};
|
|
183
|
-
return [4, API.entityService.
|
|
253
|
+
return [4, API.entityService.updateDocumentInfo(documentBody)];
|
|
184
254
|
case 1:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
255
|
+
documentData = _g.sent();
|
|
256
|
+
_g.label = 2;
|
|
257
|
+
case 2: return [4, API.entityService.updateEntity(payload)];
|
|
258
|
+
case 3:
|
|
259
|
+
data = _g.sent();
|
|
260
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
261
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
262
|
+
return [2, { data: __assign(__assign({}, data), documentData), formData: params }];
|
|
191
263
|
}
|
|
192
264
|
});
|
|
193
265
|
}); });
|
|
266
|
+
export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
|
|
267
|
+
var file = _a.file, onProgress = _a.onProgress;
|
|
268
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
var uploadPayload, onUploadProgress, data;
|
|
270
|
+
return __generator(this, function (_b) {
|
|
271
|
+
switch (_b.label) {
|
|
272
|
+
case 0:
|
|
273
|
+
uploadPayload = {
|
|
274
|
+
file_link_create: true,
|
|
275
|
+
title: file === null || file === void 0 ? void 0 : file.name,
|
|
276
|
+
purpose: 'identity_document',
|
|
277
|
+
file: file
|
|
278
|
+
};
|
|
279
|
+
onUploadProgress = function (progressEvent) {
|
|
280
|
+
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
281
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
282
|
+
};
|
|
283
|
+
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
284
|
+
case 1:
|
|
285
|
+
data = _b.sent();
|
|
286
|
+
return [2, { data: data }];
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
});
|
|
194
291
|
export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
195
292
|
var _a, settings, entity, _b, id, infoId, payload, data;
|
|
196
293
|
var _c, _d, _e, _f;
|
|
@@ -215,22 +312,7 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', fun
|
|
|
215
312
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
216
313
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
217
314
|
thunkApi.dispatch(handleNextScreenStep());
|
|
218
|
-
return [2, { response: __assign(__assign({}, data), { flows:
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}); });
|
|
222
|
-
export var retrieveChannels = createAsyncThunk('retrieveChannelsEntity', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
-
var body, data;
|
|
224
|
-
return __generator(this, function (_a) {
|
|
225
|
-
switch (_a.label) {
|
|
226
|
-
case 0:
|
|
227
|
-
body = {
|
|
228
|
-
page: 0
|
|
229
|
-
};
|
|
230
|
-
return [4, API.dataService.getChannelsOfServices(body)];
|
|
231
|
-
case 1:
|
|
232
|
-
data = _a.sent();
|
|
233
|
-
return [2, data];
|
|
315
|
+
return [2, { response: __assign(__assign({}, data), { flows: data === null || data === void 0 ? void 0 : data.info }), formData: params }];
|
|
234
316
|
}
|
|
235
317
|
});
|
|
236
318
|
}); });
|
|
@@ -238,6 +320,7 @@ var initialState = {
|
|
|
238
320
|
error: null,
|
|
239
321
|
loading: false,
|
|
240
322
|
customLoading: false,
|
|
323
|
+
uploading: false,
|
|
241
324
|
data: {
|
|
242
325
|
flowName: FlowsTypes.ENTITY,
|
|
243
326
|
verify: {
|
|
@@ -247,9 +330,11 @@ var initialState = {
|
|
|
247
330
|
otp: ''
|
|
248
331
|
},
|
|
249
332
|
entityData: {
|
|
333
|
+
licenseName: '',
|
|
334
|
+
licenseNumber: '',
|
|
250
335
|
activities: [],
|
|
251
|
-
|
|
252
|
-
|
|
336
|
+
operationStartDate: new Date().toString(),
|
|
337
|
+
uploading: false
|
|
253
338
|
}
|
|
254
339
|
}
|
|
255
340
|
};
|
|
@@ -274,42 +359,27 @@ export var entitySlice = createSlice({
|
|
|
274
359
|
state.customLoading = true;
|
|
275
360
|
})
|
|
276
361
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
277
|
-
var _a, _b, _c;
|
|
362
|
+
var _a, _b, _c, _d;
|
|
278
363
|
state.error = null;
|
|
279
364
|
state.customLoading = false;
|
|
280
|
-
var
|
|
365
|
+
var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse;
|
|
281
366
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
282
367
|
if (description) {
|
|
283
368
|
state.error = description;
|
|
284
369
|
return;
|
|
285
370
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
371
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
|
|
372
|
+
state.data.verify.token = token;
|
|
373
|
+
var _f = boardResponse || {}, brand = _f.brand, entity = _f.entity;
|
|
374
|
+
var issuingDate = ((_b = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _b === void 0 ? void 0 : _b.start_date) || ((_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date);
|
|
375
|
+
var licenseNumber = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
|
|
376
|
+
if (issuingDate) {
|
|
377
|
+
var date = new Date(issuingDate);
|
|
378
|
+
var formattedDate = moment(date).format('YYYY-MM-DD');
|
|
290
379
|
state.data.entityData.operationStartDate = convertNumbers2English(formattedDate);
|
|
291
380
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
var _f = brand || {}, website = _f.website, social = _f.social;
|
|
295
|
-
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
296
|
-
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
297
|
-
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
298
|
-
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.name) === null || _a === void 0 ? void 0 : _a.en.toLocaleLowerCase()) === 'website'; });
|
|
299
|
-
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.name) === null || _a === void 0 ? void 0 : _a.en.toLocaleLowerCase()) === 'social media'; });
|
|
300
|
-
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
301
|
-
selectedChannels = [websiteData, socialData];
|
|
302
|
-
else if (isHasTwitter || isHasInstagram)
|
|
303
|
-
selectedChannels = [socialData];
|
|
304
|
-
else if (isHasWebsite)
|
|
305
|
-
selectedChannels = [websiteData];
|
|
306
|
-
if (((_c = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
307
|
-
selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
|
|
308
|
-
var _a;
|
|
309
|
-
return (_a = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { var _a; return ((_a = channel === null || channel === void 0 ? void 0 : channel.name) === null || _a === void 0 ? void 0 : _a.en.toLowerCase()) === storedChannel.toLowerCase(); });
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
state.data.entityData.salesChannels = selectedChannels;
|
|
381
|
+
if (licenseNumber)
|
|
382
|
+
state.data.entityData.licenseNumber = licenseNumber;
|
|
313
383
|
var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
|
|
314
384
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
315
385
|
var _a;
|
|
@@ -317,8 +387,6 @@ export var entitySlice = createSlice({
|
|
|
317
387
|
});
|
|
318
388
|
state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
|
|
319
389
|
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 : [activities === null || activities === void 0 ? void 0 : activities[0]] });
|
|
320
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
|
|
321
|
-
state.data.verify.token = token;
|
|
322
390
|
})
|
|
323
391
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
324
392
|
state.error = action.error.message;
|
|
@@ -346,10 +414,10 @@ export var entitySlice = createSlice({
|
|
|
346
414
|
state.error = null;
|
|
347
415
|
})
|
|
348
416
|
.addCase(verifyEntityLeadOTP.fulfilled, function (state, action) {
|
|
349
|
-
var _a;
|
|
417
|
+
var _a, _b, _c, _d;
|
|
350
418
|
state.loading = false;
|
|
351
419
|
state.error = null;
|
|
352
|
-
var
|
|
420
|
+
var _e = action.payload, data = _e.data, boardResponse = _e.boardResponse, formData = _e.formData;
|
|
353
421
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
354
422
|
if (description) {
|
|
355
423
|
state.error = description;
|
|
@@ -357,16 +425,34 @@ export var entitySlice = createSlice({
|
|
|
357
425
|
}
|
|
358
426
|
state.data.otpData = formData;
|
|
359
427
|
state.data.otpData.responseBody = data;
|
|
428
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
|
|
429
|
+
var _f = boardResponse || {}, brand = _f.brand, entity = _f.entity;
|
|
430
|
+
var issuingDate = ((_b = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _b === void 0 ? void 0 : _b.start_date) || ((_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date);
|
|
431
|
+
var licenseNumber = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
|
|
432
|
+
if (issuingDate) {
|
|
433
|
+
var date = new Date(issuingDate);
|
|
434
|
+
var formattedDate = moment(date).format('YYYY-MM-DD');
|
|
435
|
+
state.data.entityData.operationStartDate = convertNumbers2English(formattedDate);
|
|
436
|
+
}
|
|
437
|
+
if (licenseNumber)
|
|
438
|
+
state.data.entityData.licenseNumber = licenseNumber;
|
|
439
|
+
var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
|
|
440
|
+
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
441
|
+
var _a;
|
|
442
|
+
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; });
|
|
443
|
+
});
|
|
444
|
+
state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
|
|
445
|
+
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 : [activities === null || activities === void 0 ? void 0 : activities[0]] });
|
|
360
446
|
})
|
|
361
447
|
.addCase(verifyEntityLeadOTP.rejected, function (state, action) {
|
|
362
448
|
state.loading = false;
|
|
363
449
|
state.error = action.error.message;
|
|
364
450
|
})
|
|
365
|
-
.addCase(
|
|
451
|
+
.addCase(updateEntity.pending, function (state) {
|
|
366
452
|
state.loading = true;
|
|
367
453
|
state.error = null;
|
|
368
454
|
})
|
|
369
|
-
.addCase(
|
|
455
|
+
.addCase(updateEntity.fulfilled, function (state, action) {
|
|
370
456
|
var _a;
|
|
371
457
|
state.loading = false;
|
|
372
458
|
state.error = null;
|
|
@@ -379,7 +465,7 @@ export var entitySlice = createSlice({
|
|
|
379
465
|
state.data.entityData = formData;
|
|
380
466
|
state.data.entityData.responseBody = data;
|
|
381
467
|
})
|
|
382
|
-
.addCase(
|
|
468
|
+
.addCase(updateEntity.rejected, function (state, action) {
|
|
383
469
|
state.loading = false;
|
|
384
470
|
state.error = action.error.message;
|
|
385
471
|
})
|
|
@@ -418,41 +504,19 @@ export var entitySlice = createSlice({
|
|
|
418
504
|
state.loading = false;
|
|
419
505
|
state.error = action.error.message;
|
|
420
506
|
})
|
|
421
|
-
.addCase(
|
|
507
|
+
.addCase(uploadArticle.pending, function (state) {
|
|
422
508
|
state.error = null;
|
|
423
|
-
state.
|
|
509
|
+
state.uploading = true;
|
|
424
510
|
})
|
|
425
|
-
.addCase(
|
|
426
|
-
var _a;
|
|
511
|
+
.addCase(uploadArticle.fulfilled, function (state, action) {
|
|
427
512
|
state.error = null;
|
|
428
|
-
state.
|
|
429
|
-
var data = action.payload
|
|
430
|
-
|
|
431
|
-
if (description) {
|
|
432
|
-
state.error = description;
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
var channels = data.list || [];
|
|
436
|
-
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { channelList: channels });
|
|
437
|
-
var brand = (state.data.verify.responseBody || {}).brand;
|
|
438
|
-
var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
|
|
439
|
-
var _b = brand || {}, website = _b.website, social = _b.social;
|
|
440
|
-
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
441
|
-
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
442
|
-
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
443
|
-
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.name) === null || _a === void 0 ? void 0 : _a.en.toLocaleLowerCase()) === 'website'; });
|
|
444
|
-
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.name) === null || _a === void 0 ? void 0 : _a.en.toLocaleLowerCase()) === 'social media'; });
|
|
445
|
-
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
446
|
-
selectedChannels = [websiteData, socialData];
|
|
447
|
-
else if (isHasTwitter || isHasInstagram)
|
|
448
|
-
selectedChannels = [socialData];
|
|
449
|
-
else if (isHasWebsite)
|
|
450
|
-
selectedChannels = [websiteData];
|
|
451
|
-
state.data.entityData.salesChannels = selectedChannels;
|
|
513
|
+
state.uploading = false;
|
|
514
|
+
var data = action.payload.data;
|
|
515
|
+
state.data.entityData.articleId = data === null || data === void 0 ? void 0 : data.id;
|
|
452
516
|
})
|
|
453
|
-
.addCase(
|
|
454
|
-
state.
|
|
455
|
-
state.
|
|
517
|
+
.addCase(uploadArticle.rejected, function (state) {
|
|
518
|
+
state.uploading = false;
|
|
519
|
+
state.error = 'file_upload_error';
|
|
456
520
|
});
|
|
457
521
|
}
|
|
458
522
|
});
|
|
@@ -78,10 +78,14 @@ var Mobile = function (_a) {
|
|
|
78
78
|
var settingsStore = useAppSelector(settingsSelector);
|
|
79
79
|
var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
80
80
|
var _d = React.useState(), listType = _d[0], setListType = _d[1];
|
|
81
|
+
var _e = data.mobileData, countryCode = _e.countryCode, mobile = _e.mobile;
|
|
81
82
|
var dispatch = useAppDispatch();
|
|
82
83
|
var methods = useForm({
|
|
83
84
|
resolver: yupResolver(PhoneValidationSchema),
|
|
84
|
-
defaultValues:
|
|
85
|
+
defaultValues: {
|
|
86
|
+
mobile: mobile || '',
|
|
87
|
+
countryCode: countryCode
|
|
88
|
+
},
|
|
85
89
|
mode: 'onChange'
|
|
86
90
|
});
|
|
87
91
|
var t = useTranslation().t;
|
|
@@ -90,10 +94,10 @@ var Mobile = function (_a) {
|
|
|
90
94
|
setListType(flag);
|
|
91
95
|
};
|
|
92
96
|
React.useEffect(function () {
|
|
93
|
-
if (
|
|
94
|
-
methods.setValue('countryCode',
|
|
97
|
+
if (countryCode && !methods.getValues('countryCode')) {
|
|
98
|
+
methods.setValue('countryCode', countryCode);
|
|
95
99
|
}
|
|
96
|
-
}, [
|
|
100
|
+
}, [countryCode]);
|
|
97
101
|
React.useEffect(function () {
|
|
98
102
|
dispatch(resetOTPScreen());
|
|
99
103
|
}, []);
|
|
@@ -17,6 +17,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
|
|
|
17
17
|
hide?: boolean | undefined;
|
|
18
18
|
warningType?: "alert" | "error" | "hint" | undefined;
|
|
19
19
|
} & {} & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
20
|
+
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
20
21
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
21
22
|
children?: React.ReactNode;
|
|
22
23
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
@@ -58,6 +58,10 @@ export var InputStyled = styled(Input)(function (_a) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
export var MandatoryStyled = styled('span')(function (_a) {
|
|
62
|
+
var theme = _a.theme;
|
|
63
|
+
return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
|
|
64
|
+
});
|
|
61
65
|
var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
62
66
|
height: 'fit-content'
|
|
63
67
|
}); });
|
|
@@ -74,21 +78,22 @@ export var NameContainer = styled(Text, { shouldForwardProp: function (prop) { r
|
|
|
74
78
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
75
79
|
});
|
|
76
80
|
var ActivitiesList = function (_a) {
|
|
77
|
-
var _b
|
|
81
|
+
var _b;
|
|
78
82
|
var rest = __rest(_a, []);
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var
|
|
83
|
+
var _c = React.useState([]), activitiesMenuList = _c[0], setActivitiesMenuList = _c[1];
|
|
84
|
+
var _d = React.useState([]), storedActivities = _d[0], setStoredActivities = _d[1];
|
|
85
|
+
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
82
86
|
var t = useTranslation().t;
|
|
83
87
|
var isAr = useLanguage().isAr;
|
|
84
|
-
var
|
|
88
|
+
var _f = useFormContext(), control = _f.control, setValue = _f.setValue;
|
|
85
89
|
var data = useAppSelector(entitySelector).data;
|
|
86
90
|
var activitiesControl = useController({ name: 'activities', control: control });
|
|
87
91
|
var controlValue = activitiesControl.field.value;
|
|
88
92
|
var verify = data.verify, entityData = data.entityData;
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var
|
|
93
|
+
var _g = entityData.responseBody || {}, activities = _g.activities, selectedActivities = _g.selectedActivities;
|
|
94
|
+
var entity = (verify.responseBody || {}).entity;
|
|
95
|
+
var licenseType = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.type;
|
|
96
|
+
var businessType = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
|
|
92
97
|
var isCR = businessType === BusinessType.CR;
|
|
93
98
|
React.useEffect(function () {
|
|
94
99
|
if ((activities === null || activities === void 0 ? void 0 : activities.length) > 0) {
|
|
@@ -99,7 +104,11 @@ var ActivitiesList = function (_a) {
|
|
|
99
104
|
if ((selectedActivities === null || selectedActivities === void 0 ? void 0 : selectedActivities.length) > 0) {
|
|
100
105
|
setStoredActivities(selectedActivities);
|
|
101
106
|
}
|
|
102
|
-
}, []);
|
|
107
|
+
}, [selectedActivities]);
|
|
108
|
+
React.useEffect(function () {
|
|
109
|
+
var activities = entityData.activities;
|
|
110
|
+
setValue('activities', activities);
|
|
111
|
+
}, [entityData === null || entityData === void 0 ? void 0 : entityData.activities]);
|
|
103
112
|
var onOpenList = function (event) {
|
|
104
113
|
var _a;
|
|
105
114
|
setAnchorEl(event.currentTarget);
|
|
@@ -127,10 +136,11 @@ var ActivitiesList = function (_a) {
|
|
|
127
136
|
if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) > 1) {
|
|
128
137
|
return (controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) + ' ' + t('activities_selected');
|
|
129
138
|
}
|
|
130
|
-
|
|
139
|
+
var item = controlValue[0];
|
|
140
|
+
return isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en;
|
|
131
141
|
};
|
|
132
142
|
var getSelectedActivityFlag = function (item) {
|
|
133
|
-
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === (item === null || item === void 0 ? void 0 : item.id); });
|
|
143
|
+
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return (activity === null || activity === void 0 ? void 0 : activity.id) === (item === null || item === void 0 ? void 0 : item.id); });
|
|
134
144
|
};
|
|
135
145
|
return (_jsx(Collapse, __assign({ in: (activitiesMenuList === null || activitiesMenuList === void 0 ? void 0 : activitiesMenuList.length) > 0 }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t(isCR ? 'activities' : 'category') }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: getSelectedActivities(), placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: activitiesMenuList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
136
146
|
var _a;
|