@tap-payments/auth-jsconnect 2.3.75-test → 2.3.80-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 +8 -0
- package/build/@types/form.d.ts +2 -1
- package/build/@types/redux.d.ts +4 -0
- package/build/api/index.d.ts +1 -0
- package/build/api/individual.d.ts +1 -0
- package/build/api/individual.js +15 -1
- package/build/api/lead.d.ts +1 -0
- package/build/assets/locales/ar.json +5 -1
- package/build/assets/locales/en.json +5 -1
- package/build/constants/app.js +9 -9
- package/build/constants/dummy.d.ts +8 -0
- package/build/constants/dummy.js +8 -0
- package/build/features/app/bank/bankStore.d.ts +2 -2
- package/build/features/app/bank/bankStore.js +54 -51
- package/build/features/app/business/businessStore.js +3 -4
- package/build/features/app/connect/connectStore.js +67 -35
- package/build/features/app/password/passwordStore.d.ts +2 -0
- package/build/features/app/password/passwordStore.js +24 -12
- package/build/features/bank/screens/BankDetails/BankDetails.js +7 -6
- package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +8 -3
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +3 -11
- package/build/features/brand/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +8 -3
- package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +7 -2
- package/build/features/connect/screens/Merchant/BusinessList.d.ts +10 -0
- package/build/features/connect/screens/Merchant/BusinessList.js +82 -0
- package/build/features/connect/screens/Merchant/Merchant.js +11 -6
- package/build/features/connect/screens/Merchant/validation.d.ts +7 -1
- package/build/features/connect/screens/Merchant/validation.js +6 -2
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +8 -3
- package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +7 -2
- package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -16
- package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +7 -2
- package/build/features/password/screens/Verify/Verify.js +7 -20
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -2
- package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +8 -3
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useExcludeReadOnlyFelids.d.ts +11 -0
- package/build/hooks/useExcludeReadOnlyFelids.js +33 -0
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +3 -1
- package/package.json +1 -1
|
@@ -68,7 +68,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
68
68
|
var _a;
|
|
69
69
|
import API from '../../../api';
|
|
70
70
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
71
|
-
import { CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_BRAND } from '../../../constants';
|
|
71
|
+
import { CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_BRAND, OTHER_BUSINESS } from '../../../constants';
|
|
72
72
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
73
73
|
import { AuthForType, FlowsTypes } from '../../../@types';
|
|
74
74
|
import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep } from '../../../utils';
|
|
@@ -228,7 +228,7 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
|
|
|
228
228
|
});
|
|
229
229
|
}); });
|
|
230
230
|
export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
231
|
-
var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels,
|
|
231
|
+
var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels, businessList, err_1, brands, err_2, countryCode, phone;
|
|
232
232
|
var _c, _d, _e, _f;
|
|
233
233
|
return __generator(this, function (_g) {
|
|
234
234
|
switch (_g.label) {
|
|
@@ -269,15 +269,25 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
269
269
|
_g.label = 4;
|
|
270
270
|
case 4:
|
|
271
271
|
_g.trys.push([4, 6, , 7]);
|
|
272
|
-
return [4, API.
|
|
272
|
+
return [4, API.individualService.getBusinessList(leadResponse.individual_id)];
|
|
273
273
|
case 5:
|
|
274
|
-
|
|
275
|
-
leadResponse.
|
|
274
|
+
businessList = (_g.sent()).list;
|
|
275
|
+
leadResponse.business_list = businessList;
|
|
276
276
|
return [3, 7];
|
|
277
277
|
case 6:
|
|
278
278
|
err_1 = _g.sent();
|
|
279
279
|
return [3, 7];
|
|
280
280
|
case 7:
|
|
281
|
+
_g.trys.push([7, 9, , 10]);
|
|
282
|
+
return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
|
|
283
|
+
case 8:
|
|
284
|
+
brands = (_g.sent()).brands;
|
|
285
|
+
leadResponse.brand_list = fixBrandList(brands, channels);
|
|
286
|
+
return [3, 10];
|
|
287
|
+
case 9:
|
|
288
|
+
err_2 = _g.sent();
|
|
289
|
+
return [3, 10];
|
|
290
|
+
case 10:
|
|
281
291
|
countryCode = settings.data.businessCountry;
|
|
282
292
|
phone = (leadResponse.contact || {}).phone;
|
|
283
293
|
if (phone === null || phone === void 0 ? void 0 : phone.country_code)
|
|
@@ -289,7 +299,7 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
289
299
|
});
|
|
290
300
|
}); });
|
|
291
301
|
export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
292
|
-
var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, brands,
|
|
302
|
+
var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, businessList, err_3, brands, err_4, phone;
|
|
293
303
|
var _b, _c, _d, _e, _f;
|
|
294
304
|
return __generator(this, function (_g) {
|
|
295
305
|
switch (_g.label) {
|
|
@@ -302,15 +312,15 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
302
312
|
count = 1;
|
|
303
313
|
_g.label = 1;
|
|
304
314
|
case 1:
|
|
305
|
-
if (!(count <= maxCalls)) return [3,
|
|
315
|
+
if (!(count <= maxCalls)) return [3, 16];
|
|
306
316
|
if (thunkApi.signal.aborted) {
|
|
307
|
-
return [3,
|
|
317
|
+
return [3, 16];
|
|
308
318
|
}
|
|
309
319
|
return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
|
|
310
320
|
case 2:
|
|
311
321
|
authResponse = _g.sent();
|
|
312
322
|
isSuccess = ((_b = authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
|
|
313
|
-
if (!isSuccess) return [3,
|
|
323
|
+
if (!isSuccess) return [3, 13];
|
|
314
324
|
lead_id = authResponse.lead_id;
|
|
315
325
|
if (!lead_id)
|
|
316
326
|
throw new Error('Lead id is missing');
|
|
@@ -327,18 +337,28 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
327
337
|
_g.label = 5;
|
|
328
338
|
case 5:
|
|
329
339
|
_g.trys.push([5, 7, , 8]);
|
|
330
|
-
return [4, API.
|
|
340
|
+
return [4, API.individualService.getBusinessList(leadResponse.individual_id)];
|
|
331
341
|
case 6:
|
|
332
|
-
|
|
333
|
-
leadResponse.
|
|
342
|
+
businessList = (_g.sent()).list;
|
|
343
|
+
leadResponse.business_list = businessList;
|
|
334
344
|
return [3, 8];
|
|
335
345
|
case 7:
|
|
336
|
-
|
|
346
|
+
err_3 = _g.sent();
|
|
337
347
|
return [3, 8];
|
|
338
348
|
case 8:
|
|
349
|
+
_g.trys.push([8, 10, , 11]);
|
|
350
|
+
return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
|
|
351
|
+
case 9:
|
|
352
|
+
brands = (_g.sent()).brands;
|
|
353
|
+
leadResponse.brand_list = fixBrandList(brands, channels);
|
|
354
|
+
return [3, 11];
|
|
355
|
+
case 10:
|
|
356
|
+
err_4 = _g.sent();
|
|
357
|
+
return [3, 11];
|
|
358
|
+
case 11:
|
|
339
359
|
(_d = params.onSuccess) === null || _d === void 0 ? void 0 : _d.call(params);
|
|
340
360
|
return [4, sleep(3000)];
|
|
341
|
-
case
|
|
361
|
+
case 12:
|
|
342
362
|
_g.sent();
|
|
343
363
|
phone = (leadResponse.contact || {}).phone;
|
|
344
364
|
if (phone === null || phone === void 0 ? void 0 : phone.country_code)
|
|
@@ -346,19 +366,19 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
346
366
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
|
|
347
367
|
thunkApi.dispatch(handleNextScreenStep());
|
|
348
368
|
return [2, { authResponse: authResponse, leadResponse: leadResponse, countryCode: countryCode }];
|
|
349
|
-
case
|
|
350
|
-
case
|
|
369
|
+
case 13: return [4, sleep(interval * 1000)];
|
|
370
|
+
case 14:
|
|
351
371
|
_g.sent();
|
|
352
|
-
_g.label =
|
|
353
|
-
case
|
|
372
|
+
_g.label = 15;
|
|
373
|
+
case 15:
|
|
354
374
|
count++;
|
|
355
375
|
return [3, 1];
|
|
356
|
-
case
|
|
376
|
+
case 16: throw new Error('paci_verification_failed');
|
|
357
377
|
}
|
|
358
378
|
});
|
|
359
379
|
}); });
|
|
360
380
|
export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
361
|
-
var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse, segments,
|
|
381
|
+
var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse, segments, err_5, teamSize, err_6, brand;
|
|
362
382
|
var _b, _c, _d, _e, _f;
|
|
363
383
|
return __generator(this, function (_g) {
|
|
364
384
|
switch (_g.label) {
|
|
@@ -386,7 +406,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
386
406
|
leadResponse.segments_list = segments.list;
|
|
387
407
|
return [3, 5];
|
|
388
408
|
case 4:
|
|
389
|
-
|
|
409
|
+
err_5 = _g.sent();
|
|
390
410
|
return [3, 5];
|
|
391
411
|
case 5:
|
|
392
412
|
_g.trys.push([5, 7, , 8]);
|
|
@@ -396,7 +416,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
396
416
|
leadResponse.team_size_list = teamSize.list;
|
|
397
417
|
return [3, 8];
|
|
398
418
|
case 7:
|
|
399
|
-
|
|
419
|
+
err_6 = _g.sent();
|
|
400
420
|
return [3, 8];
|
|
401
421
|
case 8:
|
|
402
422
|
if (!leadResponse.brand) return [3, 10];
|
|
@@ -413,7 +433,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
413
433
|
});
|
|
414
434
|
}); });
|
|
415
435
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
416
|
-
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
|
|
436
|
+
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, termAndConditionChecked, business, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
|
|
417
437
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
418
438
|
return __generator(this, function (_l) {
|
|
419
439
|
switch (_l.label) {
|
|
@@ -421,7 +441,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
421
441
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
422
442
|
responseBody = connect.data.otpData.responseBody;
|
|
423
443
|
leadBrandId = responseBody === null || responseBody === void 0 ? void 0 : responseBody.brand_id;
|
|
424
|
-
isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem, termAndConditionChecked = params.termAndConditionChecked;
|
|
444
|
+
isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem, termAndConditionChecked = params.termAndConditionChecked, business = params.business;
|
|
425
445
|
getAddress = function (value, isTwitter, isWeb) {
|
|
426
446
|
if (isTwitter)
|
|
427
447
|
return '@' + value;
|
|
@@ -468,18 +488,17 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
468
488
|
return [2, { response: brand_1, formData: params }];
|
|
469
489
|
case 4:
|
|
470
490
|
brandNameBody = {
|
|
491
|
+
id: '',
|
|
471
492
|
name: {
|
|
472
493
|
en: brandName,
|
|
473
494
|
ar: brandName,
|
|
474
495
|
zh: brandName
|
|
475
496
|
}
|
|
476
497
|
};
|
|
477
|
-
payload = {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
|
|
482
|
-
};
|
|
498
|
+
payload = __assign(__assign({ brand: brandNameBody }, ((business === null || business === void 0 ? void 0 : business.id) &&
|
|
499
|
+
(business === null || business === void 0 ? void 0 : business.id) !== OTHER_BUSINESS.id && {
|
|
500
|
+
business_id: business.id
|
|
501
|
+
})), { id: (responseBody === null || responseBody === void 0 ? void 0 : responseBody.lead_id) || '', step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_BRAND, encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh'] });
|
|
483
502
|
return [4, API.leadService.updateLead(payload)];
|
|
484
503
|
case 5:
|
|
485
504
|
lead = _l.sent();
|
|
@@ -614,7 +633,8 @@ var initialState = {
|
|
|
614
633
|
termAndConditionChecked: false,
|
|
615
634
|
selectedBrandItem: {},
|
|
616
635
|
responseBody: {
|
|
617
|
-
brand_list: []
|
|
636
|
+
brand_list: [],
|
|
637
|
+
business_list: []
|
|
618
638
|
}
|
|
619
639
|
}
|
|
620
640
|
}
|
|
@@ -709,7 +729,7 @@ export var connectSlice = createSlice({
|
|
|
709
729
|
state.loading = false;
|
|
710
730
|
state.error = null;
|
|
711
731
|
var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, countryCode = _b.countryCode;
|
|
712
|
-
var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id;
|
|
732
|
+
var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id, business_list = leadResponse.business_list, business_id = leadResponse.business_id;
|
|
713
733
|
var _c = contact || {}, email = _c.email, phone = _c.phone;
|
|
714
734
|
var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
|
|
715
735
|
if (!!fullName) {
|
|
@@ -724,6 +744,11 @@ export var connectSlice = createSlice({
|
|
|
724
744
|
state.data.individualData.countryCode = countryCode;
|
|
725
745
|
if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
|
|
726
746
|
state.data.brandData.brandName = brand.name.en;
|
|
747
|
+
var businessList = [];
|
|
748
|
+
if ((business_list === null || business_list === void 0 ? void 0 : business_list.length) > 0) {
|
|
749
|
+
businessList = __spreadArray(__spreadArray([], business_list, true), [OTHER_BUSINESS], false);
|
|
750
|
+
state.data.brandData.business = business_list.find(function (b) { return b.id === business_id; }) || business_list[0];
|
|
751
|
+
}
|
|
727
752
|
var brandList = [];
|
|
728
753
|
if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
|
|
729
754
|
var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
|
|
@@ -735,7 +760,8 @@ export var connectSlice = createSlice({
|
|
|
735
760
|
}
|
|
736
761
|
state.data.brandData.responseBody = {
|
|
737
762
|
brand_list: brandList,
|
|
738
|
-
channel_list: channel_list
|
|
763
|
+
channel_list: channel_list,
|
|
764
|
+
business_list: businessList
|
|
739
765
|
};
|
|
740
766
|
state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact });
|
|
741
767
|
})
|
|
@@ -751,7 +777,7 @@ export var connectSlice = createSlice({
|
|
|
751
777
|
state.loading = false;
|
|
752
778
|
state.error = null;
|
|
753
779
|
var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, countryCode = _b.countryCode;
|
|
754
|
-
var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id;
|
|
780
|
+
var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id, business_list = leadResponse.business_list, business_id = leadResponse.business_id;
|
|
755
781
|
var _c = contact || {}, email = _c.email, phone = _c.phone;
|
|
756
782
|
var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
|
|
757
783
|
if (!!fullName) {
|
|
@@ -766,6 +792,11 @@ export var connectSlice = createSlice({
|
|
|
766
792
|
state.data.individualData.countryCode = countryCode;
|
|
767
793
|
if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
|
|
768
794
|
state.data.brandData.brandName = brand.name.en;
|
|
795
|
+
var businessList = [];
|
|
796
|
+
if ((business_list === null || business_list === void 0 ? void 0 : business_list.length) > 0) {
|
|
797
|
+
businessList = __spreadArray(__spreadArray([], business_list, true), [OTHER_BUSINESS], false);
|
|
798
|
+
state.data.brandData.business = business_list.find(function (b) { return b.id === business_id; }) || business_list[0];
|
|
799
|
+
}
|
|
769
800
|
var brandList = [];
|
|
770
801
|
if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
|
|
771
802
|
var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
|
|
@@ -777,7 +808,8 @@ export var connectSlice = createSlice({
|
|
|
777
808
|
}
|
|
778
809
|
state.data.brandData.responseBody = {
|
|
779
810
|
brand_list: brandList,
|
|
780
|
-
channel_list: channel_list
|
|
811
|
+
channel_list: channel_list,
|
|
812
|
+
business_list: businessList
|
|
781
813
|
};
|
|
782
814
|
state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact });
|
|
783
815
|
})
|
|
@@ -217,27 +217,38 @@ export var updateBoardSuccess = createAsyncThunk('passwordUpdateBoardSuccess', f
|
|
|
217
217
|
});
|
|
218
218
|
}); });
|
|
219
219
|
export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
220
|
-
var token, boardId, boardInfoData, payload, data;
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
var token, boardId, boardInfoId, boardInfoData, boardData, payload, data;
|
|
221
|
+
var _a, _b;
|
|
222
|
+
return __generator(this, function (_c) {
|
|
223
|
+
switch (_c.label) {
|
|
223
224
|
case 0:
|
|
224
|
-
token = params.token, boardId = params.boardId;
|
|
225
|
-
|
|
225
|
+
token = params.token, boardId = params.boardId, boardInfoId = params.boardInfoId;
|
|
226
|
+
boardData = undefined;
|
|
226
227
|
payload = {
|
|
227
228
|
auth_type: 7,
|
|
228
229
|
auth_token: token
|
|
229
230
|
};
|
|
230
231
|
return [4, API.authService.verifyAuth(payload)];
|
|
231
232
|
case 1:
|
|
232
|
-
data = (
|
|
233
|
-
if (!boardId) return [3,
|
|
233
|
+
data = (_c.sent()).data;
|
|
234
|
+
if (!boardId) return [3, 4];
|
|
234
235
|
return [4, API.boardService.retrieveBoardInfoStatus(boardId)];
|
|
235
236
|
case 2:
|
|
236
|
-
boardInfoData =
|
|
237
|
-
|
|
237
|
+
boardInfoData = _c.sent();
|
|
238
|
+
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
238
239
|
case 3:
|
|
240
|
+
boardData = _c.sent();
|
|
241
|
+
_c.label = 4;
|
|
242
|
+
case 4:
|
|
239
243
|
thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
|
|
240
|
-
return [2, {
|
|
244
|
+
return [2, {
|
|
245
|
+
data: data,
|
|
246
|
+
token: token,
|
|
247
|
+
boardId: boardId,
|
|
248
|
+
boardInfoId: boardInfoId,
|
|
249
|
+
boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_a = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _b === void 0 ? void 0 : _b.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
|
|
250
|
+
flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
|
|
251
|
+
}];
|
|
241
252
|
}
|
|
242
253
|
});
|
|
243
254
|
}); });
|
|
@@ -460,13 +471,14 @@ export var passwordSlice = createSlice({
|
|
|
460
471
|
state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
|
|
461
472
|
state.error = null;
|
|
462
473
|
state.customLoading = false;
|
|
463
|
-
var _b = action.payload, data = _b.data, token = _b.token, boardId = _b.boardId, flows = _b.flows;
|
|
474
|
+
var _b = action.payload, data = _b.data, token = _b.token, boardId = _b.boardId, flows = _b.flows, boardResponse = _b.boardResponse, boardInfoId = _b.boardInfoId;
|
|
475
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, boardResponse), state.data.verify.responseBody), { board_id: boardId, board_info_id: boardInfoId, flows: flows });
|
|
464
476
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
465
477
|
if (description) {
|
|
466
478
|
state.error = description;
|
|
467
479
|
return;
|
|
468
480
|
}
|
|
469
|
-
state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: boardId, flows: flows });
|
|
481
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: boardId, board_info_id: boardInfoId, flows: flows });
|
|
470
482
|
state.data.verify.token = token;
|
|
471
483
|
})
|
|
472
484
|
.addCase(verifyOperationToken.pending, function (state) {
|
|
@@ -16,7 +16,7 @@ import Beneficiary from './Beneficiary';
|
|
|
16
16
|
import IBAN from './IBAN';
|
|
17
17
|
import BankName from './BankName';
|
|
18
18
|
import Button from '../../../shared/Button';
|
|
19
|
-
import { useAppDispatch, useAppSelector, useFormReadOnly, useSetFromDefaultValues, useDataNoneEditable, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useAppSelector, useFormReadOnly, useSetFromDefaultValues, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
20
20
|
import { BankKWFLValidation, BankValidation } from './validation';
|
|
21
21
|
import { useTranslation } from 'react-i18next';
|
|
22
22
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -29,7 +29,7 @@ import Form from '../../../../components/Form';
|
|
|
29
29
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
30
30
|
import ConfirmPolicy from './ConfirmPolicy';
|
|
31
31
|
import BankStatement from './BankStatement';
|
|
32
|
-
import { getFileDetailsFromDocument, isKW,
|
|
32
|
+
import { getFileDetailsFromDocument, isKW, isStringHasOneAsterisk } from '../../../../utils';
|
|
33
33
|
var FormStyled = styled(Form)(function () { return ({
|
|
34
34
|
display: 'flex',
|
|
35
35
|
flexDirection: 'column',
|
|
@@ -53,7 +53,7 @@ var BankDetails = function () {
|
|
|
53
53
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
54
54
|
var isFL = ((_a = entity === null || entity === void 0 ? void 0 : entity.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === BusinessType.FL ? true : false;
|
|
55
55
|
var bankHasDocument = ((_c = (_b = bank_account === null || bank_account === void 0 ? void 0 : bank_account.document) === null || _b === void 0 ? void 0 : _b.file_details) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
|
56
|
-
var isIBANMasked =
|
|
56
|
+
var isIBANMasked = isStringHasOneAsterisk(iban);
|
|
57
57
|
var methods = useForm({
|
|
58
58
|
resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation(isIBANMasked) : BankValidation(isIBANMasked)),
|
|
59
59
|
defaultValues: {
|
|
@@ -67,9 +67,6 @@ var BankDetails = function () {
|
|
|
67
67
|
mode: 'onChange'
|
|
68
68
|
});
|
|
69
69
|
useSetFromDefaultValues(methods, data.bankData);
|
|
70
|
-
var onSubmit = function (data) {
|
|
71
|
-
dispatch(createBankAccount(data));
|
|
72
|
-
};
|
|
73
70
|
var t = useTranslation().t;
|
|
74
71
|
var isAr = useLanguage().isAr;
|
|
75
72
|
var onBack = function () {
|
|
@@ -99,6 +96,10 @@ var BankDetails = function () {
|
|
|
99
96
|
'is_acknowledged'
|
|
100
97
|
]);
|
|
101
98
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
99
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
100
|
+
var onSubmit = function (data) {
|
|
101
|
+
dispatch(createBankAccount(getFelids(data)));
|
|
102
|
+
};
|
|
102
103
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, { readOnly: readOnly['beneficiaryName'] || noneEditable['beneficiary_name'] }), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking, readOnly: readOnly['iban'] || noneEditable['iban'] }), _jsx(BankName, { readOnly: readOnly['bankName'] || noneEditable['bank_name'] }), _jsx(BankStatement, { required: isKWCountry && isFL && !bankHasDocument, defaultFiles: defaultBankFiles, readOnly: readOnly['bankStatementId'] || noneEditable['bank_statement_file_id'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_acknowledged'] }), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
|
|
103
104
|
};
|
|
104
105
|
export default BankDetails;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Trans, useTranslation } from 'react-i18next';
|
|
4
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
4
5
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
5
|
-
import { bankSelector } from '
|
|
6
|
+
import { bankSelector } from '../../../app/bank/bankStore';
|
|
6
7
|
import { maskEmail } from '../../../../utils';
|
|
7
|
-
import { useAppSelector } from '../../../../hooks';
|
|
8
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
8
9
|
var ResetPasswordSuccess = function (_a) {
|
|
9
10
|
var _b, _c;
|
|
10
11
|
var t = useTranslation().t;
|
|
12
|
+
var dispatch = useAppDispatch();
|
|
11
13
|
var data = useAppSelector(bankSelector).data;
|
|
12
14
|
var email = (((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact) || {}).email;
|
|
13
15
|
var maskedEmail = maskEmail(email);
|
|
14
|
-
|
|
16
|
+
var onBack = function () {
|
|
17
|
+
dispatch(handlePrevScreenStep());
|
|
18
|
+
};
|
|
19
|
+
return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true, enableBack: true, onBack: function () { return onBack(); } }));
|
|
15
20
|
};
|
|
16
21
|
export default React.memo(ResetPasswordSuccess);
|
|
@@ -33,7 +33,6 @@ import ExpandIcon from '../../../../components/ExpandIcon';
|
|
|
33
33
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
34
|
import { CheckIconStyled, InputLabelStyled, NameContainer } from './CustomerBase';
|
|
35
35
|
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
36
|
-
import Search from '../../../shared/Search';
|
|
37
36
|
import Input from '../../../shared/Input';
|
|
38
37
|
var InputStyled = styled(Input)(function (_a) {
|
|
39
38
|
var theme = _a.theme, readOnly = _a.readOnly;
|
|
@@ -94,17 +93,10 @@ var ExpectedCustomers = function (_a) {
|
|
|
94
93
|
dispatch(clearError());
|
|
95
94
|
onCloseList();
|
|
96
95
|
};
|
|
97
|
-
var handleSearch = function (value) {
|
|
98
|
-
var _a;
|
|
99
|
-
var filteredList = (_a = response === null || response === void 0 ? void 0 : response.expectedCustomerSales) === null || _a === void 0 ? void 0 : _a.filter(function (customer) {
|
|
100
|
-
return customer.name.en.toLowerCase().startsWith(value.toLowerCase()) || customer.name.ar.toLowerCase().startsWith(value.toLowerCase());
|
|
101
|
-
});
|
|
102
|
-
setExpectedCustomersList(filteredList);
|
|
103
|
-
};
|
|
104
96
|
var expectedCustomersValue = expectedCustomerControl.field.value;
|
|
105
97
|
var expectedCustomersSelected = expectedCustomersValue;
|
|
106
|
-
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: readOnly, placeholder: t('choose_expected_sales'), value: isAr ? (_c = (_b = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name) === null || _b === void 0 ? void 0 : _b.ar) !== null && _c !== void 0 ? _c : '' : (_e = (_d = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name) === null || _d === void 0 ? void 0 : _d.en) !== null && _e !== void 0 ? _e : '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }),
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: readOnly, placeholder: t('choose_expected_sales'), value: isAr ? (_c = (_b = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name) === null || _b === void 0 ? void 0 : _b.ar) !== null && _c !== void 0 ? _c : '' : (_e = (_d = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name) === null || _d === void 0 ? void 0 : _d.en) !== null && _e !== void 0 ? _e : '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
99
|
+
return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.name.ar : item.name.en })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(CheckIconStyled, {})] }));
|
|
100
|
+
} }) }))] }) })));
|
|
109
101
|
};
|
|
110
102
|
export default ExpectedCustomers;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Trans, useTranslation } from 'react-i18next';
|
|
4
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
4
5
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
5
|
-
import { useAppSelector } from '../../../../hooks';
|
|
6
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
6
7
|
import { maskEmail } from '../../../../utils';
|
|
7
|
-
import { brandSelector } from '
|
|
8
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
8
9
|
var ResetPasswordSuccess = function (_a) {
|
|
9
10
|
var _b, _c;
|
|
10
11
|
var t = useTranslation().t;
|
|
12
|
+
var dispatch = useAppDispatch();
|
|
11
13
|
var data = useAppSelector(brandSelector).data;
|
|
12
14
|
var email = (((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact) || {}).email;
|
|
13
15
|
var maskedEmail = maskEmail(email);
|
|
14
|
-
|
|
16
|
+
var onBack = function () {
|
|
17
|
+
dispatch(handlePrevScreenStep());
|
|
18
|
+
};
|
|
19
|
+
return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true, enableBack: true, onBack: function () { return onBack(); } }));
|
|
15
20
|
};
|
|
16
21
|
export default React.memo(ResetPasswordSuccess);
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useTranslation, Trans } from 'react-i18next';
|
|
4
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
4
5
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
5
6
|
import { businessSelector } from '../../../app/business/businessStore';
|
|
6
|
-
import { useAppSelector } from '../../../../hooks';
|
|
7
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
7
8
|
import { maskEmail } from '../../../../utils';
|
|
8
9
|
var ResetPasswordSuccess = function (_a) {
|
|
9
10
|
var _b, _c;
|
|
10
11
|
var t = useTranslation().t;
|
|
12
|
+
var dispatch = useAppDispatch();
|
|
11
13
|
var data = useAppSelector(businessSelector).data;
|
|
12
14
|
var email = (((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact) || {}).email;
|
|
13
15
|
var maskedEmail = maskEmail(email);
|
|
14
|
-
|
|
16
|
+
var onBack = function () {
|
|
17
|
+
dispatch(handlePrevScreenStep());
|
|
18
|
+
};
|
|
19
|
+
return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true, enableBack: true, onBack: function () { return onBack(); } }));
|
|
15
20
|
};
|
|
16
21
|
export default React.memo(ResetPasswordSuccess);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BusinessInfo } from '../../../../@types';
|
|
3
|
+
interface BusinessListProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
list: Array<BusinessInfo>;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BusinessListProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import { useTranslation } from 'react-i18next';
|
|
26
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
27
|
+
import Box from '@mui/material/Box';
|
|
28
|
+
import { styled } from '@mui/material/styles';
|
|
29
|
+
import { useLanguage } from '../../../../hooks';
|
|
30
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
31
|
+
import Text from '../../../../components/Text';
|
|
32
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
|
+
import Collapse from '../../../../components/Collapse';
|
|
34
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
35
|
+
import Input from '../../../shared/Input';
|
|
36
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
37
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
38
|
+
'& .MuiInputBase-input': {
|
|
39
|
+
cursor: 'pointer'
|
|
40
|
+
}
|
|
41
|
+
}); });
|
|
42
|
+
var BusinessContainer = styled(Box)(function () { return ({
|
|
43
|
+
display: 'flex'
|
|
44
|
+
}); });
|
|
45
|
+
var BusinessNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
46
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
47
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
48
|
+
});
|
|
49
|
+
var BusinessList = function (_a) {
|
|
50
|
+
var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
|
|
51
|
+
var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
52
|
+
var t = useTranslation().t;
|
|
53
|
+
var isAr = useLanguage().isAr;
|
|
54
|
+
var control = useFormContext().control;
|
|
55
|
+
var businessControl = useController({ control: control, name: 'business' });
|
|
56
|
+
var business = businessControl.field.value;
|
|
57
|
+
var onOpenBusinessList = function (event) {
|
|
58
|
+
var _a;
|
|
59
|
+
setAnchorEl(event.currentTarget);
|
|
60
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
61
|
+
};
|
|
62
|
+
var onCloseBusinessList = function () {
|
|
63
|
+
var _a;
|
|
64
|
+
setAnchorEl(null);
|
|
65
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
66
|
+
};
|
|
67
|
+
var getBusinessName = function (business) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return (isAr ? (_a = business === null || business === void 0 ? void 0 : business.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = business === null || business === void 0 ? void 0 : business.name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
70
|
+
};
|
|
71
|
+
var getBusinessId = function (item) {
|
|
72
|
+
return (item === null || item === void 0 ? void 0 : item.id) || '';
|
|
73
|
+
};
|
|
74
|
+
var onSelectItem = function (business) {
|
|
75
|
+
businessControl.field.onChange(business);
|
|
76
|
+
onCloseBusinessList();
|
|
77
|
+
};
|
|
78
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { label: t('select_business_label'), onClick: !!anchorEl ? onCloseBusinessList : onOpenBusinessList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_business'), value: t(getBusinessName(business)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', searchValuePath: ['id', 'name.ar', 'name.en'], list: list, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
79
|
+
return (_jsxs(_Fragment, { children: [_jsx(BusinessContainer, { children: _jsx(BusinessNameText, __assign({ isSelected: getBusinessId(item) === getBusinessId(business) }, { children: t(getBusinessName(item)) })) }), getBusinessId(item) === getBusinessId(business) && _jsx(CheckIcon, {})] }));
|
|
80
|
+
} }) }))] })) })));
|
|
81
|
+
};
|
|
82
|
+
export default React.memo(BusinessList);
|