@tap-payments/auth-jsconnect 2.3.80-test → 2.3.83-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/brand/brandStore.d.ts +3 -3
- package/build/features/app/brand/brandStore.js +133 -114
- package/build/features/app/entity/entityStore.d.ts +3 -3
- package/build/features/app/entity/entityStore.js +130 -120
- package/build/features/app/tax/taxStore.d.ts +2 -2
- package/build/features/app/tax/taxStore.js +59 -55
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +3 -2
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +7 -6
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +3 -2
- package/build/features/entity/screens/EntityName/EntityName.js +3 -2
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +4 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, BrandActivitiesFormValues, BrandFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
2
|
+
import { ActionState, AsyncThunkParams, BrandActivitiesFormValues, BrandFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
interface VerifyLeadTokenProps {
|
|
5
5
|
token: string;
|
|
@@ -63,14 +63,14 @@ export declare const checkBrandNameAvailability: import("@reduxjs/toolkit").Asyn
|
|
|
63
63
|
export declare const updateBrand: import("@reduxjs/toolkit").AsyncThunk<{
|
|
64
64
|
data: any;
|
|
65
65
|
formData: Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">;
|
|
66
|
-
}, Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem"
|
|
66
|
+
}, AsyncThunkParams<Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">>, {}>;
|
|
67
67
|
export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
68
68
|
leadId: string;
|
|
69
69
|
}, {}>;
|
|
70
70
|
export declare const updateBrandActivities: import("@reduxjs/toolkit").AsyncThunk<{
|
|
71
71
|
data: any;
|
|
72
72
|
formData: BrandActivitiesFormValues;
|
|
73
|
-
}, BrandActivitiesFormValues
|
|
73
|
+
}, AsyncThunkParams<BrandActivitiesFormValues>, {}>;
|
|
74
74
|
export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
75
75
|
customerBases: any;
|
|
76
76
|
expectedSales: any;
|
|
@@ -263,70 +263,73 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
|
|
|
263
263
|
});
|
|
264
264
|
});
|
|
265
265
|
});
|
|
266
|
-
export var updateBrand = createAsyncThunk('brandUpdateBrand', function (
|
|
267
|
-
var
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
266
|
+
export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thunkApi) {
|
|
267
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
268
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
var _b, settings, brand, _c, id, data_status, isNameNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, requestBody, brandData, activities, activityList;
|
|
270
|
+
var _d, _e, _f, _g;
|
|
271
|
+
return __generator(this, function (_h) {
|
|
272
|
+
switch (_h.label) {
|
|
273
|
+
case 0:
|
|
274
|
+
_b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
|
|
275
|
+
_c = ((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) || {}, id = _c.id, data_status = _c.data_status;
|
|
276
|
+
isNameNonEditable = hasNoneEditableValue(data_status, 'name');
|
|
277
|
+
isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
|
|
278
|
+
isSegmentTypeNonEditable = hasNoneEditableValue(data_status, 'segment.type');
|
|
279
|
+
isSegmentTeamsNonEditable = hasNoneEditableValue(data_status, 'segment.teams');
|
|
280
|
+
salesChannels = formData.salesChannels, brandName = formData.brandName, segment = formData.segment, teamSize = formData.teamSize, brandLogoId = formData.brandLogoId;
|
|
281
|
+
segmentId = isSegmentTypeNonEditable ? undefined : segment && { id: segment.id };
|
|
282
|
+
teamSizeId = isSegmentTeamsNonEditable ? undefined : teamSize && { id: teamSize.id };
|
|
283
|
+
getAddress = function (value, isTwitter, isWeb) {
|
|
284
|
+
if (isTwitter)
|
|
285
|
+
return '@' + value.replaceAll('@', '');
|
|
286
|
+
if (isWeb)
|
|
287
|
+
return 'https://www.' + value.replaceAll('https://www.', '');
|
|
288
|
+
return value;
|
|
289
|
+
};
|
|
290
|
+
channel_services = isChannelServicesNonEditable
|
|
291
|
+
? undefined
|
|
292
|
+
: salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.map(function (channel) {
|
|
293
|
+
var _a;
|
|
294
|
+
return {
|
|
295
|
+
id: channel.id,
|
|
296
|
+
address: getAddress(channel.address || '', isTwitter(channel.code), isWebsite(channel.code)),
|
|
297
|
+
sub: (_a = channel.sub) === null || _a === void 0 ? void 0 : _a.map(function (sub) {
|
|
298
|
+
return { id: sub.id, address: getAddress(sub.address || '', isTwitter(sub.code), isWebsite(sub.code)) };
|
|
299
|
+
})
|
|
300
|
+
};
|
|
301
|
+
});
|
|
302
|
+
requestBody = {
|
|
303
|
+
id: id,
|
|
304
|
+
name: isNameNonEditable || !brandName ? undefined : { en: brandName, ar: brandName },
|
|
305
|
+
logo: brandLogoId,
|
|
306
|
+
segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId },
|
|
307
|
+
channel_services: channel_services
|
|
308
|
+
};
|
|
309
|
+
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
310
|
+
case 1:
|
|
311
|
+
brandData = (_h.sent()).brand;
|
|
312
|
+
activities = (((_e = brand.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.entity) || {}).activities;
|
|
313
|
+
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
314
|
+
case 2:
|
|
315
|
+
_h.sent();
|
|
316
|
+
if (activities) {
|
|
317
|
+
brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
|
|
318
|
+
}
|
|
319
|
+
if (!!activities) return [3, 4];
|
|
320
|
+
return [4, API.dataService.getActivities()];
|
|
321
|
+
case 3:
|
|
322
|
+
activityList = (_h.sent()).list;
|
|
323
|
+
brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
|
|
324
|
+
_h.label = 4;
|
|
325
|
+
case 4:
|
|
326
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
327
|
+
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, id);
|
|
328
|
+
return [2, { data: __assign({}, brandData), formData: originalFormData }];
|
|
329
|
+
}
|
|
330
|
+
});
|
|
328
331
|
});
|
|
329
|
-
});
|
|
332
|
+
});
|
|
330
333
|
export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
331
334
|
var data;
|
|
332
335
|
return __generator(this, function (_a) {
|
|
@@ -338,57 +341,62 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
|
|
|
338
341
|
}
|
|
339
342
|
});
|
|
340
343
|
}); });
|
|
341
|
-
export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (
|
|
342
|
-
var
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
344
|
+
export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (_a, thunkApi) {
|
|
345
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
346
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
347
|
+
var _b, settings, brand, _c, data_status, id, brandActivities, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, termAndConditionChecked, refundPolicy, transactionPolicy, isTermsUndefined, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
|
|
348
|
+
var _d, _e, _f;
|
|
349
|
+
return __generator(this, function (_g) {
|
|
350
|
+
switch (_g.label) {
|
|
351
|
+
case 0:
|
|
352
|
+
_b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
|
|
353
|
+
_c = ((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) || {}, data_status = _c.data_status, id = _c.id, brandActivities = _c.activities;
|
|
354
|
+
isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
|
|
355
|
+
isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
|
|
356
|
+
isCustomerBaseNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base');
|
|
357
|
+
isTermsNonEditable = hasNoneEditableValue(data_status, 'terms');
|
|
358
|
+
isSalesRangeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'sales_range');
|
|
359
|
+
activities = formData.activities, customerLocations = formData.customerLocations, expectedCustomer = formData.expectedCustomer, expectedSale = formData.expectedSale, termAndConditionChecked = formData.termAndConditionChecked, refundPolicy = formData.refundPolicy, transactionPolicy = formData.transactionPolicy;
|
|
360
|
+
isTermsUndefined = termAndConditionChecked === undefined && refundPolicy === undefined && transactionPolicy === undefined;
|
|
361
|
+
removedActivities = (activities === null || activities === void 0 ? void 0 : activities.length) > 0 &&
|
|
362
|
+
(brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
|
|
363
|
+
if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0)) return [3, 2];
|
|
364
|
+
payload = {
|
|
365
|
+
id: id,
|
|
366
|
+
activities: removedActivities
|
|
367
|
+
};
|
|
368
|
+
return [4, API.brandService.removeBrandActivity(payload)];
|
|
369
|
+
case 1:
|
|
370
|
+
_g.sent();
|
|
371
|
+
_g.label = 2;
|
|
372
|
+
case 2:
|
|
373
|
+
requestBody = {
|
|
374
|
+
id: id,
|
|
375
|
+
activities: isActivitiesNonEditable ? undefined : activities,
|
|
376
|
+
term: isTermsNonEditable || isTermsUndefined ? undefined : ['general', 'refund', 'chargeback'],
|
|
377
|
+
step_name: BRAND_STEP_NAMES.BRAND_ACTIVITIES
|
|
378
|
+
};
|
|
379
|
+
customerLocation = (customerLocations || []).map(function (location) { return ({
|
|
380
|
+
id: location.id
|
|
381
|
+
}); });
|
|
382
|
+
customerBaseId = (expectedCustomer === null || expectedCustomer === void 0 ? void 0 : expectedCustomer.id) && { id: expectedCustomer.id, period: 'monthly' };
|
|
383
|
+
salesId = (expectedSale === null || expectedSale === void 0 ? void 0 : expectedSale.id) && { id: expectedSale.id, period: 'monthly' };
|
|
384
|
+
customerBase = (customerBaseId || customerLocation.length) && __assign(__assign({}, (customerBaseId && !isCustomerBaseNonEditable && { id: expectedCustomer.id, period: 'monthly' })), (customerLocation.length && !isCustomerBaseLocationNonEditable && { locations: customerLocation }));
|
|
385
|
+
if (customerBase && !(isCustomerBaseNonEditable && isCustomerBaseLocationNonEditable))
|
|
386
|
+
requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { customer_base: customerBase }) });
|
|
387
|
+
if (salesId && !isSalesRangeNonEditable) {
|
|
388
|
+
requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { sales: salesId }) });
|
|
389
|
+
}
|
|
390
|
+
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
391
|
+
case 3:
|
|
392
|
+
brandData = (_g.sent()).data;
|
|
393
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
394
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
395
|
+
return [2, { data: __assign({}, brandData), formData: originalFormData }];
|
|
396
|
+
}
|
|
397
|
+
});
|
|
390
398
|
});
|
|
391
|
-
});
|
|
399
|
+
});
|
|
392
400
|
export var retrieveDataList = createAsyncThunk('brandRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
393
401
|
var settings, countryISO2, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
|
|
394
402
|
return __generator(this, function (_b) {
|
|
@@ -617,7 +625,7 @@ export var brandSlice = createSlice({
|
|
|
617
625
|
state.loading = false;
|
|
618
626
|
state.error = null;
|
|
619
627
|
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
620
|
-
var entity_activities = data.entity_activities, activities = data.activities, operations = data.operations;
|
|
628
|
+
var entity_activities = data.entity_activities, activities = data.activities, operations = data.operations, terms = data.terms;
|
|
621
629
|
var selectedActivity = entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
|
|
622
630
|
return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
|
|
623
631
|
});
|
|
@@ -631,6 +639,17 @@ export var brandSlice = createSlice({
|
|
|
631
639
|
state.data.brandActivities.expectedSale = sales;
|
|
632
640
|
if (!!customerBase)
|
|
633
641
|
state.data.brandActivities.expectedCustomer = customerBase;
|
|
642
|
+
terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
|
|
643
|
+
if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
|
|
644
|
+
state.data.brandActivities.termAndConditionChecked = element.agree;
|
|
645
|
+
}
|
|
646
|
+
if ((element === null || element === void 0 ? void 0 : element.term) === 'chargeback') {
|
|
647
|
+
state.data.brandActivities.transactionPolicy = element.agree;
|
|
648
|
+
}
|
|
649
|
+
if ((element === null || element === void 0 ? void 0 : element.term) === 'refund') {
|
|
650
|
+
state.data.brandActivities.refundPolicy = element.agree;
|
|
651
|
+
}
|
|
652
|
+
});
|
|
634
653
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { activities: entity_activities });
|
|
635
654
|
})
|
|
636
655
|
.addCase(updateBrandActivities.rejected, function (state, action) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
2
|
+
import { ActionState, AsyncThunkParams, EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
3
|
interface VerifyLeadTokenProps {
|
|
4
4
|
token: string;
|
|
5
5
|
isInternally?: boolean;
|
|
@@ -48,11 +48,11 @@ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk
|
|
|
48
48
|
export declare const updateEntityName: import("@reduxjs/toolkit").AsyncThunk<{
|
|
49
49
|
data: any;
|
|
50
50
|
formData: EntityNameFormValues;
|
|
51
|
-
}, EntityNameFormValues
|
|
51
|
+
}, AsyncThunkParams<EntityNameFormValues>, {}>;
|
|
52
52
|
export declare const updateEntityCapital: import("@reduxjs/toolkit").AsyncThunk<{
|
|
53
53
|
data: any;
|
|
54
54
|
formData: EntityCapitalFormValues;
|
|
55
|
-
}, EntityCapitalFormValues
|
|
55
|
+
}, AsyncThunkParams<EntityCapitalFormValues>, {}>;
|
|
56
56
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
57
57
|
response: any;
|
|
58
58
|
formData: void;
|
|
@@ -238,129 +238,139 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
240
|
}); });
|
|
241
|
-
export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (
|
|
242
|
-
var
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
'license.type',
|
|
280
|
-
'license.issuing_date',
|
|
281
|
-
'license.expiry_date',
|
|
282
|
-
'license.additional_info.unified_number',
|
|
283
|
-
'type'
|
|
284
|
-
] });
|
|
285
|
-
return [4, API.entityService.updateEntity(payload)];
|
|
286
|
-
case 1:
|
|
287
|
-
data = _f.sent();
|
|
288
|
-
documentResponse = undefined;
|
|
289
|
-
document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.CR);
|
|
290
|
-
if (!(!isDocumentsNonEditable && (params.certificateId || []).length > 0)) return [3, 7];
|
|
291
|
-
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
|
|
292
|
-
documentBody = {
|
|
293
|
-
id: document.id,
|
|
294
|
-
images: params.certificateId
|
|
295
|
-
};
|
|
296
|
-
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
297
|
-
case 2:
|
|
298
|
-
documentResponse = _f.sent();
|
|
299
|
-
return [3, 5];
|
|
300
|
-
case 3:
|
|
301
|
-
documentBody = {
|
|
302
|
-
entity_id: id || '',
|
|
303
|
-
documents: [
|
|
304
|
-
{
|
|
305
|
-
type: DocumentPurpose.CR,
|
|
306
|
-
images: params.certificateId
|
|
241
|
+
export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (_a, thunkApi) {
|
|
242
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
243
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
244
|
+
var _b, settings, entity, _c, id, data_status, data_verification, documents, issuingDate, expiryDate, licenseType, licenseNumber, articleId, unifiedNumber, legalName, certificateId, entityType, issueDate, expDate, isFL, isLegalNameENNonEditable, isLegalNameARNonEditable, isLicenseTypeNonEditable, isEntityTypeNonEditable, isLicenseNumberNonEditable, isUnifiedNumberNonEditable, isIssuingDateNonEditable, isExpiryDateNonEditable, isDocumentsNonEditable, isAOAFileNonEditable, isEntityTypeVerified, isLicenseNonEditable, isLicenseAvailable, payload, data, documentResponse, document, documentBody, documentBody, list;
|
|
245
|
+
var _d, _e, _f;
|
|
246
|
+
return __generator(this, function (_g) {
|
|
247
|
+
switch (_g.label) {
|
|
248
|
+
case 0:
|
|
249
|
+
_b = thunkApi.getState(), settings = _b.settings, entity = _b.entity;
|
|
250
|
+
_c = ((_d = entity.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.entity) || {}, id = _c.id, data_status = _c.data_status, data_verification = _c.data_verification, documents = _c.documents;
|
|
251
|
+
issuingDate = formData.issuingDate, expiryDate = formData.expiryDate, licenseType = formData.licenseType, licenseNumber = formData.licenseNumber, articleId = formData.articleId, unifiedNumber = formData.unifiedNumber, legalName = formData.legalName, certificateId = formData.certificateId, entityType = formData.entityType;
|
|
252
|
+
issueDate = issuingDate && new Date(issuingDate).getTime();
|
|
253
|
+
expDate = expiryDate && new Date(expiryDate).getTime();
|
|
254
|
+
isFL = licenseType === BusinessType.FL;
|
|
255
|
+
isLegalNameENNonEditable = hasNoneEditableValue(data_status, 'legal_name.en');
|
|
256
|
+
isLegalNameARNonEditable = hasNoneEditableValue(data_status, 'legal_name.ar');
|
|
257
|
+
isLicenseTypeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'type');
|
|
258
|
+
isEntityTypeNonEditable = hasNoneEditableValue(data_status, 'type');
|
|
259
|
+
isLicenseNumberNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'number');
|
|
260
|
+
isUnifiedNumberNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'additional_info');
|
|
261
|
+
isIssuingDateNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'issuing_date');
|
|
262
|
+
isExpiryDateNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'expiry_date');
|
|
263
|
+
isDocumentsNonEditable = hasNoneEditableValue(data_status, 'documents');
|
|
264
|
+
isAOAFileNonEditable = hasNoneEditableValue(data_status, 'AOA_file_id');
|
|
265
|
+
isEntityTypeVerified = hasVerifiedValue(data_verification, 'type');
|
|
266
|
+
isLicenseNonEditable = isLicenseNumberNonEditable && isLicenseTypeNonEditable && isIssuingDateNonEditable && isExpiryDateNonEditable && isUnifiedNumberNonEditable;
|
|
267
|
+
isLicenseAvailable = licenseNumber || licenseType || issueDate || expDate || unifiedNumber;
|
|
268
|
+
payload = __assign(__assign(__assign(__assign({ id: id, AOA_file_id: isAOAFileNonEditable ? undefined : articleId }, (!isLicenseNonEditable &&
|
|
269
|
+
isLicenseAvailable && {
|
|
270
|
+
license: __assign({ number: isLicenseNumberNonEditable || !licenseNumber ? undefined : licenseNumber, type: isLicenseTypeNonEditable || !licenseType ? undefined : isFL ? LicenseType.FL : LicenseType.CR, issuing_date: isIssuingDateNonEditable || !issueDate ? undefined : issueDate === null || issueDate === void 0 ? void 0 : issueDate.toString(), expiry_date: isExpiryDateNonEditable || !expDate ? undefined : expDate === null || expDate === void 0 ? void 0 : expDate.toString() }, (!(isUnifiedNumberNonEditable || !unifiedNumber) && {
|
|
271
|
+
additional_info: {
|
|
272
|
+
unified_number: unifiedNumber
|
|
273
|
+
}
|
|
274
|
+
}))
|
|
275
|
+
})), (!(isEntityTypeVerified || isEntityTypeNonEditable) && { type: entityType })), (!((isLegalNameENNonEditable && isLegalNameARNonEditable) || !legalName) && {
|
|
276
|
+
legal_name: {
|
|
277
|
+
en: isLegalNameENNonEditable ? undefined : legalName,
|
|
278
|
+
ar: isLegalNameARNonEditable ? undefined : legalName
|
|
307
279
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
280
|
+
})), { encryption_contract: [
|
|
281
|
+
'license.number',
|
|
282
|
+
'legal_name.ar',
|
|
283
|
+
'legal_name.en',
|
|
284
|
+
'license.type',
|
|
285
|
+
'license.issuing_date',
|
|
286
|
+
'license.expiry_date',
|
|
287
|
+
'license.additional_info.unified_number',
|
|
288
|
+
'type'
|
|
289
|
+
] });
|
|
290
|
+
return [4, API.entityService.updateEntity(payload)];
|
|
291
|
+
case 1:
|
|
292
|
+
data = _g.sent();
|
|
293
|
+
documentResponse = undefined;
|
|
294
|
+
document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.CR);
|
|
295
|
+
if (!(!isDocumentsNonEditable && (certificateId || []).length > 0)) return [3, 7];
|
|
296
|
+
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
|
|
297
|
+
documentBody = {
|
|
298
|
+
id: document.id,
|
|
299
|
+
images: certificateId
|
|
300
|
+
};
|
|
301
|
+
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
302
|
+
case 2:
|
|
303
|
+
documentResponse = _g.sent();
|
|
304
|
+
return [3, 5];
|
|
305
|
+
case 3:
|
|
306
|
+
documentBody = {
|
|
307
|
+
entity_id: id || '',
|
|
308
|
+
documents: [
|
|
309
|
+
{
|
|
310
|
+
type: DocumentPurpose.CR,
|
|
311
|
+
images: certificateId
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
};
|
|
315
|
+
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
316
|
+
case 4:
|
|
317
|
+
documentResponse = _g.sent();
|
|
318
|
+
_g.label = 5;
|
|
319
|
+
case 5: return [4, API.entityService.retrieveEntity(id)];
|
|
320
|
+
case 6:
|
|
321
|
+
data = _g.sent();
|
|
322
|
+
data.documentData = documentResponse;
|
|
323
|
+
_g.label = 7;
|
|
324
|
+
case 7: return [4, API.dataService.getActivities()];
|
|
325
|
+
case 8:
|
|
326
|
+
list = (_g.sent()).list;
|
|
327
|
+
data.activityList = list;
|
|
328
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
329
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
330
|
+
return [2, { data: data, formData: originalFormData }];
|
|
331
|
+
}
|
|
332
|
+
});
|
|
327
333
|
});
|
|
328
|
-
});
|
|
329
|
-
export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', function (
|
|
330
|
-
var
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
334
|
+
});
|
|
335
|
+
export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', function (_a, thunkApi) {
|
|
336
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
337
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
338
|
+
var _b, settings, entity, _c, id, data_status, isCapitalPaidNonEditable, isCapitalShareCountNonEditable, isCapitalShareValueNonEditable, isActivitiesNonEditable, capitalShareCount, capitalShareValue, activities, capitalPaid, hasCapitalShares, isCapitalNonEditable, activityIds, payload, data;
|
|
339
|
+
var _d, _e, _f, _g;
|
|
340
|
+
return __generator(this, function (_h) {
|
|
341
|
+
switch (_h.label) {
|
|
342
|
+
case 0:
|
|
343
|
+
_b = thunkApi.getState(), settings = _b.settings, entity = _b.entity;
|
|
344
|
+
_c = ((_d = entity.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.entity) || {}, id = _c.id, data_status = _c.data_status;
|
|
345
|
+
isCapitalPaidNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.capital, 'paid');
|
|
346
|
+
isCapitalShareCountNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.capital, 'shares.count');
|
|
347
|
+
isCapitalShareValueNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.capital, 'shares.value');
|
|
348
|
+
isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
|
|
349
|
+
capitalShareCount = formData.capitalShareCount, capitalShareValue = formData.capitalShareValue, activities = formData.activities, capitalPaid = formData.capitalPaid;
|
|
350
|
+
hasCapitalShares = capitalShareCount || capitalShareValue;
|
|
351
|
+
isCapitalNonEditable = (isCapitalPaidNonEditable && isCapitalShareCountNonEditable && isCapitalShareValueNonEditable) || (!capitalPaid && !hasCapitalShares);
|
|
352
|
+
activityIds = (_e = (activities || [])) === null || _e === void 0 ? void 0 : _e.map(function (_a) {
|
|
353
|
+
var id = _a.id;
|
|
354
|
+
return ({ id: id, action: 'add' });
|
|
355
|
+
});
|
|
356
|
+
payload = __assign({ id: id, activities: isActivitiesNonEditable || (activityIds === null || activityIds === void 0 ? void 0 : activityIds.length) === 0 ? undefined : activityIds }, (!isCapitalNonEditable && {
|
|
357
|
+
capital: __assign({ paid: isCapitalPaidNonEditable ? undefined : capitalPaid }, (!((isCapitalShareCountNonEditable && isCapitalShareValueNonEditable) || !hasCapitalShares) && {
|
|
358
|
+
shares: {
|
|
359
|
+
count: isCapitalShareCountNonEditable ? undefined : capitalShareCount,
|
|
360
|
+
value: isCapitalShareValueNonEditable ? undefined : capitalShareValue
|
|
361
|
+
}
|
|
362
|
+
}))
|
|
363
|
+
}));
|
|
364
|
+
return [4, API.entityService.updateEntity(payload)];
|
|
365
|
+
case 1:
|
|
366
|
+
data = _h.sent();
|
|
367
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
368
|
+
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, id);
|
|
369
|
+
return [2, { data: data, formData: originalFormData }];
|
|
370
|
+
}
|
|
371
|
+
});
|
|
362
372
|
});
|
|
363
|
-
});
|
|
373
|
+
});
|
|
364
374
|
export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
365
375
|
var _a, settings, entity, _b, id, infoId, payload, data, boardInfoData;
|
|
366
376
|
var _c, _d, _e, _f;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, FlowsTypes, OTPFormValues, ResponseData, SharedState, TaxFormValues } from '../../../@types';
|
|
2
|
+
import { ActionState, AsyncThunkParams, FlowsTypes, OTPFormValues, ResponseData, SharedState, TaxFormValues } from '../../../@types';
|
|
3
3
|
interface VerifyLeadTokenProps {
|
|
4
4
|
token: string;
|
|
5
5
|
isInternally?: boolean;
|
|
@@ -25,7 +25,7 @@ export declare const verifyTaxLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
25
25
|
export declare const updateTaxInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
26
26
|
data: any;
|
|
27
27
|
formData: TaxFormValues;
|
|
28
|
-
}, TaxFormValues
|
|
28
|
+
}, AsyncThunkParams<TaxFormValues>, {}>;
|
|
29
29
|
export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
30
30
|
response: any;
|
|
31
31
|
formData: void;
|
|
@@ -165,62 +165,66 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
}); });
|
|
168
|
-
export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
168
|
+
export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunkApi) {
|
|
169
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
170
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
171
|
+
var _b, settings, tax, _c, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, vatId, confirmPolicy, documentId, requestBody, data, documentBody, _d, documentBody, _e;
|
|
172
|
+
var _f, _g, _h, _j;
|
|
173
|
+
return __generator(this, function (_k) {
|
|
174
|
+
switch (_k.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
_b = thunkApi.getState(), settings = _b.settings, tax = _b.tax;
|
|
177
|
+
_c = ((_f = tax.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.entity) || {}, id = _c.id, data_status = _c.data_status, documents = _c.documents;
|
|
178
|
+
isTaxNumberNonEditable = hasNoneEditableValue(data_status, 'tax_number');
|
|
179
|
+
isConfirmPolicyNonEditable = hasNoneEditableValue(data_status, 'is_vat_acknowledged');
|
|
180
|
+
isDocumentsNonEditable = hasNoneEditableValue(data_status, 'documents');
|
|
181
|
+
document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.TAX_DOCUMENT);
|
|
182
|
+
vatId = formData.vatId, confirmPolicy = formData.confirmPolicy, documentId = formData.documentId;
|
|
183
|
+
requestBody = {
|
|
184
|
+
id: id,
|
|
185
|
+
vat_id: isTaxNumberNonEditable ? undefined : vatId,
|
|
186
|
+
step_name: TAX_STEP_NAMES.TAX_INFO,
|
|
187
|
+
is_vat_acknowledged: isConfirmPolicyNonEditable ? undefined : confirmPolicy
|
|
188
|
+
};
|
|
189
|
+
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
190
|
+
case 1:
|
|
191
|
+
data = (_k.sent()).data;
|
|
192
|
+
if ((_g = data.errors) === null || _g === void 0 ? void 0 : _g.length)
|
|
193
|
+
throw new Error(data.errors[0].description);
|
|
194
|
+
if (!(!isDocumentsNonEditable && (documentId || []).length > 0)) return [3, 5];
|
|
195
|
+
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
|
|
196
|
+
documentBody = {
|
|
197
|
+
id: document === null || document === void 0 ? void 0 : document.id,
|
|
198
|
+
images: documentId
|
|
199
|
+
};
|
|
200
|
+
_d = data;
|
|
201
|
+
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
202
|
+
case 2:
|
|
203
|
+
_d.documentData = _k.sent();
|
|
204
|
+
return [3, 5];
|
|
205
|
+
case 3:
|
|
206
|
+
documentBody = {
|
|
207
|
+
entity_id: id || '',
|
|
208
|
+
documents: [
|
|
209
|
+
{
|
|
210
|
+
type: DocumentPurpose.TAX_DOCUMENT,
|
|
211
|
+
images: documentId
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
};
|
|
215
|
+
_e = data;
|
|
216
|
+
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
217
|
+
case 4:
|
|
218
|
+
_e.documentData = _k.sent();
|
|
219
|
+
_k.label = 5;
|
|
220
|
+
case 5:
|
|
221
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
222
|
+
(_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
|
|
223
|
+
return [2, { data: data, formData: originalFormData }];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
222
226
|
});
|
|
223
|
-
});
|
|
227
|
+
});
|
|
224
228
|
export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
225
229
|
var _a, settings, tax, _b, id, infoId, payload, data, boardInfoData, boardData;
|
|
226
230
|
var _c, _d, _e, _f, _g;
|
|
@@ -15,7 +15,7 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
15
15
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
16
|
import Form from '../../../../components/Form';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { BrandActivitiesValidationSchema } from './validation';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
@@ -70,8 +70,9 @@ var BrandActivities = function (_a) {
|
|
|
70
70
|
'terms'
|
|
71
71
|
]);
|
|
72
72
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
73
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
73
74
|
var onSubmit = function (data) {
|
|
74
|
-
dispatch(updateBrandActivities(data));
|
|
75
|
+
dispatch(updateBrandActivities(getFelids(data)));
|
|
75
76
|
};
|
|
76
77
|
var onBack = function () {
|
|
77
78
|
dispatch(handlePrevScreenStep());
|
|
@@ -15,7 +15,7 @@ import React from 'react';
|
|
|
15
15
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
16
|
import Form from '../../../../components/Form';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { BrandValidationSchema } from './validation';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
@@ -60,8 +60,13 @@ var BrandInfo = function (_a) {
|
|
|
60
60
|
mode: 'onChange'
|
|
61
61
|
});
|
|
62
62
|
useSetFromDefaultValues(methods, data.brandData, true);
|
|
63
|
+
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
64
|
+
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
65
|
+
var noneEditable = useDataNoneEditable(data_status, ['name', 'segment.type', 'segment.teams', 'channel_services']);
|
|
66
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
67
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
63
68
|
var onSubmit = function (data) {
|
|
64
|
-
dispatch(updateBrand(data));
|
|
69
|
+
dispatch(updateBrand(getFelids(data)));
|
|
65
70
|
};
|
|
66
71
|
var onBack = function () {
|
|
67
72
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
|
|
@@ -87,10 +92,6 @@ var BrandInfo = function (_a) {
|
|
|
87
92
|
var handleMenuClick = function (flag) {
|
|
88
93
|
setListActive(flag);
|
|
89
94
|
};
|
|
90
|
-
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
91
|
-
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
92
|
-
var noneEditable = useDataNoneEditable(data_status, ['name', 'segment.type', 'segment.teams', 'channel_services']);
|
|
93
|
-
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
94
95
|
var isSegmentsListActive = listActive === ListType.SegmentsList;
|
|
95
96
|
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
96
97
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || noneEditable['name'], show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
|
|
@@ -15,7 +15,7 @@ import { FormProvider, useForm } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import Collapse from '@mui/material/Collapse';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
19
|
import { clearError, entitySelector, updateEntityCapital } from '../../../app/entity/entityStore';
|
|
20
20
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
21
21
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
@@ -58,8 +58,9 @@ var EntityCapital = function (_a) {
|
|
|
58
58
|
'capital.shares.value'
|
|
59
59
|
]);
|
|
60
60
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
61
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
61
62
|
var onSubmit = function (data) {
|
|
62
|
-
dispatch(updateEntityCapital(data));
|
|
63
|
+
dispatch(updateEntityCapital(getFelids(data)));
|
|
63
64
|
};
|
|
64
65
|
var onBack = function () {
|
|
65
66
|
dispatch(handlePrevScreenStep());
|
|
@@ -15,7 +15,7 @@ import { FormProvider, useForm } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import { getFileDetailsFromDocument, isKW, isSA } from '../../../../utils';
|
|
21
21
|
import { BusinessType, DocumentPurpose } from '../../../../@types';
|
|
@@ -83,8 +83,9 @@ var EntityName = function (_a) {
|
|
|
83
83
|
'AOA_file_id'
|
|
84
84
|
]);
|
|
85
85
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
86
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
86
87
|
var onSubmit = function (data) {
|
|
87
|
-
dispatch(updateEntityName(data));
|
|
88
|
+
dispatch(updateEntityName(getFelids(data)));
|
|
88
89
|
};
|
|
89
90
|
var handleIssueDateOpenClose = function (flag) {
|
|
90
91
|
setIssueAnchorEl(flag);
|
|
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import Form from '../../../../components/Form';
|
|
19
|
-
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
21
|
import { DocumentPurpose } from '../../../../@types';
|
|
22
22
|
import { getFileDetailsFromDocument, isSA } from '../../../../utils';
|
|
@@ -53,11 +53,12 @@ var TaxDetails = function () {
|
|
|
53
53
|
var originalReadOnly = useFormReadOnly(methods, { documentId: defaultTaxFiles });
|
|
54
54
|
var noneEditable = useDataNoneEditable(entity === null || entity === void 0 ? void 0 : entity.data_status, ['tax_number', 'documents', 'is_vat_acknowledged']);
|
|
55
55
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
56
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
56
57
|
var t = useTranslation().t;
|
|
57
58
|
var isAr = useLanguage().isAr;
|
|
58
59
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
59
60
|
var onSubmit = function (data) {
|
|
60
|
-
dispatch(updateTaxInfo(data));
|
|
61
|
+
dispatch(updateTaxInfo(getFelids(data)));
|
|
61
62
|
};
|
|
62
63
|
var onBack = function () {
|
|
63
64
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
|
|
@@ -66,6 +67,6 @@ var TaxDetails = function () {
|
|
|
66
67
|
}
|
|
67
68
|
dispatch(retrieveBoardStatus());
|
|
68
69
|
};
|
|
69
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: readOnly['vatId'] || noneEditable['tax_number'] }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: readOnly['documentId'] || noneEditable['documents'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['
|
|
70
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: readOnly['vatId'] || noneEditable['tax_number'] }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: readOnly['documentId'] || noneEditable['documents'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_vat_acknowledged'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid || uploading, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
70
71
|
};
|
|
71
72
|
export default TaxDetails;
|