@tap-payments/auth-jsconnect 2.6.98-test → 2.6.101-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.
Files changed (42) hide show
  1. package/build/@types/form.d.ts +0 -1
  2. package/build/app/settings.d.ts +3 -4
  3. package/build/app/settings.js +6 -9
  4. package/build/constants/app.js +13 -1
  5. package/build/features/app/auth/authStore.d.ts +14 -9
  6. package/build/features/app/auth/authStore.js +99 -25
  7. package/build/features/app/connectExpress/connectExpressStore.d.ts +1 -1
  8. package/build/features/auth/screens/AccountCreatedLoader/AccountCreatedLoader.d.ts +5 -0
  9. package/build/features/auth/screens/AccountCreatedLoader/AccountCreatedLoader.js +36 -0
  10. package/build/features/auth/screens/AccountCreatedLoader/index.d.ts +2 -0
  11. package/build/features/auth/screens/AccountCreatedLoader/index.js +2 -0
  12. package/build/features/auth/screens/AuthMerchant/AuthMerchant.d.ts +5 -0
  13. package/build/features/auth/screens/AuthMerchant/AuthMerchant.js +73 -0
  14. package/build/features/auth/screens/{AuthenticationList → AuthMerchant}/MerchantList.d.ts +2 -1
  15. package/build/features/auth/screens/AuthMerchant/MerchantList.js +64 -0
  16. package/build/features/auth/screens/AuthMerchant/index.d.ts +2 -0
  17. package/build/features/auth/screens/AuthMerchant/index.js +2 -0
  18. package/build/features/auth/screens/AuthMerchant/validation.d.ts +8 -0
  19. package/build/features/auth/screens/AuthMerchant/validation.js +4 -0
  20. package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +28 -17
  21. package/build/features/auth/screens/AuthenticationList/EntityLegalName.d.ts +3 -0
  22. package/build/features/auth/screens/AuthenticationList/EntityLegalName.js +48 -0
  23. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +31 -0
  24. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +90 -0
  25. package/build/features/auth/screens/AuthenticationList/EntityList.d.ts +3 -3
  26. package/build/features/auth/screens/AuthenticationList/EntityList.js +51 -9
  27. package/build/features/auth/screens/AuthenticationList/LicenseNumber.d.ts +3 -0
  28. package/build/features/auth/screens/AuthenticationList/LicenseNumber.js +36 -0
  29. package/build/features/auth/screens/AuthenticationList/validation.d.ts +13 -7
  30. package/build/features/auth/screens/AuthenticationList/validation.js +66 -6
  31. package/build/features/bank/Bank.js +3 -3
  32. package/build/features/brand/Brand.js +3 -3
  33. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +1 -0
  34. package/build/features/entity/Entity.js +3 -3
  35. package/build/features/featuresScreens.js +10 -0
  36. package/build/features/individual/Individual.js +3 -3
  37. package/build/features/password/Password.js +1 -1
  38. package/build/features/tax/Tax.js +3 -3
  39. package/build/hooks/useAppConfig.js +2 -3
  40. package/build/utils/locale.js +2 -1
  41. package/package.json +1 -1
  42. package/build/features/auth/screens/AuthenticationList/MerchantList.js +0 -110
@@ -38,9 +38,9 @@ import Background from '../shared/Background';
38
38
  var Bank = memo(function (_a) {
39
39
  var verifyToken = _a.verifyToken, configToken = _a.configToken, loaderColor = _a.loaderColor, props = __rest(_a, ["verifyToken", "configToken", "loaderColor"]);
40
40
  var theme = useAppTheme().theme;
41
- var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading, internalLoading = _b.internalLoading;
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
42
  var _c = useAppSelector(bankSelector), customLoading = _c.customLoading, loading = _c.loading, bankError = _c.error;
43
- useAppConfig(__assign(__assign({ configToken: configToken, navigation: BANK_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken }));
43
+ useAppConfig(__assign(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }));
44
44
  useErrorListener(bankError || error);
45
45
  useStepStartedListener();
46
46
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
@@ -56,7 +56,7 @@ var Bank = memo(function (_a) {
56
56
  open: open,
57
57
  mode: props.mode,
58
58
  internalToken: verifyToken,
59
- settingLoading: configToken ? internalLoading : settingLoading
59
+ settingLoading: settingLoading
60
60
  });
61
61
  var initialLoading = verifyToken && props.mode !== 'content' ? settingLoading : settingLoading || customLoading;
62
62
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ mode: props.mode, open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: initialLoading, error: error, open: open, breakpoint: 'sm', screenId: activeScreen.name, merchantInfo: merchant, loaderColor: loaderColor, isMaturityExpress: isMaturityExpress, type: props.mode === 'content' ? 'CONTENT' : undefined }, { children: _jsx(FeatureContainer, __assign({ mode: props.mode, isMaturityExpress: isMaturityExpress }, { children: bankFeatureScreens.map(function (_a, index) {
@@ -38,9 +38,9 @@ import Background from '../shared/Background';
38
38
  var Brand = memo(function (_a) {
39
39
  var verifyToken = _a.verifyToken, configToken = _a.configToken, loaderColor = _a.loaderColor, props = __rest(_a, ["verifyToken", "configToken", "loaderColor"]);
40
40
  var theme = useAppTheme().theme;
41
- var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading, internalLoading = _b.internalLoading;
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
42
  var _c = useAppSelector(brandSelector), customLoading = _c.customLoading, loading = _c.loading, brandError = _c.error;
43
- useAppConfig(__assign(__assign({ configToken: configToken, navigation: BRAND_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken }));
43
+ useAppConfig(__assign(__assign({ navigation: BRAND_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }));
44
44
  useErrorListener(brandError || error);
45
45
  useStepStartedListener();
46
46
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
@@ -56,7 +56,7 @@ var Brand = memo(function (_a) {
56
56
  open: open,
57
57
  mode: props.mode,
58
58
  internalToken: verifyToken,
59
- settingLoading: configToken ? internalLoading : settingLoading
59
+ settingLoading: settingLoading
60
60
  });
61
61
  var initialLoading = verifyToken && props.mode !== 'content' ? settingLoading : settingLoading || customLoading;
62
62
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ mode: props.mode, open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: initialLoading, error: error, open: open, breakpoint: 'sm', screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress, loaderColor: loaderColor, type: props.mode === 'content' ? 'CONTENT' : undefined }, { children: _jsx(FeatureContainer, __assign({ mode: props.mode, isMaturityExpress: isMaturityExpress }, { children: brandFeatureScreens.map(function (_a, index) {
@@ -81,6 +81,7 @@ var EntityList = function (_a) {
81
81
  if (filteredEntityList.length) {
82
82
  setValue('entityInfo', filteredEntityList[0], { shouldValidate: true });
83
83
  setValue('licenseNumber', '');
84
+ setValue('licenseType', '');
84
85
  setValue('legalName', '');
85
86
  handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
86
87
  }
@@ -38,9 +38,9 @@ import Background from '../shared/Background';
38
38
  var Entity = memo(function (_a) {
39
39
  var configToken = _a.configToken, verifyToken = _a.verifyToken, loaderColor = _a.loaderColor, props = __rest(_a, ["configToken", "verifyToken", "loaderColor"]);
40
40
  var theme = useAppTheme().theme;
41
- var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading, internalLoading = _b.internalLoading;
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
42
  var _c = useAppSelector(entitySelector), customLoading = _c.customLoading, entityError = _c.error, loading = _c.loading;
43
- useAppConfig(__assign(__assign({ configToken: configToken, navigation: ENTITY_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken }));
43
+ useAppConfig(__assign(__assign({ navigation: ENTITY_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }));
44
44
  useErrorListener(entityError || error);
45
45
  useStepStartedListener();
46
46
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
@@ -51,7 +51,7 @@ var Entity = memo(function (_a) {
51
51
  open: open,
52
52
  mode: props.mode,
53
53
  internalToken: verifyToken,
54
- settingLoading: configToken ? internalLoading : settingLoading
54
+ settingLoading: settingLoading
55
55
  });
56
56
  React.useEffect(function () {
57
57
  sendPageView({
@@ -36,6 +36,8 @@ import AuthOTPScreen from './auth/screens/OTP';
36
36
  import PreparingDataScreen from './auth/screens/PreparingData';
37
37
  import AccountNotFoundScreen from './auth/screens/AccountNotFound';
38
38
  import AuthAuthenticationListScreen from './auth/screens/AuthenticationList';
39
+ import AuthMerchantScreen from './auth/screens/AuthMerchant';
40
+ import AuthAccountCreatedLoaderScreen from './auth/screens/AccountCreatedLoader';
39
41
  import CustomersPage from './business/screens/Customers';
40
42
  import IDBODPage from './business/screens/IDBOD';
41
43
  import BusinessVerifyPage from './business/screens/Verify';
@@ -253,6 +255,14 @@ export var authFeatureScreens = [
253
255
  {
254
256
  name: 'AUTH_AUTHENTICATION_LIST_STEP',
255
257
  element: AuthAuthenticationListScreen
258
+ },
259
+ {
260
+ name: 'AUTH_MERCHANT_LIST_STEP',
261
+ element: AuthMerchantScreen
262
+ },
263
+ {
264
+ name: 'AUTH_ACCOUNT_CREATED_STEP',
265
+ element: AuthAccountCreatedLoaderScreen
256
266
  }
257
267
  ];
258
268
  export var businessFeatureScreens = [
@@ -38,9 +38,9 @@ import Background from '../shared/Background';
38
38
  var Individual = memo(function (_a) {
39
39
  var configToken = _a.configToken, verifyToken = _a.verifyToken, loaderColor = _a.loaderColor, props = __rest(_a, ["configToken", "verifyToken", "loaderColor"]);
40
40
  var theme = useAppTheme().theme;
41
- var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading, internalLoading = _b.internalLoading;
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
42
  var _c = useAppSelector(individualSelector), customLoading = _c.customLoading, individualError = _c.error, loading = _c.loading;
43
- useAppConfig(__assign(__assign({ configToken: configToken, navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken }));
43
+ useAppConfig(__assign(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }));
44
44
  useErrorListener(individualError || error);
45
45
  useStepStartedListener();
46
46
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
@@ -51,7 +51,7 @@ var Individual = memo(function (_a) {
51
51
  open: open,
52
52
  mode: props.mode,
53
53
  internalToken: verifyToken,
54
- settingLoading: configToken ? internalLoading : settingLoading
54
+ settingLoading: settingLoading
55
55
  });
56
56
  React.useEffect(function () {
57
57
  sendPageView({
@@ -41,7 +41,7 @@ var Password = memo(function (_a) {
41
41
  var dispatch = useAppDispatch();
42
42
  var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
43
43
  var _c = useAppSelector(passwordSelector), customLoading = _c.customLoading, passwordError = _c.error, loading = _c.loading;
44
- useAppConfig(__assign({ configToken: configToken, navigation: PASSWORD_SCREENS_NAVIGATION }, props));
44
+ useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION, disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }, props));
45
45
  useErrorListener(passwordError || error);
46
46
  useStepStartedListener();
47
47
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
@@ -38,9 +38,9 @@ import Background from '../shared/Background';
38
38
  var Tax = memo(function (_a) {
39
39
  var configToken = _a.configToken, verifyToken = _a.verifyToken, loaderColor = _a.loaderColor, props = __rest(_a, ["configToken", "verifyToken", "loaderColor"]);
40
40
  var theme = useAppTheme().theme;
41
- var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading, internalLoading = _b.internalLoading;
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
42
  var _c = useAppSelector(taxSelector), customLoading = _c.customLoading, taxError = _c.error, loading = _c.loading;
43
- useAppConfig(__assign(__assign({ configToken: configToken, navigation: TAX_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken }));
43
+ useAppConfig(__assign(__assign({ navigation: TAX_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }));
44
44
  useErrorListener(taxError || error);
45
45
  useStepStartedListener();
46
46
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
@@ -56,7 +56,7 @@ var Tax = memo(function (_a) {
56
56
  open: open,
57
57
  mode: props.mode,
58
58
  internalToken: verifyToken,
59
- settingLoading: configToken ? internalLoading : settingLoading
59
+ settingLoading: settingLoading
60
60
  });
61
61
  var initialLoading = verifyToken && props.mode !== 'content' ? settingLoading : settingLoading || customLoading;
62
62
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ mode: props.mode, open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, open: open, error: error, loading: initialLoading, loaderColor: loaderColor, breakpoint: 'sm', screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress, type: props.mode === 'content' ? 'CONTENT' : undefined }, { children: _jsx(FeatureContainer, __assign({ mode: props.mode, isMaturityExpress: isMaturityExpress }, { children: taxFeatureScreens.map(function (_a, index) {
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { useEffect } from 'react';
24
- import { handleActiveFlowScreens, handleSetAppConfig, handleLanguage, handleOpen, handleIsTapOrigin, fetchAppSettingsSync, handelBoardMaturity, settingsSelector, updateInternalLoading } from '../app/settings';
24
+ import { handleActiveFlowScreens, handleSetAppConfig, handleLanguage, handleOpen, handleIsTapOrigin, fetchAppSettingsSync, handelBoardMaturity, settingsSelector } from '../app/settings';
25
25
  import { useAppDispatch } from './useAppDispatch';
26
26
  import { useAppSelector } from './useAppSelector';
27
27
  import { isConnectTapDomain, removeRequestHeaders, setBaseUrl } from '../utils';
@@ -47,7 +47,6 @@ export var useAppConfig = function (_a) {
47
47
  return;
48
48
  if (!disableSettingFetching && !configToken)
49
49
  removeRequestHeaders();
50
- dispatch(updateInternalLoading(true));
51
50
  checkDomain();
52
51
  setBaseUrl(publicKey);
53
52
  setAppConfig();
@@ -55,7 +54,7 @@ export var useAppConfig = function (_a) {
55
54
  dispatch(handelBoardMaturity(boardMaturity));
56
55
  if (!data.isMaturityExpress)
57
56
  dispatch(handleLanguage(rest.language));
58
- if (!disableSettingFetching || configToken)
57
+ if (!disableSettingFetching)
59
58
  dispatch(fetchAppSettingsSync({
60
59
  disableCountries: disableCountries,
61
60
  disableLocale: disableLocale,
@@ -1,7 +1,8 @@
1
1
  import { initReactI18next } from 'react-i18next';
2
2
  import i18n from '../i18n';
3
3
  export var updateLocale = function (locale, country) {
4
- var data = locale['SA'] || locale[country.toUpperCase()] || locale['default'];
4
+ var _a;
5
+ var data = (_a = locale[country.toUpperCase()]) !== null && _a !== void 0 ? _a : (locale['SA'] || locale['default']);
5
6
  if (i18n.isInitialized) {
6
7
  i18n.removeResourceBundle('*', 'translation');
7
8
  i18n.addResourceBundle('en', 'translation', data.en.translation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.98-test",
3
+ "version": "2.6.101-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,110 +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 { useTranslation } from 'react-i18next';
24
- import { useController, useFormContext } from 'react-hook-form';
25
- import { styled } from '@mui/material/styles';
26
- import Box from '@mui/material/Box';
27
- import CircularProgress from '@mui/material/CircularProgress';
28
- import { useAppDispatch, useAppSelector } 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 { getMerchantList, authSelector } from '../../../app/auth/authStore';
35
- import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
36
- import CheckIcon from '../../../shared/CheckIcon';
37
- var MerchantContainer = styled(Box)(function () { return ({
38
- display: 'flex'
39
- }); });
40
- var MerchantNameText = 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 MerchantList = React.forwardRef(function (_a, ref) {
45
- var _b;
46
- var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly, isVerified = _a.isVerified;
47
- var _c = React.useState([]), list = _c[0], setList = _c[1];
48
- var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
49
- var t = useTranslation().t;
50
- var dispatch = useAppDispatch();
51
- var _e = useFormContext(), control = _e.control, watch = _e.watch, setValue = _e.setValue;
52
- var _f = useAppSelector(authSelector), data = _f.data, merchantLoading = _f.merchantLoading;
53
- var merchantList = (data.responseData || {}).merchantList;
54
- var merchantInfoControl = useController({ control: control, name: 'merchantInfo' });
55
- var entityInfo = watch('entityInfo');
56
- var brandInfo = watch('brandInfo');
57
- var merchantValue = merchantInfoControl.field.value;
58
- var error = (_b = merchantInfoControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
59
- React.useEffect(function () {
60
- if ((merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0) {
61
- var list_1 = __spreadArray([], merchantList, true);
62
- setList(list_1);
63
- }
64
- }, [merchantList]);
65
- React.useEffect(function () {
66
- var _a, _b;
67
- if (!entityInfo)
68
- return;
69
- if (merchantLoading)
70
- return;
71
- var brandInfoId = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id;
72
- 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 : '';
73
- var brandId = (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0 ? (_b = merchantList[0]) === null || _b === void 0 ? void 0 : _b.brand_id : '';
74
- var id = (entityInfo || {}).id;
75
- if (!id)
76
- return;
77
- if ((entityId && id && entityId !== id) || (brandId && brandInfoId && brandId !== brandInfoId)) {
78
- setValue('merchantInfo', undefined);
79
- dispatch(getMerchantList({ entityId: id, brandId: brandInfoId }));
80
- return;
81
- }
82
- if (!(merchantList === null || merchantList === void 0 ? void 0 : merchantList.length)) {
83
- dispatch(getMerchantList({ entityId: id, brandId: brandInfoId }));
84
- }
85
- }, [entityInfo, merchantList, brandInfo]);
86
- var onOpenMerchantSelect = function (event) {
87
- if (readOnly)
88
- return;
89
- setAnchorEl(event.currentTarget);
90
- onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
91
- };
92
- var onCloseMerchantSelect = function () {
93
- setAnchorEl(null);
94
- onListClose === null || onListClose === void 0 ? void 0 : onListClose();
95
- setList(merchantList);
96
- };
97
- var onSelectItem = function (merchant) {
98
- onCloseMerchantSelect();
99
- merchantInfoControl.field.onChange(merchant);
100
- };
101
- var getName = function (merchant) {
102
- if (!merchant)
103
- return '';
104
- return merchant.display_name;
105
- };
106
- 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) {
107
- 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 })] }));
108
- } }) }))] })) })));
109
- });
110
- export default React.memo(MerchantList);