@tap-payments/auth-jsconnect 2.6.2-test → 2.6.3-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 +80 -0
- package/build/@types/form.d.ts +7 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/entity.js +32 -1
- package/build/api/index.d.ts +6 -2
- package/build/api/operator.d.ts +5 -0
- package/build/api/operator.js +21 -1
- package/build/assets/locales/ar.json +12 -1
- package/build/assets/locales/en.json +12 -1
- package/build/components/SimpleList/SimpleList.js +1 -1
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +5 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +14 -2
- package/build/features/app/connectExpress/connectExpressStore.d.ts +19 -2
- package/build/features/app/connectExpress/connectExpressStore.js +267 -22
- package/build/features/connectExpress/ConnectExpress.js +7 -3
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.d.ts +5 -0
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +91 -0
- package/build/features/connectExpress/screens/AuthenticationList/BrandList.d.ts +10 -0
- package/build/features/connectExpress/screens/AuthenticationList/BrandList.js +81 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.d.ts +11 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +96 -0
- package/build/features/connectExpress/screens/AuthenticationList/MerchantList.d.ts +10 -0
- package/build/features/connectExpress/screens/AuthenticationList/MerchantList.js +100 -0
- package/build/features/connectExpress/screens/AuthenticationList/TerminalList.d.ts +10 -0
- package/build/features/connectExpress/screens/AuthenticationList/TerminalList.js +101 -0
- package/build/features/connectExpress/screens/AuthenticationList/index.d.ts +3 -0
- package/build/features/connectExpress/screens/AuthenticationList/index.js +2 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +17 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.js +9 -0
- package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -6
- package/build/features/featuresScreens.js +5 -0
- package/build/features/shared/Button/FlowsButtons.d.ts +3 -1
- package/build/features/shared/Button/FlowsButtons.js +14 -11
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +3 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
- package/package.json +1 -1
|
@@ -59,7 +59,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
59
59
|
import { handleNextScreenStep, handleCurrentActiveScreen, handleOpen, handleSetCountryByIso2 } from '../../../app/settings';
|
|
60
60
|
import { FlowsTypes, AuthForType, BusinessType, LicenseType } from '../../../@types';
|
|
61
61
|
import API from '../../../api';
|
|
62
|
-
import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
62
|
+
import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
64
|
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA } from '../../../utils';
|
|
65
65
|
export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -143,6 +143,63 @@ export var retrieveEntityListAsync = createAsyncThunk('connectExpress/retrieveEn
|
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
}); });
|
|
146
|
+
export var retrieveAuthenticationListAsync = createAsyncThunk('connectExpress/retrieveAuthenticationListAsync', function (_a) {
|
|
147
|
+
var individualId = _a.individualId;
|
|
148
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
149
|
+
var brandList, entityList, brands, err_1, list, err_2;
|
|
150
|
+
return __generator(this, function (_b) {
|
|
151
|
+
switch (_b.label) {
|
|
152
|
+
case 0:
|
|
153
|
+
brandList = undefined;
|
|
154
|
+
entityList = undefined;
|
|
155
|
+
_b.label = 1;
|
|
156
|
+
case 1:
|
|
157
|
+
_b.trys.push([1, 3, , 4]);
|
|
158
|
+
return [4, API.brandService.getBrandList({ individual_id: individualId })];
|
|
159
|
+
case 2:
|
|
160
|
+
brands = (_b.sent()).brands;
|
|
161
|
+
brandList = brands;
|
|
162
|
+
return [3, 4];
|
|
163
|
+
case 3:
|
|
164
|
+
err_1 = _b.sent();
|
|
165
|
+
return [3, 4];
|
|
166
|
+
case 4:
|
|
167
|
+
_b.trys.push([4, 6, , 7]);
|
|
168
|
+
return [4, API.entityService.getEntityListUsingIndividualId(individualId)];
|
|
169
|
+
case 5:
|
|
170
|
+
list = (_b.sent()).list;
|
|
171
|
+
entityList = list;
|
|
172
|
+
return [3, 7];
|
|
173
|
+
case 6:
|
|
174
|
+
err_2 = _b.sent();
|
|
175
|
+
return [3, 7];
|
|
176
|
+
case 7: return [2, { brandList: brandList || [], entityList: entityList || [] }];
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantListAsync', function (entityId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
182
|
+
var merchants;
|
|
183
|
+
return __generator(this, function (_a) {
|
|
184
|
+
switch (_a.label) {
|
|
185
|
+
case 0: return [4, API.entityService.getMerchantListUsingEntityId(entityId)];
|
|
186
|
+
case 1:
|
|
187
|
+
merchants = (_a.sent()).merchants;
|
|
188
|
+
return [2, merchants || []];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}); });
|
|
192
|
+
export var getTerminalListAsync = createAsyncThunk('connectExpress/getTerminalListAsync', function (merchantId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
193
|
+
var list;
|
|
194
|
+
return __generator(this, function (_a) {
|
|
195
|
+
switch (_a.label) {
|
|
196
|
+
case 0: return [4, API.entityService.getTerminalListUsingMerchantId(merchantId)];
|
|
197
|
+
case 1:
|
|
198
|
+
list = (_a.sent()).list;
|
|
199
|
+
return [2, list || []];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}); });
|
|
146
203
|
export var createMobileAuthAsync = createAsyncThunk('connectExpress/createMobileAuthAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
204
|
var _a, settings, connectExpress, requestBody, data;
|
|
148
205
|
var _b, _c;
|
|
@@ -310,16 +367,20 @@ export var createCivilIdAuthAsync = createAsyncThunk('connectExpress/createCivil
|
|
|
310
367
|
});
|
|
311
368
|
}); });
|
|
312
369
|
export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
|
-
var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, mobileData, _c, auth_token, device_token, service_name, payload, data, isSaudi, next;
|
|
314
|
-
var
|
|
315
|
-
return __generator(this, function (
|
|
316
|
-
switch (
|
|
370
|
+
var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, mobileData, _c, auth_token, device_token, service_name, isScopeAuthentication, redirectUrl, bi, isDataHasOperator, payload, data, authId, urlQueryStart, _d, brandList, entityList, isSaudi, next;
|
|
371
|
+
var _e, _f;
|
|
372
|
+
return __generator(this, function (_g) {
|
|
373
|
+
switch (_g.label) {
|
|
317
374
|
case 0:
|
|
318
375
|
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
319
376
|
_b = connectExpress.data || {}, responseData = _b.responseData, leadId = _b.leadId, isLeadIdPassed = _b.isLeadIdPassed, mobileData = _b.mobileData;
|
|
320
377
|
if (!(responseData === null || responseData === void 0 ? void 0 : responseData.authData))
|
|
321
378
|
throw new Error('Auth data is missing');
|
|
322
379
|
_c = responseData.authData, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name;
|
|
380
|
+
isScopeAuthentication = settings.data.appConfig.scope === SCOPE_AUTH;
|
|
381
|
+
redirectUrl = connectExpress.data.redirectUrl;
|
|
382
|
+
bi = settings.data.deviceInfo.browser.browser_id;
|
|
383
|
+
isDataHasOperator = connectExpress.data.authData.includes('operator');
|
|
323
384
|
payload = {
|
|
324
385
|
auth_token: auth_token,
|
|
325
386
|
lead_id: leadId,
|
|
@@ -334,11 +395,26 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
|
|
|
334
395
|
};
|
|
335
396
|
return [4, API.authService.verifyExpressAuth(payload)];
|
|
336
397
|
case 1:
|
|
337
|
-
data =
|
|
338
|
-
|
|
398
|
+
data = _g.sent();
|
|
399
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
400
|
+
authId = data.auth.id;
|
|
401
|
+
if (isScopeAuthentication && redirectUrl && !data.new_user && !isDataHasOperator && authId) {
|
|
402
|
+
urlQueryStart = redirectUrl.includes('?') ? '&' : '?';
|
|
403
|
+
window.open("".concat(redirectUrl).concat(urlQueryStart, "authentication_id=").concat(authId, "&bi=").concat(bi), '_self');
|
|
404
|
+
return [2, data];
|
|
405
|
+
}
|
|
406
|
+
if (!(isScopeAuthentication && redirectUrl && !data.new_user && isDataHasOperator)) return [3, 3];
|
|
407
|
+
return [4, thunkApi.dispatch(retrieveAuthenticationListAsync({ individualId: data.individual_id })).unwrap()];
|
|
339
408
|
case 2:
|
|
340
|
-
|
|
341
|
-
|
|
409
|
+
_d = _g.sent(), brandList = _d.brandList, entityList = _d.entityList;
|
|
410
|
+
if (brandList.length && entityList.length) {
|
|
411
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP')); });
|
|
412
|
+
return [2, data];
|
|
413
|
+
}
|
|
414
|
+
_g.label = 3;
|
|
415
|
+
case 3: return [4, thunkApi.dispatch(getLeadByIdAsync(data.lead_id)).unwrap()];
|
|
416
|
+
case 4:
|
|
417
|
+
_g.sent();
|
|
342
418
|
isSaudi = isSA(settings.data.businessCountry.iso2);
|
|
343
419
|
next = isSaudi ? 'CONNECT_EXPRESS_NID_MISSED_STEP' : 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP';
|
|
344
420
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(next)); });
|
|
@@ -347,16 +423,20 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
|
|
|
347
423
|
});
|
|
348
424
|
}); });
|
|
349
425
|
export var verifyNIDOtpAsync = createAsyncThunk('connectExpress/verifyNIDOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
350
|
-
var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, nidData, _c, auth_token, device_token, service_name, payload, data, stepName, needToCollectMoreInfo, creatingAccount;
|
|
351
|
-
var
|
|
352
|
-
return __generator(this, function (
|
|
353
|
-
switch (
|
|
426
|
+
var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, nidData, _c, auth_token, device_token, service_name, isScopeAuthentication, redirectUrl, bi, isDataHasOperator, payload, data, authId, urlQueryStart, _d, brandList, entityList, stepName, needToCollectMoreInfo, creatingAccount;
|
|
427
|
+
var _e, _f;
|
|
428
|
+
return __generator(this, function (_g) {
|
|
429
|
+
switch (_g.label) {
|
|
354
430
|
case 0:
|
|
355
431
|
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
356
432
|
_b = connectExpress.data || {}, responseData = _b.responseData, leadId = _b.leadId, isLeadIdPassed = _b.isLeadIdPassed, nidData = _b.nidData;
|
|
357
433
|
if (!(responseData === null || responseData === void 0 ? void 0 : responseData.authData))
|
|
358
434
|
throw new Error('Auth data is missing');
|
|
359
435
|
_c = responseData.authData, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name;
|
|
436
|
+
isScopeAuthentication = settings.data.appConfig.scope === SCOPE_AUTH;
|
|
437
|
+
redirectUrl = connectExpress.data.redirectUrl;
|
|
438
|
+
bi = settings.data.deviceInfo.browser.browser_id;
|
|
439
|
+
isDataHasOperator = connectExpress.data.authData.includes('operator');
|
|
360
440
|
payload = {
|
|
361
441
|
auth_token: auth_token,
|
|
362
442
|
lead_id: leadId,
|
|
@@ -371,11 +451,26 @@ export var verifyNIDOtpAsync = createAsyncThunk('connectExpress/verifyNIDOtpAsyn
|
|
|
371
451
|
};
|
|
372
452
|
return [4, API.authService.verifyExpressAuth(payload)];
|
|
373
453
|
case 1:
|
|
374
|
-
data =
|
|
375
|
-
(
|
|
376
|
-
|
|
454
|
+
data = _g.sent();
|
|
455
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
456
|
+
authId = data.auth.id;
|
|
457
|
+
if (isScopeAuthentication && redirectUrl && !data.new_user && !isDataHasOperator && authId) {
|
|
458
|
+
urlQueryStart = redirectUrl.includes('?') ? '&' : '?';
|
|
459
|
+
window.open("".concat(redirectUrl).concat(urlQueryStart, "authentication_id=").concat(authId, "&bi=").concat(bi), '_self');
|
|
460
|
+
return [2, data];
|
|
461
|
+
}
|
|
462
|
+
if (!(isScopeAuthentication && redirectUrl && !data.new_user && isDataHasOperator)) return [3, 3];
|
|
463
|
+
return [4, thunkApi.dispatch(retrieveAuthenticationListAsync({ individualId: data.individual_id })).unwrap()];
|
|
377
464
|
case 2:
|
|
378
|
-
|
|
465
|
+
_d = _g.sent(), brandList = _d.brandList, entityList = _d.entityList;
|
|
466
|
+
if (brandList.length && entityList.length) {
|
|
467
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP')); });
|
|
468
|
+
return [2, data];
|
|
469
|
+
}
|
|
470
|
+
_g.label = 3;
|
|
471
|
+
case 3: return [4, thunkApi.dispatch(getLeadByIdAsync(data.lead.id)).unwrap()];
|
|
472
|
+
case 4:
|
|
473
|
+
_g.sent();
|
|
379
474
|
stepName = data.step_name;
|
|
380
475
|
needToCollectMoreInfo = stepName === 'collect_info';
|
|
381
476
|
creatingAccount = stepName === 'create_account';
|
|
@@ -723,14 +818,80 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
|
|
|
723
818
|
});
|
|
724
819
|
});
|
|
725
820
|
});
|
|
821
|
+
export var updateOperatorInfoAsync = createAsyncThunk('connectExpress/updateOperatorInfoAsync', function (_a, thunkApi) {
|
|
822
|
+
var terminalInfo = _a.terminalInfo;
|
|
823
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
824
|
+
var _b, connectExpress, settings, _c, postURL, responseData, redirectUrl, bi, body, data, authId, urlQueryStart;
|
|
825
|
+
var _d, _e, _f, _g, _h;
|
|
826
|
+
return __generator(this, function (_j) {
|
|
827
|
+
switch (_j.label) {
|
|
828
|
+
case 0:
|
|
829
|
+
_b = thunkApi.getState(), connectExpress = _b.connectExpress, settings = _b.settings;
|
|
830
|
+
_c = connectExpress.data, postURL = _c.postURL, responseData = _c.responseData;
|
|
831
|
+
redirectUrl = connectExpress.data.redirectUrl;
|
|
832
|
+
bi = settings.data.deviceInfo.browser.browser_id;
|
|
833
|
+
body = {
|
|
834
|
+
id: ((_d = terminalInfo === null || terminalInfo === void 0 ? void 0 : terminalInfo.operator) === null || _d === void 0 ? void 0 : _d.id) || '',
|
|
835
|
+
post_url: postURL
|
|
836
|
+
};
|
|
837
|
+
return [4, API.operatorService.updateOperator(body)];
|
|
838
|
+
case 1:
|
|
839
|
+
data = _j.sent();
|
|
840
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, data);
|
|
841
|
+
authId = (_h = (_g = responseData === null || responseData === void 0 ? void 0 : responseData.authData) === null || _g === void 0 ? void 0 : _g.auth) === null || _h === void 0 ? void 0 : _h.id;
|
|
842
|
+
if (authId) {
|
|
843
|
+
urlQueryStart = redirectUrl.includes('?') ? '&' : '?';
|
|
844
|
+
window.open("".concat(redirectUrl).concat(urlQueryStart, "authentication_id=").concat(authId, "&bi=").concat(bi), '_self');
|
|
845
|
+
}
|
|
846
|
+
return [2];
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
});
|
|
850
|
+
});
|
|
851
|
+
export var onCloseCompleteAsync = createAsyncThunk('connectExpress/onCloseCompleteAsync', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
852
|
+
var _a, connectExpress, settings, _b, postURL, responseData, redirectUrl, bi, merchant, list, id, body, data, authId, urlQueryStart;
|
|
853
|
+
var _c, _d, _e, _f, _g, _h;
|
|
854
|
+
return __generator(this, function (_j) {
|
|
855
|
+
switch (_j.label) {
|
|
856
|
+
case 0:
|
|
857
|
+
_a = thunkApi.getState(), connectExpress = _a.connectExpress, settings = _a.settings;
|
|
858
|
+
_b = connectExpress.data, postURL = _b.postURL, responseData = _b.responseData;
|
|
859
|
+
redirectUrl = connectExpress.data.redirectUrl;
|
|
860
|
+
bi = settings.data.deviceInfo.browser.browser_id;
|
|
861
|
+
merchant = ((responseData === null || responseData === void 0 ? void 0 : responseData.boardData) || {}).merchant;
|
|
862
|
+
return [4, thunkApi.dispatch(getTerminalListAsync(merchant === null || merchant === void 0 ? void 0 : merchant.id)).unwrap()];
|
|
863
|
+
case 1:
|
|
864
|
+
list = _j.sent();
|
|
865
|
+
id = ((_d = (_c = list === null || list === void 0 ? void 0 : list[0]) === null || _c === void 0 ? void 0 : _c.operator) === null || _d === void 0 ? void 0 : _d.id) || '';
|
|
866
|
+
body = {
|
|
867
|
+
id: id,
|
|
868
|
+
post_url: postURL
|
|
869
|
+
};
|
|
870
|
+
return [4, API.operatorService.updateOperator(body)];
|
|
871
|
+
case 2:
|
|
872
|
+
data = _j.sent();
|
|
873
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, data);
|
|
874
|
+
authId = (_h = (_g = responseData === null || responseData === void 0 ? void 0 : responseData.authData) === null || _g === void 0 ? void 0 : _g.auth) === null || _h === void 0 ? void 0 : _h.id;
|
|
875
|
+
if (authId) {
|
|
876
|
+
urlQueryStart = redirectUrl.includes('?') ? '&' : '?';
|
|
877
|
+
window.open("".concat(redirectUrl).concat(urlQueryStart, "authentication_id=").concat(authId, "&bi=").concat(bi), '_self');
|
|
878
|
+
}
|
|
879
|
+
return [2];
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
}); });
|
|
726
883
|
var initialState = {
|
|
727
884
|
error: null,
|
|
728
885
|
loading: false,
|
|
729
886
|
customLoading: false,
|
|
887
|
+
merchantLoading: false,
|
|
888
|
+
terminalLoading: false,
|
|
730
889
|
data: {
|
|
731
890
|
showBoard: true,
|
|
732
891
|
isLeadIdPassed: false,
|
|
733
892
|
postURL: '',
|
|
893
|
+
redirectUrl: '',
|
|
894
|
+
authData: [],
|
|
734
895
|
flowName: FlowsTypes.CONNECT_EXPRESS,
|
|
735
896
|
mobileData: {
|
|
736
897
|
countryCode: defaultCountry,
|
|
@@ -759,6 +920,12 @@ var initialState = {
|
|
|
759
920
|
brandName: '',
|
|
760
921
|
licenseNumber: '',
|
|
761
922
|
termAndConditionChecked: false
|
|
923
|
+
},
|
|
924
|
+
authenticationData: {
|
|
925
|
+
brandInfo: undefined,
|
|
926
|
+
entityInfo: undefined,
|
|
927
|
+
merchantInfo: undefined,
|
|
928
|
+
terminalInfo: undefined
|
|
762
929
|
}
|
|
763
930
|
}
|
|
764
931
|
};
|
|
@@ -772,6 +939,12 @@ export var connectSlice = createSlice({
|
|
|
772
939
|
setShowBoard: function (state, action) {
|
|
773
940
|
state.data.showBoard = action.payload;
|
|
774
941
|
},
|
|
942
|
+
setRedirectUrl: function (state, action) {
|
|
943
|
+
state.data.redirectUrl = action.payload;
|
|
944
|
+
},
|
|
945
|
+
setAuthData: function (state, action) {
|
|
946
|
+
state.data.authData = action.payload;
|
|
947
|
+
},
|
|
775
948
|
setIsLeadIdPassed: function (state, action) {
|
|
776
949
|
state.data.isLeadIdPassed = action.payload;
|
|
777
950
|
},
|
|
@@ -1007,9 +1180,10 @@ export var connectSlice = createSlice({
|
|
|
1007
1180
|
state.error = null;
|
|
1008
1181
|
})
|
|
1009
1182
|
.addCase(verifyNIDOtpLeadIdentityAsync.fulfilled, function (state, action) {
|
|
1010
|
-
var _a;
|
|
1183
|
+
var _a, _b, _c;
|
|
1011
1184
|
state.loading = false;
|
|
1012
|
-
|
|
1185
|
+
var auth = (((_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData) || {}).auth;
|
|
1186
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign(__assign({}, (_b = state.data.responseData) === null || _b === void 0 ? void 0 : _b.authData), action.payload), { auth: __assign(__assign({}, (_c = action.payload) === null || _c === void 0 ? void 0 : _c.auth), { id: auth === null || auth === void 0 ? void 0 : auth.id }) }) });
|
|
1013
1187
|
})
|
|
1014
1188
|
.addCase(verifyNIDOtpLeadIdentityAsync.rejected, function (state, action) {
|
|
1015
1189
|
state.loading = false;
|
|
@@ -1020,9 +1194,10 @@ export var connectSlice = createSlice({
|
|
|
1020
1194
|
state.error = null;
|
|
1021
1195
|
})
|
|
1022
1196
|
.addCase(verifyPaciOtpLeadIdentityAsync.fulfilled, function (state, action) {
|
|
1023
|
-
var _a;
|
|
1197
|
+
var _a, _b, _c;
|
|
1024
1198
|
state.loading = false;
|
|
1025
|
-
|
|
1199
|
+
var auth = (((_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData) || {}).auth;
|
|
1200
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign(__assign({}, (_b = state.data.responseData) === null || _b === void 0 ? void 0 : _b.authData), action.payload), { auth: __assign(__assign({}, (_c = action.payload) === null || _c === void 0 ? void 0 : _c.auth), { id: auth === null || auth === void 0 ? void 0 : auth.id }) }) });
|
|
1026
1201
|
})
|
|
1027
1202
|
.addCase(verifyPaciOtpLeadIdentityAsync.rejected, function (state, action) {
|
|
1028
1203
|
state.loading = false;
|
|
@@ -1075,6 +1250,20 @@ export var connectSlice = createSlice({
|
|
|
1075
1250
|
.addCase(retrieveEntityListAsync.rejected, function (state, action) {
|
|
1076
1251
|
state.loading = false;
|
|
1077
1252
|
state.error = action.error.message;
|
|
1253
|
+
})
|
|
1254
|
+
.addCase(retrieveAuthenticationListAsync.fulfilled, function (state, action) {
|
|
1255
|
+
state.error = null;
|
|
1256
|
+
state.loading = false;
|
|
1257
|
+
var _a = action.payload, brandList = _a.brandList, entityList = _a.entityList;
|
|
1258
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { authenticationData: { brandList: brandList, entityList: entityList } });
|
|
1259
|
+
})
|
|
1260
|
+
.addCase(retrieveAuthenticationListAsync.pending, function (state) {
|
|
1261
|
+
state.loading = true;
|
|
1262
|
+
state.error = null;
|
|
1263
|
+
})
|
|
1264
|
+
.addCase(retrieveAuthenticationListAsync.rejected, function (state, action) {
|
|
1265
|
+
state.loading = false;
|
|
1266
|
+
state.error = action.error.message;
|
|
1078
1267
|
})
|
|
1079
1268
|
.addCase(checkEmailAvailabilityAsync.fulfilled, function (state, action) {
|
|
1080
1269
|
var _a;
|
|
@@ -1143,9 +1332,65 @@ export var connectSlice = createSlice({
|
|
|
1143
1332
|
.addCase(createAccountAsync.rejected, function (state, action) {
|
|
1144
1333
|
state.loading = false;
|
|
1145
1334
|
state.error = action.error.message;
|
|
1335
|
+
})
|
|
1336
|
+
.addCase(getMerchantListAsync.pending, function (state) {
|
|
1337
|
+
state.merchantLoading = true;
|
|
1338
|
+
state.error = null;
|
|
1339
|
+
})
|
|
1340
|
+
.addCase(getMerchantListAsync.fulfilled, function (state, action) {
|
|
1341
|
+
state.merchantLoading = false;
|
|
1342
|
+
state.error = null;
|
|
1343
|
+
var data = state.data.responseData;
|
|
1344
|
+
var merchantList = action.payload;
|
|
1345
|
+
state.data.responseData = __assign(__assign({}, data), { authenticationData: __assign(__assign({}, data === null || data === void 0 ? void 0 : data.authenticationData), { merchantList: merchantList }) });
|
|
1346
|
+
})
|
|
1347
|
+
.addCase(getMerchantListAsync.rejected, function (state, action) {
|
|
1348
|
+
state.merchantLoading = false;
|
|
1349
|
+
state.error = action.error.message;
|
|
1350
|
+
})
|
|
1351
|
+
.addCase(getTerminalListAsync.pending, function (state) {
|
|
1352
|
+
state.terminalLoading = true;
|
|
1353
|
+
state.error = null;
|
|
1354
|
+
})
|
|
1355
|
+
.addCase(getTerminalListAsync.fulfilled, function (state, action) {
|
|
1356
|
+
state.terminalLoading = false;
|
|
1357
|
+
state.error = null;
|
|
1358
|
+
var data = state.data.responseData;
|
|
1359
|
+
var terminalList = action.payload;
|
|
1360
|
+
state.data.responseData = __assign(__assign({}, data), { authenticationData: __assign(__assign({}, data === null || data === void 0 ? void 0 : data.authenticationData), { terminalList: terminalList }) });
|
|
1361
|
+
})
|
|
1362
|
+
.addCase(getTerminalListAsync.rejected, function (state, action) {
|
|
1363
|
+
state.terminalLoading = false;
|
|
1364
|
+
state.error = action.error.message;
|
|
1365
|
+
})
|
|
1366
|
+
.addCase(updateOperatorInfoAsync.pending, function (state) {
|
|
1367
|
+
state.loading = true;
|
|
1368
|
+
state.error = null;
|
|
1369
|
+
})
|
|
1370
|
+
.addCase(updateOperatorInfoAsync.fulfilled, function (state) {
|
|
1371
|
+
state.loading = false;
|
|
1372
|
+
state.error = null;
|
|
1373
|
+
state.data.responseData = __assign({}, state.data.responseData);
|
|
1374
|
+
})
|
|
1375
|
+
.addCase(updateOperatorInfoAsync.rejected, function (state, action) {
|
|
1376
|
+
state.loading = false;
|
|
1377
|
+
state.error = action.error.message;
|
|
1378
|
+
})
|
|
1379
|
+
.addCase(onCloseCompleteAsync.pending, function (state) {
|
|
1380
|
+
state.loading = true;
|
|
1381
|
+
state.error = null;
|
|
1382
|
+
})
|
|
1383
|
+
.addCase(onCloseCompleteAsync.fulfilled, function (state) {
|
|
1384
|
+
state.loading = false;
|
|
1385
|
+
state.error = null;
|
|
1386
|
+
state.data.responseData = __assign({}, state.data.responseData);
|
|
1387
|
+
})
|
|
1388
|
+
.addCase(onCloseCompleteAsync.rejected, function (state, action) {
|
|
1389
|
+
state.loading = false;
|
|
1390
|
+
state.error = action.error.message;
|
|
1146
1391
|
});
|
|
1147
1392
|
}
|
|
1148
1393
|
});
|
|
1149
|
-
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setPostUrl = _a.setPostUrl, setLeadId = _a.setLeadId, setShowBoard = _a.setShowBoard, resetIndividualScreen = _a.resetIndividualScreen;
|
|
1394
|
+
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setPostUrl = _a.setPostUrl, setRedirectUrl = _a.setRedirectUrl, setAuthData = _a.setAuthData, setLeadId = _a.setLeadId, setShowBoard = _a.setShowBoard, resetIndividualScreen = _a.resetIndividualScreen;
|
|
1150
1395
|
export default connectSlice.reducer;
|
|
1151
1396
|
export var connectExpressSelector = function (state) { return state.connectExpress; };
|
|
@@ -64,7 +64,7 @@ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepSta
|
|
|
64
64
|
import { handleCurrentActiveScreen, settingsSelector } from '../../app/settings';
|
|
65
65
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
66
66
|
import { store } from '../../app/store';
|
|
67
|
-
import { connectExpressSelector, setIsLeadIdPassed, setPostUrl, setLeadId, retrieveLeadIdentityByIdAsync, setShowBoard } from '../app/connectExpress/connectExpressStore';
|
|
67
|
+
import { connectExpressSelector, setIsLeadIdPassed, setPostUrl, setLeadId, retrieveLeadIdentityByIdAsync, setShowBoard, setRedirectUrl, setAuthData } from '../app/connectExpress/connectExpressStore';
|
|
68
68
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
69
69
|
import Collapse from '../../components/Collapse';
|
|
70
70
|
import { isKW, findOrCreateElementAndInject, sendPageView } from '../../utils';
|
|
@@ -78,11 +78,15 @@ var ConnectExpress = memo(function (_a) {
|
|
|
78
78
|
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
|
|
79
79
|
var _c = useAppSelector(connectExpressSelector), connectExpressError = _c.error, loading = _c.loading, customLoading = _c.customLoading, connectData = _c.data;
|
|
80
80
|
var onVerifyConfigTokenSuccess = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
-
var _a, post, lead_id, board;
|
|
81
|
+
var _a, post, lead_id, board, platform_redirect_url, authData;
|
|
82
82
|
return __generator(this, function (_b) {
|
|
83
|
-
_a = data || {}, post = _a.post, lead_id = _a.lead_id, board = _a.board;
|
|
83
|
+
_a = data || {}, post = _a.post, lead_id = _a.lead_id, board = _a.board, platform_redirect_url = _a.platform_redirect_url, authData = _a.data;
|
|
84
84
|
if (post === null || post === void 0 ? void 0 : post.url)
|
|
85
85
|
dispatch(setPostUrl(post.url));
|
|
86
|
+
if (platform_redirect_url)
|
|
87
|
+
dispatch(setRedirectUrl(platform_redirect_url));
|
|
88
|
+
if (authData)
|
|
89
|
+
dispatch(setAuthData(authData));
|
|
86
90
|
if (lead_id) {
|
|
87
91
|
dispatch(setIsLeadIdPassed(true));
|
|
88
92
|
dispatch(setLeadId(lead_id));
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import Collapse from '@mui/material/Collapse';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
|
+
import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
|
|
21
|
+
import { AuthForType } from '../../../../@types';
|
|
22
|
+
import Form from '../../../../components/Form';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import Button from '../../../shared/Button';
|
|
25
|
+
import { clearError, connectExpressSelector, updateOperatorInfoAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
26
|
+
import { useLanguage } from '../../../../hooks';
|
|
27
|
+
import { AuthenticationListValidationSchema } from './validation';
|
|
28
|
+
import BrandList from './BrandList';
|
|
29
|
+
import EntityList from './EntityList';
|
|
30
|
+
import MerchantList from './MerchantList';
|
|
31
|
+
import TerminalList from './TerminalList';
|
|
32
|
+
var ListType;
|
|
33
|
+
(function (ListType) {
|
|
34
|
+
ListType["BrandList"] = "BrandList";
|
|
35
|
+
ListType["EntityList"] = "EntityList";
|
|
36
|
+
ListType["MerchantList"] = "MerchantList";
|
|
37
|
+
ListType["TerminalList"] = "TerminalList";
|
|
38
|
+
})(ListType || (ListType = {}));
|
|
39
|
+
var AuthenticationList = function (_a) {
|
|
40
|
+
var _b;
|
|
41
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
42
|
+
var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error, merchantLoading = _c.merchantLoading, terminalLoading = _c.terminalLoading;
|
|
43
|
+
var _d = data.authenticationData, brandInfo = _d.brandInfo, entityInfo = _d.entityInfo, merchantInfo = _d.merchantInfo, terminalInfo = _d.terminalInfo;
|
|
44
|
+
var _e = React.useState(), listActive = _e[0], setListActive = _e[1];
|
|
45
|
+
var _f = ((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}, brandList = _f.brandList, entityList = _f.entityList;
|
|
46
|
+
var otpData = data.otpData;
|
|
47
|
+
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
48
|
+
React.useEffect(function () {
|
|
49
|
+
sendCustomEventToGTM({
|
|
50
|
+
event: 'Send Event',
|
|
51
|
+
event_category: 'User Authentication Flow',
|
|
52
|
+
event_action: 'Authentication List Step'
|
|
53
|
+
});
|
|
54
|
+
}, []);
|
|
55
|
+
var methods = useForm({
|
|
56
|
+
resolver: yupResolver(AuthenticationListValidationSchema()),
|
|
57
|
+
defaultValues: {
|
|
58
|
+
brandInfo: brandInfo,
|
|
59
|
+
entityInfo: entityInfo,
|
|
60
|
+
merchantInfo: merchantInfo,
|
|
61
|
+
terminalInfo: terminalInfo
|
|
62
|
+
},
|
|
63
|
+
mode: 'onChange'
|
|
64
|
+
});
|
|
65
|
+
var t = useTranslation().t;
|
|
66
|
+
var isAr = useLanguage().isAr;
|
|
67
|
+
var dispatch = useAppDispatch();
|
|
68
|
+
var onSubmit = function (formData) {
|
|
69
|
+
dispatch(updateOperatorInfoAsync(deepCopy(formData)));
|
|
70
|
+
};
|
|
71
|
+
var onBack = function () {
|
|
72
|
+
var _a;
|
|
73
|
+
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
74
|
+
var screen = startWithNID ? (isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP') : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
75
|
+
dispatch(handlePrevScreenStep(screen));
|
|
76
|
+
};
|
|
77
|
+
React.useEffect(function () {
|
|
78
|
+
if (error)
|
|
79
|
+
dispatch(clearError());
|
|
80
|
+
}, [methods.formState.isValid]);
|
|
81
|
+
var disabled = !methods.formState.isValid || !!error || merchantLoading || terminalLoading;
|
|
82
|
+
var handleMenuClick = function (flag) {
|
|
83
|
+
setListActive(flag);
|
|
84
|
+
};
|
|
85
|
+
var isBrandList = listActive === ListType.BrandList;
|
|
86
|
+
var isEntityList = listActive === ListType.EntityList;
|
|
87
|
+
var isMerchantList = listActive === ListType.MerchantList;
|
|
88
|
+
var isTerminalList = listActive === ListType.TerminalList;
|
|
89
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isEntityList && !isMerchantList && !isTerminalList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { list: entityList || [], countryList: settingsData.countries || [], show: !isBrandList && !isMerchantList && !isTerminalList, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(MerchantList, { show: !isBrandList && !isEntityList && !isTerminalList, onListOpen: function () { return handleMenuClick(ListType.MerchantList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TerminalList, { show: !isBrandList && !isEntityList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.TerminalList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
90
|
+
};
|
|
91
|
+
export default React.memo(AuthenticationList);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BrandInfo } from '../../../../@types';
|
|
3
|
+
interface BrandListProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
list: Array<BrandInfo>;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BrandListProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
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 ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
31
|
+
import InputSelect from '../../../shared/InputSelect';
|
|
32
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
33
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
34
|
+
import Text from '../../../../components/Text';
|
|
35
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
36
|
+
import Collapse from '../../../../components/Collapse';
|
|
37
|
+
var BrandContainer = styled(Box)(function () { return ({
|
|
38
|
+
display: 'flex'
|
|
39
|
+
}); });
|
|
40
|
+
var BrandNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
41
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
42
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
43
|
+
});
|
|
44
|
+
var BrandList = function (_a) {
|
|
45
|
+
var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
|
|
46
|
+
var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
47
|
+
var t = useTranslation().t;
|
|
48
|
+
var isAr = useLanguage().isAr;
|
|
49
|
+
var control = useFormContext().control;
|
|
50
|
+
var brandInfoControl = useController({ control: control, name: 'brandInfo' });
|
|
51
|
+
var brandInfo = brandInfoControl.field.value;
|
|
52
|
+
var onOpenBrandList = function (event) {
|
|
53
|
+
var _a;
|
|
54
|
+
setAnchorEl(event.currentTarget);
|
|
55
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
56
|
+
};
|
|
57
|
+
var onCloseBrandList = function () {
|
|
58
|
+
var _a;
|
|
59
|
+
setAnchorEl(null);
|
|
60
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
61
|
+
};
|
|
62
|
+
var getBrandName = function (brand) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
if (!brand)
|
|
65
|
+
return '';
|
|
66
|
+
return (isAr ? (_a = brand.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = brand.name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
67
|
+
};
|
|
68
|
+
var getBrandId = function (brand) {
|
|
69
|
+
if (!brand)
|
|
70
|
+
return '';
|
|
71
|
+
return brand.id || '';
|
|
72
|
+
};
|
|
73
|
+
var onSelectItem = function (brand) {
|
|
74
|
+
brandInfoControl.field.onChange(brand);
|
|
75
|
+
onCloseBrandList();
|
|
76
|
+
};
|
|
77
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputSelect, { label: t('select_brand_label'), onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(brandInfo)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { space: 140, list: list, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
78
|
+
return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(brandInfo) }, { children: t(getBrandName(item)) })) }), getBrandId(item) === getBrandId(brandInfo) && _jsx(CheckIcon, {})] }));
|
|
79
|
+
} }) }))] }) })));
|
|
80
|
+
};
|
|
81
|
+
export default React.memo(BrandList);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CountryCode, EntityLicenseAuth } from '../../../../@types';
|
|
3
|
+
interface EntityListProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
list: Array<EntityLicenseAuth>;
|
|
6
|
+
countryList: Array<CountryCode>;
|
|
7
|
+
onListOpen?: () => void;
|
|
8
|
+
onListClose?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ show, list, countryList, ...rest }: EntityListProps) => JSX.Element>;
|
|
11
|
+
export default _default;
|