@reltio/components 1.4.2289 → 1.4.2291

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.
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import React from 'react';
24
- import { useInRouterContext, Link } from 'react-router-dom';
24
+ import { useInRouterContext, Link } from 'react-router';
25
25
  import classnames from 'classnames';
26
26
  import { useStyles } from './styles';
27
27
  export var InternalLink = function (props) {
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import React from 'react';
13
13
  import { render, screen } from '@testing-library/react';
14
14
  import userEvent from '@testing-library/user-event';
15
- import { BrowserRouter } from 'react-router-dom';
15
+ import { BrowserRouter } from 'react-router';
16
16
  import { InternalLink } from './InternalLink';
17
17
  describe('InternalLink tests', function () {
18
18
  var setUp = function (props) {
@@ -27,14 +27,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.InternalLink = void 0;
29
29
  var react_1 = __importDefault(require("react"));
30
- var react_router_dom_1 = require("react-router-dom");
30
+ var react_router_1 = require("react-router");
31
31
  var classnames_1 = __importDefault(require("classnames"));
32
32
  var styles_1 = require("./styles");
33
33
  var InternalLink = function (props) {
34
34
  var styles = (0, styles_1.useStyles)();
35
- var inRouterContext = (0, react_router_dom_1.useInRouterContext)();
35
+ var inRouterContext = (0, react_router_1.useInRouterContext)();
36
36
  var href = props.href, className = props.className, otherProps = __rest(props, ["href", "className"]);
37
37
  var linkClassName = (0, classnames_1.default)(styles.link, className);
38
- return inRouterContext && href ? (react_1.default.createElement(react_router_dom_1.Link, __assign({ to: href.replace(window.location.origin, ''), className: linkClassName }, otherProps))) : (react_1.default.createElement("a", __assign({ href: href, className: linkClassName }, otherProps)));
38
+ return inRouterContext && href ? (react_1.default.createElement(react_router_1.Link, __assign({ to: href.replace(window.location.origin, ''), className: linkClassName }, otherProps))) : (react_1.default.createElement("a", __assign({ href: href, className: linkClassName }, otherProps)));
39
39
  };
40
40
  exports.InternalLink = InternalLink;
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var react_1 = __importDefault(require("react"));
18
18
  var react_2 = require("@testing-library/react");
19
19
  var user_event_1 = __importDefault(require("@testing-library/user-event"));
20
- var react_router_dom_1 = require("react-router-dom");
20
+ var react_router_1 = require("react-router");
21
21
  var InternalLink_1 = require("./InternalLink");
22
22
  describe('InternalLink tests', function () {
23
23
  var setUp = function (props) {
@@ -25,7 +25,7 @@ describe('InternalLink tests', function () {
25
25
  var user = user_event_1.default.setup();
26
26
  var Providers = function (_a) {
27
27
  var children = _a.children;
28
- return react_1.default.createElement(react_router_dom_1.BrowserRouter, null, children);
28
+ return react_1.default.createElement(react_router_1.BrowserRouter, null, children);
29
29
  };
30
30
  return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(InternalLink_1.InternalLink, __assign({}, props)), { wrapper: Providers }));
31
31
  };
@@ -2,6 +2,7 @@ import { Entity, Metadata } from '@reltio/mdm-sdk';
2
2
  export declare const createEntity: ({ withAppliedSurvivorshipRules }?: {
3
3
  withAppliedSurvivorshipRules?: boolean;
4
4
  }) => Entity;
5
+ export declare const createEntityWithAppliedRuleTree: () => Entity;
5
6
  export declare const createEntityWithAllParticipationStatuses: () => Entity;
6
7
  export declare const createMetadata: () => Metadata;
7
8
  export declare const selectedAttributeTypes: ({
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.referenceDisplayOrderEntities = exports.deepNestedDisplayOrderEntities = exports.createEntityWithTextFieldSortOrder = exports.selectedAttributeTypes = exports.createMetadata = exports.createEntityWithAllParticipationStatuses = exports.createEntity = void 0;
14
+ exports.referenceDisplayOrderEntities = exports.deepNestedDisplayOrderEntities = exports.createEntityWithTextFieldSortOrder = exports.selectedAttributeTypes = exports.createMetadata = exports.createEntityWithAllParticipationStatuses = exports.createEntityWithAppliedRuleTree = exports.createEntity = void 0;
15
15
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
16
16
  var createEntity = function (_a) {
17
17
  var _b = _a === void 0 ? {} : _a, _c = _b.withAppliedSurvivorshipRules, withAppliedSurvivorshipRules = _c === void 0 ? false : _c;
@@ -126,6 +126,37 @@ var createEntity = function (_a) {
126
126
  };
127
127
  };
128
128
  exports.createEntity = createEntity;
129
+ var createEntityWithAppliedRuleTree = function () {
130
+ var entity = (0, exports.createEntity)();
131
+ return __assign(__assign({}, entity), { attributes: __assign(__assign({}, entity.attributes), { TextField: [
132
+ {
133
+ ov: true,
134
+ type: 'configuration/entityTypes/HCP/attributes/TextField',
135
+ uri: 'entities/01L2n5z/attributes/TextField/tree',
136
+ value: 'tree value',
137
+ ovDetails: {
138
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
139
+ appliedSurvivorshipGroup: 'default',
140
+ appliedSurvivorshipRules: { LUD: ['SRC_SYS'] },
141
+ appliedSurvivorshipRuleTree: {
142
+ appliedSurvivorshipRule: 'LUD',
143
+ fallbacks: [
144
+ {
145
+ appliedSurvivorshipRule: 'SRC_SYS',
146
+ sourcesUriOrder: [
147
+ 'configuration/sources/AHA',
148
+ 'configuration/sources/AMS',
149
+ 'configuration/sources/Reltio'
150
+ ],
151
+ fallbacks: []
152
+ }
153
+ ]
154
+ }
155
+ }
156
+ }
157
+ ] }) });
158
+ };
159
+ exports.createEntityWithAppliedRuleTree = createEntityWithAppliedRuleTree;
129
160
  var createEntityWithAllParticipationStatuses = function () {
130
161
  var entity = (0, exports.createEntity)({ withAppliedSurvivorshipRules: true });
131
162
  return __assign(__assign({}, entity), { attributes: __assign(__assign({}, entity.attributes), { Boolean: [
@@ -332,6 +363,14 @@ var createMetadata = function () {
332
363
  {
333
364
  uri: 'configuration/sources/Reltio',
334
365
  label: 'Reltio'
366
+ },
367
+ {
368
+ uri: 'configuration/sources/AHA',
369
+ label: 'AHA'
370
+ },
371
+ {
372
+ uri: 'configuration/sources/AMS',
373
+ label: 'AMS'
335
374
  }
336
375
  ]
337
376
  };
@@ -1151,6 +1151,44 @@ describe('attribute table tests', function () {
1151
1151
  }
1152
1152
  });
1153
1153
  }); });
1154
+ it('should consume sourcesUriOrder from the applied survivorship rule tree', function () { return __awaiter(void 0, void 0, void 0, function () {
1155
+ var unmockTableSizing, entity, user, ruleTypeColumns, popup, renderedSources, ovValuesColumns, fallbackIcon, tooltip;
1156
+ return __generator(this, function (_a) {
1157
+ switch (_a.label) {
1158
+ case 0:
1159
+ unmockTableSizing = (0, test_utils_1.mockBasicTableSizing)();
1160
+ entity = (0, AttributesTable_test_data_1.createEntityWithAppliedRuleTree)();
1161
+ user = setUp(__assign(__assign({}, defaultProps), { visibleColumns: undefined, entity: entity })).user;
1162
+ ruleTypeColumns = react_2.screen.getAllByTestId('column-name-ruleType');
1163
+ expect((0, react_2.within)(ruleTypeColumns[0]).getByText('Source system')).toBeInTheDocument();
1164
+ return [4 /*yield*/, user.click((0, react_2.within)(ruleTypeColumns[0]).getByRole('button', { name: 'View details' }))];
1165
+ case 1:
1166
+ _a.sent();
1167
+ popup = react_2.screen.getByRole('presentation');
1168
+ expect((0, react_2.within)(popup).getByText('Source sequence')).toBeInTheDocument();
1169
+ renderedSources = (0, react_2.within)(popup)
1170
+ .getAllByText(/^(AHA|AMS|Reltio)$/)
1171
+ .map(function (sourceLabel) { return sourceLabel.textContent; });
1172
+ expect(renderedSources).toEqual(['AHA', 'AMS', 'Reltio']);
1173
+ return [4 /*yield*/, user.click((0, react_2.within)(popup).getByRole('button'))];
1174
+ case 2:
1175
+ _a.sent();
1176
+ ovValuesColumns = react_2.screen.getAllByTestId('column-name-ovValues');
1177
+ fallbackIcon = (0, test_utils_1.getMuiIconByName)('Info', ovValuesColumns[0]);
1178
+ return [4 /*yield*/, user.hover(fallbackIcon)];
1179
+ case 3:
1180
+ _a.sent();
1181
+ return [4 /*yield*/, react_2.screen.findByRole('tooltip')];
1182
+ case 4:
1183
+ tooltip = _a.sent();
1184
+ expect((0, react_2.within)(tooltip).getByText('OV decision path')).toBeInTheDocument();
1185
+ expect((0, react_2.within)(tooltip).getByText('Recency')).toBeInTheDocument();
1186
+ expect((0, react_2.within)(tooltip).getByText('Source system')).toBeInTheDocument();
1187
+ unmockTableSizing();
1188
+ return [2 /*return*/];
1189
+ }
1190
+ });
1191
+ }); });
1154
1192
  it('should render fallback icons correctly for reference attributes', function () { return __awaiter(void 0, void 0, void 0, function () {
1155
1193
  var unmockTableSizing, entity, user, ovValueCell, fallbackIcon, tooltip, fallbackIcons;
1156
1194
  return __generator(this, function (_a) {
@@ -1,4 +1,4 @@
1
- import { AppliedSurvivorshipRule, AttributeType, AttributeValue, Crosswalk, Metadata, OvDetails, RecordAttributesType } from '@reltio/mdm-sdk';
1
+ import { AppliedSurvivorshipRule, AppliedSurvivorshipRuleTree, AttributeType, AttributeValue, Crosswalk, Metadata, OvDetails, RecordAttributesType } from '@reltio/mdm-sdk';
2
2
  import { CrosswalksMap } from '../../../types';
3
3
  import { CrosswalksByOwnerTypeMap } from '../types';
4
4
  import { AttributesTableRowValue, SortAttributeValuesFn } from './types';
@@ -30,6 +30,8 @@ export declare const COLUMNS_DATA: ({
30
30
  export declare const DEFAULT_VISIBLE_COLUMNS: string[];
31
31
  export declare const countAttributeValues: (type: string, values: AttributeValue[], crosswalksMap: CrosswalksMap) => number;
32
32
  export declare const collectRuleNames: (rule: AppliedSurvivorshipRule | undefined) => string[];
33
+ export declare const collectRuleTreeNames: (tree: AppliedSurvivorshipRuleTree | undefined) => string[];
34
+ export declare const getAppliedRuleTreeLeaf: (tree: AppliedSurvivorshipRuleTree) => AppliedSurvivorshipRuleTree;
33
35
  export declare const getFallbackLabels: (metadata: Metadata, ovDetails: OvDetails) => string[];
34
36
  export declare const getWinnerCrosswalks: (attributeValues: AttributeValue[], crosswalksMap: CrosswalksMap) => Crosswalk[];
35
37
  export declare const getBasicTableColumnsData: any;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.sortByPinIgnorePriority = exports.getBasicTableRowsData = exports.getBasicTableColumnsData = exports.getWinnerCrosswalks = exports.getFallbackLabels = exports.collectRuleNames = exports.countAttributeValues = exports.DEFAULT_VISIBLE_COLUMNS = exports.COLUMNS_DATA = void 0;
15
+ exports.sortByPinIgnorePriority = exports.getBasicTableRowsData = exports.getBasicTableColumnsData = exports.getWinnerCrosswalks = exports.getFallbackLabels = exports.getAppliedRuleTreeLeaf = exports.collectRuleTreeNames = exports.collectRuleNames = exports.countAttributeValues = exports.DEFAULT_VISIBLE_COLUMNS = exports.COLUMNS_DATA = void 0;
16
16
  var ui_i18n_1 = __importDefault(require("ui-i18n"));
17
17
  var ramda_1 = require("ramda");
18
18
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
@@ -129,28 +129,52 @@ var collectRuleNames = function (rule) {
129
129
  });
130
130
  };
131
131
  exports.collectRuleNames = collectRuleNames;
132
+ var collectRuleTreeNames = function (tree) {
133
+ var _a;
134
+ if (!tree) {
135
+ return [];
136
+ }
137
+ var nextFallback = (_a = tree.fallbacks) === null || _a === void 0 ? void 0 : _a[tree.fallbacks.length - 1];
138
+ return __spreadArray([tree.appliedSurvivorshipRule], (0, exports.collectRuleTreeNames)(nextFallback), true);
139
+ };
140
+ exports.collectRuleTreeNames = collectRuleTreeNames;
141
+ var getAppliedRuleTreeLeaf = function (tree) {
142
+ return tree.fallbacks && tree.fallbacks.length > 0
143
+ ? (0, exports.getAppliedRuleTreeLeaf)(tree.fallbacks[tree.fallbacks.length - 1])
144
+ : tree;
145
+ };
146
+ exports.getAppliedRuleTreeLeaf = getAppliedRuleTreeLeaf;
132
147
  var getFallbackLabels = function (metadata, ovDetails) {
133
148
  if ((ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.participationStatus) && ovDetails.participationStatus !== mdm_sdk_1.ParticipationStatus.Strategy) {
134
149
  return [];
135
150
  }
136
- var appliedRules = ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.appliedSurvivorshipRules;
137
- var rules = (0, exports.collectRuleNames)(appliedRules);
151
+ var rules = (ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.appliedSurvivorshipRuleTree)
152
+ ? (0, exports.collectRuleTreeNames)(ovDetails.appliedSurvivorshipRuleTree)
153
+ : (0, exports.collectRuleNames)(ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.appliedSurvivorshipRules);
138
154
  if (rules.length <= 1) {
139
155
  return [];
140
156
  }
141
157
  return rules.map(function (uri) { var _a; return ((_a = (0, mdm_sdk_1.getSurvivorshipStrategy)(metadata, uri)) === null || _a === void 0 ? void 0 : _a.label) || uri; });
142
158
  };
143
159
  exports.getFallbackLabels = getFallbackLabels;
160
+ var getSourcesUriOrder = function (_a) {
161
+ var metadata = _a.metadata, strategy = _a.strategy, mapping = _a.mapping, currentSurvivorshipGroup = _a.currentSurvivorshipGroup, appliedRule = _a.appliedRule;
162
+ if (!isSourceSystemRule(strategy)) {
163
+ return undefined;
164
+ }
165
+ if (appliedRule) {
166
+ return appliedRule.sourcesUriOrder;
167
+ }
168
+ return (0, ramda_1.uniq)(__spreadArray(__spreadArray(__spreadArray([], ((mapping === null || mapping === void 0 ? void 0 : mapping.sourcesUriOrder) || []), true), ((currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.sourcesUriOrder) || []), true), getSourcesUriOrderFromMetadata(metadata), true));
169
+ };
144
170
  var createRuleTypeData = function (_a) {
145
- var metadata = _a.metadata, strategy = _a.strategy, mapping = _a.mapping, attributeType = _a.attributeType, currentSurvivorshipGroup = _a.currentSurvivorshipGroup;
171
+ var metadata = _a.metadata, strategy = _a.strategy, mapping = _a.mapping, attributeType = _a.attributeType, currentSurvivorshipGroup = _a.currentSurvivorshipGroup, appliedRule = _a.appliedRule;
146
172
  var fixUri = fixReferencedAttributeUri(attributeType);
147
173
  var primaryAttributeUri = isOtherAttributeWinnerRule(strategy) ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.primaryAttributeUri) : undefined;
148
174
  var comparisonAttributeUri = (0, mdm_sdk_1.isComplexAttribute)(attributeType) && isMinMaxValueRule(strategy)
149
175
  ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.comparisonAttributeUri)
150
176
  : undefined;
151
- var sourcesUriOrder = isSourceSystemRule(strategy)
152
- ? (0, ramda_1.uniq)(__spreadArray(__spreadArray(__spreadArray([], ((mapping === null || mapping === void 0 ? void 0 : mapping.sourcesUriOrder) || []), true), ((currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.sourcesUriOrder) || []), true), getSourcesUriOrderFromMetadata(metadata), true))
153
- : undefined;
177
+ var sourcesUriOrder = getSourcesUriOrder({ metadata: metadata, strategy: strategy, mapping: mapping, currentSurvivorshipGroup: currentSurvivorshipGroup, appliedRule: appliedRule });
154
178
  return {
155
179
  type: types_1.RuleItemType.Rule,
156
180
  data: {
@@ -168,15 +192,21 @@ var mapAttributeToRuleType = function (_a) {
168
192
  return null;
169
193
  }
170
194
  if (ovDetails.participationStatus === mdm_sdk_1.ParticipationStatus.Strategy) {
171
- var appliedRules = (0, exports.collectRuleNames)(ovDetails.appliedSurvivorshipRules);
172
- var lastRule = (0, mdm_sdk_1.getSurvivorshipStrategy)(metadata, (0, ramda_1.last)(appliedRules));
195
+ var appliedRule = ovDetails.appliedSurvivorshipRuleTree
196
+ ? (0, exports.getAppliedRuleTreeLeaf)(ovDetails.appliedSurvivorshipRuleTree)
197
+ : undefined;
198
+ var lastRuleName = appliedRule
199
+ ? appliedRule.appliedSurvivorshipRule
200
+ : (0, ramda_1.last)((0, exports.collectRuleNames)(ovDetails.appliedSurvivorshipRules));
201
+ var lastRule = (0, mdm_sdk_1.getSurvivorshipStrategy)(metadata, lastRuleName);
173
202
  return lastRule
174
203
  ? createRuleTypeData({
175
204
  metadata: metadata,
176
205
  strategy: lastRule,
177
206
  mapping: mapping,
178
207
  attributeType: attributeType,
179
- currentSurvivorshipGroup: currentSurvivorshipGroup
208
+ currentSurvivorshipGroup: currentSurvivorshipGroup,
209
+ appliedRule: appliedRule
180
210
  })
181
211
  : null;
182
212
  }
@@ -992,6 +992,142 @@ describe('helpers tests', function () {
992
992
  }
993
993
  });
994
994
  });
995
+ it('should return sourcesUriOrder from applied survivorship rule tree for source system strategy', function () {
996
+ var attributeType = {
997
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
998
+ type: 'Int',
999
+ name: 'Int',
1000
+ label: 'Int'
1001
+ };
1002
+ var attributes = {
1003
+ Int: [
1004
+ {
1005
+ uri: 'entities/123abc/attributes/Int/345fgh',
1006
+ type: 'configuration/entityTypes/HCP/attributes/Int',
1007
+ value: '1005',
1008
+ ov: true,
1009
+ ovDetails: {
1010
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
1011
+ appliedSurvivorshipGroup: 'default',
1012
+ appliedSurvivorshipRules: 'SRC_SYS',
1013
+ appliedSurvivorshipRuleTree: {
1014
+ appliedSurvivorshipRule: 'SRC_SYS',
1015
+ sourcesUriOrder: ['configuration/sources/Reltio', 'configuration/sources/AHA'],
1016
+ fallbacks: []
1017
+ }
1018
+ }
1019
+ }
1020
+ ]
1021
+ };
1022
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1023
+ var result = rows[0].ruleType;
1024
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
1025
+ type: types_1.RuleItemType.Rule,
1026
+ data: {
1027
+ strategy: {
1028
+ uri: 'configuration/survivorshipStrategies/SRC_SYS',
1029
+ label: 'Source system'
1030
+ },
1031
+ comparisonAttributeUri: undefined,
1032
+ primaryAttributeUri: undefined,
1033
+ sourcesUriOrder: ['configuration/sources/Reltio', 'configuration/sources/AHA']
1034
+ }
1035
+ });
1036
+ });
1037
+ it('should resolve winning strategy from the deepest fallback of the applied survivorship rule tree', function () {
1038
+ var attributeType = {
1039
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
1040
+ type: 'Int',
1041
+ name: 'Int',
1042
+ label: 'Int'
1043
+ };
1044
+ var attributes = {
1045
+ Int: [
1046
+ {
1047
+ uri: 'entities/123abc/attributes/Int/345fgh',
1048
+ type: 'configuration/entityTypes/HCP/attributes/Int',
1049
+ value: '1005',
1050
+ ov: true,
1051
+ ovDetails: {
1052
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
1053
+ appliedSurvivorshipGroup: 'default',
1054
+ appliedSurvivorshipRules: { SRC_SYS: [{ SRC_SYS: [{ SRC_SYS: ['LUD'] }] }] },
1055
+ appliedSurvivorshipRuleTree: {
1056
+ appliedSurvivorshipRule: 'SRC_SYS',
1057
+ sourcesUriOrder: ['configuration/sources/AMS', 'configuration/sources/AMA'],
1058
+ fallbacks: [
1059
+ {
1060
+ appliedSurvivorshipRule: 'SRC_SYS',
1061
+ sourcesUriOrder: ['configuration/sources/AMS'],
1062
+ fallbacks: [
1063
+ {
1064
+ appliedSurvivorshipRule: 'LUD',
1065
+ fallbacks: []
1066
+ }
1067
+ ]
1068
+ }
1069
+ ]
1070
+ }
1071
+ }
1072
+ }
1073
+ ]
1074
+ };
1075
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1076
+ var result = rows[0].ruleType;
1077
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
1078
+ type: types_1.RuleItemType.Rule,
1079
+ data: {
1080
+ strategy: {
1081
+ uri: 'configuration/survivorshipStrategies/LUD',
1082
+ label: 'Recency'
1083
+ },
1084
+ comparisonAttributeUri: undefined,
1085
+ primaryAttributeUri: undefined,
1086
+ sourcesUriOrder: undefined
1087
+ }
1088
+ });
1089
+ });
1090
+ it('should not provide sourcesUriOrder when the winning source system tree node has no sourcesUriOrder', function () {
1091
+ var attributeType = {
1092
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
1093
+ type: 'Int',
1094
+ name: 'Int',
1095
+ label: 'Int'
1096
+ };
1097
+ var attributes = {
1098
+ Int: [
1099
+ {
1100
+ uri: 'entities/123abc/attributes/Int/345fgh',
1101
+ type: 'configuration/entityTypes/HCP/attributes/Int',
1102
+ value: '1005',
1103
+ ov: true,
1104
+ ovDetails: {
1105
+ participationStatus: mdm_sdk_1.ParticipationStatus.Strategy,
1106
+ appliedSurvivorshipGroup: 'noOrderGroup',
1107
+ appliedSurvivorshipRules: 'SRC_SYS',
1108
+ appliedSurvivorshipRuleTree: {
1109
+ appliedSurvivorshipRule: 'SRC_SYS',
1110
+ fallbacks: []
1111
+ }
1112
+ }
1113
+ }
1114
+ ]
1115
+ };
1116
+ var rows = (0, helpers_1.getBasicTableRowsData)(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1117
+ var result = rows[0].ruleType;
1118
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
1119
+ type: types_1.RuleItemType.Rule,
1120
+ data: {
1121
+ strategy: {
1122
+ uri: 'configuration/survivorshipStrategies/SRC_SYS',
1123
+ label: 'Source system'
1124
+ },
1125
+ comparisonAttributeUri: undefined,
1126
+ primaryAttributeUri: undefined,
1127
+ sourcesUriOrder: undefined
1128
+ }
1129
+ });
1130
+ });
995
1131
  it('should return applied survivorship rule type for reference attribute', function () {
996
1132
  var attributeType = {
997
1133
  uri: 'configuration/entityTypes/HCP/attributes/Address',
@@ -1374,5 +1510,39 @@ describe('helpers tests', function () {
1374
1510
  expect((0, helpers_1.collectRuleNames)(rules)).toEqual(['SRC_SYS', 'LUD', 'SRC_SYS']);
1375
1511
  });
1376
1512
  });
1513
+ describe('collectRuleTreeNames', function () {
1514
+ it('should return empty array when tree is undefined', function () {
1515
+ expect((0, helpers_1.collectRuleTreeNames)(undefined)).toEqual([]);
1516
+ });
1517
+ it('should return single rule when there are no fallbacks', function () {
1518
+ expect((0, helpers_1.collectRuleTreeNames)({ appliedSurvivorshipRule: 'SRC_SYS', fallbacks: [] })).toEqual(['SRC_SYS']);
1519
+ });
1520
+ it('should flatten the fallback chain from the root down to the leaf', function () {
1521
+ var tree = {
1522
+ appliedSurvivorshipRule: 'SRC_SYS',
1523
+ fallbacks: [
1524
+ {
1525
+ appliedSurvivorshipRule: 'SRC_SYS',
1526
+ fallbacks: [{ appliedSurvivorshipRule: 'LUD', fallbacks: [] }]
1527
+ }
1528
+ ]
1529
+ };
1530
+ expect((0, helpers_1.collectRuleTreeNames)(tree)).toEqual(['SRC_SYS', 'SRC_SYS', 'LUD']);
1531
+ });
1532
+ });
1533
+ describe('getAppliedRuleTreeLeaf', function () {
1534
+ it('should return the node itself when there are no fallbacks', function () {
1535
+ var tree = { appliedSurvivorshipRule: 'SRC_SYS', fallbacks: [] };
1536
+ expect((0, helpers_1.getAppliedRuleTreeLeaf)(tree)).toBe(tree);
1537
+ });
1538
+ it('should return the deepest fallback node', function () {
1539
+ var leaf = { appliedSurvivorshipRule: 'LUD', fallbacks: [] };
1540
+ var tree = {
1541
+ appliedSurvivorshipRule: 'SRC_SYS',
1542
+ fallbacks: [{ appliedSurvivorshipRule: 'SRC_SYS', fallbacks: [leaf] }]
1543
+ };
1544
+ expect((0, helpers_1.getAppliedRuleTreeLeaf)(tree)).toBe(leaf);
1545
+ });
1546
+ });
1377
1547
  });
1378
1548
  });
@@ -2,6 +2,7 @@ import { Entity, Metadata } from '@reltio/mdm-sdk';
2
2
  export declare const createEntity: ({ withAppliedSurvivorshipRules }?: {
3
3
  withAppliedSurvivorshipRules?: boolean;
4
4
  }) => Entity;
5
+ export declare const createEntityWithAppliedRuleTree: () => Entity;
5
6
  export declare const createEntityWithAllParticipationStatuses: () => Entity;
6
7
  export declare const createMetadata: () => Metadata;
7
8
  export declare const selectedAttributeTypes: ({
@@ -122,6 +122,36 @@ export var createEntity = function (_a) {
122
122
  ]
123
123
  };
124
124
  };
125
+ export var createEntityWithAppliedRuleTree = function () {
126
+ var entity = createEntity();
127
+ return __assign(__assign({}, entity), { attributes: __assign(__assign({}, entity.attributes), { TextField: [
128
+ {
129
+ ov: true,
130
+ type: 'configuration/entityTypes/HCP/attributes/TextField',
131
+ uri: 'entities/01L2n5z/attributes/TextField/tree',
132
+ value: 'tree value',
133
+ ovDetails: {
134
+ participationStatus: ParticipationStatus.Strategy,
135
+ appliedSurvivorshipGroup: 'default',
136
+ appliedSurvivorshipRules: { LUD: ['SRC_SYS'] },
137
+ appliedSurvivorshipRuleTree: {
138
+ appliedSurvivorshipRule: 'LUD',
139
+ fallbacks: [
140
+ {
141
+ appliedSurvivorshipRule: 'SRC_SYS',
142
+ sourcesUriOrder: [
143
+ 'configuration/sources/AHA',
144
+ 'configuration/sources/AMS',
145
+ 'configuration/sources/Reltio'
146
+ ],
147
+ fallbacks: []
148
+ }
149
+ ]
150
+ }
151
+ }
152
+ }
153
+ ] }) });
154
+ };
125
155
  export var createEntityWithAllParticipationStatuses = function () {
126
156
  var entity = createEntity({ withAppliedSurvivorshipRules: true });
127
157
  return __assign(__assign({}, entity), { attributes: __assign(__assign({}, entity.attributes), { Boolean: [
@@ -327,6 +357,14 @@ export var createMetadata = function () {
327
357
  {
328
358
  uri: 'configuration/sources/Reltio',
329
359
  label: 'Reltio'
360
+ },
361
+ {
362
+ uri: 'configuration/sources/AHA',
363
+ label: 'AHA'
364
+ },
365
+ {
366
+ uri: 'configuration/sources/AMS',
367
+ label: 'AMS'
330
368
  }
331
369
  ]
332
370
  };
@@ -62,7 +62,7 @@ import { mockDndKit } from '../../../test-utils/dndKit';
62
62
  import { DndContext } from '@dnd-kit/core';
63
63
  import { getMuiIconByName, getMuiIconsByName, mockBasicTableSizing } from '../../../test-utils';
64
64
  import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
65
- import { createEntity, createEntityWithAllParticipationStatuses, deepNestedDisplayOrderEntities, referenceDisplayOrderEntities, createEntityWithTextFieldSortOrder, createMetadata, selectedAttributeTypes } from './AttributesTable.test-data';
65
+ import { createEntity, createEntityWithAllParticipationStatuses, createEntityWithAppliedRuleTree, deepNestedDisplayOrderEntities, referenceDisplayOrderEntities, createEntityWithTextFieldSortOrder, createMetadata, selectedAttributeTypes } from './AttributesTable.test-data';
66
66
  import AttributesTable from './AttributesTable';
67
67
  jest.mock('@dnd-kit/core', function () { return mockDndKit; });
68
68
  jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { debounce: function (x) { return x; } })); });
@@ -1146,6 +1146,44 @@ describe('attribute table tests', function () {
1146
1146
  }
1147
1147
  });
1148
1148
  }); });
1149
+ it('should consume sourcesUriOrder from the applied survivorship rule tree', function () { return __awaiter(void 0, void 0, void 0, function () {
1150
+ var unmockTableSizing, entity, user, ruleTypeColumns, popup, renderedSources, ovValuesColumns, fallbackIcon, tooltip;
1151
+ return __generator(this, function (_a) {
1152
+ switch (_a.label) {
1153
+ case 0:
1154
+ unmockTableSizing = mockBasicTableSizing();
1155
+ entity = createEntityWithAppliedRuleTree();
1156
+ user = setUp(__assign(__assign({}, defaultProps), { visibleColumns: undefined, entity: entity })).user;
1157
+ ruleTypeColumns = screen.getAllByTestId('column-name-ruleType');
1158
+ expect(within(ruleTypeColumns[0]).getByText('Source system')).toBeInTheDocument();
1159
+ return [4 /*yield*/, user.click(within(ruleTypeColumns[0]).getByRole('button', { name: 'View details' }))];
1160
+ case 1:
1161
+ _a.sent();
1162
+ popup = screen.getByRole('presentation');
1163
+ expect(within(popup).getByText('Source sequence')).toBeInTheDocument();
1164
+ renderedSources = within(popup)
1165
+ .getAllByText(/^(AHA|AMS|Reltio)$/)
1166
+ .map(function (sourceLabel) { return sourceLabel.textContent; });
1167
+ expect(renderedSources).toEqual(['AHA', 'AMS', 'Reltio']);
1168
+ return [4 /*yield*/, user.click(within(popup).getByRole('button'))];
1169
+ case 2:
1170
+ _a.sent();
1171
+ ovValuesColumns = screen.getAllByTestId('column-name-ovValues');
1172
+ fallbackIcon = getMuiIconByName('Info', ovValuesColumns[0]);
1173
+ return [4 /*yield*/, user.hover(fallbackIcon)];
1174
+ case 3:
1175
+ _a.sent();
1176
+ return [4 /*yield*/, screen.findByRole('tooltip')];
1177
+ case 4:
1178
+ tooltip = _a.sent();
1179
+ expect(within(tooltip).getByText('OV decision path')).toBeInTheDocument();
1180
+ expect(within(tooltip).getByText('Recency')).toBeInTheDocument();
1181
+ expect(within(tooltip).getByText('Source system')).toBeInTheDocument();
1182
+ unmockTableSizing();
1183
+ return [2 /*return*/];
1184
+ }
1185
+ });
1186
+ }); });
1149
1187
  it('should render fallback icons correctly for reference attributes', function () { return __awaiter(void 0, void 0, void 0, function () {
1150
1188
  var unmockTableSizing, entity, user, ovValueCell, fallbackIcon, tooltip, fallbackIcons;
1151
1189
  return __generator(this, function (_a) {
@@ -1,4 +1,4 @@
1
- import { AppliedSurvivorshipRule, AttributeType, AttributeValue, Crosswalk, Metadata, OvDetails, RecordAttributesType } from '@reltio/mdm-sdk';
1
+ import { AppliedSurvivorshipRule, AppliedSurvivorshipRuleTree, AttributeType, AttributeValue, Crosswalk, Metadata, OvDetails, RecordAttributesType } from '@reltio/mdm-sdk';
2
2
  import { CrosswalksMap } from '../../../types';
3
3
  import { CrosswalksByOwnerTypeMap } from '../types';
4
4
  import { AttributesTableRowValue, SortAttributeValuesFn } from './types';
@@ -30,6 +30,8 @@ export declare const COLUMNS_DATA: ({
30
30
  export declare const DEFAULT_VISIBLE_COLUMNS: string[];
31
31
  export declare const countAttributeValues: (type: string, values: AttributeValue[], crosswalksMap: CrosswalksMap) => number;
32
32
  export declare const collectRuleNames: (rule: AppliedSurvivorshipRule | undefined) => string[];
33
+ export declare const collectRuleTreeNames: (tree: AppliedSurvivorshipRuleTree | undefined) => string[];
34
+ export declare const getAppliedRuleTreeLeaf: (tree: AppliedSurvivorshipRuleTree) => AppliedSurvivorshipRuleTree;
33
35
  export declare const getFallbackLabels: (metadata: Metadata, ovDetails: OvDetails) => string[];
34
36
  export declare const getWinnerCrosswalks: (attributeValues: AttributeValue[], crosswalksMap: CrosswalksMap) => Crosswalk[];
35
37
  export declare const getBasicTableColumnsData: any;
@@ -121,27 +121,49 @@ export var collectRuleNames = function (rule) {
121
121
  return __spreadArray([key], value.flatMap(collectRuleNames), true);
122
122
  });
123
123
  };
124
+ export var collectRuleTreeNames = function (tree) {
125
+ var _a;
126
+ if (!tree) {
127
+ return [];
128
+ }
129
+ var nextFallback = (_a = tree.fallbacks) === null || _a === void 0 ? void 0 : _a[tree.fallbacks.length - 1];
130
+ return __spreadArray([tree.appliedSurvivorshipRule], collectRuleTreeNames(nextFallback), true);
131
+ };
132
+ export var getAppliedRuleTreeLeaf = function (tree) {
133
+ return tree.fallbacks && tree.fallbacks.length > 0
134
+ ? getAppliedRuleTreeLeaf(tree.fallbacks[tree.fallbacks.length - 1])
135
+ : tree;
136
+ };
124
137
  export var getFallbackLabels = function (metadata, ovDetails) {
125
138
  if ((ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.participationStatus) && ovDetails.participationStatus !== ParticipationStatus.Strategy) {
126
139
  return [];
127
140
  }
128
- var appliedRules = ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.appliedSurvivorshipRules;
129
- var rules = collectRuleNames(appliedRules);
141
+ var rules = (ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.appliedSurvivorshipRuleTree)
142
+ ? collectRuleTreeNames(ovDetails.appliedSurvivorshipRuleTree)
143
+ : collectRuleNames(ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.appliedSurvivorshipRules);
130
144
  if (rules.length <= 1) {
131
145
  return [];
132
146
  }
133
147
  return rules.map(function (uri) { var _a; return ((_a = getSurvivorshipStrategy(metadata, uri)) === null || _a === void 0 ? void 0 : _a.label) || uri; });
134
148
  };
149
+ var getSourcesUriOrder = function (_a) {
150
+ var metadata = _a.metadata, strategy = _a.strategy, mapping = _a.mapping, currentSurvivorshipGroup = _a.currentSurvivorshipGroup, appliedRule = _a.appliedRule;
151
+ if (!isSourceSystemRule(strategy)) {
152
+ return undefined;
153
+ }
154
+ if (appliedRule) {
155
+ return appliedRule.sourcesUriOrder;
156
+ }
157
+ return uniq(__spreadArray(__spreadArray(__spreadArray([], ((mapping === null || mapping === void 0 ? void 0 : mapping.sourcesUriOrder) || []), true), ((currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.sourcesUriOrder) || []), true), getSourcesUriOrderFromMetadata(metadata), true));
158
+ };
135
159
  var createRuleTypeData = function (_a) {
136
- var metadata = _a.metadata, strategy = _a.strategy, mapping = _a.mapping, attributeType = _a.attributeType, currentSurvivorshipGroup = _a.currentSurvivorshipGroup;
160
+ var metadata = _a.metadata, strategy = _a.strategy, mapping = _a.mapping, attributeType = _a.attributeType, currentSurvivorshipGroup = _a.currentSurvivorshipGroup, appliedRule = _a.appliedRule;
137
161
  var fixUri = fixReferencedAttributeUri(attributeType);
138
162
  var primaryAttributeUri = isOtherAttributeWinnerRule(strategy) ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.primaryAttributeUri) : undefined;
139
163
  var comparisonAttributeUri = isComplexAttribute(attributeType) && isMinMaxValueRule(strategy)
140
164
  ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.comparisonAttributeUri)
141
165
  : undefined;
142
- var sourcesUriOrder = isSourceSystemRule(strategy)
143
- ? uniq(__spreadArray(__spreadArray(__spreadArray([], ((mapping === null || mapping === void 0 ? void 0 : mapping.sourcesUriOrder) || []), true), ((currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.sourcesUriOrder) || []), true), getSourcesUriOrderFromMetadata(metadata), true))
144
- : undefined;
166
+ var sourcesUriOrder = getSourcesUriOrder({ metadata: metadata, strategy: strategy, mapping: mapping, currentSurvivorshipGroup: currentSurvivorshipGroup, appliedRule: appliedRule });
145
167
  return {
146
168
  type: RuleItemType.Rule,
147
169
  data: {
@@ -159,15 +181,21 @@ var mapAttributeToRuleType = function (_a) {
159
181
  return null;
160
182
  }
161
183
  if (ovDetails.participationStatus === ParticipationStatus.Strategy) {
162
- var appliedRules = collectRuleNames(ovDetails.appliedSurvivorshipRules);
163
- var lastRule = getSurvivorshipStrategy(metadata, last(appliedRules));
184
+ var appliedRule = ovDetails.appliedSurvivorshipRuleTree
185
+ ? getAppliedRuleTreeLeaf(ovDetails.appliedSurvivorshipRuleTree)
186
+ : undefined;
187
+ var lastRuleName = appliedRule
188
+ ? appliedRule.appliedSurvivorshipRule
189
+ : last(collectRuleNames(ovDetails.appliedSurvivorshipRules));
190
+ var lastRule = getSurvivorshipStrategy(metadata, lastRuleName);
164
191
  return lastRule
165
192
  ? createRuleTypeData({
166
193
  metadata: metadata,
167
194
  strategy: lastRule,
168
195
  mapping: mapping,
169
196
  attributeType: attributeType,
170
- currentSurvivorshipGroup: currentSurvivorshipGroup
197
+ currentSurvivorshipGroup: currentSurvivorshipGroup,
198
+ appliedRule: appliedRule
171
199
  })
172
200
  : null;
173
201
  }
@@ -8,7 +8,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
8
  return to.concat(ar || Array.prototype.slice.call(from));
9
9
  };
10
10
  import { DataTypes, ParticipationStatus } from '@reltio/mdm-sdk';
11
- import { COLUMNS_DATA, countAttributeValues, getBasicTableColumnsData, getBasicTableRowsData, getWinnerCrosswalks, collectRuleNames } from './helpers';
11
+ import { COLUMNS_DATA, countAttributeValues, getBasicTableColumnsData, getBasicTableRowsData, getWinnerCrosswalks, collectRuleNames, collectRuleTreeNames, getAppliedRuleTreeLeaf } from './helpers';
12
12
  import { RuleItemType } from './types';
13
13
  import { HeadCellRenderer } from './components/HeadCellRenderer';
14
14
  import { AttributesHeadCellRenderer } from './components/AttributesHeadCellRenderer';
@@ -990,6 +990,142 @@ describe('helpers tests', function () {
990
990
  }
991
991
  });
992
992
  });
993
+ it('should return sourcesUriOrder from applied survivorship rule tree for source system strategy', function () {
994
+ var attributeType = {
995
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
996
+ type: 'Int',
997
+ name: 'Int',
998
+ label: 'Int'
999
+ };
1000
+ var attributes = {
1001
+ Int: [
1002
+ {
1003
+ uri: 'entities/123abc/attributes/Int/345fgh',
1004
+ type: 'configuration/entityTypes/HCP/attributes/Int',
1005
+ value: '1005',
1006
+ ov: true,
1007
+ ovDetails: {
1008
+ participationStatus: ParticipationStatus.Strategy,
1009
+ appliedSurvivorshipGroup: 'default',
1010
+ appliedSurvivorshipRules: 'SRC_SYS',
1011
+ appliedSurvivorshipRuleTree: {
1012
+ appliedSurvivorshipRule: 'SRC_SYS',
1013
+ sourcesUriOrder: ['configuration/sources/Reltio', 'configuration/sources/AHA'],
1014
+ fallbacks: []
1015
+ }
1016
+ }
1017
+ }
1018
+ ]
1019
+ };
1020
+ var rows = getBasicTableRowsData(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1021
+ var result = rows[0].ruleType;
1022
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
1023
+ type: RuleItemType.Rule,
1024
+ data: {
1025
+ strategy: {
1026
+ uri: 'configuration/survivorshipStrategies/SRC_SYS',
1027
+ label: 'Source system'
1028
+ },
1029
+ comparisonAttributeUri: undefined,
1030
+ primaryAttributeUri: undefined,
1031
+ sourcesUriOrder: ['configuration/sources/Reltio', 'configuration/sources/AHA']
1032
+ }
1033
+ });
1034
+ });
1035
+ it('should resolve winning strategy from the deepest fallback of the applied survivorship rule tree', function () {
1036
+ var attributeType = {
1037
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
1038
+ type: 'Int',
1039
+ name: 'Int',
1040
+ label: 'Int'
1041
+ };
1042
+ var attributes = {
1043
+ Int: [
1044
+ {
1045
+ uri: 'entities/123abc/attributes/Int/345fgh',
1046
+ type: 'configuration/entityTypes/HCP/attributes/Int',
1047
+ value: '1005',
1048
+ ov: true,
1049
+ ovDetails: {
1050
+ participationStatus: ParticipationStatus.Strategy,
1051
+ appliedSurvivorshipGroup: 'default',
1052
+ appliedSurvivorshipRules: { SRC_SYS: [{ SRC_SYS: [{ SRC_SYS: ['LUD'] }] }] },
1053
+ appliedSurvivorshipRuleTree: {
1054
+ appliedSurvivorshipRule: 'SRC_SYS',
1055
+ sourcesUriOrder: ['configuration/sources/AMS', 'configuration/sources/AMA'],
1056
+ fallbacks: [
1057
+ {
1058
+ appliedSurvivorshipRule: 'SRC_SYS',
1059
+ sourcesUriOrder: ['configuration/sources/AMS'],
1060
+ fallbacks: [
1061
+ {
1062
+ appliedSurvivorshipRule: 'LUD',
1063
+ fallbacks: []
1064
+ }
1065
+ ]
1066
+ }
1067
+ ]
1068
+ }
1069
+ }
1070
+ }
1071
+ ]
1072
+ };
1073
+ var rows = getBasicTableRowsData(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1074
+ var result = rows[0].ruleType;
1075
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
1076
+ type: RuleItemType.Rule,
1077
+ data: {
1078
+ strategy: {
1079
+ uri: 'configuration/survivorshipStrategies/LUD',
1080
+ label: 'Recency'
1081
+ },
1082
+ comparisonAttributeUri: undefined,
1083
+ primaryAttributeUri: undefined,
1084
+ sourcesUriOrder: undefined
1085
+ }
1086
+ });
1087
+ });
1088
+ it('should not provide sourcesUriOrder when the winning source system tree node has no sourcesUriOrder', function () {
1089
+ var attributeType = {
1090
+ uri: 'configuration/entityTypes/HCP/attributes/Int',
1091
+ type: 'Int',
1092
+ name: 'Int',
1093
+ label: 'Int'
1094
+ };
1095
+ var attributes = {
1096
+ Int: [
1097
+ {
1098
+ uri: 'entities/123abc/attributes/Int/345fgh',
1099
+ type: 'configuration/entityTypes/HCP/attributes/Int',
1100
+ value: '1005',
1101
+ ov: true,
1102
+ ovDetails: {
1103
+ participationStatus: ParticipationStatus.Strategy,
1104
+ appliedSurvivorshipGroup: 'noOrderGroup',
1105
+ appliedSurvivorshipRules: 'SRC_SYS',
1106
+ appliedSurvivorshipRuleTree: {
1107
+ appliedSurvivorshipRule: 'SRC_SYS',
1108
+ fallbacks: []
1109
+ }
1110
+ }
1111
+ }
1112
+ ]
1113
+ };
1114
+ var rows = getBasicTableRowsData(metadata, 'configuration/entityTypes/HCP', [attributeType], ['ruleType'], crosswalksMap, attributes);
1115
+ var result = rows[0].ruleType;
1116
+ expect(result.getRuleTypeData(attributeType, result.attributeValues[0])).toEqual({
1117
+ type: RuleItemType.Rule,
1118
+ data: {
1119
+ strategy: {
1120
+ uri: 'configuration/survivorshipStrategies/SRC_SYS',
1121
+ label: 'Source system'
1122
+ },
1123
+ comparisonAttributeUri: undefined,
1124
+ primaryAttributeUri: undefined,
1125
+ sourcesUriOrder: undefined
1126
+ }
1127
+ });
1128
+ });
993
1129
  it('should return applied survivorship rule type for reference attribute', function () {
994
1130
  var attributeType = {
995
1131
  uri: 'configuration/entityTypes/HCP/attributes/Address',
@@ -1372,5 +1508,39 @@ describe('helpers tests', function () {
1372
1508
  expect(collectRuleNames(rules)).toEqual(['SRC_SYS', 'LUD', 'SRC_SYS']);
1373
1509
  });
1374
1510
  });
1511
+ describe('collectRuleTreeNames', function () {
1512
+ it('should return empty array when tree is undefined', function () {
1513
+ expect(collectRuleTreeNames(undefined)).toEqual([]);
1514
+ });
1515
+ it('should return single rule when there are no fallbacks', function () {
1516
+ expect(collectRuleTreeNames({ appliedSurvivorshipRule: 'SRC_SYS', fallbacks: [] })).toEqual(['SRC_SYS']);
1517
+ });
1518
+ it('should flatten the fallback chain from the root down to the leaf', function () {
1519
+ var tree = {
1520
+ appliedSurvivorshipRule: 'SRC_SYS',
1521
+ fallbacks: [
1522
+ {
1523
+ appliedSurvivorshipRule: 'SRC_SYS',
1524
+ fallbacks: [{ appliedSurvivorshipRule: 'LUD', fallbacks: [] }]
1525
+ }
1526
+ ]
1527
+ };
1528
+ expect(collectRuleTreeNames(tree)).toEqual(['SRC_SYS', 'SRC_SYS', 'LUD']);
1529
+ });
1530
+ });
1531
+ describe('getAppliedRuleTreeLeaf', function () {
1532
+ it('should return the node itself when there are no fallbacks', function () {
1533
+ var tree = { appliedSurvivorshipRule: 'SRC_SYS', fallbacks: [] };
1534
+ expect(getAppliedRuleTreeLeaf(tree)).toBe(tree);
1535
+ });
1536
+ it('should return the deepest fallback node', function () {
1537
+ var leaf = { appliedSurvivorshipRule: 'LUD', fallbacks: [] };
1538
+ var tree = {
1539
+ appliedSurvivorshipRule: 'SRC_SYS',
1540
+ fallbacks: [{ appliedSurvivorshipRule: 'SRC_SYS', fallbacks: [leaf] }]
1541
+ };
1542
+ expect(getAppliedRuleTreeLeaf(tree)).toBe(leaf);
1543
+ });
1544
+ });
1375
1545
  });
1376
1546
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2289",
3
+ "version": "1.4.2291",
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.2060",
14
+ "@reltio/mdm-sdk": "^1.4.2061",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",
@@ -30,7 +30,6 @@
30
30
  "react-mentions": "^4.3.0",
31
31
  "react-number-format": "^4.9.2",
32
32
  "react-resizable-panels": "^2.0.20",
33
- "react-router-dom": "^6.30.2",
34
33
  "react-select": "^5.8.0",
35
34
  "react-simple-maps": "^3.0.0",
36
35
  "react-virtualized": "^9.22.5",
@@ -54,6 +53,7 @@
54
53
  "react": "^18.3.1",
55
54
  "react-components": "bitbucket:reltio-ondemand/react-components#v5.0.1",
56
55
  "react-resize-detector": "^9.1.1",
56
+ "react-router": "^7.18.1",
57
57
  "ui-i18n": "bitbucket:reltio-ondemand/ui-i18n#v1.4.0"
58
58
  },
59
59
  "publishConfig": {