@tap-payments/auth-jsconnect 2.0.71-test → 2.0.72-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/app.d.ts +5 -2
- package/build/@types/form.d.ts +4 -1
- package/build/api/brand.d.ts +2 -1
- package/build/api/brand.js +10 -1
- package/build/api/data.d.ts +2 -0
- package/build/api/data.js +16 -1
- package/build/api/entity.d.ts +3 -1
- package/build/api/index.d.ts +2 -0
- package/build/api/individual.d.ts +48 -19
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +5 -1
- package/build/features/app/business/businessStore.d.ts +1 -2
- package/build/features/app/business/businessStore.js +72 -118
- package/build/features/app/connect/connectStore.d.ts +1 -0
- package/build/features/app/connect/connectStore.js +66 -37
- package/build/features/app/entity/entityStore.js +3 -3
- package/build/features/business/screens/Activities/Activities.js +1 -6
- package/build/features/business/screens/Activities/ActivitiesList.js +7 -6
- package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -3
- package/build/features/business/screens/Activities/SalesChannels.js +0 -96
- package/build/features/business/screens/Activities/validation.d.ts +0 -51
- package/build/features/business/screens/Activities/validation.js +0 -9
- package/build/features/connect/screens/Merchant/Merchant.js +9 -1
- package/build/features/connect/screens/Mobile/Mobile.js +4 -1
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +6 -5
- package/package.json +129 -129
|
@@ -23,6 +23,7 @@ export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
23
23
|
response: any;
|
|
24
24
|
formData: OTPFormValues;
|
|
25
25
|
leadData: any;
|
|
26
|
+
selectedChannels: any;
|
|
26
27
|
}, OTPFormValues, {}>;
|
|
27
28
|
interface verifyPACIParams {
|
|
28
29
|
onSuccess?: () => void | Promise<void>;
|
|
@@ -215,16 +215,17 @@ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thu
|
|
|
215
215
|
});
|
|
216
216
|
}); });
|
|
217
217
|
export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
218
|
-
var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, individualInfo, payload, data, leadData, isNewUser, params_1;
|
|
219
|
-
var _c, _d;
|
|
220
|
-
return __generator(this, function (
|
|
221
|
-
switch (
|
|
218
|
+
var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, individualInfo, selectedChannels, payload, data, leadData, isNewUser, brand, params_1;
|
|
219
|
+
var _c, _d, _e, _f;
|
|
220
|
+
return __generator(this, function (_g) {
|
|
221
|
+
switch (_g.label) {
|
|
222
222
|
case 0:
|
|
223
223
|
_a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
|
|
224
224
|
isAbsher = connect.data.otpData.isAbsher;
|
|
225
225
|
_b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData;
|
|
226
226
|
responseBody = (isAbsher ? nidData : mobileData).responseBody;
|
|
227
227
|
individualInfo = undefined;
|
|
228
|
+
selectedChannels = undefined;
|
|
228
229
|
payload = {
|
|
229
230
|
data: params.otp,
|
|
230
231
|
auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
|
|
@@ -239,20 +240,26 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
|
|
|
239
240
|
};
|
|
240
241
|
return [4, API.authService.verifyAuth(payload)];
|
|
241
242
|
case 1:
|
|
242
|
-
data = (
|
|
243
|
-
if (!!data.errors) return [3,
|
|
243
|
+
data = (_g.sent()).data;
|
|
244
|
+
if (!!data.errors) return [3, 7];
|
|
244
245
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
245
246
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.lead_id)];
|
|
246
247
|
case 2:
|
|
247
|
-
leadData = (
|
|
248
|
+
leadData = (_g.sent()).data;
|
|
248
249
|
individualInfo = leadData;
|
|
249
250
|
isNewUser = leadData === null || leadData === void 0 ? void 0 : leadData.is_new_individual;
|
|
250
|
-
|
|
251
|
+
if (!!!((_e = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _e === void 0 ? void 0 : _e.id)) return [3, 4];
|
|
252
|
+
return [4, API.brandService.retrieveBrand((_f = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _f === void 0 ? void 0 : _f.id)];
|
|
251
253
|
case 3:
|
|
252
|
-
|
|
254
|
+
brand = (_g.sent()).brand;
|
|
255
|
+
selectedChannels = brand === null || brand === void 0 ? void 0 : brand.channel_services;
|
|
256
|
+
_g.label = 4;
|
|
257
|
+
case 4: return [4, thunkApi.dispatch(retrieveBrandList(individualInfo === null || individualInfo === void 0 ? void 0 : individualInfo.individual_id))];
|
|
258
|
+
case 5:
|
|
259
|
+
_g.sent();
|
|
253
260
|
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
254
|
-
case
|
|
255
|
-
|
|
261
|
+
case 6:
|
|
262
|
+
_g.sent();
|
|
256
263
|
if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
|
|
257
264
|
params_1 = {
|
|
258
265
|
individualId: data === null || data === void 0 ? void 0 : data.individual_id,
|
|
@@ -265,8 +272,8 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
|
|
|
265
272
|
? thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'))
|
|
266
273
|
: thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
|
|
267
274
|
}
|
|
268
|
-
|
|
269
|
-
case
|
|
275
|
+
_g.label = 7;
|
|
276
|
+
case 7: return [2, { response: data, formData: params, leadData: individualInfo, selectedChannels: selectedChannels }];
|
|
270
277
|
}
|
|
271
278
|
});
|
|
272
279
|
}); });
|
|
@@ -437,48 +444,66 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
437
444
|
});
|
|
438
445
|
}); });
|
|
439
446
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
440
|
-
var _a, settings, connect, instagram, twitter, _b, otpData, brandData,
|
|
441
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
442
|
-
return __generator(this, function (
|
|
443
|
-
switch (
|
|
447
|
+
var _a, settings, connect, instagram, twitter, _b, otpData, brandData, responseBody, isExistingUser, isOther, brand, payload, data, hasWebsite, hasTwitter, hasInstagram, hasAppleApp, hasPlayApp, hasCallCenter, hasPhysicalStore, links, salesBackendBody, salesChannelsPayload;
|
|
448
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
449
|
+
return __generator(this, function (_w) {
|
|
450
|
+
switch (_w.label) {
|
|
444
451
|
case 0:
|
|
445
452
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
446
453
|
instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.instagram) : '';
|
|
447
454
|
twitter = !!((_e = params.links) === null || _e === void 0 ? void 0 : _e.twitter) ? "".concat(TWITTER_URL, "/").concat((_f = params.links) === null || _f === void 0 ? void 0 : _f.twitter) : '';
|
|
448
455
|
_b = connect.data, otpData = _b.otpData, brandData = _b.brandData;
|
|
449
|
-
isAbsher = otpData.isAbsher;
|
|
450
456
|
responseBody = otpData.responseBody;
|
|
451
457
|
isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.is_new_individual) === false;
|
|
452
458
|
isOther = !!((_g = params.selectedBrandItem) === null || _g === void 0 ? void 0 : _g.id) ? ((_h = params.selectedBrandItem) === null || _h === void 0 ? void 0 : _h.id) === 'other' : true;
|
|
453
|
-
brand =
|
|
459
|
+
brand = {
|
|
460
|
+
name: {
|
|
454
461
|
en: params.brandName,
|
|
455
462
|
ar: params.brandName,
|
|
456
463
|
zh: params.brandName
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
id: (_k = params.selectedBrandItem) === null || _k === void 0 ? void 0 : _k.id,
|
|
460
|
-
name: undefined
|
|
461
|
-
}));
|
|
464
|
+
}
|
|
465
|
+
};
|
|
462
466
|
payload = {
|
|
463
467
|
brand: brand,
|
|
464
|
-
id: (isExistingUser ? (
|
|
468
|
+
id: (isExistingUser ? (_j = brandData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id : (_k = otpData.responseBody) === null || _k === void 0 ? void 0 : _k.lead_id) || '',
|
|
465
469
|
terms_conditions_accepted: isExistingUser && !isOther ? undefined : params.termAndConditionChecked,
|
|
466
470
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_BRAND,
|
|
467
|
-
encryption_contract: [
|
|
468
|
-
'brand.name.en',
|
|
469
|
-
'brand.name.ar',
|
|
470
|
-
'brand.name.zh',
|
|
471
|
-
'brand.website',
|
|
472
|
-
'brand.social[0]',
|
|
473
|
-
'brand.social[1]'
|
|
474
|
-
]
|
|
471
|
+
encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
|
|
475
472
|
};
|
|
476
473
|
return [4, API.leadService.updateLead(payload)];
|
|
477
474
|
case 1:
|
|
478
|
-
data =
|
|
475
|
+
data = _w.sent();
|
|
476
|
+
hasWebsite = !!((_l = params.links) === null || _l === void 0 ? void 0 : _l.website);
|
|
477
|
+
hasTwitter = !!((_m = params.links) === null || _m === void 0 ? void 0 : _m.twitter);
|
|
478
|
+
hasInstagram = !!((_o = params.links) === null || _o === void 0 ? void 0 : _o.instagram);
|
|
479
|
+
hasAppleApp = !!((_p = params.links) === null || _p === void 0 ? void 0 : _p.apple_store);
|
|
480
|
+
hasPlayApp = !!((_q = params.links) === null || _q === void 0 ? void 0 : _q.play_store);
|
|
481
|
+
hasCallCenter = !!((_r = params.links) === null || _r === void 0 ? void 0 : _r.call_center);
|
|
482
|
+
hasPhysicalStore = !!((_s = params.links) === null || _s === void 0 ? void 0 : _s.physical_store);
|
|
483
|
+
links = params.links;
|
|
484
|
+
salesBackendBody = [];
|
|
485
|
+
if (hasWebsite)
|
|
486
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_7VoC2322123xgg9250S9L806', address: links.website });
|
|
487
|
+
if (hasTwitter)
|
|
488
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_cLGQ2322123rmQk259q9s815', address: links.twitter });
|
|
489
|
+
if (hasInstagram)
|
|
490
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_cLGQ2322123rmQk259q9s815', address: links.instagram });
|
|
491
|
+
if (hasAppleApp)
|
|
492
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_2kLg2322123pK5C25V49K815', address: links.apple_store });
|
|
493
|
+
if (hasPlayApp)
|
|
494
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_2kLg2322123pK5C25V49K815', address: links.play_store });
|
|
495
|
+
if (hasCallCenter)
|
|
496
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_aCg923221233eUv255x9V816', address: links.call_center });
|
|
497
|
+
if (hasPhysicalStore)
|
|
498
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_1aQ52322123Xt7K25Qv9d815', address: links.physical_store });
|
|
499
|
+
salesChannelsPayload = {
|
|
500
|
+
id: (_t = data === null || data === void 0 ? void 0 : data.brand) === null || _t === void 0 ? void 0 : _t.id,
|
|
501
|
+
channel_services: salesBackendBody
|
|
502
|
+
};
|
|
503
|
+
API.brandService.updateBrandSales(salesChannelsPayload);
|
|
479
504
|
thunkApi.dispatch(updateLeadSuccess());
|
|
480
505
|
thunkApi.dispatch(handleNextScreenStep());
|
|
481
|
-
(
|
|
506
|
+
(_v = (_u = settings.data.appConfig).onStepCompleted) === null || _v === void 0 ? void 0 : _v.call(_u, settings.data.activeScreen.name, params);
|
|
482
507
|
return [2, { response: data, formData: params }];
|
|
483
508
|
}
|
|
484
509
|
});
|
|
@@ -591,7 +616,11 @@ var initialState = {
|
|
|
591
616
|
links: {
|
|
592
617
|
website: '',
|
|
593
618
|
twitter: '',
|
|
594
|
-
instagram: ''
|
|
619
|
+
instagram: '',
|
|
620
|
+
apple_store: '',
|
|
621
|
+
play_store: '',
|
|
622
|
+
call_center: '',
|
|
623
|
+
physical_store: ''
|
|
595
624
|
},
|
|
596
625
|
selectedBrandItem: {},
|
|
597
626
|
responseBody: {
|
|
@@ -767,7 +796,7 @@ export var connectSlice = createSlice({
|
|
|
767
796
|
.addCase(verifyAuth.fulfilled, function (state, action) {
|
|
768
797
|
var _a, _b;
|
|
769
798
|
state.error = null;
|
|
770
|
-
var _c = action.payload, formData = _c.formData, response = _c.response, leadData = _c.leadData;
|
|
799
|
+
var _c = action.payload, formData = _c.formData, response = _c.response, leadData = _c.leadData, selectedChannels = _c.selectedChannels;
|
|
771
800
|
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
772
801
|
if (description) {
|
|
773
802
|
state.loading = false;
|
|
@@ -172,8 +172,8 @@ export var updateEntityInfo = createAsyncThunk('updateEntityInfo', function (par
|
|
|
172
172
|
requestBody = {
|
|
173
173
|
id: (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
|
|
174
174
|
activities: (_d = (params.activities || [])) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
|
|
175
|
-
var
|
|
176
|
-
return
|
|
175
|
+
var id = _a.id;
|
|
176
|
+
return ({ id: id });
|
|
177
177
|
}),
|
|
178
178
|
license_name: params.licenseName,
|
|
179
179
|
license_number: params.licenseNumber,
|
|
@@ -313,7 +313,7 @@ export var entitySlice = createSlice({
|
|
|
313
313
|
var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
|
|
314
314
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
315
315
|
var _a;
|
|
316
|
-
return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) {
|
|
316
|
+
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; });
|
|
317
317
|
});
|
|
318
318
|
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
319
|
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]] });
|
|
@@ -20,7 +20,6 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
20
20
|
import { useTranslation } from 'react-i18next';
|
|
21
21
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
22
|
import Button from '../../../shared/Button';
|
|
23
|
-
import SalesChannels from './SalesChannels';
|
|
24
23
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
24
|
import Collapse from '../../../../components/Collapse';
|
|
26
25
|
import OperationStartDate from './OperationStartDate';
|
|
@@ -53,10 +52,6 @@ var Activities = function () {
|
|
|
53
52
|
var onBack = function () {
|
|
54
53
|
dispatch(handlePrevScreenStep());
|
|
55
54
|
};
|
|
56
|
-
React.useEffect(function () {
|
|
57
|
-
var salesChannels = activitiesData.salesChannels;
|
|
58
|
-
methods.setValue('salesChannels', salesChannels);
|
|
59
|
-
}, [activitiesData.salesChannels]);
|
|
60
55
|
React.useEffect(function () {
|
|
61
56
|
var activities = activitiesData.activities;
|
|
62
57
|
methods.setValue('activities', activities);
|
|
@@ -73,6 +68,6 @@ var Activities = function () {
|
|
|
73
68
|
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
74
69
|
};
|
|
75
70
|
var disabled = !methods.formState.isValid || !!error;
|
|
76
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(LicenseName, {}) })),
|
|
71
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(LicenseName, {}) })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
77
72
|
};
|
|
78
73
|
export default Activities;
|
|
@@ -105,9 +105,9 @@ var ActivitiesList = function (_a) {
|
|
|
105
105
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
106
106
|
};
|
|
107
107
|
var onSelectItem = function (item) {
|
|
108
|
-
var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.
|
|
108
|
+
var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === item.id; });
|
|
109
109
|
if (isActivityExists) {
|
|
110
|
-
var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.
|
|
110
|
+
var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.id !== (item === null || item === void 0 ? void 0 : item.id); });
|
|
111
111
|
if (updatedIdList.length >= 1)
|
|
112
112
|
activitiesControl.field.onChange(updatedIdList);
|
|
113
113
|
return;
|
|
@@ -115,17 +115,18 @@ var ActivitiesList = function (_a) {
|
|
|
115
115
|
activitiesControl.field.onChange(__spreadArray(__spreadArray([], controlValue, true), [item], false));
|
|
116
116
|
};
|
|
117
117
|
var getSelectedActivities = function () {
|
|
118
|
-
var _a, _b;
|
|
119
118
|
if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) > 1) {
|
|
120
119
|
return (controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) + ' ' + t('activities_selected');
|
|
121
120
|
}
|
|
122
|
-
|
|
121
|
+
var item = controlValue[0];
|
|
122
|
+
return isAr ? item === null || item === void 0 ? void 0 : item.name.ar : item === null || item === void 0 ? void 0 : item.name.en;
|
|
123
123
|
};
|
|
124
124
|
var getSelectedActivityFlag = function (item) {
|
|
125
|
-
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.
|
|
125
|
+
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === item.id; });
|
|
126
126
|
};
|
|
127
127
|
return (_jsx(Collapse, __assign({ in: (activitiesMenuList === null || activitiesMenuList === void 0 ? void 0 : activitiesMenuList.length) > 0 }, { children: _jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t(isCR ? 'activities' : 'category'), " ", _jsx(MandatoryStyled, { children: "*" })] }), _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) {
|
|
128
|
-
|
|
128
|
+
var _a, _b, _c;
|
|
129
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: item.id === ((_a = getSelectedActivityFlag(item)) === null || _a === void 0 ? void 0 : _a.id) }, { children: isAr ? (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = item === null || item === void 0 ? void 0 : item.name) === null || _c === void 0 ? void 0 : _c.en })) })), getSelectedActivityFlag(item) && _jsx(CheckIconStyled, {})] }));
|
|
129
130
|
} }) }))] })] }) })));
|
|
130
131
|
};
|
|
131
132
|
export default ActivitiesList;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
3
|
-
export declare const CollapseStyled: import("@emotion/styled").StyledComponent<import("../../../../components/Collapse").CollapseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
4
|
-
declare const SalesChannels: () => JSX.Element;
|
|
5
|
-
export default SalesChannels;
|
|
@@ -9,104 +9,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import * as React from 'react';
|
|
23
|
-
import Box from '@mui/material/Box';
|
|
24
12
|
import { alpha, styled } from '@mui/material/styles';
|
|
25
|
-
import { useTranslation } from 'react-i18next';
|
|
26
|
-
import { useController, useFormContext } from 'react-hook-form';
|
|
27
|
-
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
28
|
-
import Text from '../../../../components/Text';
|
|
29
|
-
import { businessSelector, clearError } from '../../../app/business/businessStore';
|
|
30
|
-
import CheckBox from '../../../../components/CheckBox';
|
|
31
|
-
import Warning from '../../../../components/Warning';
|
|
32
|
-
import Collapse from '../../../../components/Collapse';
|
|
33
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
35
|
-
var theme = _a.theme;
|
|
36
|
-
return (__assign({ margin: theme.spacing(2.5, 2.5, 0.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
37
|
-
});
|
|
38
|
-
var ContainerStyled = styled(Box)(function (_a) {
|
|
39
|
-
var theme = _a.theme;
|
|
40
|
-
return ({
|
|
41
|
-
display: 'flex',
|
|
42
|
-
flexDirection: 'row',
|
|
43
|
-
alignItems: 'center',
|
|
44
|
-
padding: theme.spacing(0, 0.5, 0, 0.5),
|
|
45
|
-
height: theme.spacing(3.625),
|
|
46
|
-
marginBlockEnd: theme.spacing(0.2)
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
var TextStyled = styled(Text)(function (_a) {
|
|
50
|
-
var theme = _a.theme;
|
|
51
|
-
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre' }, theme.typography.body2), { marginBlockStart: theme.spacing(1.75) }));
|
|
52
|
-
});
|
|
53
|
-
var CheckBoxStyled = styled(CheckBox)(function (_a) {
|
|
54
|
-
var theme = _a.theme;
|
|
55
|
-
return ({
|
|
56
|
-
marginInlineEnd: theme.spacing(-1),
|
|
57
|
-
'& .MuiSvgIcon-root': {
|
|
58
|
-
fontSize: 30
|
|
59
|
-
},
|
|
60
|
-
'&.Mui-checked': {
|
|
61
|
-
color: theme.palette.text.primary,
|
|
62
|
-
borderRadius: theme.spacing(2.5)
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
13
|
export var MandatoryStyled = styled('span')(function (_a) {
|
|
67
14
|
var theme = _a.theme;
|
|
68
15
|
return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
|
|
69
16
|
});
|
|
70
|
-
export var CollapseStyled = styled(Collapse)(function (_a) {
|
|
71
|
-
var theme = _a.theme;
|
|
72
|
-
return ({
|
|
73
|
-
marginBlockStart: theme.spacing(2)
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
var SalesChannels = function () {
|
|
77
|
-
var _a;
|
|
78
|
-
var _b = React.useState([]), channelsMenuList = _b[0], setChannelsMenuList = _b[1];
|
|
79
|
-
var t = useTranslation().t;
|
|
80
|
-
var isAr = useLanguage().isAr;
|
|
81
|
-
var control = useFormContext().control;
|
|
82
|
-
var dispatch = useAppDispatch();
|
|
83
|
-
var channelsControl = useController({ name: 'salesChannels', control: control });
|
|
84
|
-
var channelsChecked = channelsControl.field.value;
|
|
85
|
-
var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
86
|
-
var _c = useAppSelector(businessSelector), data = _c.data, error = _c.error;
|
|
87
|
-
var channelList = (data.businessTypeData.responseBody || {}).channelList;
|
|
88
|
-
var salesChannels = (data.activitiesData || {}).salesChannels;
|
|
89
|
-
React.useEffect(function () {
|
|
90
|
-
if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
|
|
91
|
-
setChannelsMenuList(channelList);
|
|
92
|
-
}
|
|
93
|
-
}, [channelList]);
|
|
94
|
-
var handleSalesChannelChange = function (event, checked) {
|
|
95
|
-
var selected = channelsMenuList.find(function (channel) { return channel.id === event.target.id; });
|
|
96
|
-
var isExists = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (selected === null || selected === void 0 ? void 0 : selected.id); });
|
|
97
|
-
if (isExists) {
|
|
98
|
-
var updatedIdList = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.filter(function (channel) { return channel.id !== (selected === null || selected === void 0 ? void 0 : selected.id); });
|
|
99
|
-
channelsControl.field.onChange(updatedIdList);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
channelsControl.field.onChange(__spreadArray(__spreadArray([], channelsChecked, true), [selected], false));
|
|
103
|
-
if (error)
|
|
104
|
-
dispatch(clearError());
|
|
105
|
-
};
|
|
106
|
-
var getSelectedChannelsFlag = function (item) {
|
|
107
|
-
if (channelsChecked)
|
|
108
|
-
return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
|
|
109
|
-
};
|
|
110
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name.ar : channel.name.en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
|
|
111
|
-
};
|
|
112
|
-
export default SalesChannels;
|
|
@@ -16,23 +16,6 @@ export declare const ActivitiesValidationSchema: yup.ObjectSchema<import("yup/li
|
|
|
16
16
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
17
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
18
|
}>>[] | undefined>;
|
|
19
|
-
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
20
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
21
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
23
|
-
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
26
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
27
|
-
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
28
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
29
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
30
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
31
|
-
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
32
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
33
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
34
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
35
|
-
}>>[] | undefined>;
|
|
36
19
|
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
37
20
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
38
21
|
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -51,23 +34,6 @@ export declare const ActivitiesValidationSchema: yup.ObjectSchema<import("yup/li
|
|
|
51
34
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
52
35
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
53
36
|
}>>[] | undefined>;
|
|
54
|
-
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
55
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
56
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
57
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
58
|
-
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
59
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
60
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
61
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
62
|
-
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
63
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
64
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
65
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
66
|
-
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
67
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
68
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
69
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
70
|
-
}>>[] | undefined>;
|
|
71
37
|
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
72
38
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
73
39
|
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -86,22 +52,5 @@ export declare const ActivitiesValidationSchema: yup.ObjectSchema<import("yup/li
|
|
|
86
52
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
87
53
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
88
54
|
}>>[] | undefined>;
|
|
89
|
-
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
90
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
91
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
92
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
93
|
-
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
94
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
95
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
96
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
97
|
-
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
98
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
99
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
100
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
101
|
-
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
102
|
-
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
103
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
104
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
105
|
-
}>>[] | undefined>;
|
|
106
55
|
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
107
56
|
}>>>;
|
|
@@ -4,14 +4,5 @@ export var ActivitiesValidationSchema = yup.object().shape({
|
|
|
4
4
|
ar: yup.string(),
|
|
5
5
|
en: yup.string()
|
|
6
6
|
})),
|
|
7
|
-
salesChannels: yup
|
|
8
|
-
.array()
|
|
9
|
-
.min(1, 'choose_atleast_one_channel')
|
|
10
|
-
.of(yup.object().shape({
|
|
11
|
-
id: yup.string(),
|
|
12
|
-
name_en: yup.string(),
|
|
13
|
-
name_ar: yup.string()
|
|
14
|
-
}))
|
|
15
|
-
.required('choose_atleast_one_channel'),
|
|
16
7
|
operationStartDate: yup.string().required('choose_any_business_date')
|
|
17
8
|
});
|
|
@@ -85,7 +85,15 @@ var Merchant = function (_a) {
|
|
|
85
85
|
setUserType(ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND);
|
|
86
86
|
methods.clearErrors();
|
|
87
87
|
setTimeout(function () {
|
|
88
|
-
var sites = {
|
|
88
|
+
var sites = {
|
|
89
|
+
website: '',
|
|
90
|
+
twitter: '',
|
|
91
|
+
instagram: '',
|
|
92
|
+
apple_store: '',
|
|
93
|
+
play_store: '',
|
|
94
|
+
call_center: '',
|
|
95
|
+
physical_store: ''
|
|
96
|
+
};
|
|
89
97
|
methods.setValue('brandName', '', { shouldValidate: true });
|
|
90
98
|
methods.setValue('links', sites);
|
|
91
99
|
methods.setValue('salesChannels', []);
|
|
@@ -22,7 +22,7 @@ import Button, { AbsherButton, MobileButton } from '../../../shared/Button';
|
|
|
22
22
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
23
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
24
24
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
25
|
-
import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen } from '../../../app/connect/connectStore';
|
|
25
|
+
import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen, resetOTPScreen } from '../../../app/connect/connectStore';
|
|
26
26
|
import { useLanguage } from '../../../../hooks';
|
|
27
27
|
import Divider from '@mui/material/Divider';
|
|
28
28
|
import { isKW } from '../../../../utils';
|
|
@@ -94,6 +94,9 @@ var Mobile = function (_a) {
|
|
|
94
94
|
methods.setValue('countryCode', data.mobileData.countryCode);
|
|
95
95
|
}
|
|
96
96
|
}, [data.mobileData]);
|
|
97
|
+
React.useEffect(function () {
|
|
98
|
+
dispatch(resetOTPScreen());
|
|
99
|
+
}, []);
|
|
97
100
|
React.useEffect(function () {
|
|
98
101
|
if (error)
|
|
99
102
|
dispatch(clearError());
|
|
@@ -111,10 +111,10 @@ var ActivitiesList = function (_a) {
|
|
|
111
111
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
112
112
|
};
|
|
113
113
|
var onSelectItem = function (item) {
|
|
114
|
-
var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.
|
|
115
|
-
var storedActivity = storedActivities === null || storedActivities === void 0 ? void 0 : storedActivities.find(function (activity) { return activity.
|
|
114
|
+
var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === (item === null || item === void 0 ? void 0 : item.id); });
|
|
115
|
+
var storedActivity = storedActivities === null || storedActivities === void 0 ? void 0 : storedActivities.find(function (activity) { return activity.id === (item === null || item === void 0 ? void 0 : item.id); });
|
|
116
116
|
if (isActivityExists && !storedActivity) {
|
|
117
|
-
var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.
|
|
117
|
+
var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.id !== (item === null || item === void 0 ? void 0 : item.id); });
|
|
118
118
|
if (updatedIdList.length >= 1)
|
|
119
119
|
activitiesControl.field.onChange(updatedIdList);
|
|
120
120
|
return;
|
|
@@ -130,10 +130,11 @@ var ActivitiesList = function (_a) {
|
|
|
130
130
|
return isAr ? (_a = controlValue[0]) === null || _a === void 0 ? void 0 : _a.ar : (_b = controlValue[0]) === null || _b === void 0 ? void 0 : _b.en;
|
|
131
131
|
};
|
|
132
132
|
var getSelectedActivityFlag = function (item) {
|
|
133
|
-
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.
|
|
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); });
|
|
134
134
|
};
|
|
135
135
|
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
|
-
|
|
136
|
+
var _a;
|
|
137
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === ((_a = getSelectedActivityFlag(item)) === null || _a === void 0 ? void 0 : _a.id) }, { children: isAr ? item === null || item === void 0 ? void 0 : item.name.ar : item === null || item === void 0 ? void 0 : item.name.en })) })), getSelectedActivityFlag(item) && _jsx(CheckIconStyled, {})] }));
|
|
137
138
|
} }) }))] })] }) })));
|
|
138
139
|
};
|
|
139
140
|
export default ActivitiesList;
|