@reltio/components 1.4.908 → 1.4.912

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/cjs/components/ActionButton/ActionButton.d.ts +16 -0
  2. package/cjs/components/ActionButton/ActionButton.js +90 -0
  3. package/cjs/components/ActionButton/styles.d.ts +1 -0
  4. package/cjs/components/ActionButton/styles.js +50 -0
  5. package/cjs/components/MergeButton/MergeButton.d.ts +15 -0
  6. package/cjs/components/MergeButton/MergeButton.js +64 -0
  7. package/cjs/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  8. package/cjs/components/NotMatchButton/NotMatchButton.js +64 -0
  9. package/cjs/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  10. package/cjs/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  11. package/cjs/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  12. package/cjs/components/attributes/AttributesView/AttributesView.js +2 -2
  13. package/cjs/components/attributes/AttributesView/index.d.ts +1 -1
  14. package/cjs/components/attributes/editMode/AttributesList/AttributesList.js +3 -1
  15. package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +4 -1
  16. package/cjs/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  17. package/cjs/components/attributes/editMode/AttributesView/AttributesView.js +9 -2
  18. package/cjs/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  19. package/cjs/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  20. package/cjs/components/attributes/editMode/contexts/PinnedAttributesContext.js +8 -0
  21. package/cjs/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  22. package/cjs/components/attributes/types/attributesView.d.ts +4 -0
  23. package/cjs/components/history/HistoryMenuButton/HistoryMenuButton.js +46 -1
  24. package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
  25. package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.js +44 -0
  26. package/cjs/components/history/HistoryMenuButton/styles.d.ts +1 -1
  27. package/cjs/components/history/HistoryMenuButton/styles.js +13 -0
  28. package/cjs/components/index.d.ts +3 -0
  29. package/cjs/components/index.js +8 -1
  30. package/cjs/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -30
  31. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
  32. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
  33. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
  34. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
  35. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
  36. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
  37. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
  38. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +13 -0
  39. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
  40. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +25 -9
  41. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
  42. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
  43. package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  44. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
  45. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -6
  46. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  47. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -26
  48. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
  49. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +109 -28
  50. package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
  51. package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
  52. package/cjs/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
  53. package/cjs/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
  54. package/cjs/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
  55. package/cjs/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
  56. package/cjs/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  57. package/cjs/components/workflow/components/LineDecorator/styles.js +4 -1
  58. package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
  59. package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
  60. package/cjs/components/workflow/helpers/dcrHelpers.d.ts +7 -0
  61. package/cjs/components/workflow/helpers/dcrHelpers.js +48 -0
  62. package/cjs/components/workflow/hooks/useChangeRequest.d.ts +5 -0
  63. package/cjs/components/workflow/hooks/useChangeRequest.js +58 -0
  64. package/{esm/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → cjs/components/workflow/types/dcrTypes.d.ts} +22 -16
  65. package/cjs/components/workflow/types/dcrTypes.js +2 -0
  66. package/cjs/contexts/CollaborationContext/index.d.ts +1 -0
  67. package/cjs/contexts/CollaborationContext/index.js +1 -0
  68. package/cjs/hooks/index.d.ts +2 -0
  69. package/cjs/hooks/index.js +5 -1
  70. package/cjs/hooks/useCollaboration.d.ts +11 -10
  71. package/cjs/hooks/useCollaboration.js +24 -15
  72. package/cjs/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  73. package/cjs/hooks/useMarkAsNotMatchRequest.js +29 -0
  74. package/cjs/hooks/useMergeAllRequest.d.ts +12 -0
  75. package/cjs/hooks/useMergeAllRequest.js +29 -0
  76. package/esm/components/ActionButton/ActionButton.d.ts +16 -0
  77. package/esm/components/ActionButton/ActionButton.js +65 -0
  78. package/esm/components/ActionButton/styles.d.ts +1 -0
  79. package/esm/components/ActionButton/styles.js +47 -0
  80. package/esm/components/MergeButton/MergeButton.d.ts +15 -0
  81. package/esm/components/MergeButton/MergeButton.js +39 -0
  82. package/esm/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  83. package/esm/components/NotMatchButton/NotMatchButton.js +39 -0
  84. package/esm/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  85. package/esm/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  86. package/esm/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  87. package/esm/components/attributes/AttributesView/AttributesView.js +2 -2
  88. package/esm/components/attributes/AttributesView/index.d.ts +1 -1
  89. package/esm/components/attributes/editMode/AttributesList/AttributesList.js +4 -2
  90. package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +5 -2
  91. package/esm/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  92. package/esm/components/attributes/editMode/AttributesView/AttributesView.js +10 -3
  93. package/esm/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  94. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  95. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.js +2 -0
  96. package/esm/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  97. package/esm/components/attributes/types/attributesView.d.ts +4 -0
  98. package/esm/components/history/HistoryMenuButton/HistoryMenuButton.js +27 -1
  99. package/esm/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
  100. package/esm/components/history/HistoryMenuButton/MenuItemRenderer.js +20 -0
  101. package/esm/components/history/HistoryMenuButton/styles.d.ts +1 -1
  102. package/esm/components/history/HistoryMenuButton/styles.js +13 -0
  103. package/esm/components/index.d.ts +3 -0
  104. package/esm/components/index.js +3 -0
  105. package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -11
  106. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
  107. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
  108. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
  109. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
  110. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
  111. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
  112. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
  113. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +10 -0
  114. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
  115. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +26 -10
  116. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
  117. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
  118. package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  119. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
  120. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -7
  121. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  122. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -25
  123. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
  124. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +112 -31
  125. package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
  126. package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
  127. package/esm/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
  128. package/esm/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
  129. package/esm/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
  130. package/esm/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
  131. package/esm/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  132. package/esm/components/workflow/components/LineDecorator/styles.js +4 -1
  133. package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
  134. package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
  135. package/esm/components/workflow/helpers/dcrHelpers.d.ts +7 -0
  136. package/esm/components/workflow/helpers/dcrHelpers.js +43 -0
  137. package/esm/components/workflow/hooks/useChangeRequest.d.ts +5 -0
  138. package/esm/components/workflow/hooks/useChangeRequest.js +54 -0
  139. package/{cjs/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → esm/components/workflow/types/dcrTypes.d.ts} +22 -16
  140. package/esm/components/workflow/types/dcrTypes.js +1 -0
  141. package/esm/contexts/CollaborationContext/index.d.ts +1 -0
  142. package/esm/contexts/CollaborationContext/index.js +1 -0
  143. package/esm/hooks/index.d.ts +2 -0
  144. package/esm/hooks/index.js +2 -0
  145. package/esm/hooks/useCollaboration.d.ts +11 -10
  146. package/esm/hooks/useCollaboration.js +25 -16
  147. package/esm/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  148. package/esm/hooks/useMarkAsNotMatchRequest.js +22 -0
  149. package/esm/hooks/useMergeAllRequest.d.ts +12 -0
  150. package/esm/hooks/useMergeAllRequest.js +22 -0
  151. package/package.json +3 -3
@@ -1,9 +1,20 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.mergeChanges = void 0;
4
15
  var ramda_1 = require("ramda");
5
16
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
6
- var operations_1 = require("../constants/operations");
17
+ var operations_1 = require("../../../constants/operations");
7
18
  var attributesHelpers_1 = require("./attributesHelpers");
8
19
  var ATTRIBUTE_DELIMITER = '/';
9
20
  var SPECIAL_ATTRIBUTES_NAMES = [
@@ -15,31 +26,37 @@ var SPECIAL_ATTRIBUTES_NAMES = [
15
26
  ];
16
27
  var prepareStartOrEndDate = function (_a) {
17
28
  var newValue = _a.newValue, oldValue = _a.oldValue;
18
- var parseValue = function (value) { return (ramda_1.is(String) ? parseInt(value) : value); };
29
+ var parseValue = function (value) { return (isNaN(value) ? value : parseInt(value)); };
19
30
  var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !mdm_sdk_1.isEmptyValue(value); };
20
31
  var isExistNewValue = isExistedValue(newValue);
21
32
  var isExistOldValue = isExistedValue(oldValue);
22
33
  if (isExistNewValue && isExistOldValue) {
23
- return {
24
- type: operations_1.DCRTypes.UPDATE_ATTRIBUTE,
25
- oldValue: { value: parseValue(oldValue[0]) },
26
- newValue: { value: parseValue(newValue[0]) }
27
- };
34
+ return [
35
+ {
36
+ type: operations_1.DCRTypes.UPDATE_ATTRIBUTE,
37
+ oldValue: { value: parseValue(oldValue[0]) },
38
+ newValue: { value: parseValue(newValue[0]) }
39
+ }
40
+ ];
28
41
  }
29
42
  else if (isExistNewValue) {
30
- return {
31
- type: operations_1.DCRTypes.INSERT_ATTRIBUTE,
32
- newValue: { value: parseValue(newValue[0]) }
33
- };
43
+ return [
44
+ {
45
+ type: operations_1.DCRTypes.INSERT_ATTRIBUTE,
46
+ newValue: { value: parseValue(newValue[0]) }
47
+ }
48
+ ];
34
49
  }
35
50
  else if (isExistOldValue) {
36
- return {
37
- type: operations_1.DCRTypes.DELETE_ATTRIBUTE,
38
- oldValue: { value: parseValue(oldValue[0]) }
39
- };
51
+ return [
52
+ {
53
+ type: operations_1.DCRTypes.DELETE_ATTRIBUTE,
54
+ oldValue: { value: parseValue(oldValue[0]) }
55
+ }
56
+ ];
40
57
  }
41
58
  };
42
- var prepareRolesOrTags = function (change, metadata) {
59
+ var prepareRolesOrTags = function (metadata, change) {
43
60
  var _a = change.newValue, newValue = _a === void 0 ? [] : _a, _b = change.oldValue, oldValue = _b === void 0 ? [] : _b, type = change.type;
44
61
  var getLabel = type === operations_1.DCRTypes.UPDATE_ROLES ? mdm_sdk_1.getRoleLabel(metadata) : ramda_1.identity;
45
62
  var diffNewValue = ramda_1.difference(newValue, oldValue);
@@ -91,6 +108,47 @@ var prepareAttribute = function (container, change) {
91
108
  }
92
109
  return container;
93
110
  };
111
+ var createEntityOrRelation = function (metadata, value) {
112
+ var _a = value.attributes, attributes = _a === void 0 ? {} : _a, startDate = value.startDate, endDate = value.endDate;
113
+ var _b = value, roles = _b.roles, tags = _b.tags, defaultProfilePicValue = _b.defaultProfilePicValue;
114
+ var newObject = __assign({}, attributes);
115
+ if (defaultProfilePicValue) {
116
+ newObject['defaultProfilePicValue'] = [defaultProfilePicValue];
117
+ }
118
+ if (roles) {
119
+ newObject[mdm_sdk_1.EntityAttrTypes.roles.name] = [
120
+ {
121
+ type: operations_1.DCRTypes.INSERT_ATTRIBUTE,
122
+ newValue: { value: roles.map(mdm_sdk_1.getRoleLabel(metadata)).join(', ') }
123
+ }
124
+ ];
125
+ }
126
+ if (tags) {
127
+ newObject[mdm_sdk_1.EntityAttrTypes.tags.name] = [
128
+ {
129
+ type: operations_1.DCRTypes.INSERT_ATTRIBUTE,
130
+ newValue: { value: tags.join(', ') }
131
+ }
132
+ ];
133
+ }
134
+ if (startDate) {
135
+ newObject[mdm_sdk_1.EntityAttrTypes.startDate.name] = [
136
+ {
137
+ type: operations_1.DCRTypes.INSERT_ATTRIBUTE,
138
+ newValue: { value: startDate }
139
+ }
140
+ ];
141
+ }
142
+ if (endDate) {
143
+ newObject[mdm_sdk_1.EntityAttrTypes.endDate.name] = [
144
+ {
145
+ type: operations_1.DCRTypes.INSERT_ATTRIBUTE,
146
+ newValue: { value: endDate }
147
+ }
148
+ ];
149
+ }
150
+ return newObject;
151
+ };
94
152
  var mergeAttributesInChange = function (metadata, objectInfo, change, container) {
95
153
  if (container === void 0) { container = {}; }
96
154
  var type = change.type;
@@ -99,39 +157,62 @@ var mergeAttributesInChange = function (metadata, objectInfo, change, container)
99
157
  container['defaultProfilePicValue'] = [change.newValue];
100
158
  break;
101
159
  case operations_1.DCRTypes.UPDATE_TAGS:
102
- container[mdm_sdk_1.EntityAttrTypes.tags.name] = prepareRolesOrTags(change, metadata);
160
+ container[mdm_sdk_1.EntityAttrTypes.tags.name] = prepareRolesOrTags(metadata, change);
103
161
  break;
104
162
  case operations_1.DCRTypes.UPDATE_ROLES: {
105
- container[mdm_sdk_1.EntityAttrTypes.roles.name] = prepareRolesOrTags(change, metadata);
163
+ container[mdm_sdk_1.EntityAttrTypes.roles.name] = prepareRolesOrTags(metadata, change);
106
164
  break;
107
165
  }
108
166
  case operations_1.DCRTypes.UPDATE_START_DATE:
109
- container[mdm_sdk_1.EntityAttrTypes.startDate.name] = [prepareStartOrEndDate(change)];
167
+ container[mdm_sdk_1.EntityAttrTypes.startDate.name] = prepareStartOrEndDate(change);
110
168
  break;
111
169
  case operations_1.DCRTypes.UPDATE_END_DATE:
112
- container[mdm_sdk_1.EntityAttrTypes.endDate.name] = [prepareStartOrEndDate(change)];
170
+ container[mdm_sdk_1.EntityAttrTypes.endDate.name] = prepareStartOrEndDate(change);
113
171
  break;
114
- default: {
172
+ case operations_1.DCRTypes.CREATE_RELATIONSHIP:
173
+ case operations_1.DCRTypes.CREATE_ENTITY: {
174
+ return __assign(__assign({}, container), createEntityOrRelation(metadata, change.newValue));
175
+ }
176
+ case operations_1.DCRTypes.INSERT_ATTRIBUTE:
177
+ case operations_1.DCRTypes.UPDATE_ATTRIBUTE:
178
+ case operations_1.DCRTypes.DELETE_ATTRIBUTE:
179
+ case operations_1.DCRTypes.PIN_ATTRIBUTE:
180
+ case operations_1.DCRTypes.IGNORE_ATTRIBUTE:
115
181
  prepareAttribute(container, change);
116
182
  break;
117
- }
183
+ default:
184
+ break;
118
185
  }
119
186
  return container;
120
187
  };
121
- var mergeChanges = function (metadata, changes, objectInfo) {
122
- var getAttributeChanges = function (attributeName) { return ramda_1.pipe(ramda_1.pick([attributeName]), attributesHelpers_1.getChanges(metadata, objectInfo)); };
188
+ var updateRelation = function (metadata, changes, relationInfo) {
189
+ var relationChanges = ramda_1.propOr([], relationInfo.uri)(changes);
190
+ return relationChanges.reduce(function (result, change) {
191
+ return mergeAttributesInChange(metadata, relationInfo, change, result);
192
+ }, {});
193
+ };
194
+ var mergeChanges = function (metadata, changes, entityInfo, relationsInfo) {
195
+ var getAttributeChanges = function (attributeName) {
196
+ return ramda_1.pipe(ramda_1.pick([attributeName]), attributesHelpers_1.getEntityChanges(metadata, entityInfo));
197
+ };
123
198
  var concatChanges = ramda_1.curry(function (getters, attributesTree) {
124
199
  return ramda_1.reduce(function (acc, getter) { return ramda_1.concat(acc, getter(attributesTree)); }, [], getters);
125
200
  });
126
- var changesTree = changes.reduce(function (result, change) {
127
- return mergeAttributesInChange(metadata, objectInfo, change, result);
201
+ var entityInfoChanges = ramda_1.propOr([], entityInfo.uri)(changes);
202
+ var changesTree = entityInfoChanges.reduce(function (result, change) {
203
+ return mergeAttributesInChange(metadata, entityInfo, change, result);
128
204
  }, {});
129
- return concatChanges([
130
- ramda_1.pipe(ramda_1.omit(SPECIAL_ATTRIBUTES_NAMES), attributesHelpers_1.getChanges(metadata, objectInfo)),
205
+ var relationsTrees = relationsInfo.map(function (relationInfo) { return updateRelation(metadata, changes, relationInfo); });
206
+ var entityChanges = concatChanges([
207
+ ramda_1.pipe(ramda_1.omit(SPECIAL_ATTRIBUTES_NAMES), attributesHelpers_1.getEntityChanges(metadata, entityInfo)),
131
208
  getAttributeChanges(mdm_sdk_1.EntityAttrTypes.roles.name),
132
209
  getAttributeChanges(mdm_sdk_1.EntityAttrTypes.tags.name),
133
210
  getAttributeChanges(mdm_sdk_1.EntityAttrTypes.startDate.name),
134
211
  getAttributeChanges(mdm_sdk_1.EntityAttrTypes.endDate.name)
135
212
  ], changesTree);
213
+ var relationsChanges = ramda_1.flatten(relationsInfo.map(function (relationInfo, index) {
214
+ return attributesHelpers_1.getRelationChanges(metadata, relationInfo, relationsTrees[index]);
215
+ }));
216
+ return [entityChanges, relationsChanges];
136
217
  };
137
218
  exports.mergeChanges = mergeChanges;
@@ -1,6 +1,7 @@
1
- export declare const useCollapsibleList: (changes: any, limit?: number) => {
1
+ import { Diff, Title } from '../types/diffTypes';
2
+ export declare const useCollapsibleList: (items: (Diff | Title)[], limit?: number) => {
2
3
  isExpanded: boolean;
3
4
  onToggle: () => void;
4
- itemsToShow: any;
5
+ itemsToShow: (Diff | Title)[];
5
6
  collapsedSuggestionsCount: number;
6
7
  };
@@ -4,14 +4,14 @@ exports.useCollapsibleList = void 0;
4
4
  var react_1 = require("react");
5
5
  var contextHelpers_1 = require("../helpers/contextHelpers");
6
6
  var DEFAULT_VISIBLE_ITEMS_COUNT = 3;
7
- var useCollapsibleList = function (changes, limit) {
7
+ var useCollapsibleList = function (items, limit) {
8
8
  if (limit === void 0) { limit = DEFAULT_VISIBLE_ITEMS_COUNT; }
9
9
  var _a = react_1.useState(false), isExpanded = _a[0], setIsExpanded = _a[1];
10
10
  var onToggle = react_1.useCallback(function () { return setIsExpanded(function (value) { return !value; }); }, []);
11
- var collapsedItems = react_1.useMemo(function () { return changes.slice(0, limit); }, [changes, limit]);
12
- var suggestionsCount = react_1.useMemo(function () { return contextHelpers_1.getSuggestionsCount(changes); }, [changes]);
11
+ var collapsedItems = react_1.useMemo(function () { return items.slice(0, limit); }, [items, limit]);
12
+ var suggestionsCount = react_1.useMemo(function () { return contextHelpers_1.getSuggestionsCount(items); }, [items]);
13
13
  var visibleSuggestionsCount = react_1.useMemo(function () { return contextHelpers_1.getSuggestionsCount(collapsedItems); }, [collapsedItems]);
14
- var itemsToShow = isExpanded ? changes : collapsedItems;
14
+ var itemsToShow = isExpanded ? items : collapsedItems;
15
15
  var collapsedSuggestionsCount = suggestionsCount - visibleSuggestionsCount;
16
16
  return { isExpanded: isExpanded, onToggle: onToggle, itemsToShow: itemsToShow, collapsedSuggestionsCount: collapsedSuggestionsCount };
17
17
  };
@@ -0,0 +1,16 @@
1
+ import { AttributeType } from '@reltio/mdm-sdk';
2
+ import { ChangeValue, DCRAttributeValue, RelationInfo } from '../../../types/dcrTypes';
3
+ import { OperationTypes } from '../../../constants/operations';
4
+ export declare type RelationAttributeValue = DCRAttributeValue & RelationInfo;
5
+ export declare type Diff = {
6
+ level: number;
7
+ label: string;
8
+ attributeType: AttributeType;
9
+ attributeValue?: DCRAttributeValue | RelationAttributeValue;
10
+ newValue?: ChangeValue;
11
+ oldValue?: ChangeValue;
12
+ operation?: OperationTypes;
13
+ };
14
+ export declare type Title = {
15
+ label: string;
16
+ };
@@ -6,6 +6,7 @@ declare type Props = {
6
6
  first?: boolean;
7
7
  last?: boolean;
8
8
  transparent?: boolean;
9
+ divider?: boolean;
9
10
  };
10
- declare const LineDecorator: ({ className, children, plain, first, last, transparent }: Props) => JSX.Element;
11
+ declare const LineDecorator: ({ className, children, plain, first, last, transparent, divider }: Props) => JSX.Element;
11
12
  export default LineDecorator;
@@ -6,14 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var react_1 = __importDefault(require("react"));
7
7
  var classnames_1 = __importDefault(require("classnames"));
8
8
  var styles_1 = require("./styles");
9
+ var Divider_1 = __importDefault(require("@material-ui/core/Divider"));
9
10
  var LineDecorator = function (_a) {
10
11
  var _b, _c, _d;
11
- var className = _a.className, children = _a.children, plain = _a.plain, first = _a.first, last = _a.last, transparent = _a.transparent;
12
+ var className = _a.className, children = _a.children, plain = _a.plain, first = _a.first, last = _a.last, transparent = _a.transparent, divider = _a.divider;
12
13
  var styles = styles_1.useStyles();
13
14
  return (react_1.default.createElement("div", { className: classnames_1.default(className, styles.decorator) },
14
15
  react_1.default.createElement("div", { className: classnames_1.default(styles.lineBlock, (_b = {}, _b[styles.withLinePadding] = first, _b)) }, !transparent && (react_1.default.createElement(react_1.default.Fragment, null,
15
16
  react_1.default.createElement("div", { className: styles.noLine }),
16
17
  react_1.default.createElement("div", { className: classnames_1.default(styles.line, (_c = {}, _c[styles.plain] = plain, _c), (_d = {}, _d[styles.last] = last, _d)) })))),
17
- react_1.default.createElement("div", { className: styles.content }, children)));
18
+ react_1.default.createElement("div", { className: styles.content },
19
+ children,
20
+ divider && react_1.default.createElement(Divider_1.default, { className: styles.rowDivider, light: true, variant: "inset" }))));
18
21
  };
19
22
  exports.default = LineDecorator;
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "last" | "line" | "decorator" | "plain" | "lineBlock" | "withLinePadding" | "noLine">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "last" | "line" | "rowDivider" | "decorator" | "plain" | "lineBlock" | "withLinePadding" | "noLine">;
@@ -60,5 +60,8 @@ exports.useStyles = styles_1.makeStyles({
60
60
  minWidth: 0
61
61
  },
62
62
  plain: {},
63
- last: {}
63
+ last: {},
64
+ rowDivider: {
65
+ marginLeft: 0
66
+ }
64
67
  });
@@ -0,0 +1,7 @@
1
+ import { GroupedObjectsInfo, DCRChanges, DCRObjectInfo, DCRObjectsInfo } from '../types/dcrTypes';
2
+ export declare const getEntitiesObjects: any;
3
+ export declare const getRelationsObjects: any;
4
+ export declare const extractObjectsFromChangeRequest: (changes: DCRChanges, objectsInfo: DCRObjectsInfo) => DCRObjectInfo[];
5
+ export declare const createEntityRelationsObjectByEntity: any;
6
+ export declare const createEntityRelationsObjectByRelation: any;
7
+ export declare const concatEntityRelationsObjects: (acc: Record<string, GroupedObjectsInfo>, object: GroupedObjectsInfo) => Record<string, GroupedObjectsInfo>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.concatEntityRelationsObjects = exports.createEntityRelationsObjectByRelation = exports.createEntityRelationsObjectByEntity = exports.extractObjectsFromChangeRequest = exports.getRelationsObjects = exports.getEntitiesObjects = void 0;
15
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
16
+ var ramda_1 = require("ramda");
17
+ exports.getEntitiesObjects = ramda_1.filter(ramda_1.pipe(ramda_1.prop('uri'), mdm_sdk_1.isEntityUri));
18
+ exports.getRelationsObjects = ramda_1.filter(ramda_1.pipe(ramda_1.prop('uri'), mdm_sdk_1.isRelationUri));
19
+ var getRelations = function (objectsWithChanges, entityUri) {
20
+ return ramda_1.filter(ramda_1.allPass([ramda_1.pipe(ramda_1.prop('uri'), mdm_sdk_1.isRelationUri), ramda_1.pipe(ramda_1.prop('startObjectUri'), ramda_1.equals(entityUri))]))(objectsWithChanges);
21
+ };
22
+ var extractObjectsFromChangeRequest = function (changes, objectsInfo) {
23
+ var getChange = function (key) { return ramda_1.prop([key], changes); };
24
+ return ramda_1.pipe(ramda_1.keys, ramda_1.filter(getChange), ramda_1.map(function (key) { return (__assign(__assign({}, objectsInfo[key]), { uri: key })); }))(objectsInfo);
25
+ };
26
+ exports.extractObjectsFromChangeRequest = extractObjectsFromChangeRequest;
27
+ exports.createEntityRelationsObjectByEntity = ramda_1.curry(function (objectsWithChanges, entity) {
28
+ return {
29
+ entity: entity,
30
+ relations: getRelations(objectsWithChanges, entity.uri)
31
+ };
32
+ });
33
+ exports.createEntityRelationsObjectByRelation = ramda_1.curry(function (objectsInfo, relation) {
34
+ var entity = objectsInfo[relation.startObjectUri];
35
+ var relations = [relation];
36
+ return entity ? { entity: __assign(__assign({}, entity), { uri: relation.startObjectUri }), relations: relations } : { relations: relations };
37
+ });
38
+ var concatEntityRelationsObjects = function (acc, object) {
39
+ var entity = object.entity, relations = object.relations;
40
+ var entityUri = entity.uri;
41
+ var mergedRelations = ramda_1.pipe(ramda_1.pathOr([], [entityUri, 'relations']), ramda_1.concat(relations), ramda_1.uniq)(acc);
42
+ acc[entityUri] = {
43
+ entity: entity,
44
+ relations: mergedRelations
45
+ };
46
+ return acc;
47
+ };
48
+ exports.concatEntityRelationsObjects = concatEntityRelationsObjects;
@@ -0,0 +1,5 @@
1
+ import { GroupedObjectsInfo, ChangeRequest } from '../types/dcrTypes';
2
+ export declare const useChangeRequest: (dcrUri: string) => {
3
+ dcr: ChangeRequest;
4
+ groupedObjects: GroupedObjectsInfo[];
5
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useChangeRequest = void 0;
15
+ var react_1 = require("react");
16
+ var ramda_1 = require("ramda");
17
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
18
+ var hooks_1 = require("../../../hooks");
19
+ var dcrHelpers_1 = require("../helpers/dcrHelpers");
20
+ var errors_1 = require("../helpers/errors");
21
+ var useChangeRequest = function (dcrUri) {
22
+ var _a = react_1.useState([]), groupedObjects = _a[0], setGroupedObjects = _a[1];
23
+ var _b = react_1.useState(null), dcr = _b[0], setDcr = _b[1];
24
+ var safePromise = hooks_1.useSafePromise();
25
+ var requestEntities = react_1.useCallback(function (entityUris) {
26
+ if (ramda_1.isEmpty(entityUris)) {
27
+ return Promise.resolve([]);
28
+ }
29
+ return safePromise(mdm_sdk_1.getEntitiesByUris(entityUris, { searchOptions: 'ovOnly', defaultMaxValues: 1 }));
30
+ }, []); // eslint-disable-line
31
+ react_1.useEffect(function () {
32
+ mdm_sdk_1.getDataChangeRequest(dcrUri)
33
+ .then(function (dcr) {
34
+ var changes = dcr.changes, objectsInfo = dcr.objectsInfo;
35
+ var objectsWithChanges = dcrHelpers_1.extractObjectsFromChangeRequest(changes, objectsInfo);
36
+ var entityObjectsWithRelations = ramda_1.pipe(dcrHelpers_1.getEntitiesObjects, ramda_1.map(dcrHelpers_1.createEntityRelationsObjectByEntity(objectsWithChanges)))(objectsWithChanges);
37
+ var relationsObjects = ramda_1.pipe(dcrHelpers_1.getRelationsObjects, ramda_1.map(dcrHelpers_1.createEntityRelationsObjectByRelation(objectsInfo)))(objectsWithChanges);
38
+ var _a = ramda_1.partition(ramda_1.has('entity'), relationsObjects), relationsObjectsWithEntity = _a[0], relationsObjectsWithoutEntity = _a[1];
39
+ var entityUris = relationsObjectsWithoutEntity.map(ramda_1.path(['relations', 0, 'startObjectUri']));
40
+ requestEntities(entityUris)
41
+ .then(function (entities) {
42
+ var relationsObjectsWithRequestedEntities = relationsObjectsWithoutEntity.map(function (relationsObject, index) {
43
+ return __assign(__assign({}, relationsObject), { entity: entities[index] });
44
+ });
45
+ ramda_1.pipe(ramda_1.flatten, ramda_1.reduce(dcrHelpers_1.concatEntityRelationsObjects, {}), ramda_1.values, setGroupedObjects)([
46
+ entityObjectsWithRelations,
47
+ relationsObjectsWithEntity,
48
+ relationsObjectsWithRequestedEntities
49
+ ]);
50
+ })
51
+ .catch(errors_1.showWorkflowError);
52
+ setDcr(dcr);
53
+ })
54
+ .catch(errors_1.showWorkflowError);
55
+ }, [dcrUri, requestEntities]);
56
+ return { dcr: dcr, groupedObjects: groupedObjects };
57
+ };
58
+ exports.useChangeRequest = useChangeRequest;
@@ -1,10 +1,26 @@
1
- import { Crosswalk, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
1
+ import { Crosswalk, Entity, NestedAttributeValue, ReferenceAttributeValue, Relation, SimpleAttributeValue } from '@reltio/mdm-sdk';
2
2
  import { DCRTypes } from '../constants/operations';
3
+ export declare type ChangeRequest = {
4
+ changes: DCRChanges;
5
+ createdBy: string;
6
+ createdTime: number;
7
+ objectsInfo: DCRObjectsInfo;
8
+ state: string;
9
+ type: string;
10
+ updatedBy: string;
11
+ updatedTime: number;
12
+ uri: string;
13
+ };
14
+ export declare type GroupedObjectsInfo = {
15
+ entity: EntityInfo;
16
+ relations: RelationInfo[];
17
+ };
3
18
  export declare type EntityInfo = {
4
19
  isExist: boolean;
5
20
  label: string;
6
21
  secondaryLabel: string;
7
22
  type: string;
23
+ uri?: string;
8
24
  };
9
25
  export declare type RelationInfo = {
10
26
  type: string;
@@ -13,11 +29,15 @@ export declare type RelationInfo = {
13
29
  endObjectLabel: string;
14
30
  endObjectUri: string;
15
31
  isExist: boolean;
32
+ uri?: string;
16
33
  };
17
34
  export declare type DCRObjectInfo = EntityInfo | RelationInfo;
18
35
  export declare type DCRObjectsInfo = {
19
36
  [key: string]: DCRObjectInfo;
20
37
  };
38
+ export declare type DCRAttributes = {
39
+ [attributeName: string]: (ChangeValue | DCRChange)[];
40
+ };
21
41
  export declare type Value = DCRAttributes | DCRChange | string | boolean | number;
22
42
  export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue, 'uri' | 'value'> & {
23
43
  value: Value;
@@ -27,10 +47,7 @@ export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttrib
27
47
  };
28
48
  uri?: string;
29
49
  };
30
- export declare type DCRAttributes = {
31
- [attributeName: string]: DCRAttributeValue[];
32
- };
33
- export declare type ChangeValue = DCRAttributeValue | string[];
50
+ export declare type ChangeValue = DCRAttributeValue | string[] | Entity | Relation;
34
51
  export declare type DCRChange = {
35
52
  attributePath?: string;
36
53
  attributeType?: string;
@@ -50,14 +67,3 @@ export declare type DCRChange = {
50
67
  export declare type DCRChanges = {
51
68
  [key: string]: DCRChange[];
52
69
  };
53
- export declare type ChangeRequest = {
54
- changes: DCRChanges;
55
- createdBy: string;
56
- createdTime: number;
57
- objectsInfo: DCRObjectsInfo;
58
- state: string;
59
- type: string;
60
- updatedBy: string;
61
- updatedTime: number;
62
- uri: string;
63
- };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,6 +6,7 @@ export declare const CollaborationContext: React.Context<{
6
6
  comments: Comment[];
7
7
  currentComment: Comment;
8
8
  getComments: (uri: string, pageToken?: string) => void;
9
+ getCommentsCount: (objectIds: string[]) => void;
9
10
  getComment: (commentId: Comment['commentId']) => void;
10
11
  createComment: (params: Pick<Comment, 'content' | 'namedUsers' | 'objectType' | 'relatedObjectUris'> & {
11
12
  uri: string;
@@ -12,6 +12,7 @@ exports.CollaborationContext = react_1.default.createContext({
12
12
  currentComment: null,
13
13
  getComment: noop,
14
14
  getComments: function () { return new Promise(noop); },
15
+ getCommentsCount: noop,
15
16
  createComment: function () { return new Promise(noop); },
16
17
  editComment: function () { return new Promise(noop); },
17
18
  createReply: function () { return new Promise(noop); },
@@ -13,3 +13,5 @@ export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
13
13
  export { useConfigPermissions } from './useConfigPermissions';
14
14
  export { useMatchesLoader } from './useMatchesLoader';
15
15
  export { usePagingSimulator } from './usePagingSimulator';
16
+ export { useMergeAllRequest } from './useMergeAllRequest';
17
+ export { useMarkAsNotMatchRequest } from './useMarkAsNotMatchRequest';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCollaboration = exports.useAsyncMount = exports.useActions = void 0;
3
+ exports.useMarkAsNotMatchRequest = exports.useMergeAllRequest = exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCollaboration = exports.useAsyncMount = exports.useActions = void 0;
4
4
  var useActions_1 = require("./useActions");
5
5
  Object.defineProperty(exports, "useActions", { enumerable: true, get: function () { return useActions_1.useActions; } });
6
6
  var useAsyncMount_1 = require("./useAsyncMount");
@@ -31,3 +31,7 @@ var useMatchesLoader_1 = require("./useMatchesLoader");
31
31
  Object.defineProperty(exports, "useMatchesLoader", { enumerable: true, get: function () { return useMatchesLoader_1.useMatchesLoader; } });
32
32
  var usePagingSimulator_1 = require("./usePagingSimulator");
33
33
  Object.defineProperty(exports, "usePagingSimulator", { enumerable: true, get: function () { return usePagingSimulator_1.usePagingSimulator; } });
34
+ var useMergeAllRequest_1 = require("./useMergeAllRequest");
35
+ Object.defineProperty(exports, "useMergeAllRequest", { enumerable: true, get: function () { return useMergeAllRequest_1.useMergeAllRequest; } });
36
+ var useMarkAsNotMatchRequest_1 = require("./useMarkAsNotMatchRequest");
37
+ Object.defineProperty(exports, "useMarkAsNotMatchRequest", { enumerable: true, get: function () { return useMarkAsNotMatchRequest_1.useMarkAsNotMatchRequest; } });
@@ -1,19 +1,20 @@
1
1
  import { CollaborationObjectTypes, Comment, CommentsMap } from '@reltio/mdm-sdk';
2
2
  export declare const useCollaboration: (objectIds?: string[], objectTypes?: CollaborationObjectTypes[]) => {
3
- commentsMap: CommentsMap;
4
- currentComment: Comment;
3
+ clearCurrentComment: () => void;
5
4
  comments: Comment[];
6
- getComment: (commentId: string) => void;
5
+ commentsMap: CommentsMap;
6
+ createComment: ({ content, namedUsers, objectType, uri, relatedObjectUris }: any) => Promise<void>;
7
7
  createReply: ({ content, namedUsers, commentId, action, uri }: any) => Promise<void>;
8
- editComment: ({ content, namedUsers, objectType, uri, relatedObjectUris, commentId, replies }: any) => Promise<void>;
8
+ currentComment: Comment;
9
9
  deleteComment: ({ uri, commentId }: any) => void;
10
- createComment: ({ content, namedUsers, objectType, uri, relatedObjectUris }: any) => Promise<void>;
11
- clearCurrentComment: () => void;
12
- resolveThread: ({ commentId, uri }: any) => void;
13
- reOpenThread: ({ commentId, uri }: any) => void;
14
- sending: boolean;
10
+ editComment: ({ content, namedUsers, objectType, uri, relatedObjectUris, commentId, replies }: any) => Promise<void>;
11
+ getComment: (commentId: string) => void;
12
+ getComments: (relatedObjectUri: string, pageToken?: string) => void;
13
+ getCommentsCount: (objectIds: string[], shouldResetCommentsMap?: any) => void;
15
14
  loading: boolean;
16
15
  objectTypes: CollaborationObjectTypes[];
17
- getComments: (relatedObjectUri: string, pageToken?: string) => void;
18
16
  pageToken: string;
17
+ reOpenThread: ({ commentId, uri }: any) => void;
18
+ resolveThread: ({ commentId, uri }: any) => void;
19
+ sending: boolean;
19
20
  };
@@ -39,18 +39,26 @@ var useCollaboration = function (objectIds, objectTypes) {
39
39
  var _d = react_1.useState(null), currentComment = _d[0], setCurrentComment = _d[1];
40
40
  var _e = react_1.useState(false), sending = _e[0], setSending = _e[1];
41
41
  var _f = react_1.useState(false), loading = _f[0], setLoading = _f[1];
42
- react_1.useEffect(function () {
43
- if (isCollaborationEnabled && entity && !mdm_sdk_1.isTempUri(entity.uri)) {
42
+ var addCommentsToCommentsMap = react_1.useCallback(function (commentsMap) {
43
+ setCommentsMap(function (currentCommentsMap) { return (__assign(__assign({}, currentCommentsMap), commentsMap)); });
44
+ }, []);
45
+ var entityUri = entity === null || entity === void 0 ? void 0 : entity.uri;
46
+ var getCommentsCount = react_1.useCallback(function (objectIds, shouldResetCommentsMap) {
47
+ if (shouldResetCommentsMap === void 0) { shouldResetCommentsMap = false; }
48
+ if (isCollaborationEnabled && entityUri && !mdm_sdk_1.isTempUri(entityUri)) {
44
49
  var onError = function (e) {
45
50
  console.warn('Collaboration error', e);
46
51
  setCommentsMap(null);
47
52
  };
48
- ramda_1.pipe(mdm_sdk_1.getCommentsCount, ramda_1.andThen(ramda_1.map(ramda_1.props(['objectId', 'comments']))), ramda_1.andThen(ramda_1.fromPairs), ramda_1.andThen(setCommentsMap), ramda_1.otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
53
+ ramda_1.pipe(mdm_sdk_1.getCommentsCount, ramda_1.andThen(ramda_1.map(ramda_1.props(['objectId', 'comments']))), ramda_1.andThen(ramda_1.fromPairs), ramda_1.andThen(shouldResetCommentsMap ? setCommentsMap : addCommentsToCommentsMap), ramda_1.otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
49
54
  }
50
55
  else {
51
56
  setCommentsMap(null);
52
57
  }
53
- }, [entity, isCollaborationEnabled, tenant, collaborationPath, objectIds]);
58
+ }, [addCommentsToCommentsMap, collaborationPath, entityUri, isCollaborationEnabled, tenant]);
59
+ react_1.useEffect(function () {
60
+ getCommentsCount(objectIds, true);
61
+ }, [objectIds, getCommentsCount]);
54
62
  var getComments = react_1.useCallback(function (relatedObjectUri, pageToken) {
55
63
  mdm_sdk_1.getComments({ collaborationPath: collaborationPath, tenant: tenant, relatedObjectUri: relatedObjectUri, pageToken: pageToken })
56
64
  .then(function (_a) {
@@ -204,22 +212,23 @@ var useCollaboration = function (objectIds, objectTypes) {
204
212
  setCurrentComment(null);
205
213
  }, []);
206
214
  return {
207
- commentsMap: commentsMap,
208
- currentComment: currentComment,
215
+ clearCurrentComment: clearCurrentComment,
209
216
  comments: comments,
210
- getComment: getComment,
217
+ commentsMap: commentsMap,
218
+ createComment: createComment,
211
219
  createReply: createReply,
212
- editComment: editComment,
220
+ currentComment: currentComment,
213
221
  deleteComment: deleteComment,
214
- createComment: createComment,
215
- clearCurrentComment: clearCurrentComment,
216
- resolveThread: resolveThread,
217
- reOpenThread: reOpenThread,
218
- sending: sending,
222
+ editComment: editComment,
223
+ getComment: getComment,
224
+ getComments: getComments,
225
+ getCommentsCount: getCommentsCount,
219
226
  loading: loading,
220
227
  objectTypes: objectTypes,
221
- getComments: getComments,
222
- pageToken: pageToken
228
+ pageToken: pageToken,
229
+ reOpenThread: reOpenThread,
230
+ resolveThread: resolveThread,
231
+ sending: sending
223
232
  };
224
233
  };
225
234
  exports.useCollaboration = useCollaboration;