@reltio/profile 1.4.1585 → 1.4.1586-mui5

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 (335) hide show
  1. package/.DS_Store +0 -0
  2. package/index.ts +4 -0
  3. package/package.json +40 -23
  4. package/public/bundle.js +205 -0
  5. package/{bundle.js.LICENSE.txt → public/bundle.js.LICENSE.txt} +44 -16
  6. package/public/package.json +24 -0
  7. package/scripts/build/index.js +20 -0
  8. package/src/.DS_Store +0 -0
  9. package/src/components/.DS_Store +0 -0
  10. package/src/components/BackgroundProcessIndicator/BackgroundProcessIndicator.tsx +101 -0
  11. package/src/components/BackgroundProcessIndicator/styles.ts +50 -0
  12. package/src/components/DCRReviewPerspectiveView/DCRReviewPerspectiveView.tsx +77 -0
  13. package/src/components/DCRReviewPerspectiveView/__tests__/DCRReviewPerspectiveView.test.tsx +156 -0
  14. package/src/components/DCRReviewPerspectiveView/components/DCRProfileBand/DCRProfileBand.tsx +22 -0
  15. package/src/components/DCRReviewPerspectiveView/components/DCRProfileBand/__tests__/DCRProfileBand.test.tsx +92 -0
  16. package/src/components/DCRReviewPerspectiveView/components/DCRProfileBand/styles.ts +11 -0
  17. package/src/components/DCRReviewPerspectiveView/hooks/useWorkflowTasks.ts +31 -0
  18. package/src/components/DCRReviewPerspectiveView/index.ts +1 -0
  19. package/src/components/DCRReviewPerspectiveView/styles.ts +33 -0
  20. package/src/components/EntityMapView/EntityMapView.tsx +64 -0
  21. package/src/components/EntityMapView/__tests__/EntityMapView.spec.js +121 -0
  22. package/src/components/EntityMapView/styles.ts +20 -0
  23. package/src/components/EntityMapView/useMarkers.ts +27 -0
  24. package/src/components/HierarchyPathsView/ConfigContext.ts +4 -0
  25. package/src/components/HierarchyPathsView/HierarchyPathsHeader.tsx +32 -0
  26. package/src/components/HierarchyPathsView/HierarchyPathsView.tsx +90 -0
  27. package/src/components/HierarchyPathsView/Node.tsx +62 -0
  28. package/src/components/HierarchyPathsView/__tests__/HierarchyPathsView.test.tsx +547 -0
  29. package/src/components/HierarchyPathsView/__tests__/IntegrationHierarchyPathsView.test.tsx +47 -0
  30. package/src/components/HierarchyPathsView/__tests__/Node.test.tsx +152 -0
  31. package/src/components/HierarchyPathsView/__tests__/data/metadata.data.ts +33 -0
  32. package/src/components/HierarchyPathsView/__tests__/data/store.data.ts +37 -0
  33. package/src/components/HierarchyPathsView/__tests__/data/treePaths.data.ts +63 -0
  34. package/src/components/HierarchyPathsView/defaultTypeIcon.png +0 -0
  35. package/src/components/HierarchyPathsView/helpers.ts +3 -0
  36. package/src/components/HierarchyPathsView/hooks/useDynamicNodesHeights.ts +33 -0
  37. package/src/components/HierarchyPathsView/hooks/useLoadPaths.ts +76 -0
  38. package/src/components/HierarchyPathsView/icons/ShowGraph.svg +10 -0
  39. package/src/components/HierarchyPathsView/index.ts +1 -0
  40. package/src/components/HierarchyPathsView/styles.ts +60 -0
  41. package/src/components/HierarchyPathsView/theme/__tests__/node-content-renderer.test.tsx +78 -0
  42. package/src/components/HierarchyPathsView/theme/__tests__/tree-node-data-renderer.test.tsx +72 -0
  43. package/src/components/HierarchyPathsView/theme/index.ts +8 -0
  44. package/src/components/HierarchyPathsView/theme/node-content-renderer.tsx +84 -0
  45. package/src/components/HierarchyPathsView/theme/styles.ts +102 -0
  46. package/src/components/HierarchyPathsView/theme/tree-node-data-renderer.tsx +70 -0
  47. package/src/components/HierarchyPathsView/types.ts +17 -0
  48. package/src/components/ImageAttributeView/ImageAttributeView.tsx +87 -0
  49. package/src/components/ImageAttributeView/ImageAttributeViewEditableContent/ImageAttributeViewEditableContent.tsx +52 -0
  50. package/src/components/ImageAttributeView/ImageAttributeViewEditableContent/__tests__/ImageAttributeViewEditableContent.test.tsx +136 -0
  51. package/src/components/ImageAttributeView/ImageLineCaption/ImageLineCaption.tsx +18 -0
  52. package/src/components/ImageAttributeView/ImageLineCaption/__tests__/ImageLineCaption.test.tsx +15 -0
  53. package/src/components/ImageAttributeView/ImageLineCaption/styles.ts +10 -0
  54. package/src/components/ImageAttributeView/__tests__/ImageAttributeView.test.tsx +151 -0
  55. package/src/components/ImageAttributeView/__tests__/IntegrationImageAttributeView.test.tsx +36 -0
  56. package/src/components/ImageAttributeView/__tests__/data/store.data.ts +22 -0
  57. package/src/components/ImageAttributeView/styles.ts +13 -0
  58. package/src/components/Notifications/Notification.tsx +98 -0
  59. package/src/components/Notifications/Notifications.tsx +17 -0
  60. package/src/components/Notifications/__tests__/Notification.spec.tsx +230 -0
  61. package/src/components/Notifications/__tests__/Notifications.spec.tsx +37 -0
  62. package/src/components/Notifications/index.ts +1 -0
  63. package/src/components/Notifications/styles.ts +17 -0
  64. package/src/components/Notifications/types.ts +21 -0
  65. package/src/components/PerspectiveProfileBand/PerspectiveProfileBand.tsx +304 -0
  66. package/src/components/PerspectiveProfileBand/__tests__/PerspectiveProfileBand.specs.tsx +526 -0
  67. package/src/components/PerspectiveProfileBand/__tests__/data/collaboration.data.ts +23 -0
  68. package/src/components/PerspectiveProfileBand/__tests__/data/store.data.ts +162 -0
  69. package/src/components/PerspectiveProfileBand/copy.svg +14 -0
  70. package/src/components/PerspectiveProfileBand/hooks/useCloneAction.ts +94 -0
  71. package/src/components/PerspectiveProfileBand/index.ts +1 -0
  72. package/src/components/PerspectiveProfileBand/styles.ts +27 -0
  73. package/src/components/PerspectiveProfileBand/suggest.svg +16 -0
  74. package/src/components/ProfileAttributesView/ProfileAttributesView.tsx +21 -0
  75. package/src/components/ProfileAttributesView/__tests__/ProfileAttributesView.test.tsx +70 -0
  76. package/src/components/ProfileErrorsPanel/ProfileErrorsPanel.tsx +70 -0
  77. package/src/components/ProfileErrorsPanel/__tests__/ProfileErrorsPanel.specs.tsx +140 -0
  78. package/src/components/ProfileErrorsPanel/components/Error.tsx +50 -0
  79. package/src/components/ProfileErrorsPanel/components/ErrorsPanel.tsx +65 -0
  80. package/src/components/ProfileErrorsPanel/components/__tests__/Error.specs.tsx +264 -0
  81. package/src/components/ProfileErrorsPanel/components/__tests__/ErrorsPanel.specs.tsx +93 -0
  82. package/src/components/ProfileErrorsPanel/helpers.ts +45 -0
  83. package/src/components/ProfileErrorsPanel/icons/hyperlink.svg +4 -0
  84. package/src/components/ProfileErrorsPanel/index.ts +1 -0
  85. package/src/components/ProfileErrorsPanel/styles.ts +100 -0
  86. package/src/components/ProfileErrorsPanel/useCachedErrors.ts +11 -0
  87. package/src/components/ProfileLayout/ProfileLayout.tsx +56 -0
  88. package/src/components/ProfileLayout/__tests__/ProfileLayout.specs.tsx +56 -0
  89. package/src/components/ProfileLayout/index.ts +1 -0
  90. package/src/components/ProfileLayout/styles.ts +19 -0
  91. package/src/components/ProfileLayoutItem/ProfileLayoutItem.tsx +89 -0
  92. package/src/components/ProfileLayoutItem/__tests__/ProfileLayoutItem.test.tsx +165 -0
  93. package/src/components/ProfileLayoutItem/__tests__/data/store.data.ts +29 -0
  94. package/src/components/ProfileLayoutItem/index.ts +1 -0
  95. package/src/components/ProfileLayoutItem/styles.ts +13 -0
  96. package/src/components/ProfilePerspectiveResizablePanes/ProfilePerspectiveResizablePanes.tsx +34 -0
  97. package/src/components/ProfilePerspectiveResizablePanes/styles.ts +9 -0
  98. package/src/components/ProfilePerspectiveView/ProfilePerspectiveView.tsx +193 -0
  99. package/src/components/ProfilePerspectiveView/__tests__/IntegrationProfilePerspective.test.tsx +417 -0
  100. package/src/components/ProfilePerspectiveView/__tests__/ProfilePerspectiveView.specs.tsx +1503 -0
  101. package/src/components/ProfilePerspectiveView/__tests__/data/entities.data.ts +19 -0
  102. package/src/components/ProfilePerspectiveView/__tests__/data/entity.data.ts +25 -0
  103. package/src/components/ProfilePerspectiveView/__tests__/data/metadata.data.ts +33 -0
  104. package/src/components/ProfilePerspectiveView/__tests__/data/profile.data.ts +22 -0
  105. package/src/components/ProfilePerspectiveView/__tests__/data/store.data.ts +51 -0
  106. package/src/components/ProfilePerspectiveView/hooks/data/backgroundUpdateDalay.ts +2 -0
  107. package/src/components/ProfilePerspectiveView/hooks/useBackgroundProcessIndicator.ts +121 -0
  108. package/src/components/ProfilePerspectiveView/hooks/useProfileLayout.ts +101 -0
  109. package/src/components/ProfilePerspectiveView/hooks/useProfileRightSidePanelElements.tsx +167 -0
  110. package/src/components/ProfilePerspectiveView/hooks/useWorkflowTasks.ts +15 -0
  111. package/src/components/ProfilePerspectiveView/index.ts +1 -0
  112. package/src/components/ProfilePerspectiveView/styles.ts +38 -0
  113. package/src/components/ProfilePotentialMatchesView/ActionButtons.tsx +39 -0
  114. package/src/components/ProfilePotentialMatchesView/MatchCard.tsx +53 -0
  115. package/src/components/ProfilePotentialMatchesView/ProfilePotentialMatchesView.tsx +137 -0
  116. package/src/components/ProfilePotentialMatchesView/__tests__/ActionButtons.specs.tsx +89 -0
  117. package/src/components/ProfilePotentialMatchesView/__tests__/MatchCard.specs.tsx +62 -0
  118. package/src/components/ProfilePotentialMatchesView/__tests__/ProfilePotentialMatchesView.specs.tsx +267 -0
  119. package/src/components/ProfilePotentialMatchesView/__tests__/commonData.ts +91 -0
  120. package/src/components/ProfilePotentialMatchesView/styles.ts +30 -0
  121. package/src/components/ProfileRelationsView/ProfileRelationsView.tsx +24 -0
  122. package/src/components/ProfileRelationsView/__tests__/ProfileRelationsView.test.tsx +112 -0
  123. package/src/components/ProfileRelationsView/components/EditableRelationItem/EditableRelationItem.tsx +133 -0
  124. package/src/components/ProfileRelationsView/components/EditableRelationItem/__tests__/EditableRelationItem.specs.tsx +222 -0
  125. package/src/components/ProfileRelationsView/components/EditableRelationItem/styles.ts +59 -0
  126. package/src/components/ProfileRelationsView/components/RelationArrowButton/RelationArrowButton.tsx +29 -0
  127. package/src/components/ProfileRelationsView/components/RelationArrowButton/__tests__/RelationArrowButton.specs.tsx +99 -0
  128. package/src/components/ProfileRelationsView/components/RelationArrowButton/styles.ts +8 -0
  129. package/src/components/ProfileRelationsView/components/RelationTooltip/RelationTooltip.tsx +83 -0
  130. package/src/components/ProfileRelationsView/components/RelationTooltip/__tests__/RelationTooltip.test.tsx +155 -0
  131. package/src/components/ProfileRelationsView/components/RelationTooltip/styles.ts +27 -0
  132. package/src/components/ProfileRelationsView/components/RelationsContent/RelationsContent.tsx +62 -0
  133. package/src/components/ProfileRelationsView/components/RelationsContent/__tests__/RelationsContent.specs.tsx +148 -0
  134. package/src/components/ProfileRelationsView/components/RelationsContent/styles.ts +15 -0
  135. package/src/components/ProfileRelationsView/components/RelationsEditableContent/RelationsEditableContent.tsx +153 -0
  136. package/src/components/ProfileRelationsView/components/RelationsEditableContent/__tests__/RelationsEditableContent.specs.tsx +367 -0
  137. package/src/components/ProfileRelationsView/components/RelationsEditableContent/styles.ts +28 -0
  138. package/src/components/ProfileRelationsView/components/RelationsHeader/FilterButton/FilterButton.tsx +113 -0
  139. package/src/components/ProfileRelationsView/components/RelationsHeader/FilterButton/styles.ts +43 -0
  140. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/ImportFromDT.tsx +65 -0
  141. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/MultipleImportIcon.tsx +23 -0
  142. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/__tests__/ImportFromDT.test.tsx +500 -0
  143. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/__tests__/MultipleImportIcon.test.tsx +20 -0
  144. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/hooks/useImportFromDTLoader.ts +84 -0
  145. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/styles.ts +37 -0
  146. package/src/components/ProfileRelationsView/components/RelationsHeader/RelationsHeader.tsx +39 -0
  147. package/src/components/ProfileRelationsView/components/RelationsHeader/__tests__/RelationsHeader.test.tsx +82 -0
  148. package/src/components/ProfileRelationsView/components/RelationsHeader/styles.ts +18 -0
  149. package/src/components/ProfileRelationsView/components/RelationsList/Ratings/Ratings.tsx +60 -0
  150. package/src/components/ProfileRelationsView/components/RelationsList/Ratings/__tests__/Ratings.test.tsx +64 -0
  151. package/src/components/ProfileRelationsView/components/RelationsList/Ratings/styles.ts +48 -0
  152. package/src/components/ProfileRelationsView/components/RelationsList/RatingsButtons/RatingsButtons.tsx +74 -0
  153. package/src/components/ProfileRelationsView/components/RelationsList/RatingsButtons/__tests__/RatingsButtons.test.tsx +72 -0
  154. package/src/components/ProfileRelationsView/components/RelationsList/RatingsButtons/styles.ts +20 -0
  155. package/src/components/ProfileRelationsView/components/RelationsList/RatingsPopup/RatingsPopup.tsx +109 -0
  156. package/src/components/ProfileRelationsView/components/RelationsList/RatingsPopup/__tests__/RatingsPopup.test.tsx +106 -0
  157. package/src/components/ProfileRelationsView/components/RelationsList/RatingsPopup/styles.ts +133 -0
  158. package/src/components/ProfileRelationsView/components/RelationsList/RelationAttributes/RelationAttributes.tsx +81 -0
  159. package/src/components/ProfileRelationsView/components/RelationsList/RelationAttributes/__tests__/RelationAttributes.test.tsx +218 -0
  160. package/src/components/ProfileRelationsView/components/RelationsList/RelationAttributes/styles.ts +12 -0
  161. package/src/components/ProfileRelationsView/components/RelationsList/RelationCompexItem/RelationComplexItem.tsx +129 -0
  162. package/src/components/ProfileRelationsView/components/RelationsList/RelationCompexItem/__tests__/RelationComplexItem.test.tsx +303 -0
  163. package/src/components/ProfileRelationsView/components/RelationsList/RelationCompexItem/styles.ts +51 -0
  164. package/src/components/ProfileRelationsView/components/RelationsList/RelationItem/RelationItem.tsx +103 -0
  165. package/src/components/ProfileRelationsView/components/RelationsList/RelationItem/__tests__/RelationItem.test.tsx +222 -0
  166. package/src/components/ProfileRelationsView/components/RelationsList/RelationItem/styles.ts +72 -0
  167. package/src/components/ProfileRelationsView/components/RelationsList/RelationsList.tsx +69 -0
  168. package/src/components/ProfileRelationsView/components/RelationsList/ShowDetailsButton/ShowDetailsButton.tsx +28 -0
  169. package/src/components/ProfileRelationsView/components/RelationsList/ShowDetailsButton/__tests__/ShowDetailsButton.test.tsx +33 -0
  170. package/src/components/ProfileRelationsView/components/RelationsList/__tests__/RelationsList.test.tsx +143 -0
  171. package/src/components/ProfileRelationsView/components/RelationsView/RelationsView.tsx +108 -0
  172. package/src/components/ProfileRelationsView/components/RelationsView/__tests__/RelationsView.test.tsx +183 -0
  173. package/src/components/ProfileRelationsView/components/RelationsView/index.ts +1 -0
  174. package/src/components/ProfileRelationsView/components/RelationsView/styles.ts +22 -0
  175. package/src/components/ProfileRelationsView/components/SecondLevelWrapper/SecondLevelWrapper.tsx +66 -0
  176. package/src/components/ProfileRelationsView/components/SecondLevelWrapper/__tests__/SecondLevelWrapper.test.tsx +234 -0
  177. package/src/components/ProfileRelationsView/components/SecondLevelWrapper/styles.ts +12 -0
  178. package/src/components/ProfileRelationsView/components/SuggestedButtons/SuggestedButtons.tsx +23 -0
  179. package/src/components/ProfileRelationsView/components/SuggestedButtons/__tests__/SuggestedButtons.test.tsx +33 -0
  180. package/src/components/ProfileRelationsView/components/SuggestedButtons/styles.ts +7 -0
  181. package/src/components/ProfileRelationsView/contexts/ImportDTContext.ts +7 -0
  182. package/src/components/ProfileRelationsView/contexts/RelationsViewStateContext.ts +6 -0
  183. package/src/components/ProfileRelationsView/helpers/__tests__/filters.test.tsx +10 -0
  184. package/src/components/ProfileRelationsView/helpers/__tests__/ratings.test.ts +92 -0
  185. package/src/components/ProfileRelationsView/helpers/__tests__/relation.test.tsx +27 -0
  186. package/src/components/ProfileRelationsView/helpers/filters.ts +17 -0
  187. package/src/components/ProfileRelationsView/helpers/permissions.ts +17 -0
  188. package/src/components/ProfileRelationsView/helpers/ratings.ts +35 -0
  189. package/src/components/ProfileRelationsView/helpers/relation.ts +15 -0
  190. package/src/components/ProfileRelationsView/hooks/useRelationInfo.ts +25 -0
  191. package/src/components/ProfileRelationsView/hooks/useRelationsState.ts +92 -0
  192. package/src/components/ProfileRelationsView/hooks/useSecondLevelConnections.ts +76 -0
  193. package/src/components/ProfileRelationsView/hooks/useSuggestedRelations.ts +54 -0
  194. package/src/components/ProfileSingleAttributeView/ProfileSingleAttributeView.tsx +20 -0
  195. package/src/components/ProfileSingleAttributeView/__tests__/IntegrationProfileSingleAttribute.test.tsx +368 -0
  196. package/src/components/ProfileSingleAttributeView/__tests__/ProfileSingleAttributeView.test.tsx +933 -0
  197. package/src/components/ProfileSingleAttributeView/__tests__/data/metadata.data.ts +103 -0
  198. package/src/components/ProfileSingleAttributeView/__tests__/data/store.data.ts +42 -0
  199. package/src/components/ProfileSingleAttributeView/components/FilterButton/FilterButton.tsx +63 -0
  200. package/src/components/ProfileSingleAttributeView/components/FilterButton/__tests__/FilterButton.spec.tsx +93 -0
  201. package/src/components/ProfileSingleAttributeView/components/FilterButton/styles.ts +27 -0
  202. package/src/components/ProfileSingleAttributeView/components/SingleAttributeEditableContent/SingleAttributeEditableContent.tsx +204 -0
  203. package/src/components/ProfileSingleAttributeView/components/SingleAttributeEditableContent/__tests__/SingleAttributeEditableContent.specs.tsx +559 -0
  204. package/src/components/ProfileSingleAttributeView/components/SingleAttributeEditableContent/styles.ts +28 -0
  205. package/src/components/ProfileSingleAttributeView/components/SingleAttributeHeader/SingleAttributeHeader.tsx +58 -0
  206. package/src/components/ProfileSingleAttributeView/components/SingleAttributeHeader/__tests__/SingleAttributeHeader.test.tsx +188 -0
  207. package/src/components/ProfileSingleAttributeView/components/SingleAttributeHeader/styles.ts +21 -0
  208. package/src/components/ProfileSingleAttributeView/components/SingleAttributeReadableContent/SingleAttributeReadableContent.tsx +31 -0
  209. package/src/components/ProfileSingleAttributeView/components/SingleAttributeReadableContent/__tests__/SingleAttributeReadableContent.spec.tsx +42 -0
  210. package/src/components/ProfileSingleAttributeView/components/SingleAttributeReadableContent/styles.ts +9 -0
  211. package/src/components/ProfileSingleAttributeView/components/SingleAttributeView/SingleAttributeView.tsx +90 -0
  212. package/src/components/ProfileSingleAttributeView/components/SingleAttributeView/__tests__/SingleAttributeView.test.tsx +346 -0
  213. package/src/components/ProfileSingleAttributeView/components/SingleAttributeView/styles.ts +22 -0
  214. package/src/components/ProfileSingleAttributeView/contexts/SingleAttributeContext.ts +20 -0
  215. package/src/components/ProfileSingleAttributeView/hooks/useSingleAttribute.ts +25 -0
  216. package/src/components/ProfileSingleAttributeView/styles.ts +26 -0
  217. package/src/components/ProfileTableAttributeView/ProfileTableAttributeView.tsx +20 -0
  218. package/src/components/ProfileTableAttributeView/__tests__/IntegrationProfileTableAttributeView.test.tsx +278 -0
  219. package/src/components/ProfileTableAttributeView/__tests__/ProfileTableAttributeView.test.tsx +744 -0
  220. package/src/components/ProfileTableAttributeView/__tests__/data/metadata.data.ts +141 -0
  221. package/src/components/ProfileTableAttributeView/__tests__/data/store.data.ts +48 -0
  222. package/src/components/ProfileTableAttributeView/components/AttributeEditing/AttributeEditing.tsx +97 -0
  223. package/src/components/ProfileTableAttributeView/components/AttributeEditing/__tests__/AttributeEditing.test.tsx +409 -0
  224. package/src/components/ProfileTableAttributeView/components/AttributeEditing/styles.ts +17 -0
  225. package/src/components/ProfileTableAttributeView/components/AttributeTable/AttributeTable.tsx +171 -0
  226. package/src/components/ProfileTableAttributeView/components/AttributeTable/EditButtons.tsx +28 -0
  227. package/src/components/ProfileTableAttributeView/components/AttributeTable/__tests__/AttributeTable.test.tsx +431 -0
  228. package/src/components/ProfileTableAttributeView/components/AttributeTable/__tests__/EditButtons.test.tsx +54 -0
  229. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/BlobRenderer.tsx +20 -0
  230. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/DefaultCellValueRenderer.tsx +43 -0
  231. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/HeadCellRenderer.tsx +19 -0
  232. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/RowCellRenderer.tsx +33 -0
  233. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/__tests__/BlobRenderer.test.tsx +29 -0
  234. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/__tests__/DefaultCellValueRenderer.test.tsx +149 -0
  235. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/styles.ts +61 -0
  236. package/src/components/ProfileTableAttributeView/components/AttributeTable/styles.ts +21 -0
  237. package/src/components/ProfileTableAttributeView/components/AttributeTableHeader/AttributeTableHeader.tsx +53 -0
  238. package/src/components/ProfileTableAttributeView/components/AttributeTableHeader/__tests__/AttributeTableHeader.test.tsx +96 -0
  239. package/src/components/ProfileTableAttributeView/components/AttributeTableHeader/styles.ts +7 -0
  240. package/src/components/ProfileTableAttributeView/components/TableAttributeContent/TableAttributeContent.tsx +123 -0
  241. package/src/components/ProfileTableAttributeView/components/TableAttributeContent/__tests__/TableAttributeContent.test.tsx +600 -0
  242. package/src/components/ProfileTableAttributeView/components/TableAttributeContent/hooks/useEditableAttribute.ts +212 -0
  243. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/TableAttributeEditableContent.tsx +96 -0
  244. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/__tests__/TableAttributeEditableContent.test.tsx +450 -0
  245. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/hooks/__tests__/useExpandAttributes.test.tsx +92 -0
  246. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/hooks/useExpandAttributes.ts +88 -0
  247. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/styles.ts +21 -0
  248. package/src/components/ProfileTableAttributeView/components/TableAttributeView/TableAttributeView.tsx +64 -0
  249. package/src/components/ProfileTableAttributeView/components/TableAttributeView/__tests__/TableAttributeView.test.tsx +139 -0
  250. package/src/components/ProfileTableAttributeView/components/TableAttributeView/styles.ts +20 -0
  251. package/src/components/ProfileTableAttributeView/components/types.ts +16 -0
  252. package/src/components/ProfileTableAttributeView/contexts/TableAttributeContext.tsx +34 -0
  253. package/src/components/ProfileTableAttributeView/helpers/tableAttributeHelpers.ts +72 -0
  254. package/src/components/ProfileTableAttributeView/hooks/__tests__/helpers.test.ts +97 -0
  255. package/src/components/ProfileTableAttributeView/hooks/helpers.ts +13 -0
  256. package/src/components/ProfileTableAttributeView/hooks/reducer.ts +19 -0
  257. package/src/components/ProfileTableAttributeView/hooks/useTableAttribute.ts +77 -0
  258. package/src/components/RightSidePanel/RightSidePanel.tsx +43 -0
  259. package/src/components/RightSidePanel/__tests__/RightSidePanel.spec.tsx +149 -0
  260. package/src/components/RightSidePanel/components/CollaborationButton/CollaborationButton.tsx +22 -0
  261. package/src/components/RightSidePanel/components/CollaborationButton/__tests__/CollaborationButton.spec.tsx +24 -0
  262. package/src/components/RightSidePanel/components/CollaborationList/CollaborationList.tsx +56 -0
  263. package/src/components/RightSidePanel/components/CollaborationList/__tests__/CollaborationList.spec.tsx +104 -0
  264. package/src/components/RightSidePanel/components/CollaborationList/styles.ts +15 -0
  265. package/src/components/RightSidePanel/components/CollaborationPanelEmptyState/CollaborationPanelEmptyState.tsx +14 -0
  266. package/src/components/RightSidePanel/components/CollaborationPanelEmptyState/__tests__/CollaborationPanelEmptyState.specs.tsx +16 -0
  267. package/src/components/RightSidePanel/components/DBConnectorsList/DBConnectorsList.tsx +19 -0
  268. package/src/components/RightSidePanel/components/DBConnectorsList/__tests__/DBConnectorsList.spec.tsx +42 -0
  269. package/src/components/RightSidePanel/components/DBConnectorsList/styles.ts +12 -0
  270. package/src/components/RightSidePanel/components/WorkflowButton/WorkflowButton.tsx +21 -0
  271. package/src/components/RightSidePanel/components/WorkflowButton/__tests__/WorkflowButton.spec.tsx +23 -0
  272. package/src/components/RightSidePanel/components/WorkflowList/WorkflowList.tsx +18 -0
  273. package/src/components/RightSidePanel/components/WorkflowList/__tests__/WorkflowList.spec.tsx +46 -0
  274. package/src/components/RightSidePanel/components/WorkflowList/styles.ts +9 -0
  275. package/src/components/RightSidePanel/components/WorkflowPanelEmptyState/WorkflowPanelEmptyState.tsx +14 -0
  276. package/src/components/RightSidePanel/components/WorkflowPanelEmptyState/__tests__/WorkflowPanelEmptyState.specs.tsx +17 -0
  277. package/src/components/RightSidePanel/icons/CollaborationIcon.svg +18 -0
  278. package/src/components/RightSidePanel/icons/ConnectorsIcon.svg +3 -0
  279. package/src/components/RightSidePanel/styles.ts +21 -0
  280. package/src/components/Sandbox/CustomView.tsx +59 -0
  281. package/src/components/Sandbox/__tests__/CustomView.test.tsx +294 -0
  282. package/src/components/Sandbox/styles.ts +10 -0
  283. package/src/components/TagPerspectiveView/TagPerspectiveView.tsx +79 -0
  284. package/src/components/TagPerspectiveView/__tests__/TagPerspectiveView.test.tsx +146 -0
  285. package/src/components/TagPerspectiveView/components/TagListHeader/TagListHeader.tsx +48 -0
  286. package/src/components/TagPerspectiveView/components/TagListHeader/__tests__/TagListHeader.test.tsx +60 -0
  287. package/src/components/TagPerspectiveView/components/TagListHeader/index.ts +1 -0
  288. package/src/components/TagPerspectiveView/components/TagListHeader/styles.ts +36 -0
  289. package/src/components/TagPerspectiveView/components/TagProfileBand/TagProfileBand.tsx +21 -0
  290. package/src/components/TagPerspectiveView/components/TagProfileBand/__tests__/TagProfileBand.test.tsx +14 -0
  291. package/src/components/TagPerspectiveView/components/TagProfileBand/index.ts +1 -0
  292. package/src/components/TagPerspectiveView/components/TagProfileBand/styles.ts +24 -0
  293. package/src/components/TagPerspectiveView/hooks/__tests__/useTag.test.tsx +166 -0
  294. package/src/components/TagPerspectiveView/hooks/__tests__/useTagsProvider.test.tsx +208 -0
  295. package/src/components/TagPerspectiveView/hooks/useTag.ts +48 -0
  296. package/src/components/TagPerspectiveView/hooks/useTagsProvider.ts +83 -0
  297. package/src/components/TagPerspectiveView/index.ts +1 -0
  298. package/src/components/TagPerspectiveView/styles.ts +43 -0
  299. package/src/components/hooks/helpers/__tests__/helpers.test.ts +688 -0
  300. package/src/components/hooks/helpers/index.ts +77 -0
  301. package/src/components/hooks/useProfileValidation.ts +30 -0
  302. package/src/components/hooks/useSingleAttributeLoader.ts +164 -0
  303. package/src/components/views/HOCs/styles.ts +37 -0
  304. package/src/components/views/HOCs/withDragHandle.tsx +26 -0
  305. package/src/components/views/HOCs/withErrorBoundary.tsx +27 -0
  306. package/src/components/views/StubView.tsx +18 -0
  307. package/src/components/views/ViewComponent.tsx +25 -0
  308. package/src/components/views/ViewsFactory.tsx +143 -0
  309. package/src/components/views/__tests__/ViewComponent.specs.tsx +47 -0
  310. package/src/components/views/__tests__/ViewsFactory.specs.tsx +256 -0
  311. package/src/components/views/styles.ts +16 -0
  312. package/src/perspectives/DCRReviewPerspective.tsx +51 -0
  313. package/src/perspectives/ProfilePerspective.tsx +104 -0
  314. package/src/perspectives/TagPerspective.tsx +42 -0
  315. package/src/perspectives/__tests__/DCRReviewPerspective.spec.tsx +54 -0
  316. package/src/perspectives/__tests__/ProfilePerspective.spec.tsx +76 -0
  317. package/src/perspectives/__tests__/helpers.spec.ts +131 -0
  318. package/src/perspectives/helpers.ts +29 -0
  319. package/src/types/index.ts +9 -0
  320. package/stories/Profile.stories.tsx +35 -0
  321. package/stories/utils/entity.ts +80 -0
  322. package/stories/utils/hierarchyTree/config.ts +13 -0
  323. package/stories/utils/hierarchyTree/hopsResponse.ts +182 -0
  324. package/stories/utils/hierarchyTree/treeResponse.ts +412 -0
  325. package/stories/utils/mdmStore.ts +64 -0
  326. package/stories/utils/metadata.ts +701 -0
  327. package/stories/utils/profilePerspectiveConfig.ts +95 -0
  328. package/stories/utils/relationsTableView/config.ts +18 -0
  329. package/stories/utils/relationsTableView/connections.ts +647 -0
  330. package/stories/utils/responses.ts +62 -0
  331. package/tsconfig.json +4 -0
  332. package/webpack.config.js +10 -0
  333. package/bundle.js +0 -2
  334. /package/{5271a9e7b6651c852e93.png → public/5271a9e7b6651c852e93.png} +0 -0
  335. /package/{main.css → public/main.css} +0 -0
@@ -0,0 +1,53 @@
1
+ import {
2
+ COMMENTS_CONTAINER_VISIBILITY_AREA,
3
+ CommentsContainer,
4
+ ProfileMatchCard,
5
+ useMatchesLoader
6
+ } from '@reltio/components';
7
+ import {
8
+ CollaborationObjectTypes,
9
+ createObjectIdForPM,
10
+ createRelatedObjectUris,
11
+ Match,
12
+ ProfilePotentialMatchesViewConfig
13
+ } from '@reltio/mdm-sdk';
14
+ import {ActionButtons} from './ActionButtons';
15
+ import React from 'react';
16
+ import {useSelector} from 'react-redux';
17
+ import mdmModule from '@reltio/mdm-module';
18
+
19
+ type Props = Pick<ReturnType<typeof useMatchesLoader>, 'entitiesMap'> & {
20
+ config: ProfilePotentialMatchesViewConfig;
21
+ match: Match;
22
+ onFinishRequest: () => void;
23
+ onStartRequest: () => void;
24
+ };
25
+
26
+ export const MatchCard = ({config, entitiesMap, match, onFinishRequest, onStartRequest}: Props) => {
27
+ const metadata = useSelector(mdmModule.selectors.getMetadata);
28
+ const entity = useSelector(mdmModule.selectors.getEntity);
29
+ return (
30
+ <ProfileMatchCard
31
+ match={match}
32
+ entity={entity}
33
+ entitiesMap={entitiesMap}
34
+ metadata={metadata}
35
+ className={COMMENTS_CONTAINER_VISIBILITY_AREA}
36
+ >
37
+ <CommentsContainer
38
+ uri={createObjectIdForPM(entity.uri, match.object.uri)}
39
+ relatedObjectUris={createRelatedObjectUris(CollaborationObjectTypes.POTENTIAL_MATCH, {
40
+ entityUri: entity.uri,
41
+ matchEntityUri: match.object.uri
42
+ })}
43
+ objectType={CollaborationObjectTypes.POTENTIAL_MATCH}
44
+ />
45
+ <ActionButtons
46
+ match={match}
47
+ config={config}
48
+ onStartRequest={onStartRequest}
49
+ onFinishRequest={onFinishRequest}
50
+ />
51
+ </ProfileMatchCard>
52
+ );
53
+ };
@@ -0,0 +1,137 @@
1
+ import React, {useCallback, useContext, useEffect, useMemo, useState} from 'react';
2
+ import {useDispatch, useSelector} from 'react-redux';
3
+ import classnames from 'classnames';
4
+ import i18n from 'ui-i18n';
5
+ import {isEmpty, map} from 'ramda';
6
+ import Link from '@mui/material/Link';
7
+ import Typography from '@mui/material/Typography';
8
+ import {
9
+ BasicView,
10
+ CollaborationContext,
11
+ EntitiesMapContext,
12
+ FacetViewHeader,
13
+ LinearLoadIndicator,
14
+ useMatchesLoader,
15
+ ViewIdContext
16
+ } from '@reltio/components';
17
+ import mdmModule, {ui as mdmModuleUi} from '@reltio/mdm-module';
18
+ import {
19
+ getEntityUriForLink,
20
+ getEntityUriFromMatchObject,
21
+ getPotentialMatchesObjectIdsForCollaboration,
22
+ Order,
23
+ ProfilePotentialMatchesViewConfig
24
+ } from '@reltio/mdm-sdk';
25
+ import {MatchCard} from './MatchCard';
26
+ import {useStyles} from './styles';
27
+
28
+ type Props = {
29
+ config: ProfilePotentialMatchesViewConfig;
30
+ className?: string;
31
+ };
32
+
33
+ export const DEFAULT_MATCHES_LIMIT = 3;
34
+ export const DEFAULT_OPTIONS = {
35
+ showTransitiveMatches: true,
36
+ showInactiveEntities: false
37
+ };
38
+ export const DEFAULT_SORTING = {order: Order.asc, field: 'score'};
39
+ enum ComponentStates {
40
+ Loading,
41
+ NoData,
42
+ Loaded
43
+ }
44
+ export const ProfilePotentialMatchesView = ({config, className}: Props) => {
45
+ const styles = useStyles();
46
+ const entity = useSelector(mdmModule.selectors.getEntity);
47
+ const entityUri = getEntityUriForLink(entity);
48
+
49
+ const [isLoading, setIsLoading] = useState(false);
50
+ const turnOnDisableSpinner = useCallback(() => {
51
+ setIsLoading(true);
52
+ }, []);
53
+ const turnOffDisableSpinner = useCallback(() => {
54
+ setIsLoading(false);
55
+ }, []);
56
+
57
+ const {matches, entitiesMap, loadMatches} = useMatchesLoader({
58
+ enabled: !!entityUri,
59
+ entity,
60
+ options: DEFAULT_OPTIONS,
61
+ filter: '',
62
+ page: 0,
63
+ sorting: DEFAULT_SORTING,
64
+ rowsPerPage: DEFAULT_MATCHES_LIMIT,
65
+ onStartLoading: turnOnDisableSpinner,
66
+ onFinishLoading: turnOffDisableSpinner
67
+ });
68
+ const onFinishMatchAction = useCallback(() => {
69
+ loadMatches();
70
+ }, [loadMatches]);
71
+
72
+ const dispatch = useDispatch();
73
+ const viewId = useContext(ViewIdContext);
74
+ const openPotentialMatchPerspective = useCallback(() => {
75
+ dispatch(mdmModuleUi.actions.openPerspective({perspectiveId: 'potentialMatches', viewId}));
76
+ }, [dispatch, viewId]);
77
+
78
+ const objectIds = useMemo(
79
+ () => getPotentialMatchesObjectIdsForCollaboration(entityUri, map(getEntityUriFromMatchObject, matches)),
80
+ [entityUri, matches]
81
+ );
82
+
83
+ const {getCommentsCount} = useContext(CollaborationContext);
84
+ useEffect(() => {
85
+ getCommentsCount(objectIds);
86
+ }, [getCommentsCount, objectIds]);
87
+
88
+ const showSeeAll = !isEmpty(matches);
89
+ const getComponentState = () => {
90
+ if (isLoading) {
91
+ return ComponentStates.Loading;
92
+ }
93
+ if (isEmpty(matches)) {
94
+ return ComponentStates.NoData;
95
+ }
96
+ return ComponentStates.Loaded;
97
+ };
98
+ const state = getComponentState();
99
+ return (
100
+ <EntitiesMapContext.Provider value={entitiesMap}>
101
+ <BasicView className={classnames(styles.root, className)}>
102
+ <FacetViewHeader title={config.caption} />
103
+ <div className={styles.matchesContainer}>
104
+ {state === ComponentStates.Loading && <LinearLoadIndicator />}
105
+ {state === ComponentStates.NoData && (
106
+ <Typography className={styles.noData}>{i18n.text('No matches found')}</Typography>
107
+ )}
108
+ {state === ComponentStates.Loaded &&
109
+ matches.map((match) => (
110
+ <MatchCard
111
+ config={config}
112
+ entitiesMap={entitiesMap}
113
+ match={match}
114
+ onFinishRequest={onFinishMatchAction}
115
+ onStartRequest={turnOnDisableSpinner}
116
+ key={match.object.uri}
117
+ />
118
+ ))}
119
+ </div>
120
+ {showSeeAll && (
121
+ <>
122
+ <div className={styles.footer}>
123
+ <Link
124
+ component="button"
125
+ variant="caption"
126
+ onClick={openPotentialMatchPerspective}
127
+ underline="none"
128
+ >
129
+ {i18n.text('See all')}
130
+ </Link>
131
+ </div>
132
+ </>
133
+ )}
134
+ </BasicView>
135
+ </EntitiesMapContext.Provider>
136
+ );
137
+ };
@@ -0,0 +1,89 @@
1
+ import React from 'react';
2
+ import {mount} from 'enzyme';
3
+ import {ActionButtons} from '../ActionButtons';
4
+ import * as reactRedux from 'react-redux';
5
+ import {getActionPermissionForMatch} from '@reltio/mdm-sdk';
6
+ import mdmModule, {profile} from '@reltio/mdm-module';
7
+ import {config, currentEntity, matches, metadata} from './commonData';
8
+ import {ActionButtonMode, ViewIdContext} from '@reltio/components';
9
+
10
+ jest.mock('@reltio/mdm-sdk', () => ({
11
+ ...jest.requireActual<Record<string, unknown>>('@reltio/mdm-sdk'),
12
+ getActionPermissionForMatch: jest.fn()
13
+ }));
14
+
15
+ const MergeButtonMock = () => <div className="MergeButtonMock" />;
16
+ const NotMatchButtonMock = () => <div className="NotMatchButtonMock" />;
17
+
18
+ jest.mock('@reltio/components', () => ({
19
+ ...jest.requireActual<Record<string, unknown>>('@reltio/components'),
20
+ MergeButton: MergeButtonMock,
21
+ NotMatchButton: NotMatchButtonMock
22
+ }));
23
+
24
+ describe('ActionsButtons tests', () => {
25
+ const getMergeButton = (component) => component.find(MergeButtonMock);
26
+ const getNotMatchButton = (component) => component.find(NotMatchButtonMock);
27
+ const match = matches[0];
28
+ const onStartRequest = jest.fn();
29
+ const onFinishRequest = jest.fn();
30
+ const dispatch = jest.fn();
31
+ beforeAll(() => {
32
+ jest.spyOn(reactRedux, 'useSelector').mockImplementation((selector) => selector(undefined));
33
+ jest.spyOn(reactRedux, 'useDispatch').mockReturnValue(dispatch);
34
+ jest.spyOn(mdmModule.selectors, 'getMetadata').mockReturnValue(metadata);
35
+ jest.spyOn(mdmModule.selectors, 'getEntity').mockReturnValue(currentEntity);
36
+ });
37
+
38
+ beforeEach(() => {
39
+ (getActionPermissionForMatch as jest.Mock).mockReturnValue({canMerge: true, canMark: true});
40
+ });
41
+
42
+ afterEach(() => {
43
+ jest.clearAllMocks();
44
+ });
45
+ const viewId = 'id1';
46
+ const setUp = () =>
47
+ mount(
48
+ <ViewIdContext.Provider value={viewId}>
49
+ <ActionButtons
50
+ config={config}
51
+ match={match}
52
+ onStartRequest={onStartRequest}
53
+ onFinishRequest={onFinishRequest}
54
+ />
55
+ </ViewIdContext.Provider>
56
+ );
57
+ it('should show button if user have permission', () => {
58
+ const component = setUp();
59
+ expect(getMergeButton(component)).toHaveLength(1);
60
+ expect(getNotMatchButton(component)).toHaveLength(1);
61
+ });
62
+
63
+ it('should not show button if user do not have permission', () => {
64
+ (getActionPermissionForMatch as jest.Mock).mockReturnValue({canMerge: false, canMark: false});
65
+ const component = setUp();
66
+ expect(getMergeButton(component)).toHaveLength(0);
67
+ expect(getNotMatchButton(component)).toHaveLength(0);
68
+ });
69
+
70
+ it('should call onFinishRequest and dispatch loadEntity action for merge button', () => {
71
+ const component = setUp();
72
+ getMergeButton(component).prop('onFinishRequest')();
73
+ expect(onFinishRequest).toHaveBeenCalled();
74
+ expect(dispatch).toHaveBeenCalledWith(profile.entity.actions.loadEntity({viewId, uri: currentEntity.uri}));
75
+ });
76
+
77
+ it('should provide properties for MergeButton and NotMatchButton ', () => {
78
+ const component = setUp();
79
+ const mergeButtonProps = getMergeButton(component).props();
80
+ expect(mergeButtonProps.entity).toBe(currentEntity);
81
+ expect(mergeButtonProps.mode).toBe(ActionButtonMode.iconButton);
82
+ expect(mergeButtonProps.onStartRequest).toBe(onStartRequest);
83
+ const notMatchButtonProps = getNotMatchButton(component).props();
84
+ expect(notMatchButtonProps.entity).toBe(currentEntity);
85
+ expect(notMatchButtonProps.mode).toBe(ActionButtonMode.iconButton);
86
+ expect(notMatchButtonProps.onStartRequest).toBe(onStartRequest);
87
+ expect(notMatchButtonProps.onFinishRequest).toBe(onFinishRequest);
88
+ });
89
+ });
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import * as reactRedux from 'react-redux';
3
+ import {shallow} from 'enzyme';
4
+ import mdmModule from '@reltio/mdm-module';
5
+ import {config, currentEntity, matches, metadata} from './commonData';
6
+ import {MatchCard} from '../MatchCard';
7
+ import {COMMENTS_CONTAINER_VISIBILITY_AREA, CommentsContainer, ProfileMatchCard} from '@reltio/components';
8
+ import {ActionButtons} from '../ActionButtons';
9
+ import {CollaborationObjectTypes} from '@reltio/mdm-sdk';
10
+
11
+ describe('MatchCard test', () => {
12
+ const getCommentsContainer = (component) => component.find(CommentsContainer);
13
+ const getProfileMatchCard = (component) => component.find(ProfileMatchCard);
14
+ const getActionButtons = (component) => component.find(ActionButtons);
15
+ const match = matches[0];
16
+ const onFinishRequest = jest.fn();
17
+ const onStartRequest = jest.fn();
18
+ const entitiesMap = {'entities/1Gw3QsjR': {label: 'label', uri: 'uri', type: 'type'}};
19
+ const setUp = () =>
20
+ shallow(
21
+ <MatchCard
22
+ config={config}
23
+ entitiesMap={entitiesMap}
24
+ match={match}
25
+ onFinishRequest={onFinishRequest}
26
+ onStartRequest={onStartRequest}
27
+ />
28
+ );
29
+
30
+ beforeAll(() => {
31
+ jest.spyOn(reactRedux, 'useSelector').mockImplementation((selector) => selector(undefined));
32
+ jest.spyOn(mdmModule.selectors, 'getMetadata').mockReturnValue(metadata);
33
+ jest.spyOn(mdmModule.selectors, 'getEntity').mockReturnValue(currentEntity);
34
+ });
35
+
36
+ it('should render components well', () => {
37
+ const component = setUp();
38
+ expect(getProfileMatchCard(component)).toHaveLength(1);
39
+ expect(getProfileMatchCard(component).props()).toMatchObject({
40
+ match,
41
+ entity: currentEntity,
42
+ entitiesMap: entitiesMap,
43
+ metadata,
44
+ className: COMMENTS_CONTAINER_VISIBILITY_AREA
45
+ });
46
+
47
+ expect(getCommentsContainer(component)).toHaveLength(1);
48
+ expect(getCommentsContainer(component).props()).toEqual({
49
+ objectType: CollaborationObjectTypes.POTENTIAL_MATCH,
50
+ uri: `${match.object.uri}-${currentEntity.uri}`,
51
+ relatedObjectUris: [currentEntity.uri, match.object.uri]
52
+ });
53
+
54
+ expect(getActionButtons(component)).toHaveLength(1);
55
+ expect(getActionButtons(component).props()).toEqual({
56
+ match,
57
+ config,
58
+ onStartRequest,
59
+ onFinishRequest
60
+ });
61
+ });
62
+ });
@@ -0,0 +1,267 @@
1
+ import React from 'react';
2
+ import {mount} from 'enzyme';
3
+ import {map, pipe, take} from 'ramda';
4
+ import {
5
+ BasicView,
6
+ FacetViewHeader,
7
+ CollaborationContext,
8
+ LinearLoadIndicator,
9
+ ViewIdContext,
10
+ EntitiesMapContext
11
+ } from '@reltio/components';
12
+ import {
13
+ getActionPermissionForMatches,
14
+ getEntityUriFromMatchObject,
15
+ getMatchesFromDataTenants,
16
+ getPotentialMatchesObjectIdsForCollaboration,
17
+ getTransitiveMatches
18
+ } from '@reltio/mdm-sdk';
19
+ import mdmModule, {ui as mdmModuleUi} from '@reltio/mdm-module';
20
+ import * as reactRedux from 'react-redux';
21
+ import {act} from 'react-dom/test-utils';
22
+ import {DEFAULT_MATCHES_LIMIT, DEFAULT_SORTING, ProfilePotentialMatchesView} from '../ProfilePotentialMatchesView';
23
+ import Link from '@mui/material/Link';
24
+ import {config, currentEntity, matches} from './commonData';
25
+
26
+ jest.mock('@reltio/mdm-sdk', () => ({
27
+ ...jest.requireActual<Record<string, unknown>>('@reltio/mdm-sdk'),
28
+ getActionPermissionForMatches: jest.fn(),
29
+ getTransitiveMatches: jest.fn(),
30
+ getMatchesFromDataTenants: jest.fn(),
31
+ getCommentsCount: jest.fn()
32
+ }));
33
+
34
+ const MatchCardMock = () => <div className="MatchCardMock" />;
35
+ jest.mock('../MatchCard', () => ({
36
+ MatchCard: MatchCardMock
37
+ }));
38
+
39
+ jest.mock('@reltio/components', () => ({
40
+ ...jest.requireActual<Record<string, unknown>>('@reltio/components'),
41
+ EntitiesMapContext: {
42
+ Provider: jest.fn()
43
+ }
44
+ }));
45
+
46
+ describe('ProfilePotentialMatchesView tests', () => {
47
+ const className = 'test className';
48
+
49
+ const dispatch = jest.fn();
50
+ const dataTenants = [{id: 'dt1'}];
51
+
52
+ const getMatchCard = (component) => component.find(MatchCardMock);
53
+ const getBasicView = (component) => component.find(BasicView);
54
+ const getFacetViewHeader = (component) => component.find(FacetViewHeader);
55
+ const getLink = (component) => component.find(Link);
56
+ const getLinearLoadIndicator = (component) => component.find(LinearLoadIndicator);
57
+ const getFooter = (component) => component.find('.footer');
58
+ const getMatchesContainer = (component) => component.find('.matchesContainer');
59
+ const getNoDataComponent = (component) => component.find('p.noData');
60
+
61
+ const testTenant = 'test Tenant';
62
+ const dtssPath = 'dtssPath/';
63
+ const collaborationPath = 'https://cservice-dev.reltio.com/reltio-collaboration/tst-01';
64
+ beforeAll(() => {
65
+ jest.spyOn(reactRedux, 'useSelector').mockImplementation((selector) => selector(undefined));
66
+ jest.spyOn(reactRedux, 'useDispatch').mockReturnValue(dispatch);
67
+
68
+ (EntitiesMapContext.Provider as any).mockImplementation(({children}) => (
69
+ <div id="entitiesMapContextMock">{children}</div>
70
+ ));
71
+ });
72
+
73
+ beforeEach(() => {
74
+ (getTransitiveMatches as jest.Mock).mockReturnValue(Promise.resolve(matches));
75
+ (getMatchesFromDataTenants as jest.Mock).mockReturnValue(Promise.resolve(matches));
76
+ (getActionPermissionForMatches as jest.Mock).mockReturnValue({canMerge: true, canMark: true});
77
+ jest.spyOn(mdmModule.selectors, 'getEntity').mockReturnValue(currentEntity);
78
+ jest.spyOn(mdmModule.selectors, 'getTenant').mockReturnValue(testTenant);
79
+ jest.spyOn(mdmModule.selectors, 'getDtssPath').mockReturnValue(dtssPath);
80
+ jest.spyOn(mdmModule.selectors, 'getGlobalSearchRequestOptions').mockReturnValue({
81
+ activityFilter: 'active',
82
+ globalFilter: '',
83
+ searchOptions: {}
84
+ });
85
+ jest.spyOn(mdmModule.selectors, 'getDataTenants').mockReturnValue(dataTenants);
86
+ jest.spyOn(mdmModule.selectors, 'isCollaborationEnabled').mockReturnValue(true);
87
+ jest.spyOn(mdmModule.selectors, 'getCollaborationPath').mockReturnValue(collaborationPath);
88
+ });
89
+
90
+ afterEach(() => {
91
+ jest.clearAllMocks();
92
+ });
93
+ const setUp = async ({viewId = 'id1'} = {viewId: 'id1'}) => {
94
+ let component;
95
+ await act(async () => {
96
+ component = mount(
97
+ <ViewIdContext.Provider value={viewId}>
98
+ <ProfilePotentialMatchesView config={config} className={className} />
99
+ </ViewIdContext.Provider>
100
+ );
101
+ });
102
+ return component;
103
+ };
104
+
105
+ it('should render basics components well', async () => {
106
+ const component = await setUp();
107
+ await component.update();
108
+
109
+ expect(getMatchesFromDataTenants).toHaveBeenCalled();
110
+
111
+ expect(component.find(EntitiesMapContext.Provider).prop('value')).toEqual({
112
+ 'entities/1Gw3QsjR': {
113
+ type: 'configuration/entityTypes/HCP',
114
+ uri: 'entities/1Gw3QsjR'
115
+ },
116
+ 'entities/1HM8WlMC': {
117
+ type: 'configuration/entityTypes/HCP',
118
+ uri: 'entities/1HM8WlMC'
119
+ },
120
+ 'entities/1XL8k30v': {
121
+ type: 'configuration/entityTypes/HCP',
122
+ uri: 'entities/1XL8k30v'
123
+ },
124
+ 'entities/2WiVGZTQ': {
125
+ type: 'configuration/entityTypes/HCP',
126
+ uri: 'entities/2WiVGZTQ'
127
+ }
128
+ });
129
+ expect(getBasicView(component).prop('className')).toContain(className);
130
+ expect(getFacetViewHeader(component).prop('title')).toBe(config.caption);
131
+ expect(getMatchCard(component)).toHaveLength(DEFAULT_MATCHES_LIMIT);
132
+ expect(getLink(component).text()).toBe('See all');
133
+ });
134
+
135
+ it('should render LinearLoadIndicator and hide footer and no data label while loading', async () => {
136
+ const component = mount(
137
+ <ViewIdContext.Provider value={'id1'}>
138
+ <ProfilePotentialMatchesView config={config} className={className} />
139
+ </ViewIdContext.Provider>
140
+ );
141
+ expect(getLinearLoadIndicator(component)).toHaveLength(1);
142
+ expect(getNoDataComponent(component)).toHaveLength(0);
143
+ expect(getFooter(component)).toHaveLength(0);
144
+ await act(async () => {
145
+ await Promise.resolve();
146
+ });
147
+ await component.update();
148
+ expect(getFooter(component)).toHaveLength(1);
149
+ expect(getLinearLoadIndicator(component)).toHaveLength(0);
150
+ });
151
+
152
+ it('should render footer when matches even if we have the only match', async () => {
153
+ (getTransitiveMatches as jest.Mock).mockReturnValue(Promise.resolve([matches[0]]));
154
+ (getMatchesFromDataTenants as jest.Mock).mockReturnValue(Promise.resolve([matches[0]]));
155
+ const component = await setUp();
156
+ await component.update();
157
+ expect(getFooter(component)).toHaveLength(1);
158
+ });
159
+
160
+ it('should show empty state', async () => {
161
+ (getTransitiveMatches as jest.Mock).mockReturnValue(Promise.resolve([]));
162
+ (getMatchesFromDataTenants as jest.Mock).mockReturnValue(Promise.resolve([]));
163
+ const component = await setUp();
164
+ await component.update();
165
+ expect(getNoDataComponent(component)).toHaveLength(1);
166
+ expect(getMatchesContainer(component).text()).toBe('No matches found');
167
+ expect(getFooter(component)).toHaveLength(0);
168
+ });
169
+ it('should dispatch action for open potantial-matches perspective', async () => {
170
+ const viewId = 'id1';
171
+ let component;
172
+ await act(async () => {
173
+ component = mount(
174
+ <ViewIdContext.Provider value={viewId}>
175
+ <ProfilePotentialMatchesView config={config} className={className} />
176
+ </ViewIdContext.Provider>
177
+ );
178
+ });
179
+ await component.update();
180
+ act(() => {
181
+ getLink(component).prop('onClick')();
182
+ });
183
+ expect(dispatch).toHaveBeenCalledWith(
184
+ mdmModuleUi.actions.openPerspective({perspectiveId: 'potentialMatches', viewId})
185
+ );
186
+ });
187
+ describe('useMatchesLoader behaviour', () => {
188
+ it('should call getMatchesFromDataTenants', async () => {
189
+ await act(async () => {
190
+ mount(
191
+ <ViewIdContext.Provider value="id1">
192
+ <ProfilePotentialMatchesView config={config} className={className} />
193
+ </ViewIdContext.Provider>
194
+ );
195
+ });
196
+ expect(getMatchesFromDataTenants).toHaveBeenCalledWith({
197
+ customerTenant: testTenant,
198
+ dataTenants: dataTenants,
199
+ dtssPath,
200
+ entity: currentEntity
201
+ });
202
+ });
203
+ it('should call getTransitiveMatches', async () => {
204
+ await act(async () => {
205
+ mount(
206
+ <ViewIdContext.Provider value="id1">
207
+ <ProfilePotentialMatchesView config={config} className={className} />
208
+ </ViewIdContext.Provider>
209
+ );
210
+ });
211
+ expect(getTransitiveMatches).toHaveBeenCalledWith({
212
+ order: DEFAULT_SORTING.order,
213
+ sort: DEFAULT_SORTING.field,
214
+ deep: undefined,
215
+ activeness: 'active',
216
+ entityUri: currentEntity.uri,
217
+ filter: ''
218
+ });
219
+ });
220
+ it('should not call getTransitiveMatches when entity uri is undefined', async () => {
221
+ jest.spyOn(mdmModule.selectors, 'getEntity').mockReturnValue(null);
222
+ await act(async () => {
223
+ mount(
224
+ <ViewIdContext.Provider value="id1">
225
+ <ProfilePotentialMatchesView config={config} className={className} />
226
+ </ViewIdContext.Provider>
227
+ );
228
+ });
229
+ expect(getTransitiveMatches).not.toHaveBeenCalled();
230
+ });
231
+
232
+ it('should return empty for temp entity', async () => {
233
+ jest.spyOn(mdmModule.selectors, 'getEntity').mockReturnValue({
234
+ uri: 'uri$$Temp',
235
+ type: 'configuration/entityTypes/HCP'
236
+ });
237
+ const component = await setUp();
238
+ await component.update();
239
+ expect(getMatchCard(component)).toHaveLength(0);
240
+ expect(getMatchesContainer(component).text()).toBe('No matches found');
241
+ expect(getTransitiveMatches).not.toHaveBeenCalled();
242
+ });
243
+ });
244
+ describe('useCollaboration behaviour', () => {
245
+ it('should call getCommentsCount', async () => {
246
+ const getCommentsCountFn = jest.fn();
247
+ await act(async () => {
248
+ mount(
249
+ <ViewIdContext.Provider value="id1">
250
+ <CollaborationContext.Provider value={{getCommentsCount: getCommentsCountFn} as any}>
251
+ <ProfilePotentialMatchesView config={config} className={className} />
252
+ </CollaborationContext.Provider>
253
+ </ViewIdContext.Provider>
254
+ );
255
+ });
256
+ await act(async () => {
257
+ await Promise.resolve();
258
+ });
259
+ expect(getCommentsCountFn).toHaveBeenCalledWith(
260
+ getPotentialMatchesObjectIdsForCollaboration(
261
+ currentEntity.uri,
262
+ pipe(take(DEFAULT_MATCHES_LIMIT), map(getEntityUriFromMatchObject))(matches)
263
+ )
264
+ );
265
+ });
266
+ });
267
+ });