@tap-payments/auth-jsconnect 2.10.15-development → 2.10.17-development

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.
@@ -76,12 +76,13 @@ var EntityList = function (_a) {
76
76
  var selectedEntity = selectedEntityControl.field.value;
77
77
  React.useEffect(function () {
78
78
  if (entityList.length > 0) {
79
- var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; });
80
- var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false) || [];
79
+ var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; }) || [];
80
+ var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false);
81
81
  setList(list_1);
82
82
  if (filteredEntityList.length) {
83
83
  setValue('entityInfo', filteredEntityList[0], { shouldValidate: true });
84
84
  setValue('licenseNumber', '');
85
+ setValue('unifiedNumber', '');
85
86
  setValue('licenseType', '');
86
87
  setValue('legalName', '');
87
88
  handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
@@ -125,6 +126,7 @@ var EntityList = function (_a) {
125
126
  handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(true);
126
127
  else {
127
128
  setValue('licenseNumber', '');
129
+ setValue('unifiedNumber', '');
128
130
  setValue('legalName', '');
129
131
  setValue('licenseType', '');
130
132
  handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
@@ -36,7 +36,7 @@ import { businessSelector, clearError } from '../../../app/business/businessStor
36
36
  import Text from '../../../../components/Text';
37
37
  import ExpandIcon from '../../../../components/ExpandIcon';
38
38
  import Collapse from '../../../../components/Collapse';
39
- import { isKW, isOtherLicense, isSA } from '../../../../utils';
39
+ import { isKW, isOtherLicense } from '../../../../utils';
40
40
  import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
41
41
  import { settingsSelector } from '../../../../app/settings';
42
42
  var InputStyled = styled(InputSelect)(function (_a) {
@@ -104,8 +104,6 @@ var LicenseList = function (_a) {
104
104
  };
105
105
  var getLicenseName = function (item) {
106
106
  var _a, _b;
107
- if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.CR && isOtherLicense(item) && isSA(country_code))
108
- return t('v1_add_unified_number');
109
107
  if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.FL && !isOtherLicense(item))
110
108
  return t('future_work');
111
109
  return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
@@ -75,12 +75,13 @@ var EntityList = function (_a) {
75
75
  var selectedEntityControl = useController({ control: control, name: 'entityInfo' });
76
76
  React.useEffect(function () {
77
77
  if (entityList.length > 0) {
78
- var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; });
79
- var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false) || [];
78
+ var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; }) || [];
79
+ var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false);
80
80
  setList(list_1);
81
81
  if (filteredEntityList.length) {
82
82
  setValue('entityInfo', filteredEntityList[0], { shouldValidate: true });
83
83
  setValue('licenseNumber', '');
84
+ setValue('unifiedNumber', '');
84
85
  setValue('licenseType', '');
85
86
  setValue('legalName', '');
86
87
  handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
@@ -124,6 +125,7 @@ var EntityList = function (_a) {
124
125
  handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(true);
125
126
  else {
126
127
  setValue('licenseNumber', '');
128
+ setValue('unifiedNumber', '');
127
129
  setValue('legalName', '');
128
130
  setValue('licenseType', '');
129
131
  handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
@@ -110,8 +110,6 @@ var LicenseList = function (_a) {
110
110
  };
111
111
  var getLicenseName = function (item) {
112
112
  var _a, _b;
113
- if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.CR && isOtherLicense(item) && isSACountry)
114
- return t('v1_add_unified_number');
115
113
  if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.FL && !isOtherLicense(item))
116
114
  return t('future_work');
117
115
  return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
@@ -19,6 +19,7 @@ export interface DataProps {
19
19
  emailUrl: string;
20
20
  brandName?: string;
21
21
  isAuthorizedUser?: boolean;
22
+ terminalStepName?: string;
22
23
  }
23
24
  export interface EmailProvidersButtonsProps extends ButtonProps {
24
25
  buttons: ButtonItemProps[];
@@ -177,7 +177,7 @@ export default function FlowsButtons(_a) {
177
177
  });
178
178
  if (flowName === item.name && !isResetPassword(item.name, item.status)) {
179
179
  var isOtherThanSAOrKWCountry = !isKWOrSA(settingsData.businessCountry.iso2);
180
- dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry)));
180
+ dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry, data.terminalStepName)));
181
181
  return;
182
182
  }
183
183
  if (typeof settingsData.appConfig.onBoardButtonClick === 'function') {
@@ -19,6 +19,7 @@ interface SuccessFlowButtonsProps {
19
19
  onClose?: () => void;
20
20
  loading?: boolean;
21
21
  status: 'complete' | 'incomplete';
22
+ terminalStepName?: string;
22
23
  }
23
- declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status }: SuccessFlowButtonsProps) => JSX.Element>;
24
+ declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status, terminalStepName }: SuccessFlowButtonsProps) => JSX.Element>;
24
25
  export default _default;
@@ -45,7 +45,7 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
45
45
  });
46
46
  var SuccessFlowButtons = function (_a) {
47
47
  var _b, _c, _d;
48
- var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals, recipient = _a.recipient, onClose = _a.onClose, loading = _a.loading, status = _a.status;
48
+ var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals, recipient = _a.recipient, onClose = _a.onClose, loading = _a.loading, status = _a.status, terminalStepName = _a.terminalStepName;
49
49
  var _e = useState([]), buttons = _e[0], setButtons = _e[1];
50
50
  var t = useTranslation().t;
51
51
  var isAr = useLanguage().isAr;
@@ -127,7 +127,8 @@ var SuccessFlowButtons = function (_a) {
127
127
  email: email || '',
128
128
  emailUrl: url,
129
129
  brandName: shortenBrand(brandName),
130
- isAuthorizedUser: is_authorized
130
+ isAuthorizedUser: is_authorized,
131
+ terminalStepName: terminalStepName
131
132
  } }) })] }));
132
133
  };
133
134
  export default memo(SuccessFlowButtons);
@@ -14,6 +14,8 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
16
16
  import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
17
+ import Button from '../../../../components/Button';
18
+ import Loader from '../../../../components/Loader';
17
19
  import { ICONS_NAMES } from '../../../../constants';
18
20
  import { ScreenContainer } from '../../../shared/Containers';
19
21
  import { linkNewTerminal, retrieveBoardDetails, retrieveBoardStatus, terminalSelector } from '../../../app/terminal/terminalStore';
@@ -51,6 +53,6 @@ var NoTerminalDeviceLinked = function () {
51
53
  })
52
54
  .catch(function () { });
53
55
  };
54
- return (_jsx(ScreenContainer, __assign({ sx: { ml: 2.5, mr: 2.5 }, minHeight: 280, justifyContent: 'space-between' }, { children: _jsxs(NoTerminalDeviceLinkedContainer, { children: [_jsx(DeviceImage, { src: ICONS_NAMES.terminal_device }), _jsx(TitleTypography, { children: t('terminal_no_terminal_linked') }), _jsx(DescriptionTypography, { children: t('terminal_no_terminal_linked_description') })] }) })));
56
+ return (_jsxs(ScreenContainer, __assign({ sx: { ml: 2.5, mr: 2.5 }, minHeight: 280, justifyContent: 'space-between' }, { children: [_jsxs(NoTerminalDeviceLinkedContainer, { children: [_jsx(DeviceImage, { src: ICONS_NAMES.terminal_device }), _jsx(TitleTypography, { children: t('terminal_no_terminal_linked') }), _jsx(DescriptionTypography, { children: t('terminal_no_terminal_linked_description') })] }), _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') }))] })));
55
57
  };
56
58
  export default React.memo(NoTerminalDeviceLinked);
@@ -13,19 +13,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo } from 'react';
14
14
  import { settingsSelector } from '../../../../app/settings';
15
15
  import { useAppSelector, useAppDispatch } from '../../../../hooks';
16
- import { SCOPE_AUTH } from '../../../../constants';
16
+ import { CONNECT_FLOWS, SCOPE_AUTH } from '../../../../constants';
17
17
  import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
18
18
  import { onCloseCompleteTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
19
19
  var SuccessWithFlowButtons = function () {
20
+ var _a;
20
21
  var dispatch = useAppDispatch();
21
- var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading;
22
+ var _b = useAppSelector(terminalSelector), data = _b.data, loading = _b.loading;
22
23
  var settingsData = useAppSelector(settingsSelector).data;
23
24
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var _b = data.responseData || {}, boardFlows = _b.boardFlows, boardData = _b.boardData;
25
- var _c = boardData || {}, entity = _c.entity, brand = _c.brand, bank = _c.bank_account, merchant = _c.merchant, user = _c.user, business = _c.business, board_id = _c.board_id, board_info_id = _c.board_info_id, name = _c.name, individuals = _c.individuals, recipient = _c.recipient, board_status = _c.board_status;
25
+ var _c = data.responseData || {}, boardFlows = _c.boardFlows, boardData = _c.boardData, terminalData = _c.terminalData;
26
+ var _d = boardData || {}, entity = _d.entity, brand = _d.brand, bank = _d.bank_account, merchant = _d.merchant, user = _d.user, business = _d.business, board_id = _d.board_id, board_info_id = _d.board_info_id, name = _d.name, individuals = _d.individuals, recipient = _d.recipient, board_status = _d.board_status;
26
27
  var onClose = function () {
27
28
  dispatch(onCloseCompleteTerminal());
28
29
  };
29
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status }));
30
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status, terminalStepName: ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.terminal_devices) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked }));
30
31
  };
31
32
  export default memo(SuccessWithFlowButtons);
@@ -43,7 +43,7 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
43
43
  };
44
44
  export declare const removeRequestHeaders: () => void;
45
45
  export declare const getBaseUrl: () => string;
46
- export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean) => string;
46
+ export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean, terminalStepName?: string) => string;
47
47
  export declare const getEighteenYearsAgo: () => string;
48
48
  export declare const isKW: (flag: string) => boolean;
49
49
  export declare const isSA: (flag: string) => boolean;
@@ -179,7 +179,7 @@ export var getBaseUrl = function () {
179
179
  }
180
180
  return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
181
181
  };
182
- export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry) {
182
+ export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry, terminalStepName) {
183
183
  if (flow === FlowsTypes.BANK) {
184
184
  return 'BANK_BANK_DETAILS_STEP';
185
185
  }
@@ -205,7 +205,7 @@ export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherT
205
205
  return 'PASSWORD_CREATE_PASSWORD_STEP';
206
206
  }
207
207
  if (flow === FlowsTypes.TERMINAL) {
208
- return CONNECT_FLOWS.terminal.terminalDeviceList;
208
+ return terminalStepName !== null && terminalStepName !== void 0 ? terminalStepName : CONNECT_FLOWS.terminal.terminalDeviceList;
209
209
  }
210
210
  return '';
211
211
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.10.15-development",
3
+ "version": "2.10.17-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",