@tap-payments/auth-jsconnect 2.6.24-test → 2.6.26-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.
@@ -1,4 +1,4 @@
1
- import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SaleChannel, Segment, SourceOfIncome, TeamSize, City, EntityLicense, EntityLicenseAuth, AuthMerchantInfo, AuthTerminalInfo } from './app';
1
+ import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SaleChannel, Segment, SourceOfIncome, TeamSize, City, EntityLicense, EntityLicenseAuth, AuthMerchantInfo } from './app';
2
2
  export declare type MobileFormValues = {
3
3
  mobile: string;
4
4
  countryCode: CountryCode;
@@ -147,5 +147,4 @@ export declare type AuthenticationListFormValues = {
147
147
  brandInfo?: BrandInfo;
148
148
  entityInfo?: EntityLicenseAuth;
149
149
  merchantInfo?: AuthMerchantInfo;
150
- terminalInfo?: AuthTerminalInfo;
151
150
  };
@@ -20,7 +20,7 @@ declare const API: {
20
20
  };
21
21
  operatorService: {
22
22
  validateOperator: (body: ValidateOperatorBody) => Promise<any>;
23
- updateOperator: ({ id, ...data }: UpdateOperatorBody) => Promise<any>;
23
+ updateOperator: (data: UpdateOperatorBody) => Promise<any>;
24
24
  };
25
25
  countryService: {
26
26
  getCountries: (disableCountries?: boolean | undefined) => Promise<any> | {
@@ -7,13 +7,15 @@ export declare type ValidateOperatorBody = {
7
7
  connect_pkey?: string;
8
8
  };
9
9
  export declare type UpdateOperatorBody = {
10
- id: string;
11
10
  post_url: string;
12
11
  authentication_id: string;
13
12
  bi: string;
13
+ brand_id: string;
14
+ merchant_id: string;
15
+ entity_id: string;
14
16
  };
15
17
  declare const operatorService: {
16
18
  validateOperator: (body: ValidateOperatorBody) => Promise<any>;
17
- updateOperator: ({ id, ...data }: UpdateOperatorBody) => Promise<any>;
19
+ updateOperator: (data: UpdateOperatorBody) => Promise<any>;
18
20
  };
19
21
  export { operatorService };
@@ -34,17 +34,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
35
  }
36
36
  };
37
- var __rest = (this && this.__rest) || function (s, e) {
38
- var t = {};
39
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
40
- t[p] = s[p];
41
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
42
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
43
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
44
- t[p[i]] = s[p[i]];
45
- }
46
- return t;
47
- };
48
37
  import { ENDPOINT_PATHS } from '../constants';
49
38
  import { httpClient } from './axios';
50
39
  var validateOperator = function (body) { return __awaiter(void 0, void 0, void 0, function () {
@@ -70,11 +59,10 @@ var validateOperator = function (body) { return __awaiter(void 0, void 0, void 0
70
59
  }
71
60
  });
72
61
  }); };
73
- var updateOperator = function (_a) {
74
- var id = _a.id, data = __rest(_a, ["id"]);
62
+ var updateOperator = function (data) {
75
63
  return httpClient({
76
- method: 'put',
77
- url: "".concat(ENDPOINT_PATHS.OPERATOR, "/").concat(id),
64
+ method: 'post',
65
+ url: "".concat(ENDPOINT_PATHS.CONNECT, "/confirm"),
78
66
  data: data
79
67
  });
80
68
  };
@@ -9,7 +9,11 @@ interface SettingParams {
9
9
  onVerifyConfigTokenSuccess?: (data: ConfigExpressTokenParams) => Promise<void>;
10
10
  }
11
11
  export declare const fetchAppSettingsSync: import("@reduxjs/toolkit").AsyncThunk<any, SettingParams, {}>;
12
- export declare const onCloseComplete: import("@reduxjs/toolkit").AsyncThunk<void, string, {}>;
12
+ export declare const onCloseComplete: import("@reduxjs/toolkit").AsyncThunk<void, {
13
+ merchantId: string;
14
+ brandId: string;
15
+ entityId: string;
16
+ }, {}>;
13
17
  export interface SettingsData {
14
18
  skin: ThemeMode;
15
19
  language: LanguageMode;
@@ -145,30 +145,29 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
145
145
  }
146
146
  });
147
147
  }); });
148
- export var onCloseComplete = createAsyncThunk('settings/onCloseComplete', function (merchantId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
149
- var settings, _a, appConfig, authId, postURL, redirectUrl, bi, list, id, body, data, urlQueryStart;
150
- var _b, _c, _d, _e;
151
- return __generator(this, function (_f) {
152
- switch (_f.label) {
148
+ export var onCloseComplete = createAsyncThunk('settings/onCloseComplete', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
149
+ var settings, _a, appConfig, authId, postURL, redirectUrl, bi, merchantId, brandId, entityId, body, data, urlQueryStart;
150
+ var _b, _c;
151
+ return __generator(this, function (_d) {
152
+ switch (_d.label) {
153
153
  case 0:
154
154
  settings = thunkApi.getState().settings;
155
155
  _a = settings.data, appConfig = _a.appConfig, authId = _a.authId;
156
156
  postURL = appConfig.postURL, redirectUrl = appConfig.redirectUrl;
157
157
  bi = settings.data.deviceInfo.browser.browser_id;
158
- return [4, API.entityService.getTerminalListUsingMerchantId(merchantId)];
159
- case 1:
160
- list = (_f.sent()).list;
161
- id = ((_c = (_b = list === null || list === void 0 ? void 0 : list[0]) === null || _b === void 0 ? void 0 : _b.operator) === null || _c === void 0 ? void 0 : _c.id) || '';
158
+ merchantId = params.merchantId, brandId = params.brandId, entityId = params.entityId;
162
159
  body = {
163
- id: id,
164
160
  post_url: postURL || '',
165
161
  authentication_id: authId || '',
166
- bi: bi
162
+ bi: bi,
163
+ brand_id: brandId || '',
164
+ merchant_id: merchantId || '',
165
+ entity_id: entityId || ''
167
166
  };
168
167
  return [4, API.operatorService.updateOperator(body)];
169
- case 2:
170
- data = _f.sent();
171
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, data);
168
+ case 1:
169
+ data = _d.sent();
170
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, data);
172
171
  if (authId) {
173
172
  if (settings.data.appConfig.mode === 'popup') {
174
173
  settings.data.appConfig.onFlowCompleted({ auth_id: authId, bi: bi });
@@ -311,14 +311,13 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', funct
311
311
  });
312
312
  }); });
313
313
  export var onCloseCompleteBank = createAsyncThunk('bank/onCloseCompleteBank', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
314
- var bank, id;
315
- var _a;
314
+ var bank, _a, merchant, brand, entity;
316
315
  return __generator(this, function (_b) {
317
316
  switch (_b.label) {
318
317
  case 0:
319
318
  bank = thunkApi.getState().bank;
320
- id = (((_a = bank.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant) || {}).id;
321
- return [4, thunkApi.dispatch(onCloseComplete(id))];
319
+ _a = bank.data.verify.responseBody || {}, merchant = _a.merchant, brand = _a.brand, entity = _a.entity;
320
+ return [4, thunkApi.dispatch(onCloseComplete({ merchantId: merchant === null || merchant === void 0 ? void 0 : merchant.id, brandId: brand === null || brand === void 0 ? void 0 : brand.id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
322
321
  case 1:
323
322
  _b.sent();
324
323
  return [2];
@@ -553,14 +553,13 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardBrandSuccess', func
553
553
  });
554
554
  }); });
555
555
  export var onCloseCompleteBrand = createAsyncThunk('brand/onCloseCompleteBrand', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
556
- var brand, id;
557
- var _a;
556
+ var brand, _a, merchant, brandRes, entity;
558
557
  return __generator(this, function (_b) {
559
558
  switch (_b.label) {
560
559
  case 0:
561
560
  brand = thunkApi.getState().brand;
562
- id = (((_a = brand.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant) || {}).id;
563
- return [4, thunkApi.dispatch(onCloseComplete(id))];
561
+ _a = brand.data.verify.responseBody || {}, merchant = _a.merchant, brandRes = _a.brand, entity = _a.entity;
562
+ return [4, thunkApi.dispatch(onCloseComplete({ merchantId: merchant === null || merchant === void 0 ? void 0 : merchant.id, brandId: brandRes === null || brandRes === void 0 ? void 0 : brandRes.id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
564
563
  case 1:
565
564
  _b.sent();
566
565
  return [2];
@@ -25,7 +25,6 @@ export declare const retrieveAuthenticationListAsync: import("@reduxjs/toolkit")
25
25
  individualId: string;
26
26
  }, {}>;
27
27
  export declare const getMerchantListAsync: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
28
- export declare const getTerminalListAsync: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
29
28
  export declare const createMobileAuthAsync: import("@reduxjs/toolkit").AsyncThunk<{
30
29
  response: any;
31
30
  formData: MobileFormValues;
@@ -224,17 +224,6 @@ export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantLi
224
224
  }
225
225
  });
226
226
  }); });
227
- export var getTerminalListAsync = createAsyncThunk('connectExpress/getTerminalListAsync', function (merchantId) { return __awaiter(void 0, void 0, void 0, function () {
228
- var list;
229
- return __generator(this, function (_a) {
230
- switch (_a.label) {
231
- case 0: return [4, API.entityService.getTerminalListUsingMerchantId(merchantId)];
232
- case 1:
233
- list = (_a.sent()).list;
234
- return [2, list || []];
235
- }
236
- });
237
- }); });
238
227
  export var createMobileAuthAsync = createAsyncThunk('connectExpress/createMobileAuthAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
239
228
  var _a, settings, connectExpress, requestBody, data;
240
229
  var _b, _c;
@@ -539,9 +528,9 @@ export var verifyNIDOtpAsync = createAsyncThunk('connectExpress/verifyNIDOtpAsyn
539
528
  }); });
540
529
  export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
541
530
  var _a, settings, connectExpress, authData, _b, scope, redirectUrl, authConfigData, isScopeAuthentication, bi, isDataHasOperator, expiry, interval, maxCalls, count, data, isSuccess, authId, urlQueryStart, _c, brandList, entityList, stepName, needToCollectMoreInfo, creatingAccount;
542
- var _d;
543
- return __generator(this, function (_e) {
544
- switch (_e.label) {
531
+ var _d, _e;
532
+ return __generator(this, function (_f) {
533
+ switch (_f.label) {
545
534
  case 0:
546
535
  _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
547
536
  authData = (connectExpress.data.responseData || {}).authData;
@@ -553,7 +542,7 @@ export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync',
553
542
  interval = 3;
554
543
  maxCalls = Math.floor(expiry / interval);
555
544
  count = 1;
556
- _e.label = 1;
545
+ _f.label = 1;
557
546
  case 1:
558
547
  if (!(count <= maxCalls)) return [3, 9];
559
548
  if (thunkApi.signal.aborted) {
@@ -561,8 +550,8 @@ export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync',
561
550
  }
562
551
  return [4, API.authService.getVerifyExpressAuth(authData === null || authData === void 0 ? void 0 : authData.auth_token)];
563
552
  case 2:
564
- data = _e.sent();
565
- isSuccess = ((_d = data.status) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === 'success';
553
+ data = _f.sent();
554
+ isSuccess = ((_e = (_d = data.auth) === null || _d === void 0 ? void 0 : _d.status) === null || _e === void 0 ? void 0 : _e.toLowerCase()) === 'success';
566
555
  if (!isSuccess) return [3, 6];
567
556
  authId = data.auth.id;
568
557
  thunkApi.dispatch(storeAuthId(authId));
@@ -581,15 +570,15 @@ export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync',
581
570
  if (!(isScopeAuthentication && !data.new_user && isDataHasOperator)) return [3, 4];
582
571
  return [4, thunkApi.dispatch(retrieveAuthenticationListAsync({ individualId: data.individual_id })).unwrap()];
583
572
  case 3:
584
- _c = _e.sent(), brandList = _c.brandList, entityList = _c.entityList;
573
+ _c = _f.sent(), brandList = _c.brandList, entityList = _c.entityList;
585
574
  if (brandList.length && entityList.length) {
586
575
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP')); });
587
576
  return [2, data];
588
577
  }
589
- _e.label = 4;
578
+ _f.label = 4;
590
579
  case 4: return [4, thunkApi.dispatch(getLeadByIdAsync(data.lead.id)).unwrap()];
591
580
  case 5:
592
- _e.sent();
581
+ _f.sent();
593
582
  stepName = data.step_name;
594
583
  needToCollectMoreInfo = stepName === 'collect_info';
595
584
  creatingAccount = stepName === 'create_account';
@@ -602,8 +591,8 @@ export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync',
602
591
  return [2, data];
603
592
  case 6: return [4, sleep(interval * 1000)];
604
593
  case 7:
605
- _e.sent();
606
- _e.label = 8;
594
+ _f.sent();
595
+ _f.label = 8;
607
596
  case 8:
608
597
  count++;
609
598
  return [3, 1];
@@ -957,12 +946,12 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
957
946
  });
958
947
  });
959
948
  export var updateOperatorInfoAsync = createAsyncThunk('connectExpress/updateOperatorInfoAsync', function (_a, thunkApi) {
960
- var terminalInfo = _a.terminalInfo;
949
+ var brandInfo = _a.brandInfo, entityInfo = _a.entityInfo, merchantInfo = _a.merchantInfo;
961
950
  return __awaiter(void 0, void 0, void 0, function () {
962
951
  var _b, connectExpress, settings, responseData, _c, postURL, redirectUrl, bi, authId, body, data, urlQueryStart;
963
- var _d, _e, _f, _g, _h;
964
- return __generator(this, function (_j) {
965
- switch (_j.label) {
952
+ var _d, _e, _f, _g;
953
+ return __generator(this, function (_h) {
954
+ switch (_h.label) {
966
955
  case 0:
967
956
  _b = thunkApi.getState(), connectExpress = _b.connectExpress, settings = _b.settings;
968
957
  responseData = connectExpress.data.responseData;
@@ -970,15 +959,17 @@ export var updateOperatorInfoAsync = createAsyncThunk('connectExpress/updateOper
970
959
  bi = settings.data.deviceInfo.browser.browser_id;
971
960
  authId = (_e = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authData) === null || _d === void 0 ? void 0 : _d.auth) === null || _e === void 0 ? void 0 : _e.id;
972
961
  body = {
973
- id: ((_f = terminalInfo === null || terminalInfo === void 0 ? void 0 : terminalInfo.operator) === null || _f === void 0 ? void 0 : _f.id) || '',
974
962
  post_url: postURL || '',
975
963
  authentication_id: authId,
976
- bi: bi
964
+ bi: bi,
965
+ brand_id: (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id) || '',
966
+ merchant_id: (merchantInfo === null || merchantInfo === void 0 ? void 0 : merchantInfo.id) || '',
967
+ entity_id: (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) || ''
977
968
  };
978
969
  return [4, API.operatorService.updateOperator(body)];
979
970
  case 1:
980
- data = _j.sent();
981
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, data);
971
+ data = _h.sent();
972
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, data);
982
973
  if (authId) {
983
974
  if (settings.data.appConfig.mode === 'popup') {
984
975
  settings.data.appConfig.onFlowCompleted({ auth_id: authId, bi: bi });
@@ -996,14 +987,14 @@ export var updateOperatorInfoAsync = createAsyncThunk('connectExpress/updateOper
996
987
  });
997
988
  });
998
989
  export var onCloseCompleteAsync = createAsyncThunk('connectExpress/onCloseCompleteAsync', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
999
- var connectExpress, id;
1000
- var _a, _b;
990
+ var connectExpress, _a, merchant, brand, entity;
991
+ var _b;
1001
992
  return __generator(this, function (_c) {
1002
993
  switch (_c.label) {
1003
994
  case 0:
1004
995
  connectExpress = thunkApi.getState().connectExpress;
1005
- id = (((_b = (_a = connectExpress.data.responseData) === null || _a === void 0 ? void 0 : _a.boardData) === null || _b === void 0 ? void 0 : _b.merchant) || {}).id;
1006
- return [4, thunkApi.dispatch(onCloseComplete(id))];
996
+ _a = ((_b = connectExpress.data.responseData) === null || _b === void 0 ? void 0 : _b.boardData) || {}, merchant = _a.merchant, brand = _a.brand, entity = _a.entity;
997
+ return [4, thunkApi.dispatch(onCloseComplete({ merchantId: merchant === null || merchant === void 0 ? void 0 : merchant.id, brandId: brand === null || brand === void 0 ? void 0 : brand.id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
1007
998
  case 1:
1008
999
  _c.sent();
1009
1000
  return [2];
@@ -1052,8 +1043,7 @@ var initialState = {
1052
1043
  authenticationData: {
1053
1044
  brandInfo: undefined,
1054
1045
  entityInfo: undefined,
1055
- merchantInfo: undefined,
1056
- terminalInfo: undefined
1046
+ merchantInfo: undefined
1057
1047
  }
1058
1048
  }
1059
1049
  };
@@ -1495,24 +1485,6 @@ export var connectSlice = createSlice({
1495
1485
  .addCase(getMerchantListAsync.rejected, function (state, action) {
1496
1486
  state.merchantLoading = false;
1497
1487
  state.error = action.error.message;
1498
- })
1499
- .addCase(getTerminalListAsync.pending, function (state) {
1500
- state.terminalLoading = true;
1501
- state.error = null;
1502
- })
1503
- .addCase(getTerminalListAsync.fulfilled, function (state, action) {
1504
- state.terminalLoading = false;
1505
- state.error = null;
1506
- var data = state.data.responseData;
1507
- var terminalList = action.payload;
1508
- if (terminalList === null || terminalList === void 0 ? void 0 : terminalList.length) {
1509
- state.data.authenticationData.terminalInfo = terminalList[0];
1510
- }
1511
- state.data.responseData = __assign(__assign({}, data), { authenticationData: __assign(__assign({}, data === null || data === void 0 ? void 0 : data.authenticationData), { terminalList: terminalList }) });
1512
- })
1513
- .addCase(getTerminalListAsync.rejected, function (state, action) {
1514
- state.terminalLoading = false;
1515
- state.error = action.error.message;
1516
1488
  })
1517
1489
  .addCase(updateOperatorInfoAsync.pending, function (state) {
1518
1490
  state.loading = true;
@@ -456,14 +456,13 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', fun
456
456
  });
457
457
  }); });
458
458
  export var onCloseCompleteEntity = createAsyncThunk('entity/onCloseCompleteEntity', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
459
- var entity, id;
460
- var _a;
459
+ var entity, _a, merchant, brand, entityRes;
461
460
  return __generator(this, function (_b) {
462
461
  switch (_b.label) {
463
462
  case 0:
464
463
  entity = thunkApi.getState().entity;
465
- id = (((_a = entity.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant) || {}).id;
466
- return [4, thunkApi.dispatch(onCloseComplete(id))];
464
+ _a = entity.data.verify.responseBody || {}, merchant = _a.merchant, brand = _a.brand, entityRes = _a.entity;
465
+ return [4, thunkApi.dispatch(onCloseComplete({ merchantId: merchant === null || merchant === void 0 ? void 0 : merchant.id, brandId: brand === null || brand === void 0 ? void 0 : brand.id, entityId: entityRes === null || entityRes === void 0 ? void 0 : entityRes.id }))];
467
466
  case 1:
468
467
  _b.sent();
469
468
  return [2];
@@ -827,14 +827,13 @@ export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess',
827
827
  });
828
828
  }); });
829
829
  export var onCloseCompleteIndividual = createAsyncThunk('individual/onCloseCompleteIndividual', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
830
- var individual, id;
831
- var _a;
830
+ var individual, _a, merchant, brand, entity;
832
831
  return __generator(this, function (_b) {
833
832
  switch (_b.label) {
834
833
  case 0:
835
834
  individual = thunkApi.getState().individual;
836
- id = (((_a = individual.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant) || {}).id;
837
- return [4, thunkApi.dispatch(onCloseComplete(id))];
835
+ _a = individual.data.verify.responseBody || {}, merchant = _a.merchant, brand = _a.brand, entity = _a.entity;
836
+ return [4, thunkApi.dispatch(onCloseComplete({ merchantId: merchant === null || merchant === void 0 ? void 0 : merchant.id, brandId: brand === null || brand === void 0 ? void 0 : brand.id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
838
837
  case 1:
839
838
  _b.sent();
840
839
  return [2];
@@ -357,14 +357,13 @@ export var retrieveBoardResetPasswordSuccess = createAsyncThunk('retrieveBoardRe
357
357
  });
358
358
  }); });
359
359
  export var onCloseCompletePassword = createAsyncThunk('password/onCloseCompletePassword', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
360
- var password, id;
361
- var _a;
360
+ var password, _a, merchant, brand, entity;
362
361
  return __generator(this, function (_b) {
363
362
  switch (_b.label) {
364
363
  case 0:
365
364
  password = thunkApi.getState().password;
366
- id = (((_a = password.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant) || {}).id;
367
- return [4, thunkApi.dispatch(onCloseComplete(id))];
365
+ _a = password.data.verify.responseBody || {}, merchant = _a.merchant, brand = _a.brand, entity = _a.entity;
366
+ return [4, thunkApi.dispatch(onCloseComplete({ merchantId: merchant === null || merchant === void 0 ? void 0 : merchant.id, brandId: brand === null || brand === void 0 ? void 0 : brand.id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
368
367
  case 1:
369
368
  _b.sent();
370
369
  return [2];
@@ -279,14 +279,13 @@ export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function
279
279
  });
280
280
  }); });
281
281
  export var onCloseCompleteTax = createAsyncThunk('password/onCloseCompleteTax', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
282
- var tax, id;
283
- var _a;
282
+ var tax, _a, merchant, brand, entity;
284
283
  return __generator(this, function (_b) {
285
284
  switch (_b.label) {
286
285
  case 0:
287
286
  tax = thunkApi.getState().tax;
288
- id = (((_a = tax.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant) || {}).id;
289
- return [4, thunkApi.dispatch(onCloseComplete(id))];
287
+ _a = tax.data.verify.responseBody || {}, merchant = _a.merchant, brand = _a.brand, entity = _a.entity;
288
+ return [4, thunkApi.dispatch(onCloseComplete({ merchantId: merchant === null || merchant === void 0 ? void 0 : merchant.id, brandId: brand === null || brand === void 0 ? void 0 : brand.id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
290
289
  case 1:
291
290
  _b.sent();
292
291
  return [2];
@@ -46,9 +46,9 @@ var FormStyled = styled(Form)(function () { return ({
46
46
  flexDirection: 'column'
47
47
  }); });
48
48
  var VerifyNumber = function (_a) {
49
- var _b;
49
+ var _b, _c;
50
50
  var dispatch = useAppDispatch();
51
- var _c = useAppSelector(boardSelector), data = _c.data, loading = _c.loading, error = _c.error;
51
+ var _d = useAppSelector(boardSelector), data = _d.data, loading = _d.loading, error = _d.error;
52
52
  var methods = useForm({
53
53
  resolver: yupResolver(OTPValidation),
54
54
  defaultValues: data.otpData,
@@ -56,8 +56,8 @@ var VerifyNumber = function (_a) {
56
56
  });
57
57
  var t = useTranslation().t;
58
58
  var isAr = useLanguage().isAr;
59
- var _d = React.useState(false), resendLoading = _d[0], setResendLoading = _d[1];
60
- var phone = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by.sent_to;
59
+ var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
60
+ var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
61
61
  React.useEffect(function () {
62
62
  if (error && methods.formState.isValid && phone)
63
63
  dispatch(clearError());
@@ -28,19 +28,17 @@ import { AuthenticationListValidationSchema } from './validation';
28
28
  import BrandList from './BrandList';
29
29
  import EntityList from './EntityList';
30
30
  import MerchantList from './MerchantList';
31
- import TerminalList from './TerminalList';
32
31
  var ListType;
33
32
  (function (ListType) {
34
33
  ListType["BrandList"] = "BrandList";
35
34
  ListType["EntityList"] = "EntityList";
36
35
  ListType["MerchantList"] = "MerchantList";
37
- ListType["TerminalList"] = "TerminalList";
38
36
  })(ListType || (ListType = {}));
39
37
  var AuthenticationList = function (_a) {
40
38
  var _b;
41
39
  var settingsData = useAppSelector(settingsSelector).data;
42
40
  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;
41
+ var _d = data.authenticationData, brandInfo = _d.brandInfo, entityInfo = _d.entityInfo, merchantInfo = _d.merchantInfo;
44
42
  var _e = React.useState(), listActive = _e[0], setListActive = _e[1];
45
43
  var _f = ((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}, brandList = _f.brandList, entityList = _f.entityList;
46
44
  var otpData = data.otpData;
@@ -57,8 +55,7 @@ var AuthenticationList = function (_a) {
57
55
  defaultValues: {
58
56
  brandInfo: brandInfo,
59
57
  entityInfo: entityInfo,
60
- merchantInfo: merchantInfo,
61
- terminalInfo: terminalInfo
58
+ merchantInfo: merchantInfo
62
59
  },
63
60
  mode: 'onChange'
64
61
  });
@@ -78,10 +75,6 @@ var AuthenticationList = function (_a) {
78
75
  if (merchantInfo && !methods.getValues('merchantInfo'))
79
76
  methods.setValue('merchantInfo', merchantInfo, { shouldValidate: true });
80
77
  }, [merchantInfo]);
81
- React.useEffect(function () {
82
- if (terminalInfo && !methods.getValues('terminalInfo'))
83
- methods.setValue('terminalInfo', terminalInfo, { shouldValidate: true });
84
- }, [terminalInfo]);
85
78
  React.useEffect(function () {
86
79
  if (error)
87
80
  dispatch(clearError());
@@ -95,7 +88,6 @@ var AuthenticationList = function (_a) {
95
88
  var isBrandList = listActive === ListType.BrandList;
96
89
  var isEntityList = listActive === ListType.EntityList;
97
90
  var isMerchantList = listActive === ListType.MerchantList;
98
- var isTerminalList = listActive === ListType.TerminalList;
99
- 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') })) }))] })) })) }));
91
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isEntityList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { list: entityList || [], countryList: settingsData.countries || [], show: !isBrandList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(MerchantList, { show: !isBrandList && !isEntityList, onListOpen: function () { return handleMenuClick(ListType.MerchantList); }, 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') })) }))] })) })) }));
100
92
  };
101
93
  export default React.memo(AuthenticationList);
@@ -48,11 +48,11 @@ var MerchantList = React.forwardRef(function (_a, ref) {
48
48
  var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
49
49
  var t = useTranslation().t;
50
50
  var dispatch = useAppDispatch();
51
- var _f = useFormContext(), control = _f.control, getValues = _f.getValues, setValue = _f.setValue;
51
+ var _f = useFormContext(), control = _f.control, watch = _f.watch, setValue = _f.setValue;
52
52
  var _g = useAppSelector(connectExpressSelector), data = _g.data, merchantLoading = _g.merchantLoading;
53
53
  var merchantList = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}).merchantList;
54
54
  var merchantInfoControl = useController({ control: control, name: 'merchantInfo' });
55
- var entityInfo = getValues('entityInfo');
55
+ var entityInfo = watch('entityInfo');
56
56
  var merchantValue = merchantInfoControl.field.value;
57
57
  var error = (_c = merchantInfoControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
58
58
  React.useEffect(function () {
@@ -63,16 +63,23 @@ var MerchantList = React.forwardRef(function (_a, ref) {
63
63
  }, [merchantList]);
64
64
  React.useEffect(function () {
65
65
  var _a;
66
+ if (!entityInfo)
67
+ return;
68
+ if (merchantLoading)
69
+ return;
66
70
  var entityId = (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0 ? (_a = merchantList[0]) === null || _a === void 0 ? void 0 : _a.business_entity_id : '';
67
71
  var id = (entityInfo || {}).id;
68
72
  if (!id)
69
73
  return;
70
- if (entityId !== id) {
74
+ if (entityId && id && entityId !== id) {
71
75
  setValue('merchantInfo', undefined);
72
- setValue('terminalInfo', undefined);
76
+ dispatch(getMerchantListAsync(id));
77
+ return;
78
+ }
79
+ if (!(merchantList === null || merchantList === void 0 ? void 0 : merchantList.length)) {
73
80
  dispatch(getMerchantListAsync(id));
74
81
  }
75
- }, [entityInfo]);
82
+ }, [entityInfo, merchantList]);
76
83
  var onOpenMerchantSelect = function (event) {
77
84
  if (readOnly)
78
85
  return;
@@ -93,7 +100,7 @@ var MerchantList = React.forwardRef(function (_a, ref) {
93
100
  return '';
94
101
  return merchant.display_name;
95
102
  };
96
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_merchant_label'), readOnly: readOnly, placeholder: t('select_merchant_placeholder'), value: getName(merchantValue) || '', warningMessage: error && t(error), onClick: merchantLoading ? undefined : !!anchorEl ? function () { return onCloseMerchantSelect(); } : onOpenMerchantSelect, endAdornment: merchantLoading ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : (_jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified })) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { list: list || [], onSelectItem: onSelectItem, renderItem: function (item) {
103
+ return (_jsx(Collapse, __assign({ in: show && (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 1 }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_merchant_label'), readOnly: readOnly, placeholder: t('select_merchant_placeholder'), value: getName(merchantValue) || '', warningMessage: error && t(error), onClick: merchantLoading ? undefined : !!anchorEl ? function () { return onCloseMerchantSelect(); } : onOpenMerchantSelect, endAdornment: merchantLoading ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : (_jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified })) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { list: list || [], onSelectItem: onSelectItem, renderItem: function (item) {
97
104
  return (_jsxs(_Fragment, { children: [_jsx(MerchantContainer, { children: _jsx(MerchantNameText, __assign({ isSelected: item.id === (merchantValue === null || merchantValue === void 0 ? void 0 : merchantValue.id) }, { children: getName(item) })) }), item.id === (merchantValue === null || merchantValue === void 0 ? void 0 : merchantValue.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
98
105
  } }) }))] })) })));
99
106
  });
@@ -3,15 +3,12 @@ export declare const AuthenticationListValidationSchema: () => yup.ObjectSchema<
3
3
  brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
4
4
  entityInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
5
5
  merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
6
- terminalInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
7
6
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
8
7
  brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
9
8
  entityInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
10
9
  merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
11
- terminalInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
12
10
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
11
  brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
14
12
  entityInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
15
13
  merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
16
- terminalInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
17
14
  }>>>;
@@ -3,7 +3,6 @@ export var AuthenticationListValidationSchema = function () {
3
3
  return yup.object().shape({
4
4
  brandInfo: yup.object().required('auth_brand_required'),
5
5
  entityInfo: yup.object().required('auth_entity_required'),
6
- merchantInfo: yup.object().required('auth_merchant_required'),
7
- terminalInfo: yup.object().required('auth_terminal_required')
6
+ merchantInfo: yup.object().required('auth_merchant_required')
8
7
  });
9
8
  };
@@ -30,7 +30,9 @@ export var useAppConfig = function (_a) {
30
30
  var dispatch = useAppDispatch();
31
31
  var data = useAppSelector(settingsSelector).data;
32
32
  var setAppConfig = function () {
33
- dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey }, rest)));
33
+ if (!disableSettingFetching) {
34
+ dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey }, rest)));
35
+ }
34
36
  dispatch(handleActiveFlowScreens(navigation));
35
37
  };
36
38
  var checkDomain = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.24-test",
3
+ "version": "2.6.26-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- interface TerminalListProps {
3
- show: boolean;
4
- onListOpen?: () => void;
5
- onListClose?: () => void;
6
- readOnly?: boolean;
7
- isVerified?: boolean;
8
- }
9
- declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<TerminalListProps & React.RefAttributes<unknown>>>;
10
- export default _default;
@@ -1,101 +0,0 @@
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 __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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
22
- import * as React from 'react';
23
- import Box from '@mui/material/Box';
24
- import { useTranslation } from 'react-i18next';
25
- import { useController, useFormContext } from 'react-hook-form';
26
- import { styled } from '@mui/material/styles';
27
- import CircularProgress from '@mui/material/CircularProgress';
28
- import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
29
- import Collapse from '../../../../components/Collapse';
30
- import Text from '../../../../components/Text';
31
- import SimpleList from '../../../../components/SimpleList';
32
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
33
- import InputSelect from '../../../shared/InputSelect';
34
- import { getTerminalListAsync, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
35
- import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
36
- import CheckIcon from '../../../shared/CheckIcon';
37
- var TerminalContainer = styled(Box)(function () { return ({
38
- display: 'flex'
39
- }); });
40
- var TerminalNameText = 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, paddingInlineStart: theme.spacing(1.25) }));
43
- });
44
- var TerminalList = React.forwardRef(function (_a, ref) {
45
- var _b, _c;
46
- var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly, isVerified = _a.isVerified;
47
- var _d = React.useState([]), list = _d[0], setList = _d[1];
48
- var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
49
- var t = useTranslation().t;
50
- var dispatch = useAppDispatch();
51
- var isAr = useLanguage().isAr;
52
- var _f = useFormContext(), control = _f.control, getValues = _f.getValues, setValue = _f.setValue;
53
- var _g = useAppSelector(connectExpressSelector), data = _g.data, terminalLoading = _g.terminalLoading;
54
- var terminalList = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}).terminalList;
55
- var terminalInfoControl = useController({ control: control, name: 'terminalInfo' });
56
- var merchantInfo = getValues('merchantInfo');
57
- var terminalValue = terminalInfoControl.field.value;
58
- var error = (_c = terminalInfoControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
59
- React.useEffect(function () {
60
- if ((terminalList === null || terminalList === void 0 ? void 0 : terminalList.length) > 0) {
61
- var list_1 = __spreadArray([], terminalList, true);
62
- setList(list_1);
63
- }
64
- }, [terminalList]);
65
- React.useEffect(function () {
66
- var _a, _b;
67
- var merchantId = (terminalList === null || terminalList === void 0 ? void 0 : terminalList.length) > 0 ? (_b = (_a = terminalList[0]) === null || _a === void 0 ? void 0 : _a.merchant) === null || _b === void 0 ? void 0 : _b.id : '';
68
- var id = (merchantInfo || {}).id;
69
- if (!id)
70
- return;
71
- if (merchantId !== id) {
72
- setValue('terminalInfo', undefined);
73
- dispatch(getTerminalListAsync(id));
74
- }
75
- }, [merchantInfo]);
76
- var onOpenTerminalSelect = function (event) {
77
- if (readOnly)
78
- return;
79
- setAnchorEl(event.currentTarget);
80
- onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
81
- };
82
- var onCloseTerminalSelect = function () {
83
- setAnchorEl(null);
84
- onListClose === null || onListClose === void 0 ? void 0 : onListClose();
85
- setList(terminalList);
86
- };
87
- var onSelectItem = function (terminal) {
88
- onCloseTerminalSelect();
89
- terminalInfoControl.field.onChange(terminal);
90
- };
91
- var getName = function (terminal) {
92
- var _a, _b, _c;
93
- if (!terminal)
94
- return '';
95
- return isAr ? ((_a = terminal.name) === null || _a === void 0 ? void 0 : _a.ar) || ((_b = terminal.name) === null || _b === void 0 ? void 0 : _b.en) : (_c = terminal.name) === null || _c === void 0 ? void 0 : _c.en;
96
- };
97
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_terminal_label'), readOnly: readOnly, placeholder: t('select_terminal_placeholder'), value: getName(terminalValue) || '', warningMessage: error && t(error), onClick: terminalLoading ? undefined : !!anchorEl ? function () { return onCloseTerminalSelect(); } : onOpenTerminalSelect, endAdornment: terminalLoading ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : (_jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified })) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { list: list || [], onSelectItem: onSelectItem, renderItem: function (item) {
98
- return (_jsxs(_Fragment, { children: [_jsx(TerminalContainer, { children: _jsx(TerminalNameText, __assign({ isSelected: item.id === (terminalValue === null || terminalValue === void 0 ? void 0 : terminalValue.id) }, { children: getName(item) })) }), item.id === (terminalValue === null || terminalValue === void 0 ? void 0 : terminalValue.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
99
- } }) }))] })) })));
100
- });
101
- export default React.memo(TerminalList);