@reltio/components 1.4.2238 → 1.4.2239
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/DataTenantBadge/DataTenantBadge.js +3 -3
- package/DataTenantBadge/DataTenantBadge.test.js +3 -3
- package/EntityUriLink/EntityUriLink.d.ts +1 -0
- package/EntityUriLink/EntityUriLink.js +2 -2
- package/ProfileCard/ProfileCard.d.ts +2 -1
- package/ProfileCard/ProfileCard.js +2 -2
- package/ProfileCard/ProfileCard.test.js +19 -0
- package/ProfileCard/components/ProfileCardContent/ProfileCardContent.d.ts +2 -1
- package/ProfileCard/components/ProfileCardContent/ProfileCardContent.js +2 -2
- package/TenantsDropDownSelector/TenantsDropDownSelector.d.ts +2 -1
- package/TenantsDropDownSelector/TenantsDropDownSelector.js +2 -3
- package/TenantsDropDownSelector/TenantsDropDownSelector.spec.js +34 -3
- package/cjs/DataTenantBadge/DataTenantBadge.js +2 -2
- package/cjs/DataTenantBadge/DataTenantBadge.test.js +3 -3
- package/cjs/EntityUriLink/EntityUriLink.d.ts +1 -0
- package/cjs/EntityUriLink/EntityUriLink.js +2 -2
- package/cjs/ProfileCard/ProfileCard.d.ts +2 -1
- package/cjs/ProfileCard/ProfileCard.js +2 -2
- package/cjs/ProfileCard/ProfileCard.test.js +19 -0
- package/cjs/ProfileCard/components/ProfileCardContent/ProfileCardContent.d.ts +2 -1
- package/cjs/ProfileCard/components/ProfileCardContent/ProfileCardContent.js +2 -2
- package/cjs/TenantsDropDownSelector/TenantsDropDownSelector.d.ts +2 -1
- package/cjs/TenantsDropDownSelector/TenantsDropDownSelector.js +1 -2
- package/cjs/TenantsDropDownSelector/TenantsDropDownSelector.spec.js +34 -3
- package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/cjs/contexts/MdmModuleContext/hooks.js +6 -2
- package/cjs/contexts/MdmModuleContext/index.d.ts +1 -1
- package/cjs/contexts/MdmModuleContext/index.js +3 -2
- package/cjs/hooks/useMatchesLoader/useMatchesLoader.js +3 -1
- package/cjs/hooks/useMatchesLoader/useMatchesLoader.test.js +124 -22
- package/contexts/MdmModuleContext/context.d.ts +2 -0
- package/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/contexts/MdmModuleContext/hooks.js +3 -0
- package/contexts/MdmModuleContext/index.d.ts +1 -1
- package/contexts/MdmModuleContext/index.js +1 -1
- package/hooks/useMatchesLoader/useMatchesLoader.js +4 -2
- package/hooks/useMatchesLoader/useMatchesLoader.test.js +125 -23
- package/package.json +2 -2
|
@@ -3,14 +3,14 @@ import classnames from 'classnames';
|
|
|
3
3
|
import { propEq, toUpper, slice, pipe, defaultTo, find, propOr, startsWith, ifElse } from 'ramda';
|
|
4
4
|
import Typography from '@mui/material/Typography';
|
|
5
5
|
import Tooltip from '@mui/material/Tooltip';
|
|
6
|
-
import {
|
|
6
|
+
import { useMdmDataTenantsWithIdBuilder } from '../contexts/MdmModuleContext';
|
|
7
7
|
import { useStyles } from './styles';
|
|
8
8
|
var addDataTenantPrefix = function (label) { return "DT:".concat(slice(0, 1, label)); };
|
|
9
9
|
export var DataTenantBadge = function (_a) {
|
|
10
10
|
var dataTenantId = _a.dataTenantId, className = _a.className;
|
|
11
11
|
var styles = useStyles({ dataTenantId: dataTenantId });
|
|
12
|
-
var
|
|
13
|
-
var dataTenant = pipe(defaultTo([]), find(propEq('id', dataTenantId)))(
|
|
12
|
+
var dataTenantsWithIdBuilder = useMdmDataTenantsWithIdBuilder();
|
|
13
|
+
var dataTenant = pipe(defaultTo([]), find(propEq('id', dataTenantId)))(dataTenantsWithIdBuilder);
|
|
14
14
|
var label = pipe(propOr('', 'label'), toUpper, ifElse(startsWith('DT:'), slice(0, 4), addDataTenantPrefix))(dataTenant);
|
|
15
15
|
var content = (React.createElement("div", { className: classnames(styles.root, className) },
|
|
16
16
|
React.createElement(Typography, { variant: "body2" }, label)));
|
|
@@ -30,7 +30,7 @@ var defaultDataTenants = [
|
|
|
30
30
|
}
|
|
31
31
|
];
|
|
32
32
|
var defaultMdmValues = {
|
|
33
|
-
|
|
33
|
+
dataTenantsWithIdBuilder: defaultDataTenants
|
|
34
34
|
};
|
|
35
35
|
var setUp = function (props, mdmValues) {
|
|
36
36
|
if (mdmValues === void 0) { mdmValues = defaultMdmValues; }
|
|
@@ -40,7 +40,7 @@ var setUp = function (props, mdmValues) {
|
|
|
40
40
|
};
|
|
41
41
|
return render(React.createElement(DataTenantBadge, __assign({}, props)), { wrapper: Providers });
|
|
42
42
|
};
|
|
43
|
-
describe('
|
|
43
|
+
describe('DataTenantBadge tests', function () {
|
|
44
44
|
it('should pass className to root element correctly', function () {
|
|
45
45
|
setUp({ dataTenantId: 'uitest3', className: 'dataTenantBadge' });
|
|
46
46
|
expect(screen.getByLabelText('DT:TEST')).toHaveClass('dataTenantBadge');
|
|
@@ -50,7 +50,7 @@ describe('DataTenantBage tests', function () {
|
|
|
50
50
|
screen.getByText('DT:T');
|
|
51
51
|
});
|
|
52
52
|
it('should render correct label if dataTenants is not exists', function () {
|
|
53
|
-
var mdmValues = {
|
|
53
|
+
var mdmValues = { dataTenantsWithIdBuilder: [] };
|
|
54
54
|
setUp({ dataTenantId: 'uitest3' }, mdmValues);
|
|
55
55
|
screen.getByText('DT:');
|
|
56
56
|
});
|
|
@@ -25,7 +25,7 @@ import { useMdmUiPath, useMdmAction } from '../contexts/MdmModuleContext';
|
|
|
25
25
|
import { UrlGeneratorsContext } from '../contexts/UrlGeneratorsContext';
|
|
26
26
|
import { isControlOrCommandPressed } from '../helpers/events';
|
|
27
27
|
export var EntityUriLink = forwardRef(function (_a, ref) {
|
|
28
|
-
var value = _a.value, children = _a.children, screen = _a.screen, className = _a.className, _b = _a.shouldOpenInNewTab, shouldOpenInNewTab = _b === void 0 ? false : _b, otherProps = __rest(_a, ["value", "children", "screen", "className", "shouldOpenInNewTab"]);
|
|
28
|
+
var value = _a.value, children = _a.children, screen = _a.screen, className = _a.className, _b = _a.shouldOpenInNewTab, shouldOpenInNewTab = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, otherProps = __rest(_a, ["value", "children", "screen", "className", "shouldOpenInNewTab", "disabled"]);
|
|
29
29
|
var generateEntityUrl = useContext(UrlGeneratorsContext).generateEntityUrl;
|
|
30
30
|
var uiPath = useMdmUiPath();
|
|
31
31
|
var openEntity = useMdmAction('openEntity');
|
|
@@ -36,6 +36,6 @@ export var EntityUriLink = forwardRef(function (_a, ref) {
|
|
|
36
36
|
}
|
|
37
37
|
e.stopPropagation();
|
|
38
38
|
}, [openEntity, screen, value]);
|
|
39
|
-
return value ? (React.createElement("a", __assign({ ref: ref, href: generateEntityUrl({ uiPath: uiPath, uri: value, screen: screen }), onClick: shouldOpenInNewTab ? undefined : handleClick, target: shouldOpenInNewTab ? '_blank' : '_self', rel: "noreferrer", className: className }, otherProps), children))
|
|
39
|
+
return disabled || !value ? (React.createElement("span", __assign({ ref: ref, className: className }, otherProps), children)) : (React.createElement("a", __assign({ ref: ref, href: generateEntityUrl({ uiPath: uiPath, uri: value, screen: screen }), onClick: shouldOpenInNewTab ? undefined : handleClick, target: shouldOpenInNewTab ? '_blank' : '_self', rel: "noreferrer", className: className }, otherProps), children));
|
|
40
40
|
});
|
|
41
41
|
EntityUriLink.displayName = 'EntityUriLink';
|
|
@@ -8,6 +8,7 @@ type Props = {
|
|
|
8
8
|
container?: string;
|
|
9
9
|
};
|
|
10
10
|
variant?: 'loading' | 'normal';
|
|
11
|
+
disableEntityLink?: boolean;
|
|
11
12
|
} & React.HTMLAttributes<HTMLDivElement>;
|
|
12
|
-
declare const _default: React.MemoExoticComponent<({ entity, classes, variant, ...otherProps }: Props) => React.JSX.Element>;
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ entity, classes, variant, disableEntityLink, ...otherProps }: Props) => React.JSX.Element>;
|
|
13
14
|
export default _default;
|
|
@@ -26,9 +26,9 @@ import { ProfileCardContent } from './components/ProfileCardContent';
|
|
|
26
26
|
import { ProfileCardPlaceholder } from './components/ProfileCardPlaceholder';
|
|
27
27
|
import { useStyles } from './styles';
|
|
28
28
|
var ProfileCard = function (_a) {
|
|
29
|
-
var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.variant, variant = _c === void 0 ? 'normal' : _c, otherProps = __rest(_a, ["entity", "classes", "variant"]);
|
|
29
|
+
var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.variant, variant = _c === void 0 ? 'normal' : _c, _d = _a.disableEntityLink, disableEntityLink = _d === void 0 ? false : _d, otherProps = __rest(_a, ["entity", "classes", "variant", "disableEntityLink"]);
|
|
30
30
|
var styles = useStyles();
|
|
31
31
|
var containerClass = classes.container;
|
|
32
|
-
return (React.createElement("div", __assign({ className: classnames(styles.container, containerClass) }, otherProps), variant === 'normal' ? (React.createElement(ProfileCardContent, { entity: entity, classes: classes })) : (React.createElement(ProfileCardPlaceholder, null))));
|
|
32
|
+
return (React.createElement("div", __assign({ className: classnames(styles.container, containerClass) }, otherProps), variant === 'normal' ? (React.createElement(ProfileCardContent, { entity: entity, classes: classes, disableEntityLink: disableEntityLink })) : (React.createElement(ProfileCardPlaceholder, null))));
|
|
33
33
|
};
|
|
34
34
|
export default memo(ProfileCard);
|
|
@@ -112,4 +112,23 @@ describe('Profile card tests', function () {
|
|
|
112
112
|
screen.getByTestId('profile-card-placeholder-avatar');
|
|
113
113
|
screen.getByTestId('profile-card-placeholder-info');
|
|
114
114
|
});
|
|
115
|
+
it('should render two ProfileCards: one from IdentityBuilder (no link) and one normal (with link)', function () {
|
|
116
|
+
var entityWithDataTenant = __assign(__assign({}, defaultEntity), { uri: 'entities/dt-456', label: 'IdentityBuilder match', dataTenant: 'tenant-with-id-builder' });
|
|
117
|
+
var Providers = function (_a) {
|
|
118
|
+
var children = _a.children;
|
|
119
|
+
return (React.createElement(MdmModuleProvider, { values: mdmValues }, children));
|
|
120
|
+
};
|
|
121
|
+
render(React.createElement(React.Fragment, null,
|
|
122
|
+
React.createElement(ProfileCard, { entity: entityWithDataTenant, disableEntityLink: true, "data-reltio-id": "profile-id-builder" }),
|
|
123
|
+
React.createElement(ProfileCard, { entity: defaultEntity, disableEntityLink: false, "data-reltio-id": "profile-normal" })), { wrapper: Providers });
|
|
124
|
+
// IdentityBuilder: the label is visible as text only, no link
|
|
125
|
+
var idBuilderCard = screen.getByTestId('profile-id-builder');
|
|
126
|
+
expect(idBuilderCard).toHaveTextContent('IdentityBuilder match');
|
|
127
|
+
expect(idBuilderCard.querySelector('a[href]')).not.toBeInTheDocument();
|
|
128
|
+
// Normal: a label is a link
|
|
129
|
+
var normalCard = screen.getByTestId('profile-normal');
|
|
130
|
+
expect(normalCard).toHaveTextContent('Main label');
|
|
131
|
+
expect(normalCard.querySelector('a[href]')).toBeInTheDocument();
|
|
132
|
+
expect(screen.getByRole('link', { name: 'Main label' })).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/123');
|
|
133
|
+
});
|
|
115
134
|
});
|
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
label?: string;
|
|
7
7
|
secondaryLabel?: string;
|
|
8
8
|
};
|
|
9
|
+
disableEntityLink?: boolean;
|
|
9
10
|
};
|
|
10
|
-
export declare const ProfileCardContent: ({ entity, classes }: Props) => React.JSX.Element;
|
|
11
|
+
export declare const ProfileCardContent: ({ entity, classes, disableEntityLink }: Props) => React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -8,7 +8,7 @@ import { ExpandedValueTooltip } from '../../../ExpandedValueTooltip';
|
|
|
8
8
|
import { EntityTypeBadge } from '../../../EntityTypeBadge';
|
|
9
9
|
import { useStyles } from './styles';
|
|
10
10
|
export var ProfileCardContent = function (_a) {
|
|
11
|
-
var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b;
|
|
11
|
+
var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.disableEntityLink, disableEntityLink = _c === void 0 ? false : _c;
|
|
12
12
|
var styles = useStyles();
|
|
13
13
|
var secondaryLabelClass = classes.secondaryLabel, labelClass = classes.label;
|
|
14
14
|
var label = getLabel(entity.label);
|
|
@@ -19,7 +19,7 @@ export var ProfileCardContent = function (_a) {
|
|
|
19
19
|
return (React.createElement(React.Fragment, null,
|
|
20
20
|
React.createElement(EntityAvatar, { entity: entity, imageClassName: styles.image }),
|
|
21
21
|
React.createElement("div", { className: styles.info },
|
|
22
|
-
React.createElement(EntityUriLink, { value: getEntityUriForLink(entity), className: styles.link },
|
|
22
|
+
React.createElement(EntityUriLink, { value: getEntityUriForLink(entity), className: styles.link, disabled: disableEntityLink },
|
|
23
23
|
React.createElement(ExpandedValueTooltip, { value: label, placement: "top", showOnExceededHeight: true },
|
|
24
24
|
React.createElement("div", { className: classnames(styles.label, labelClass) }, label))),
|
|
25
25
|
secondaryLabel && (React.createElement(ExpandedValueTooltip, { value: secondaryLabel, placement: "top", showOnExceededHeight: true },
|
|
@@ -4,6 +4,7 @@ type Props = {
|
|
|
4
4
|
selectedTenant: DataTenant;
|
|
5
5
|
entityTypeUri: string;
|
|
6
6
|
onChangeTenant: (tenant: DataTenant) => void;
|
|
7
|
+
dataTenants: DataTenant[];
|
|
7
8
|
};
|
|
8
|
-
export declare const TenantsDropDownSelector: ({ entityTypeUri, onChangeTenant, selectedTenant }: Props) => React.JSX.Element;
|
|
9
|
+
export declare const TenantsDropDownSelector: ({ entityTypeUri, onChangeTenant, selectedTenant, dataTenants }: Props) => React.JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -5,12 +5,11 @@ import { isAvailableTenantForEntityType, isEmptyValue } from '@reltio/mdm-sdk';
|
|
|
5
5
|
import { DropDownMenuButton } from '../DropDownMenuButton';
|
|
6
6
|
import { TenantIcon } from '../TenantIcon';
|
|
7
7
|
import { TenantMenuItem } from './components/TenantMenuItem';
|
|
8
|
-
import {
|
|
8
|
+
import { useMdmTenantObject } from '../contexts/MdmModuleContext';
|
|
9
9
|
import { useStyles } from './styles';
|
|
10
10
|
export var TenantsDropDownSelector = function (_a) {
|
|
11
|
-
var entityTypeUri = _a.entityTypeUri, onChangeTenant = _a.onChangeTenant, selectedTenant = _a.selectedTenant;
|
|
11
|
+
var entityTypeUri = _a.entityTypeUri, onChangeTenant = _a.onChangeTenant, selectedTenant = _a.selectedTenant, dataTenants = _a.dataTenants;
|
|
12
12
|
var styles = useStyles();
|
|
13
|
-
var dataTenants = useMdmDataTenants();
|
|
14
13
|
var customerTenant = useMdmTenantObject();
|
|
15
14
|
var menuItems = useMemo(function () {
|
|
16
15
|
return pipe(defaultTo([]), filter(isAvailableTenantForEntityType(entityTypeUri)), map(function (dataTenant) { return ({
|
|
@@ -45,6 +45,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
+
if (ar || !(i in from)) {
|
|
51
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
+
ar[i] = from[i];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
+
};
|
|
48
57
|
import React from 'react';
|
|
49
58
|
import { render, screen, within } from '@testing-library/react';
|
|
50
59
|
import userEvent from '@testing-library/user-event';
|
|
@@ -55,14 +64,19 @@ var defaultDataTenants = [
|
|
|
55
64
|
{ id: 'tenantId2', name: 'secondTenantName' },
|
|
56
65
|
{ id: 'tenantId3', name: 'thirdTenantName', label: 'Third tenant name' }
|
|
57
66
|
];
|
|
67
|
+
var defaultDataTenantsWithIdBuilder = __spreadArray(__spreadArray([], defaultDataTenants, true), [
|
|
68
|
+
{ id: 'tenantId4', name: 'idBuilderTenant', idBuilderSubscription: true }
|
|
69
|
+
], false);
|
|
58
70
|
var defaultMdmValues = {
|
|
59
71
|
dataTenants: defaultDataTenants,
|
|
72
|
+
dataTenantsWithIdBuilder: defaultDataTenantsWithIdBuilder,
|
|
60
73
|
tenant: tenantObject
|
|
61
74
|
};
|
|
62
75
|
var defaultProps = {
|
|
63
76
|
onChangeTenant: jest.fn(),
|
|
64
77
|
entityTypeUri: 'entityTypeUris',
|
|
65
|
-
selectedTenant: tenantObject
|
|
78
|
+
selectedTenant: tenantObject,
|
|
79
|
+
dataTenants: defaultDataTenantsWithIdBuilder
|
|
66
80
|
};
|
|
67
81
|
var setUp = function (_a) {
|
|
68
82
|
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
@@ -75,8 +89,8 @@ var setUp = function (_a) {
|
|
|
75
89
|
};
|
|
76
90
|
describe('TenantsDropDownSelector test', function () {
|
|
77
91
|
it('should render nothing if dataTenants is empty', function () {
|
|
78
|
-
var
|
|
79
|
-
var container = setUp({
|
|
92
|
+
var props = __assign(__assign({}, defaultProps), { dataTenants: [] });
|
|
93
|
+
var container = setUp({ props: props }).container;
|
|
80
94
|
expect(container).toBeEmptyDOMElement();
|
|
81
95
|
});
|
|
82
96
|
it('should render nothing if onChangeTenant is undefined', function () {
|
|
@@ -125,4 +139,21 @@ describe('TenantsDropDownSelector test', function () {
|
|
|
125
139
|
}
|
|
126
140
|
});
|
|
127
141
|
}); });
|
|
142
|
+
it('should use dataTenants passed via props', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
143
|
+
var user, button, menuItems;
|
|
144
|
+
return __generator(this, function (_a) {
|
|
145
|
+
switch (_a.label) {
|
|
146
|
+
case 0:
|
|
147
|
+
user = setUp().user;
|
|
148
|
+
button = screen.getByText('T');
|
|
149
|
+
return [4 /*yield*/, user.click(button)];
|
|
150
|
+
case 1:
|
|
151
|
+
_a.sent();
|
|
152
|
+
menuItems = screen.getAllByRole('menuitem');
|
|
153
|
+
expect(menuItems).toHaveLength(4); // 1 customer tenant + 3 data tenants (including idBuilder in defaultDataTenantsWithIdBuilder)
|
|
154
|
+
within(menuItems[3]).getByText('idBuilderTenant');
|
|
155
|
+
return [2 /*return*/];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}); });
|
|
128
159
|
});
|
|
@@ -15,8 +15,8 @@ var addDataTenantPrefix = function (label) { return "DT:".concat((0, ramda_1.sli
|
|
|
15
15
|
var DataTenantBadge = function (_a) {
|
|
16
16
|
var dataTenantId = _a.dataTenantId, className = _a.className;
|
|
17
17
|
var styles = (0, styles_1.useStyles)({ dataTenantId: dataTenantId });
|
|
18
|
-
var
|
|
19
|
-
var dataTenant = (0, ramda_1.pipe)((0, ramda_1.defaultTo)([]), (0, ramda_1.find)((0, ramda_1.propEq)('id', dataTenantId)))(
|
|
18
|
+
var dataTenantsWithIdBuilder = (0, MdmModuleContext_1.useMdmDataTenantsWithIdBuilder)();
|
|
19
|
+
var dataTenant = (0, ramda_1.pipe)((0, ramda_1.defaultTo)([]), (0, ramda_1.find)((0, ramda_1.propEq)('id', dataTenantId)))(dataTenantsWithIdBuilder);
|
|
20
20
|
var label = (0, ramda_1.pipe)((0, ramda_1.propOr)('', 'label'), ramda_1.toUpper, (0, ramda_1.ifElse)((0, ramda_1.startsWith)('DT:'), (0, ramda_1.slice)(0, 4), addDataTenantPrefix))(dataTenant);
|
|
21
21
|
var content = (react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.root, className) },
|
|
22
22
|
react_1.default.createElement(Typography_1.default, { variant: "body2" }, label)));
|
|
@@ -35,7 +35,7 @@ var defaultDataTenants = [
|
|
|
35
35
|
}
|
|
36
36
|
];
|
|
37
37
|
var defaultMdmValues = {
|
|
38
|
-
|
|
38
|
+
dataTenantsWithIdBuilder: defaultDataTenants
|
|
39
39
|
};
|
|
40
40
|
var setUp = function (props, mdmValues) {
|
|
41
41
|
if (mdmValues === void 0) { mdmValues = defaultMdmValues; }
|
|
@@ -45,7 +45,7 @@ var setUp = function (props, mdmValues) {
|
|
|
45
45
|
};
|
|
46
46
|
return (0, react_2.render)(react_1.default.createElement(DataTenantBadge_1.DataTenantBadge, __assign({}, props)), { wrapper: Providers });
|
|
47
47
|
};
|
|
48
|
-
describe('
|
|
48
|
+
describe('DataTenantBadge tests', function () {
|
|
49
49
|
it('should pass className to root element correctly', function () {
|
|
50
50
|
setUp({ dataTenantId: 'uitest3', className: 'dataTenantBadge' });
|
|
51
51
|
expect(react_2.screen.getByLabelText('DT:TEST')).toHaveClass('dataTenantBadge');
|
|
@@ -55,7 +55,7 @@ describe('DataTenantBage tests', function () {
|
|
|
55
55
|
react_2.screen.getByText('DT:T');
|
|
56
56
|
});
|
|
57
57
|
it('should render correct label if dataTenants is not exists', function () {
|
|
58
|
-
var mdmValues = {
|
|
58
|
+
var mdmValues = { dataTenantsWithIdBuilder: [] };
|
|
59
59
|
setUp({ dataTenantId: 'uitest3' }, mdmValues);
|
|
60
60
|
react_2.screen.getByText('DT:');
|
|
61
61
|
});
|
|
@@ -51,7 +51,7 @@ var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
|
51
51
|
var UrlGeneratorsContext_1 = require("../contexts/UrlGeneratorsContext");
|
|
52
52
|
var events_1 = require("../helpers/events");
|
|
53
53
|
exports.EntityUriLink = (0, react_1.forwardRef)(function (_a, ref) {
|
|
54
|
-
var value = _a.value, children = _a.children, screen = _a.screen, className = _a.className, _b = _a.shouldOpenInNewTab, shouldOpenInNewTab = _b === void 0 ? false : _b, otherProps = __rest(_a, ["value", "children", "screen", "className", "shouldOpenInNewTab"]);
|
|
54
|
+
var value = _a.value, children = _a.children, screen = _a.screen, className = _a.className, _b = _a.shouldOpenInNewTab, shouldOpenInNewTab = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, otherProps = __rest(_a, ["value", "children", "screen", "className", "shouldOpenInNewTab", "disabled"]);
|
|
55
55
|
var generateEntityUrl = (0, react_1.useContext)(UrlGeneratorsContext_1.UrlGeneratorsContext).generateEntityUrl;
|
|
56
56
|
var uiPath = (0, MdmModuleContext_1.useMdmUiPath)();
|
|
57
57
|
var openEntity = (0, MdmModuleContext_1.useMdmAction)('openEntity');
|
|
@@ -62,6 +62,6 @@ exports.EntityUriLink = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
62
62
|
}
|
|
63
63
|
e.stopPropagation();
|
|
64
64
|
}, [openEntity, screen, value]);
|
|
65
|
-
return value ? (react_1.default.createElement("a", __assign({ ref: ref, href: generateEntityUrl({ uiPath: uiPath, uri: value, screen: screen }), onClick: shouldOpenInNewTab ? undefined : handleClick, target: shouldOpenInNewTab ? '_blank' : '_self', rel: "noreferrer", className: className }, otherProps), children))
|
|
65
|
+
return disabled || !value ? (react_1.default.createElement("span", __assign({ ref: ref, className: className }, otherProps), children)) : (react_1.default.createElement("a", __assign({ ref: ref, href: generateEntityUrl({ uiPath: uiPath, uri: value, screen: screen }), onClick: shouldOpenInNewTab ? undefined : handleClick, target: shouldOpenInNewTab ? '_blank' : '_self', rel: "noreferrer", className: className }, otherProps), children));
|
|
66
66
|
});
|
|
67
67
|
exports.EntityUriLink.displayName = 'EntityUriLink';
|
|
@@ -8,6 +8,7 @@ type Props = {
|
|
|
8
8
|
container?: string;
|
|
9
9
|
};
|
|
10
10
|
variant?: 'loading' | 'normal';
|
|
11
|
+
disableEntityLink?: boolean;
|
|
11
12
|
} & React.HTMLAttributes<HTMLDivElement>;
|
|
12
|
-
declare const _default: React.MemoExoticComponent<({ entity, classes, variant, ...otherProps }: Props) => React.JSX.Element>;
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ entity, classes, variant, disableEntityLink, ...otherProps }: Props) => React.JSX.Element>;
|
|
13
14
|
export default _default;
|
|
@@ -54,9 +54,9 @@ var ProfileCardContent_1 = require("./components/ProfileCardContent");
|
|
|
54
54
|
var ProfileCardPlaceholder_1 = require("./components/ProfileCardPlaceholder");
|
|
55
55
|
var styles_1 = require("./styles");
|
|
56
56
|
var ProfileCard = function (_a) {
|
|
57
|
-
var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.variant, variant = _c === void 0 ? 'normal' : _c, otherProps = __rest(_a, ["entity", "classes", "variant"]);
|
|
57
|
+
var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.variant, variant = _c === void 0 ? 'normal' : _c, _d = _a.disableEntityLink, disableEntityLink = _d === void 0 ? false : _d, otherProps = __rest(_a, ["entity", "classes", "variant", "disableEntityLink"]);
|
|
58
58
|
var styles = (0, styles_1.useStyles)();
|
|
59
59
|
var containerClass = classes.container;
|
|
60
|
-
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)(styles.container, containerClass) }, otherProps), variant === 'normal' ? (react_1.default.createElement(ProfileCardContent_1.ProfileCardContent, { entity: entity, classes: classes })) : (react_1.default.createElement(ProfileCardPlaceholder_1.ProfileCardPlaceholder, null))));
|
|
60
|
+
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)(styles.container, containerClass) }, otherProps), variant === 'normal' ? (react_1.default.createElement(ProfileCardContent_1.ProfileCardContent, { entity: entity, classes: classes, disableEntityLink: disableEntityLink })) : (react_1.default.createElement(ProfileCardPlaceholder_1.ProfileCardPlaceholder, null))));
|
|
61
61
|
};
|
|
62
62
|
exports.default = (0, react_1.memo)(ProfileCard);
|
|
@@ -117,4 +117,23 @@ describe('Profile card tests', function () {
|
|
|
117
117
|
react_2.screen.getByTestId('profile-card-placeholder-avatar');
|
|
118
118
|
react_2.screen.getByTestId('profile-card-placeholder-info');
|
|
119
119
|
});
|
|
120
|
+
it('should render two ProfileCards: one from IdentityBuilder (no link) and one normal (with link)', function () {
|
|
121
|
+
var entityWithDataTenant = __assign(__assign({}, defaultEntity), { uri: 'entities/dt-456', label: 'IdentityBuilder match', dataTenant: 'tenant-with-id-builder' });
|
|
122
|
+
var Providers = function (_a) {
|
|
123
|
+
var children = _a.children;
|
|
124
|
+
return (react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues }, children));
|
|
125
|
+
};
|
|
126
|
+
(0, react_2.render)(react_1.default.createElement(react_1.default.Fragment, null,
|
|
127
|
+
react_1.default.createElement(ProfileCard_1.default, { entity: entityWithDataTenant, disableEntityLink: true, "data-reltio-id": "profile-id-builder" }),
|
|
128
|
+
react_1.default.createElement(ProfileCard_1.default, { entity: defaultEntity, disableEntityLink: false, "data-reltio-id": "profile-normal" })), { wrapper: Providers });
|
|
129
|
+
// IdentityBuilder: the label is visible as text only, no link
|
|
130
|
+
var idBuilderCard = react_2.screen.getByTestId('profile-id-builder');
|
|
131
|
+
expect(idBuilderCard).toHaveTextContent('IdentityBuilder match');
|
|
132
|
+
expect(idBuilderCard.querySelector('a[href]')).not.toBeInTheDocument();
|
|
133
|
+
// Normal: a label is a link
|
|
134
|
+
var normalCard = react_2.screen.getByTestId('profile-normal');
|
|
135
|
+
expect(normalCard).toHaveTextContent('Main label');
|
|
136
|
+
expect(normalCard.querySelector('a[href]')).toBeInTheDocument();
|
|
137
|
+
expect(react_2.screen.getByRole('link', { name: 'Main label' })).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/123');
|
|
138
|
+
});
|
|
120
139
|
});
|
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
label?: string;
|
|
7
7
|
secondaryLabel?: string;
|
|
8
8
|
};
|
|
9
|
+
disableEntityLink?: boolean;
|
|
9
10
|
};
|
|
10
|
-
export declare const ProfileCardContent: ({ entity, classes }: Props) => React.JSX.Element;
|
|
11
|
+
export declare const ProfileCardContent: ({ entity, classes, disableEntityLink }: Props) => React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -37,7 +37,7 @@ var ExpandedValueTooltip_1 = require("../../../ExpandedValueTooltip");
|
|
|
37
37
|
var EntityTypeBadge_1 = require("../../../EntityTypeBadge");
|
|
38
38
|
var styles_1 = require("./styles");
|
|
39
39
|
var ProfileCardContent = function (_a) {
|
|
40
|
-
var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b;
|
|
40
|
+
var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.disableEntityLink, disableEntityLink = _c === void 0 ? false : _c;
|
|
41
41
|
var styles = (0, styles_1.useStyles)();
|
|
42
42
|
var secondaryLabelClass = classes.secondaryLabel, labelClass = classes.label;
|
|
43
43
|
var label = (0, mdm_sdk_1.getLabel)(entity.label);
|
|
@@ -48,7 +48,7 @@ var ProfileCardContent = function (_a) {
|
|
|
48
48
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
49
49
|
react_1.default.createElement(EntityAvatar_1.EntityAvatar, { entity: entity, imageClassName: styles.image }),
|
|
50
50
|
react_1.default.createElement("div", { className: styles.info },
|
|
51
|
-
react_1.default.createElement(EntityUriLink_1.EntityUriLink, { value: (0, mdm_sdk_1.getEntityUriForLink)(entity), className: styles.link },
|
|
51
|
+
react_1.default.createElement(EntityUriLink_1.EntityUriLink, { value: (0, mdm_sdk_1.getEntityUriForLink)(entity), className: styles.link, disabled: disableEntityLink },
|
|
52
52
|
react_1.default.createElement(ExpandedValueTooltip_1.ExpandedValueTooltip, { value: label, placement: "top", showOnExceededHeight: true },
|
|
53
53
|
react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.label, labelClass) }, label))),
|
|
54
54
|
secondaryLabel && (react_1.default.createElement(ExpandedValueTooltip_1.ExpandedValueTooltip, { value: secondaryLabel, placement: "top", showOnExceededHeight: true },
|
|
@@ -4,6 +4,7 @@ type Props = {
|
|
|
4
4
|
selectedTenant: DataTenant;
|
|
5
5
|
entityTypeUri: string;
|
|
6
6
|
onChangeTenant: (tenant: DataTenant) => void;
|
|
7
|
+
dataTenants: DataTenant[];
|
|
7
8
|
};
|
|
8
|
-
export declare const TenantsDropDownSelector: ({ entityTypeUri, onChangeTenant, selectedTenant }: Props) => React.JSX.Element;
|
|
9
|
+
export declare const TenantsDropDownSelector: ({ entityTypeUri, onChangeTenant, selectedTenant, dataTenants }: Props) => React.JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -37,9 +37,8 @@ var TenantMenuItem_1 = require("./components/TenantMenuItem");
|
|
|
37
37
|
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
38
38
|
var styles_1 = require("./styles");
|
|
39
39
|
var TenantsDropDownSelector = function (_a) {
|
|
40
|
-
var entityTypeUri = _a.entityTypeUri, onChangeTenant = _a.onChangeTenant, selectedTenant = _a.selectedTenant;
|
|
40
|
+
var entityTypeUri = _a.entityTypeUri, onChangeTenant = _a.onChangeTenant, selectedTenant = _a.selectedTenant, dataTenants = _a.dataTenants;
|
|
41
41
|
var styles = (0, styles_1.useStyles)();
|
|
42
|
-
var dataTenants = (0, MdmModuleContext_1.useMdmDataTenants)();
|
|
43
42
|
var customerTenant = (0, MdmModuleContext_1.useMdmTenantObject)();
|
|
44
43
|
var menuItems = (0, react_1.useMemo)(function () {
|
|
45
44
|
return (0, ramda_1.pipe)((0, ramda_1.defaultTo)([]), (0, ramda_1.filter)((0, mdm_sdk_1.isAvailableTenantForEntityType)(entityTypeUri)), (0, ramda_1.map)(function (dataTenant) { return ({
|
|
@@ -46,6 +46,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
};
|
|
49
58
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
60
|
};
|
|
@@ -60,14 +69,19 @@ var defaultDataTenants = [
|
|
|
60
69
|
{ id: 'tenantId2', name: 'secondTenantName' },
|
|
61
70
|
{ id: 'tenantId3', name: 'thirdTenantName', label: 'Third tenant name' }
|
|
62
71
|
];
|
|
72
|
+
var defaultDataTenantsWithIdBuilder = __spreadArray(__spreadArray([], defaultDataTenants, true), [
|
|
73
|
+
{ id: 'tenantId4', name: 'idBuilderTenant', idBuilderSubscription: true }
|
|
74
|
+
], false);
|
|
63
75
|
var defaultMdmValues = {
|
|
64
76
|
dataTenants: defaultDataTenants,
|
|
77
|
+
dataTenantsWithIdBuilder: defaultDataTenantsWithIdBuilder,
|
|
65
78
|
tenant: tenantObject
|
|
66
79
|
};
|
|
67
80
|
var defaultProps = {
|
|
68
81
|
onChangeTenant: jest.fn(),
|
|
69
82
|
entityTypeUri: 'entityTypeUris',
|
|
70
|
-
selectedTenant: tenantObject
|
|
83
|
+
selectedTenant: tenantObject,
|
|
84
|
+
dataTenants: defaultDataTenantsWithIdBuilder
|
|
71
85
|
};
|
|
72
86
|
var setUp = function (_a) {
|
|
73
87
|
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
@@ -80,8 +94,8 @@ var setUp = function (_a) {
|
|
|
80
94
|
};
|
|
81
95
|
describe('TenantsDropDownSelector test', function () {
|
|
82
96
|
it('should render nothing if dataTenants is empty', function () {
|
|
83
|
-
var
|
|
84
|
-
var container = setUp({
|
|
97
|
+
var props = __assign(__assign({}, defaultProps), { dataTenants: [] });
|
|
98
|
+
var container = setUp({ props: props }).container;
|
|
85
99
|
expect(container).toBeEmptyDOMElement();
|
|
86
100
|
});
|
|
87
101
|
it('should render nothing if onChangeTenant is undefined', function () {
|
|
@@ -130,4 +144,21 @@ describe('TenantsDropDownSelector test', function () {
|
|
|
130
144
|
}
|
|
131
145
|
});
|
|
132
146
|
}); });
|
|
147
|
+
it('should use dataTenants passed via props', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
|
+
var user, button, menuItems;
|
|
149
|
+
return __generator(this, function (_a) {
|
|
150
|
+
switch (_a.label) {
|
|
151
|
+
case 0:
|
|
152
|
+
user = setUp().user;
|
|
153
|
+
button = react_2.screen.getByText('T');
|
|
154
|
+
return [4 /*yield*/, user.click(button)];
|
|
155
|
+
case 1:
|
|
156
|
+
_a.sent();
|
|
157
|
+
menuItems = react_2.screen.getAllByRole('menuitem');
|
|
158
|
+
expect(menuItems).toHaveLength(4); // 1 customer tenant + 3 data tenants (including idBuilder in defaultDataTenantsWithIdBuilder)
|
|
159
|
+
(0, react_2.within)(menuItems[3]).getByText('idBuilderTenant');
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}); });
|
|
133
164
|
});
|
|
@@ -47,6 +47,7 @@ export type MdmModuleValuesContextProps = Partial<{
|
|
|
47
47
|
tenant: DataTenant;
|
|
48
48
|
environment: string;
|
|
49
49
|
dataTenants: DataTenant[];
|
|
50
|
+
dataTenantsWithIdBuilder: DataTenant[];
|
|
50
51
|
searchOptions: SearchOptions;
|
|
51
52
|
activityFilter: ActivityFilter;
|
|
52
53
|
globalFilter: GlobalFilter;
|
|
@@ -263,6 +264,7 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
263
264
|
tenant: DataTenant;
|
|
264
265
|
environment: string;
|
|
265
266
|
dataTenants: DataTenant[];
|
|
267
|
+
dataTenantsWithIdBuilder: DataTenant[];
|
|
266
268
|
searchOptions: SearchOptions;
|
|
267
269
|
activityFilter: ActivityFilter;
|
|
268
270
|
globalFilter: GlobalFilter;
|
|
@@ -47,6 +47,7 @@ export declare const useMdmTenant: () => string;
|
|
|
47
47
|
export declare const useMdmTenantName: () => string;
|
|
48
48
|
export declare const useMdmEnvironment: () => string;
|
|
49
49
|
export declare const useMdmDataTenants: () => import("@reltio/mdm-sdk").DataTenant[];
|
|
50
|
+
export declare const useMdmDataTenantsWithIdBuilder: () => import("@reltio/mdm-sdk").DataTenant[];
|
|
50
51
|
export declare const useMdmSearchNavigationData: () => import("@reltio/mdm-sdk").SearchNavigationData;
|
|
51
52
|
export declare const useMdmSearchProviderData: () => import("@reltio/mdm-sdk").SearchProviderData;
|
|
52
53
|
export declare const useMdmIsCollaborationEnabled: () => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.useMdmCanUserMakeExport = exports.useMdmDcrReviewValidation = exports.useMdmReviewDCREnabled = exports.useMdmShowMasking = exports.useMdmControlAttributes = exports.useMdmHiddenAttributes = exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmRelationsDrafts = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmIsSourcesScreenEnabled = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = void 0;
|
|
3
|
+
exports.useMdmSearchProviderData = exports.useMdmSearchNavigationData = exports.useMdmDataTenantsWithIdBuilder = exports.useMdmDataTenants = exports.useMdmEnvironment = exports.useMdmTenantName = exports.useMdmTenant = exports.useMdmTenantObject = exports.useMdmUserRoles = exports.useMdmUsername = exports.useMdmUser = exports.useMdmMetadata = exports.useMdmDependentLookups = exports.useMdmLookups = exports.useMdmProfileLastLoadedTime = exports.useMdmHistoryEvent = exports.useMdmHistorySlice = exports.useMdmHistoryMode = exports.useMdmHistoryDiff = exports.useMdmIsEditableMode = exports.useMdmIsViewMode = exports.useMdmMode = exports.useMdmEntityUriWithDataTenant = exports.useMdmEntityWithDiff = exports.useMdmEntityUri = exports.useMdmEntity = exports.useMdmModifiedEntities = exports.useMdmLookupAutocomplete = exports.useMdmAttributesSortingStrategy = exports.useMdmMaxValuesInResponse = exports.useMdmAttributesPresentation = exports.useMdmDateTimeMask = exports.useMdmDateMask = exports.useMdmPivotingAttributes = exports.useMdmShowEntityId = exports.useMdmImageAttributesFieldsOrder = exports.useMdmCollaborationPath = exports.useMdmImagePath = exports.useMdmApiPath = exports.useMdmReltioPath = exports.useMdmImageServicePath = exports.useMdmWorkflowPath = exports.useMdmServicesPath = exports.useMdmDtssPath = exports.useMdmUiPath = exports.useMdmAbsoluteImagePath = exports.useMdmExportPath = exports.useMdmWorkflowEnvironmentUrl = exports.useMdmUiError = exports.useMdmAutoCloseInterval = void 0;
|
|
4
|
+
exports.useMdmCanUserMakeExport = exports.useMdmDcrReviewValidation = exports.useMdmReviewDCREnabled = exports.useMdmShowMasking = exports.useMdmControlAttributes = exports.useMdmHiddenAttributes = exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmRelationsDrafts = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmIsSourcesScreenEnabled = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = exports.useMdmIsCollaborationEnabled = void 0;
|
|
5
5
|
var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
6
6
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
7
7
|
var context_1 = require("./context");
|
|
@@ -120,6 +120,10 @@ var useMdmEnvironment = function () { return useMdmModuleValuesContext(function
|
|
|
120
120
|
exports.useMdmEnvironment = useMdmEnvironment;
|
|
121
121
|
var useMdmDataTenants = function () { return useMdmModuleValuesContext(function (context) { return context.dataTenants; }); };
|
|
122
122
|
exports.useMdmDataTenants = useMdmDataTenants;
|
|
123
|
+
var useMdmDataTenantsWithIdBuilder = function () {
|
|
124
|
+
return useMdmModuleValuesContext(function (context) { return context.dataTenantsWithIdBuilder; });
|
|
125
|
+
};
|
|
126
|
+
exports.useMdmDataTenantsWithIdBuilder = useMdmDataTenantsWithIdBuilder;
|
|
123
127
|
var useMdmSearchNavigationData = function () { return useMdmModuleValuesContext(function (context) { return context.searchNavigationData; }); };
|
|
124
128
|
exports.useMdmSearchNavigationData = useMdmSearchNavigationData;
|
|
125
129
|
var useMdmSearchProviderData = function () { return useMdmModuleValuesContext(function (context) { return context.searchProviderData; }); };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmDcrReviewValidation, useMdmImagePath } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmDataTenantsWithIdBuilder, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmDcrReviewValidation, useMdmImagePath } from './hooks';
|
|
3
3
|
export type { MdmModuleActionsContextProps, MdmModuleValuesContextProps, MdmModuleListenersContextProps } from './context';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.useMdmImagePath = exports.useMdmDcrReviewValidation = exports.useMdmReviewDCREnabled = exports.useMdmShowMasking = exports.useMdmControlAttributes = exports.useMdmHiddenAttributes = exports.useMdmIsSourcesScreenEnabled = exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmRelationsDrafts = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = void 0;
|
|
3
|
+
exports.useMdmSearchProviderData = exports.useMdmSearchNavigationData = exports.useMdmDataTenantsWithIdBuilder = exports.useMdmDataTenants = exports.useMdmEnvironment = exports.useMdmTenantName = exports.useMdmTenant = exports.useMdmTenantObject = exports.useMdmUserRoles = exports.useMdmUsername = exports.useMdmUser = exports.useMdmMetadata = exports.useMdmDependentLookups = exports.useMdmLookups = exports.useMdmProfileLastLoadedTime = exports.useMdmHistoryEvent = exports.useMdmHistorySlice = exports.useMdmHistoryMode = exports.useMdmHistoryDiff = exports.useMdmIsEditableMode = exports.useMdmIsViewMode = exports.useMdmMode = exports.useMdmEntityUriWithDataTenant = exports.useMdmEntityWithDiff = exports.useMdmEntityUri = exports.useMdmEntity = exports.useMdmModifiedEntities = exports.useMdmLookupAutocomplete = exports.useMdmAttributesSortingStrategy = exports.useMdmMaxValuesInResponse = exports.useMdmAttributesPresentation = exports.useMdmDateTimeMask = exports.useMdmDateMask = exports.useMdmPivotingAttributes = exports.useMdmShowEntityId = exports.useMdmImageAttributesFieldsOrder = exports.useMdmCollaborationPath = exports.useMdmApiPath = exports.useMdmReltioPath = exports.useMdmImageServicePath = exports.useMdmWorkflowPath = exports.useMdmServicesPath = exports.useMdmDtssPath = exports.useMdmUiPath = exports.useMdmAbsoluteImagePath = exports.useMdmExportPath = exports.useMdmWorkflowEnvironmentUrl = exports.useMdmUiError = exports.useMdmAutoCloseInterval = exports.MdmModuleProvider = void 0;
|
|
4
|
+
exports.useMdmImagePath = exports.useMdmDcrReviewValidation = exports.useMdmReviewDCREnabled = exports.useMdmShowMasking = exports.useMdmControlAttributes = exports.useMdmHiddenAttributes = exports.useMdmIsSourcesScreenEnabled = exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmRelationsDrafts = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = exports.useMdmIsCollaborationEnabled = void 0;
|
|
5
5
|
var provider_1 = require("./provider");
|
|
6
6
|
Object.defineProperty(exports, "MdmModuleProvider", { enumerable: true, get: function () { return provider_1.MdmModuleProvider; } });
|
|
7
7
|
var hooks_1 = require("./hooks");
|
|
@@ -51,6 +51,7 @@ Object.defineProperty(exports, "useMdmTenant", { enumerable: true, get: function
|
|
|
51
51
|
Object.defineProperty(exports, "useMdmTenantName", { enumerable: true, get: function () { return hooks_1.useMdmTenantName; } });
|
|
52
52
|
Object.defineProperty(exports, "useMdmEnvironment", { enumerable: true, get: function () { return hooks_1.useMdmEnvironment; } });
|
|
53
53
|
Object.defineProperty(exports, "useMdmDataTenants", { enumerable: true, get: function () { return hooks_1.useMdmDataTenants; } });
|
|
54
|
+
Object.defineProperty(exports, "useMdmDataTenantsWithIdBuilder", { enumerable: true, get: function () { return hooks_1.useMdmDataTenantsWithIdBuilder; } });
|
|
54
55
|
Object.defineProperty(exports, "useMdmSearchNavigationData", { enumerable: true, get: function () { return hooks_1.useMdmSearchNavigationData; } });
|
|
55
56
|
Object.defineProperty(exports, "useMdmSearchProviderData", { enumerable: true, get: function () { return hooks_1.useMdmSearchProviderData; } });
|
|
56
57
|
Object.defineProperty(exports, "useMdmIsCollaborationEnabled", { enumerable: true, get: function () { return hooks_1.useMdmIsCollaborationEnabled; } });
|
|
@@ -26,7 +26,7 @@ var useMatchesLoader = function (_a) {
|
|
|
26
26
|
var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
|
|
27
27
|
var tenant = (0, MdmModuleContext_1.useMdmTenant)();
|
|
28
28
|
var dtssPath = (0, MdmModuleContext_1.useMdmDtssPath)();
|
|
29
|
-
var dataTenants = (0, MdmModuleContext_1.
|
|
29
|
+
var dataTenants = (0, MdmModuleContext_1.useMdmDataTenantsWithIdBuilder)();
|
|
30
30
|
var showMasking = (0, MdmModuleContext_1.useMdmShowMasking)();
|
|
31
31
|
var _f = (0, MdmModuleContext_1.useMdmGlobalSearchRequestOptions)() || {}, activityFilter = _f.activityFilter, globalFilter = _f.globalFilter;
|
|
32
32
|
var activeness = typeof options.showInactiveEntities === 'boolean'
|
|
@@ -65,6 +65,7 @@ var useMatchesLoader = function (_a) {
|
|
|
65
65
|
dtssPath: dtssPath,
|
|
66
66
|
entity: entity,
|
|
67
67
|
customerTenant: tenant,
|
|
68
|
+
dataTenants: dataTenants,
|
|
68
69
|
offset: page * rowsPerPage,
|
|
69
70
|
max: rowsPerPage,
|
|
70
71
|
force: force
|
|
@@ -102,6 +103,7 @@ var useMatchesLoader = function (_a) {
|
|
|
102
103
|
[
|
|
103
104
|
globalFilter,
|
|
104
105
|
activeness,
|
|
106
|
+
dataTenants,
|
|
105
107
|
dtssPath,
|
|
106
108
|
enabled,
|
|
107
109
|
entityUri,
|
|
@@ -10,6 +10,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
13
49
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
51
|
};
|
|
@@ -19,7 +55,14 @@ var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
|
19
55
|
var react_hooks_1 = require("@testing-library/react-hooks");
|
|
20
56
|
var MdmModuleContext_1 = require("../../contexts/MdmModuleContext");
|
|
21
57
|
var useMatchesLoader_1 = require("./useMatchesLoader");
|
|
22
|
-
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getTransitiveMatches: jest.fn() })); });
|
|
58
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getTransitiveMatches: jest.fn(), getMatchesForDataTenantEntity: jest.fn(), isDataTenantEntity: jest.fn().mockImplementation(function (entity) { return !!entity.dataTenant; }) })); });
|
|
59
|
+
/**
|
|
60
|
+
* useMatchesLoader runs a useEffect that calls getMatches() on mount. getMatches() is async:
|
|
61
|
+
* it calls the SDK (getTransitiveMatches / getMatchesForDataTenantEntity), and when the
|
|
62
|
+
* promise resolves, it updates the state (setTotal, setMatches, setEntitiesMap), which triggers
|
|
63
|
+
* a re-render. waitForNextUpdate() waits for that next render, so assertions run after
|
|
64
|
+
* the async load has completed and we avoid races.
|
|
65
|
+
*/
|
|
23
66
|
describe('Test useMatchesLoader hook', function () {
|
|
24
67
|
var defaultProps = {
|
|
25
68
|
enabled: true,
|
|
@@ -49,37 +92,96 @@ describe('Test useMatchesLoader hook', function () {
|
|
|
49
92
|
}
|
|
50
93
|
]
|
|
51
94
|
}); };
|
|
52
|
-
var
|
|
95
|
+
var defaultDataTenantsWithIdBuilder = [{ id: 'tenantId4', name: 'idBuilderTenant', idBuilderSubscription: false }];
|
|
96
|
+
var defaultMdmValues = {
|
|
97
|
+
metadata: getMetadata(),
|
|
98
|
+
dataTenantsWithIdBuilder: defaultDataTenantsWithIdBuilder
|
|
99
|
+
};
|
|
53
100
|
var setUp = function (_a) {
|
|
54
101
|
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
55
102
|
var Providers = function (_a) {
|
|
56
103
|
var children = _a.children;
|
|
57
104
|
return react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues }, children);
|
|
58
105
|
};
|
|
59
|
-
return
|
|
106
|
+
return (0, react_hooks_1.renderHook)(useMatchesLoader_1.useMatchesLoader, { initialProps: props, wrapper: Providers });
|
|
60
107
|
};
|
|
61
108
|
afterEach(function () {
|
|
62
109
|
jest.clearAllMocks();
|
|
63
110
|
});
|
|
64
111
|
describe('Data masking behaviour', function () {
|
|
65
|
-
it('should call transitive endpoint without options if metadata doesnt have masked attribute', function () {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
112
|
+
it('should call transitive endpoint without options if metadata doesnt have masked attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
113
|
+
var waitForNextUpdate;
|
|
114
|
+
return __generator(this, function (_a) {
|
|
115
|
+
switch (_a.label) {
|
|
116
|
+
case 0:
|
|
117
|
+
waitForNextUpdate = setUp().waitForNextUpdate;
|
|
118
|
+
return [4 /*yield*/, waitForNextUpdate()];
|
|
119
|
+
case 1:
|
|
120
|
+
_a.sent();
|
|
121
|
+
expect(mdm_sdk_1.getTransitiveMatches).toHaveBeenCalledTimes(1);
|
|
122
|
+
expect(mdm_sdk_1.getTransitiveMatches).not.toHaveBeenCalledWith(expect.objectContaining({ options: expect.anything() }));
|
|
123
|
+
return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}); });
|
|
127
|
+
it('should call transitive endpoint with sendMasked option if metadata has masked attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
128
|
+
var metadata, waitForNextUpdate;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
metadata = getMetadata();
|
|
133
|
+
metadata.entityTypes[0].attributes[0].masking = { regexPattern: '.{4}$' };
|
|
134
|
+
waitForNextUpdate = setUp({ mdmValues: { metadata: metadata } }).waitForNextUpdate;
|
|
135
|
+
return [4 /*yield*/, waitForNextUpdate()];
|
|
136
|
+
case 1:
|
|
137
|
+
_a.sent();
|
|
138
|
+
expect(mdm_sdk_1.getTransitiveMatches).toHaveBeenCalledTimes(1);
|
|
139
|
+
expect(mdm_sdk_1.getTransitiveMatches).toHaveBeenCalledWith(expect.objectContaining({ options: 'sendMasked,showAccess' }));
|
|
140
|
+
return [2 /*return*/];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}); });
|
|
144
|
+
it('should not add sendMasked or showAccess option if showMasking configuration property is false', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
145
|
+
var metadata, waitForNextUpdate;
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
switch (_a.label) {
|
|
148
|
+
case 0:
|
|
149
|
+
metadata = getMetadata();
|
|
150
|
+
metadata.entityTypes[0].attributes[0].masking = { regexPattern: '.{4}$' };
|
|
151
|
+
waitForNextUpdate = setUp({ mdmValues: { metadata: metadata, showMasking: false } }).waitForNextUpdate;
|
|
152
|
+
return [4 /*yield*/, waitForNextUpdate()];
|
|
153
|
+
case 1:
|
|
154
|
+
_a.sent();
|
|
155
|
+
expect(mdm_sdk_1.getTransitiveMatches).toHaveBeenCalledTimes(1);
|
|
156
|
+
expect(mdm_sdk_1.getTransitiveMatches).not.toHaveBeenCalledWith(expect.objectContaining({ options: expect.anything() }));
|
|
157
|
+
return [2 /*return*/];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}); });
|
|
84
161
|
});
|
|
162
|
+
it('should pass dataTenants to getMatchesForDataTenantEntity when entity has dataTenant', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
163
|
+
var dataTenantEntity, dataTenants, waitForNextUpdate;
|
|
164
|
+
return __generator(this, function (_a) {
|
|
165
|
+
switch (_a.label) {
|
|
166
|
+
case 0:
|
|
167
|
+
dataTenantEntity = {
|
|
168
|
+
uri: 'entities/dataTenantEntity',
|
|
169
|
+
type: 'configuration/entityTypes/HCP',
|
|
170
|
+
dataTenant: 'tenantId4',
|
|
171
|
+
attributes: {}
|
|
172
|
+
};
|
|
173
|
+
dataTenants = [{ id: 'tenantId4', name: 'tenant', idBuilderSubscription: false }];
|
|
174
|
+
waitForNextUpdate = setUp({
|
|
175
|
+
props: __assign(__assign({}, defaultProps), { entity: dataTenantEntity }),
|
|
176
|
+
mdmValues: __assign(__assign({}, defaultMdmValues), { dataTenantsWithIdBuilder: dataTenants })
|
|
177
|
+
}).waitForNextUpdate;
|
|
178
|
+
return [4 /*yield*/, waitForNextUpdate()];
|
|
179
|
+
case 1:
|
|
180
|
+
_a.sent();
|
|
181
|
+
expect(mdm_sdk_1.getMatchesForDataTenantEntity).toHaveBeenCalledTimes(1);
|
|
182
|
+
expect(mdm_sdk_1.getMatchesForDataTenantEntity).toHaveBeenCalledWith(expect.objectContaining({ dataTenants: dataTenants }));
|
|
183
|
+
return [2 /*return*/];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}); });
|
|
85
187
|
});
|
|
@@ -47,6 +47,7 @@ export type MdmModuleValuesContextProps = Partial<{
|
|
|
47
47
|
tenant: DataTenant;
|
|
48
48
|
environment: string;
|
|
49
49
|
dataTenants: DataTenant[];
|
|
50
|
+
dataTenantsWithIdBuilder: DataTenant[];
|
|
50
51
|
searchOptions: SearchOptions;
|
|
51
52
|
activityFilter: ActivityFilter;
|
|
52
53
|
globalFilter: GlobalFilter;
|
|
@@ -263,6 +264,7 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
263
264
|
tenant: DataTenant;
|
|
264
265
|
environment: string;
|
|
265
266
|
dataTenants: DataTenant[];
|
|
267
|
+
dataTenantsWithIdBuilder: DataTenant[];
|
|
266
268
|
searchOptions: SearchOptions;
|
|
267
269
|
activityFilter: ActivityFilter;
|
|
268
270
|
globalFilter: GlobalFilter;
|
|
@@ -47,6 +47,7 @@ export declare const useMdmTenant: () => string;
|
|
|
47
47
|
export declare const useMdmTenantName: () => string;
|
|
48
48
|
export declare const useMdmEnvironment: () => string;
|
|
49
49
|
export declare const useMdmDataTenants: () => import("@reltio/mdm-sdk").DataTenant[];
|
|
50
|
+
export declare const useMdmDataTenantsWithIdBuilder: () => import("@reltio/mdm-sdk").DataTenant[];
|
|
50
51
|
export declare const useMdmSearchNavigationData: () => import("@reltio/mdm-sdk").SearchNavigationData;
|
|
51
52
|
export declare const useMdmSearchProviderData: () => import("@reltio/mdm-sdk").SearchProviderData;
|
|
52
53
|
export declare const useMdmIsCollaborationEnabled: () => boolean;
|
|
@@ -69,6 +69,9 @@ export var useMdmTenant = function () { return useMdmModuleValuesContext(functio
|
|
|
69
69
|
export var useMdmTenantName = function () { return useMdmModuleValuesContext(function (context) { var _a; return (_a = context.tenant) === null || _a === void 0 ? void 0 : _a.name; }); };
|
|
70
70
|
export var useMdmEnvironment = function () { return useMdmModuleValuesContext(function (context) { return context.environment; }); };
|
|
71
71
|
export var useMdmDataTenants = function () { return useMdmModuleValuesContext(function (context) { return context.dataTenants; }); };
|
|
72
|
+
export var useMdmDataTenantsWithIdBuilder = function () {
|
|
73
|
+
return useMdmModuleValuesContext(function (context) { return context.dataTenantsWithIdBuilder; });
|
|
74
|
+
};
|
|
72
75
|
export var useMdmSearchNavigationData = function () { return useMdmModuleValuesContext(function (context) { return context.searchNavigationData; }); };
|
|
73
76
|
export var useMdmSearchProviderData = function () { return useMdmModuleValuesContext(function (context) { return context.searchProviderData; }); };
|
|
74
77
|
export var useMdmIsCollaborationEnabled = function () {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmDcrReviewValidation, useMdmImagePath } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmDataTenantsWithIdBuilder, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmDcrReviewValidation, useMdmImagePath } from './hooks';
|
|
3
3
|
export type { MdmModuleActionsContextProps, MdmModuleValuesContextProps, MdmModuleListenersContextProps } from './context';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmDcrReviewValidation, useMdmImagePath } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmDataTenantsWithIdBuilder, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmDcrReviewValidation, useMdmImagePath } from './hooks';
|
|
@@ -13,7 +13,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
13
13
|
import { ActivityFilter, collectAllTransitiveEntitiesUris, getEntitiesMapForTransitiveMatches, getMatchesForDataTenantEntity, getMatchesFromDataTenants, getTransitiveMatches, isDataTenantEntity, isTempUri, withDtssPotentialItems, addGlobalFilterToQuery, addGetTransitiveMatchesMaskingOptions } from '@reltio/mdm-sdk';
|
|
14
14
|
import { usePagingSimulator } from '../usePagingSimulator';
|
|
15
15
|
import { useSafePromise } from '../useSafePromise';
|
|
16
|
-
import {
|
|
16
|
+
import { useMdmDataTenantsWithIdBuilder, useMdmDtssPath, useMdmGlobalSearchRequestOptions, useMdmMetadata, useMdmTenant, useMdmShowMasking } from '../../contexts/MdmModuleContext';
|
|
17
17
|
export var useMatchesLoader = function (_a) {
|
|
18
18
|
var enabled = _a.enabled, entity = _a.entity, filter = _a.filter, rules = _a.rules, onFinishLoading = _a.onFinishLoading, onStartLoading = _a.onStartLoading, options = _a.options, page = _a.page, rowsPerPage = _a.rowsPerPage, sorting = _a.sorting, markMatchedValues = _a.markMatchedValues;
|
|
19
19
|
var _b = sorting || {}, order = _b.order, field = _b.field;
|
|
@@ -23,7 +23,7 @@ export var useMatchesLoader = function (_a) {
|
|
|
23
23
|
var metadata = useMdmMetadata();
|
|
24
24
|
var tenant = useMdmTenant();
|
|
25
25
|
var dtssPath = useMdmDtssPath();
|
|
26
|
-
var dataTenants =
|
|
26
|
+
var dataTenants = useMdmDataTenantsWithIdBuilder();
|
|
27
27
|
var showMasking = useMdmShowMasking();
|
|
28
28
|
var _f = useMdmGlobalSearchRequestOptions() || {}, activityFilter = _f.activityFilter, globalFilter = _f.globalFilter;
|
|
29
29
|
var activeness = typeof options.showInactiveEntities === 'boolean'
|
|
@@ -62,6 +62,7 @@ export var useMatchesLoader = function (_a) {
|
|
|
62
62
|
dtssPath: dtssPath,
|
|
63
63
|
entity: entity,
|
|
64
64
|
customerTenant: tenant,
|
|
65
|
+
dataTenants: dataTenants,
|
|
65
66
|
offset: page * rowsPerPage,
|
|
66
67
|
max: rowsPerPage,
|
|
67
68
|
force: force
|
|
@@ -99,6 +100,7 @@ export var useMatchesLoader = function (_a) {
|
|
|
99
100
|
[
|
|
100
101
|
globalFilter,
|
|
101
102
|
activeness,
|
|
103
|
+
dataTenants,
|
|
102
104
|
dtssPath,
|
|
103
105
|
enabled,
|
|
104
106
|
entityUri,
|
|
@@ -9,12 +9,55 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
import React from 'react';
|
|
13
|
-
import { getTransitiveMatches } from '@reltio/mdm-sdk';
|
|
49
|
+
import { getTransitiveMatches, getMatchesForDataTenantEntity } from '@reltio/mdm-sdk';
|
|
14
50
|
import { renderHook } from '@testing-library/react-hooks';
|
|
15
51
|
import { MdmModuleProvider } from '../../contexts/MdmModuleContext';
|
|
16
52
|
import { useMatchesLoader } from './useMatchesLoader';
|
|
17
|
-
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getTransitiveMatches: jest.fn() })); });
|
|
53
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getTransitiveMatches: jest.fn(), getMatchesForDataTenantEntity: jest.fn(), isDataTenantEntity: jest.fn().mockImplementation(function (entity) { return !!entity.dataTenant; }) })); });
|
|
54
|
+
/**
|
|
55
|
+
* useMatchesLoader runs a useEffect that calls getMatches() on mount. getMatches() is async:
|
|
56
|
+
* it calls the SDK (getTransitiveMatches / getMatchesForDataTenantEntity), and when the
|
|
57
|
+
* promise resolves, it updates the state (setTotal, setMatches, setEntitiesMap), which triggers
|
|
58
|
+
* a re-render. waitForNextUpdate() waits for that next render, so assertions run after
|
|
59
|
+
* the async load has completed and we avoid races.
|
|
60
|
+
*/
|
|
18
61
|
describe('Test useMatchesLoader hook', function () {
|
|
19
62
|
var defaultProps = {
|
|
20
63
|
enabled: true,
|
|
@@ -44,37 +87,96 @@ describe('Test useMatchesLoader hook', function () {
|
|
|
44
87
|
}
|
|
45
88
|
]
|
|
46
89
|
}); };
|
|
47
|
-
var
|
|
90
|
+
var defaultDataTenantsWithIdBuilder = [{ id: 'tenantId4', name: 'idBuilderTenant', idBuilderSubscription: false }];
|
|
91
|
+
var defaultMdmValues = {
|
|
92
|
+
metadata: getMetadata(),
|
|
93
|
+
dataTenantsWithIdBuilder: defaultDataTenantsWithIdBuilder
|
|
94
|
+
};
|
|
48
95
|
var setUp = function (_a) {
|
|
49
96
|
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
50
97
|
var Providers = function (_a) {
|
|
51
98
|
var children = _a.children;
|
|
52
99
|
return React.createElement(MdmModuleProvider, { values: mdmValues }, children);
|
|
53
100
|
};
|
|
54
|
-
return
|
|
101
|
+
return renderHook(useMatchesLoader, { initialProps: props, wrapper: Providers });
|
|
55
102
|
};
|
|
56
103
|
afterEach(function () {
|
|
57
104
|
jest.clearAllMocks();
|
|
58
105
|
});
|
|
59
106
|
describe('Data masking behaviour', function () {
|
|
60
|
-
it('should call transitive endpoint without options if metadata doesnt have masked attribute', function () {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
107
|
+
it('should call transitive endpoint without options if metadata doesnt have masked attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
108
|
+
var waitForNextUpdate;
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
switch (_a.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
waitForNextUpdate = setUp().waitForNextUpdate;
|
|
113
|
+
return [4 /*yield*/, waitForNextUpdate()];
|
|
114
|
+
case 1:
|
|
115
|
+
_a.sent();
|
|
116
|
+
expect(getTransitiveMatches).toHaveBeenCalledTimes(1);
|
|
117
|
+
expect(getTransitiveMatches).not.toHaveBeenCalledWith(expect.objectContaining({ options: expect.anything() }));
|
|
118
|
+
return [2 /*return*/];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}); });
|
|
122
|
+
it('should call transitive endpoint with sendMasked option if metadata has masked attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
123
|
+
var metadata, waitForNextUpdate;
|
|
124
|
+
return __generator(this, function (_a) {
|
|
125
|
+
switch (_a.label) {
|
|
126
|
+
case 0:
|
|
127
|
+
metadata = getMetadata();
|
|
128
|
+
metadata.entityTypes[0].attributes[0].masking = { regexPattern: '.{4}$' };
|
|
129
|
+
waitForNextUpdate = setUp({ mdmValues: { metadata: metadata } }).waitForNextUpdate;
|
|
130
|
+
return [4 /*yield*/, waitForNextUpdate()];
|
|
131
|
+
case 1:
|
|
132
|
+
_a.sent();
|
|
133
|
+
expect(getTransitiveMatches).toHaveBeenCalledTimes(1);
|
|
134
|
+
expect(getTransitiveMatches).toHaveBeenCalledWith(expect.objectContaining({ options: 'sendMasked,showAccess' }));
|
|
135
|
+
return [2 /*return*/];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}); });
|
|
139
|
+
it('should not add sendMasked or showAccess option if showMasking configuration property is false', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
140
|
+
var metadata, waitForNextUpdate;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
metadata = getMetadata();
|
|
145
|
+
metadata.entityTypes[0].attributes[0].masking = { regexPattern: '.{4}$' };
|
|
146
|
+
waitForNextUpdate = setUp({ mdmValues: { metadata: metadata, showMasking: false } }).waitForNextUpdate;
|
|
147
|
+
return [4 /*yield*/, waitForNextUpdate()];
|
|
148
|
+
case 1:
|
|
149
|
+
_a.sent();
|
|
150
|
+
expect(getTransitiveMatches).toHaveBeenCalledTimes(1);
|
|
151
|
+
expect(getTransitiveMatches).not.toHaveBeenCalledWith(expect.objectContaining({ options: expect.anything() }));
|
|
152
|
+
return [2 /*return*/];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}); });
|
|
79
156
|
});
|
|
157
|
+
it('should pass dataTenants to getMatchesForDataTenantEntity when entity has dataTenant', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
158
|
+
var dataTenantEntity, dataTenants, waitForNextUpdate;
|
|
159
|
+
return __generator(this, function (_a) {
|
|
160
|
+
switch (_a.label) {
|
|
161
|
+
case 0:
|
|
162
|
+
dataTenantEntity = {
|
|
163
|
+
uri: 'entities/dataTenantEntity',
|
|
164
|
+
type: 'configuration/entityTypes/HCP',
|
|
165
|
+
dataTenant: 'tenantId4',
|
|
166
|
+
attributes: {}
|
|
167
|
+
};
|
|
168
|
+
dataTenants = [{ id: 'tenantId4', name: 'tenant', idBuilderSubscription: false }];
|
|
169
|
+
waitForNextUpdate = setUp({
|
|
170
|
+
props: __assign(__assign({}, defaultProps), { entity: dataTenantEntity }),
|
|
171
|
+
mdmValues: __assign(__assign({}, defaultMdmValues), { dataTenantsWithIdBuilder: dataTenants })
|
|
172
|
+
}).waitForNextUpdate;
|
|
173
|
+
return [4 /*yield*/, waitForNextUpdate()];
|
|
174
|
+
case 1:
|
|
175
|
+
_a.sent();
|
|
176
|
+
expect(getMatchesForDataTenantEntity).toHaveBeenCalledTimes(1);
|
|
177
|
+
expect(getMatchesForDataTenantEntity).toHaveBeenCalledWith(expect.objectContaining({ dataTenants: dataTenants }));
|
|
178
|
+
return [2 /*return*/];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}); });
|
|
80
182
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2239",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
12
12
|
"@googlemaps/markerclusterer": "^2.5.3",
|
|
13
13
|
"@react-sigma/core": "3.4.0",
|
|
14
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
14
|
+
"@reltio/mdm-sdk": "^1.4.2028",
|
|
15
15
|
"@vis.gl/react-google-maps": "^1.3.0",
|
|
16
16
|
"d3-cloud": "^1.2.5",
|
|
17
17
|
"d3-geo": "^2.0.1",
|