@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,1503 @@
1
+ import React from 'react';
2
+ import {act} from 'react-dom/test-utils';
3
+ import {mount} from 'enzyme';
4
+ import * as reactRedux from 'react-redux';
5
+ import {
6
+ EmptyStub,
7
+ EmptyState,
8
+ HistoryDiffContext,
9
+ ProfilePerspectiveViewContext,
10
+ WorkflowTasksContext,
11
+ useHistorySlice,
12
+ useHistoryDiff,
13
+ LinearLoadIndicator,
14
+ ScrollToElementProvider,
15
+ CollaborationContextProvider
16
+ } from '@reltio/components';
17
+ import * as mdmSdk from '@reltio/mdm-sdk';
18
+ import {Mode, debounce, ProfileViewTypes} from '@reltio/mdm-sdk';
19
+ import {profile, ui} from '@reltio/mdm-module';
20
+ import {nanoid} from 'nanoid';
21
+
22
+ import {ProfileLayout} from '../../ProfileLayout';
23
+ import {PerspectiveProfileBand} from '../../PerspectiveProfileBand';
24
+ import ProfilePerspectiveView from '..';
25
+ import {ProfileSavedState} from '../../../types';
26
+ import {ProfileErrorsPanel} from '../../ProfileErrorsPanel';
27
+ import hash from 'object-hash';
28
+ import {delayPromise, rerenderWrapper} from '../../../../../../__mocks__/test-utils';
29
+ import {Notifications} from '../../Notifications';
30
+ import {RightSidePanel} from '../../RightSidePanel/RightSidePanel';
31
+
32
+ jest.mock('../../ProfileLayout', () => ({
33
+ ProfileLayout: jest.fn()
34
+ }));
35
+ jest.mock('../../PerspectiveProfileBand', () => ({
36
+ PerspectiveProfileBand: jest.fn()
37
+ }));
38
+ jest.mock('../../ProfileErrorsPanel', () => ({
39
+ ProfileErrorsPanel: jest.fn()
40
+ }));
41
+ jest.mock('@reltio/mdm-sdk', () => {
42
+ const originalModule = jest.requireActual('@reltio/mdm-sdk');
43
+ return {
44
+ ...originalModule,
45
+ debounce: jest.fn().mockImplementation((fn) => fn),
46
+ getCommentsCount: jest.fn(),
47
+ getTasksForEntity: jest.fn().mockReturnValue(Promise.resolve([])),
48
+ getEntityType: jest.fn().mockReturnValue({})
49
+ };
50
+ });
51
+ jest.mock('@reltio/components', () => {
52
+ const originalModule = jest.requireActual('@reltio/components');
53
+ return {
54
+ ...originalModule,
55
+ CollaborationContextProvider: jest.fn(),
56
+ WorkflowTasksContext: {Provider: jest.fn()},
57
+ ProfilePerspectiveViewContext: {Provider: jest.fn()},
58
+ HistoryDiffContext: {Provider: jest.fn()},
59
+ useHistorySlice: jest.fn(),
60
+ useHistoryDiff: jest.fn(),
61
+ useActionsHook: () => () => () => {}
62
+ };
63
+ });
64
+ jest.mock('nanoid', () => {
65
+ const nanoid = jest.requireActual('nanoid');
66
+ return {
67
+ ...nanoid,
68
+ nanoid: jest.fn()
69
+ };
70
+ });
71
+
72
+ const originalDebounce = jest.requireActual('@reltio/mdm-sdk').debounce;
73
+
74
+ describe('ProfilePerspectiveView tests', () => {
75
+ let resolveSavedState;
76
+
77
+ const props = {
78
+ config: {
79
+ id: 'ProfileView',
80
+ layout: [
81
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 10},
82
+ {minHeight: 10, x: 2, width: 2, y: 0, id: 'table1', height: 10}
83
+ ],
84
+ views: [
85
+ {
86
+ class: ProfileViewTypes.HierarchyTree,
87
+ point: 'com.reltio.plugins.ui.view' as const,
88
+ id: 'tree1'
89
+ },
90
+ {
91
+ class: ProfileViewTypes.AttributeTable,
92
+ 'react-class': 'TableClass',
93
+ point: 'com.reltio.plugins.ui.view' as const,
94
+ id: 'table1'
95
+ }
96
+ ],
97
+ sidePanelViews: []
98
+ },
99
+ getSavedState: jest.fn(
100
+ () =>
101
+ new Promise((_resolve) => {
102
+ resolveSavedState = _resolve;
103
+ })
104
+ ) as () => Promise<Record<string, ProfileSavedState>>,
105
+ saveState: jest.fn(),
106
+ commentId: '000066U'
107
+ };
108
+ const entity = {uri: '1', updatedTime: 1, type: 'configuration/HCP'};
109
+ const configHash = hash(props.config);
110
+ let store;
111
+ const dispatch = jest.fn();
112
+
113
+ beforeEach(() => {
114
+ (debounce as jest.Mock).mockImplementation((fn) => fn);
115
+ store = {
116
+ profile: {
117
+ entity,
118
+ history: {},
119
+ modifiedEntities: {}
120
+ },
121
+ tenant: {
122
+ id: 't1'
123
+ },
124
+ ui: {
125
+ sidePanelViews: [],
126
+ paths: {
127
+ servicesPath: 'http://localhost:3000/services'
128
+ },
129
+ newConfig: {
130
+ properties: {
131
+ profileCheckUpdate: {
132
+ autoUpdateInReadMode: ['configuration/entityTypes/HCO'],
133
+ entityTypes: [
134
+ 'configuration/entityTypes/Company',
135
+ 'configuration/entityTypes/HCO',
136
+ 'configuration/entityTypes/HCP',
137
+ 'configuration/entityTypes/HCA'
138
+ ]
139
+ }
140
+ }
141
+ }
142
+ },
143
+ search: {
144
+ keyword: {
145
+ isRawFilter: false,
146
+ value: '1 12'
147
+ }
148
+ }
149
+ };
150
+ });
151
+
152
+ beforeAll(() => {
153
+ jest.spyOn(reactRedux, 'useSelector').mockImplementation((selector: (store: unknown) => unknown) =>
154
+ selector(store)
155
+ );
156
+ jest.spyOn(reactRedux, 'useDispatch').mockImplementation(() => dispatch);
157
+ (ProfileLayout as unknown as jest.Mock).mockImplementation(EmptyStub);
158
+ (PerspectiveProfileBand as unknown as jest.Mock).mockImplementation(EmptyStub);
159
+ (ProfileErrorsPanel as unknown as jest.Mock).mockImplementation(EmptyStub);
160
+ (CollaborationContextProvider as unknown as jest.Mock).mockImplementation(({children}) => (
161
+ <div id="collaborationContextProviderMock">{children}</div>
162
+ ));
163
+ (WorkflowTasksContext.Provider as unknown as jest.Mock).mockImplementation(({children}) => (
164
+ <div id="workflowContextContextMock">{children}</div>
165
+ ));
166
+ (ProfilePerspectiveViewContext.Provider as unknown as jest.Mock).mockImplementation(({children}) => (
167
+ <div id="ProfilePerspectiveViewContextMock">{children}</div>
168
+ ));
169
+ (HistoryDiffContext.Provider as unknown as jest.Mock).mockImplementation(({children}) => (
170
+ <div id="historyDiffContextMock">{children}</div>
171
+ ));
172
+ });
173
+ afterEach(() => {
174
+ jest.clearAllMocks();
175
+ });
176
+
177
+ it('should render initial state correctly', () => {
178
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
179
+ expect(wrapper.find(PerspectiveProfileBand)).toHaveLength(0);
180
+ expect(wrapper.find(ProfileLayout)).toHaveLength(0);
181
+ expect(wrapper.find(ProfileErrorsPanel)).toHaveLength(0);
182
+ expect(wrapper.find(EmptyState)).toHaveLength(1);
183
+ const profilePerspectiveViewContext = wrapper.find(ProfilePerspectiveViewContext.Provider);
184
+ expect(profilePerspectiveViewContext).toHaveLength(1);
185
+ expect(profilePerspectiveViewContext.prop('value')).toBe(true);
186
+ expect(wrapper.find(ScrollToElementProvider)).toHaveLength(1);
187
+ });
188
+
189
+ it('should render profile band, profile errors panel, right side panel and profile layout correctly', async () => {
190
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
191
+ expect(wrapper.find(EmptyState)).toHaveLength(1);
192
+ expect(wrapper.find(LinearLoadIndicator)).toHaveLength(1);
193
+ await act(async () => {
194
+ resolveSavedState(null);
195
+ });
196
+ wrapper.update();
197
+ expect(wrapper.find(LinearLoadIndicator)).toHaveLength(0);
198
+ expect(wrapper.find(EmptyState)).toHaveLength(0);
199
+ expect(wrapper.find(PerspectiveProfileBand)).toHaveLength(1);
200
+ expect(wrapper.find(ProfileErrorsPanel)).toHaveLength(1);
201
+ expect(wrapper.find(ProfileLayout)).toHaveLength(1);
202
+ expect(wrapper.find(ProfileLayout).props()).toMatchObject({
203
+ views: props.config.views,
204
+ layout: props.config.layout
205
+ });
206
+ expect(wrapper.find(RightSidePanel)).toHaveLength(1);
207
+ });
208
+
209
+ it('should not render profile layout for temp entity in read mode', async () => {
210
+ store.profile.entity = {
211
+ ...store.profile.entity,
212
+ uri: 'entities/uri$$123'
213
+ };
214
+ store.profile.mode = Mode.Viewing;
215
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
216
+ expect(wrapper.find(EmptyState)).toHaveLength(1);
217
+ expect(wrapper.find(LinearLoadIndicator)).toHaveLength(1);
218
+ await act(async () => {
219
+ resolveSavedState(null);
220
+ });
221
+ wrapper.update();
222
+ expect(wrapper.find(ProfileLayout)).toHaveLength(0);
223
+ });
224
+
225
+ it('should not render profile band, profile errors panel and profile layout if entity uri is not defined', async () => {
226
+ store.profile.entity = {};
227
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
228
+ expect(wrapper.find(EmptyState)).toHaveLength(1);
229
+ expect(wrapper.find(LinearLoadIndicator)).toHaveLength(1);
230
+ await act(async () => {
231
+ resolveSavedState(null);
232
+ });
233
+ wrapper.update();
234
+ expect(wrapper.find(EmptyState)).toHaveLength(1);
235
+ expect(wrapper.find(LinearLoadIndicator)).toHaveLength(1);
236
+ expect(wrapper.find(PerspectiveProfileBand)).toHaveLength(0);
237
+ expect(wrapper.find(ProfileErrorsPanel)).toHaveLength(0);
238
+ expect(wrapper.find(ProfileLayout)).toHaveLength(0);
239
+ });
240
+
241
+ it('should fix non uniq ids issue for views and layout', async () => {
242
+ let count = 0;
243
+
244
+ (nanoid as jest.Mock).mockImplementation(() => {
245
+ count++;
246
+ return `uniqId${count}`;
247
+ });
248
+
249
+ const views = [
250
+ {
251
+ class: ProfileViewTypes.HierarchyTree,
252
+ point: 'com.reltio.plugins.ui.view' as const,
253
+ id: 'tree1'
254
+ },
255
+ {
256
+ class: ProfileViewTypes.HierarchyTree,
257
+ point: 'com.reltio.plugins.ui.view' as const,
258
+ 'react-class': 'TreeClass',
259
+ id: 'tree1'
260
+ }
261
+ ];
262
+ const layout = [
263
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 10},
264
+ {minHeight: 10, x: 2, width: 2, y: 0, id: 'tree1', height: 10}
265
+ ];
266
+ const config = {...props.config, views, layout};
267
+ const configHash = hash(config);
268
+ const wrapper = mount(<ProfilePerspectiveView {...props} config={config} />);
269
+ expect(wrapper.find(EmptyState)).toHaveLength(1);
270
+ await act(async () => {
271
+ resolveSavedState(null);
272
+ });
273
+ wrapper.update();
274
+ const fixedViews = [views[0], {...views[1], id: 'tree1_uniqId1'}];
275
+ const fixedLayout = [layout[0], {...layout[1], id: 'tree1_uniqId1'}];
276
+ expect(wrapper.find(ProfileLayout)).toHaveLength(1);
277
+ expect(wrapper.find(ProfileLayout).props()).toMatchObject({
278
+ views: fixedViews,
279
+ layout: fixedLayout
280
+ });
281
+
282
+ expect(props.saveState).not.toBeCalled();
283
+ act(() => {
284
+ wrapper.find(ProfileLayout).prop('onLayoutChanged')(fixedLayout);
285
+ });
286
+ expect(props.saveState).toBeCalledWith({
287
+ 'configuration/HCP': {layout: fixedLayout, views: fixedViews, configHash}
288
+ });
289
+ });
290
+
291
+ it('should not fail when entity is null', async () => {
292
+ store.profile.entity = null;
293
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
294
+ expect(wrapper.find(EmptyState)).toHaveLength(1);
295
+ });
296
+
297
+ it('should not fall if profileBand config is not provided', async () => {
298
+ const config = {
299
+ id: props.config.id,
300
+ layout: props.config.layout,
301
+ views: props.config.views,
302
+ sidePanelViews: []
303
+ };
304
+ const modifiedProps = {...props, config};
305
+ const wrapper = mount(<ProfilePerspectiveView {...modifiedProps} />);
306
+ await act(async () => {
307
+ resolveSavedState(null);
308
+ });
309
+ wrapper.update();
310
+ const perspectiveProfileBand = wrapper.find(PerspectiveProfileBand);
311
+ expect(perspectiveProfileBand.prop('config')).toEqual(undefined);
312
+ });
313
+
314
+ it('should apply layout on change', async () => {
315
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
316
+ await act(async () => {
317
+ resolveSavedState(null);
318
+ });
319
+ wrapper.update();
320
+ const newLayout = [
321
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 10},
322
+ {minHeight: 10, x: 0, width: 2, y: 2, id: 'table1', height: 10}
323
+ ];
324
+ act(() => {
325
+ wrapper.find(ProfileLayout).prop('onLayoutChanged')(newLayout);
326
+ });
327
+ wrapper.update();
328
+ expect(wrapper.find(ProfileLayout).prop('layout')).toBe(newLayout);
329
+ });
330
+
331
+ it('should pass profileBandConfig to PerspectiveProfileBand', async () => {
332
+ const config = {
333
+ ...props.config,
334
+ profileBand: {
335
+ cloneAction: [
336
+ {
337
+ entityTypeUris: ['configuration/entityTypes/HCP'],
338
+ attributeReplacementMapping: {},
339
+ relationshipTypesToCopy: []
340
+ }
341
+ ]
342
+ }
343
+ };
344
+ const modifiedProps = {...props, config};
345
+ const wrapper = mount(<ProfilePerspectiveView {...modifiedProps} />);
346
+ await act(async () => {
347
+ resolveSavedState(null);
348
+ });
349
+ wrapper.update();
350
+ expect(wrapper.find(PerspectiveProfileBand)).toHaveLength(1);
351
+ expect(wrapper.find(PerspectiveProfileBand).prop('profileBandConfig')).toBe(config.profileBand);
352
+ });
353
+
354
+ it('should render Notifications', () => {
355
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
356
+ expect(wrapper.find(Notifications)).toHaveLength(1);
357
+ });
358
+
359
+ it('should check permission on views and remove them from layout', async () => {
360
+ store = {
361
+ ...store,
362
+ user: {
363
+ roles: ['MY_testRole']
364
+ }
365
+ };
366
+ const layout = [
367
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 20},
368
+ {minHeight: 10, x: 2, width: 2, y: 0, id: 'relations3Hidden', height: 20},
369
+ {minHeight: 10, x: 2, width: 2, y: 10, id: 'table', height: 20}
370
+ ];
371
+ const views = [
372
+ {
373
+ class: ProfileViewTypes.HierarchyTree,
374
+ id: 'tree1'
375
+ },
376
+ {
377
+ class: ProfileViewTypes.RelationsTable,
378
+ id: 'relations3Hidden',
379
+ canRead: {roles: ['MY_testRole_hidden']}
380
+ },
381
+ {
382
+ class: ProfileViewTypes.AttributeTable,
383
+ id: 'table',
384
+ canRead: {roles: ['MY_testRole']}
385
+ }
386
+ ];
387
+ const wrapper = mount(<ProfilePerspectiveView {...props} config={{...props.config, layout, views}} />);
388
+ await act(async () => {
389
+ resolveSavedState({});
390
+ });
391
+ wrapper.update();
392
+ expect(wrapper.find(ProfileLayout).prop('layout')).toEqual([
393
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 20},
394
+ {minHeight: 10, x: 2, width: 2, y: 10, id: 'table', height: 20}
395
+ ]);
396
+ expect(wrapper.find(ProfileLayout).prop('views')).toEqual([
397
+ {
398
+ class: ProfileViewTypes.HierarchyTree,
399
+ id: 'tree1'
400
+ },
401
+ {
402
+ class: ProfileViewTypes.AttributeTable,
403
+ id: 'table',
404
+ canRead: {roles: ['MY_testRole']}
405
+ }
406
+ ]);
407
+ });
408
+
409
+ describe('saved state scenario', () => {
410
+ it('should request saved state on mount', () => {
411
+ mount(<ProfilePerspectiveView {...props} />);
412
+ expect(props.getSavedState).toBeCalled();
413
+ });
414
+
415
+ it('should apply saved layout and views if config has same hash', async () => {
416
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
417
+ const layout = [
418
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 20},
419
+ {minHeight: 10, x: 2, width: 2, y: 0, id: 'table1', height: 20}
420
+ ];
421
+ const views = [
422
+ {
423
+ class: 'Class1',
424
+ id: 'tree1'
425
+ },
426
+ {
427
+ 'react-class': 'TreeClass2',
428
+ id: 'table1'
429
+ }
430
+ ];
431
+ await act(async () => {
432
+ resolveSavedState({'configuration/HCP': {layout, views, configHash}});
433
+ });
434
+ wrapper.update();
435
+ expect(wrapper.find(ProfileLayout).prop('layout')).toEqual(layout);
436
+ expect(wrapper.find(ProfileLayout).prop('views')).toEqual(views);
437
+ });
438
+
439
+ it('should correctly apply saved layout and views for config with nested route', async () => {
440
+ const config = {
441
+ ...props.config,
442
+ nestedRoute: 'nestedRoute'
443
+ };
444
+
445
+ const wrapper = mount(<ProfilePerspectiveView {...props} config={config} />);
446
+ await act(async () => {
447
+ resolveSavedState({
448
+ 'configuration/HCP/nestedRoute': {layout: config.layout, views: config.views, configHash}
449
+ });
450
+ });
451
+ wrapper.update();
452
+ expect(wrapper.find(ProfileLayout).prop('layout')).toEqual(config.layout);
453
+ expect(wrapper.find(ProfileLayout).prop('views')).toEqual(config.views);
454
+ });
455
+
456
+ it('should apply config layout and config views if config has new hash', async () => {
457
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
458
+ const layout = [
459
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 20},
460
+ {minHeight: 10, x: 2, width: 2, y: 0, id: 'table1', height: 20}
461
+ ];
462
+ const views = [
463
+ {
464
+ class: 'Class1',
465
+ id: 'tree1'
466
+ },
467
+ {
468
+ 'react-class': 'TreeClass2',
469
+ id: 'table1'
470
+ }
471
+ ];
472
+ await act(async () => {
473
+ resolveSavedState({'configuration/HCP': {layout, views, configHash: 'newHash'}});
474
+ });
475
+ wrapper.update();
476
+ expect(wrapper.find(ProfileLayout).prop('layout')).toEqual(props.config.layout);
477
+ expect(wrapper.find(ProfileLayout).prop('views')).toEqual(props.config.views);
478
+ });
479
+
480
+ it('should save layout on change', async () => {
481
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
482
+ await act(async () => {
483
+ resolveSavedState(null);
484
+ });
485
+ wrapper.update();
486
+ const newLayout = [
487
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 10},
488
+ {minHeight: 10, x: 0, width: 2, y: 2, id: 'table1', height: 10}
489
+ ];
490
+ expect(props.saveState).not.toBeCalled();
491
+ act(() => {
492
+ wrapper.find(ProfileLayout).prop('onLayoutChanged')(newLayout);
493
+ });
494
+ expect(props.saveState).toBeCalledWith({
495
+ 'configuration/HCP': {layout: newLayout, views: props.config.views, configHash}
496
+ });
497
+ });
498
+
499
+ it('should update layout on entityTypeChange', async () => {
500
+ const state = {
501
+ 'configuration/HCP': {
502
+ layout: [{minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 20}],
503
+ views: [{class: 'Class1', id: 'tree1'}]
504
+ },
505
+ 'configuration/HCO': {
506
+ layout: [{minHeight: 10, x: 2, width: 2, y: 0, id: 'table1', height: 20}],
507
+ views: [{'react-class': 'TreeClass2', id: 'table1'}]
508
+ }
509
+ };
510
+ const makeConfig = (entityType) => ({
511
+ id: 'ProfileView',
512
+ ...state[entityType],
513
+ sidePanelViews: []
514
+ });
515
+ const componentProps = {...props, config: makeConfig('configuration/HCP')};
516
+ const wrapper = mount(<ProfilePerspectiveView {...componentProps} />);
517
+ await act(async () => {
518
+ resolveSavedState(state);
519
+ });
520
+ wrapper.update();
521
+
522
+ expect(props.saveState).not.toBeCalled();
523
+ expect(wrapper.find(ProfileLayout).prop('layout')).toStrictEqual([
524
+ {height: 20, id: 'tree1', minHeight: 10, width: 2, x: 0, y: 0}
525
+ ]);
526
+ const prevEntity = store.profile.entity;
527
+ await act(async () => {
528
+ store.profile.entity = {uri: '2', updatedTime: 1, type: 'configuration/HCO'};
529
+ wrapper.setProps({config: makeConfig('configuration/HCO')});
530
+ });
531
+ wrapper.update();
532
+ await act(async () => {
533
+ await delayPromise(10);
534
+ wrapper.update();
535
+ });
536
+ store.profile.entity = prevEntity;
537
+ expect(wrapper.find(ProfileLayout).prop('layout')).toStrictEqual([
538
+ {height: 20, id: 'table1', minHeight: 10, width: 2, x: 2, y: 0}
539
+ ]);
540
+ });
541
+
542
+ it('should update layout on entityTypeChange if saved in preferences layout is missing', async () => {
543
+ const state = {
544
+ 'configuration/HCP': {
545
+ layout: [{minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 20}],
546
+ views: [{class: 'Class1', id: 'tree1'}]
547
+ },
548
+ 'configuration/HCO': {
549
+ layout: [{minHeight: 10, x: 2, width: 2, y: 0, id: 'table1', height: 20}],
550
+ views: [{'react-class': 'TreeClass2', id: 'table1'}]
551
+ }
552
+ };
553
+ const preferencesState = {};
554
+ const makeConfig = (entityType) => ({
555
+ id: 'ProfileView',
556
+ ...state[entityType],
557
+ sidePanelViews: []
558
+ });
559
+ const componentProps = {...props, config: makeConfig('configuration/HCP')};
560
+ const wrapper = mount(<ProfilePerspectiveView {...componentProps} />);
561
+ await act(async () => {
562
+ resolveSavedState(preferencesState);
563
+ });
564
+ wrapper.update();
565
+
566
+ expect(props.saveState).not.toBeCalled();
567
+ expect(wrapper.find(ProfileLayout).prop('layout')).toStrictEqual([
568
+ {height: 20, id: 'tree1', minHeight: 10, width: 2, x: 0, y: 0}
569
+ ]);
570
+ const prevEntity = store.profile.entity;
571
+ await act(async () => {
572
+ store.profile.entity = {uri: '2', updatedTime: 1, type: 'configuration/HCO'};
573
+ wrapper.setProps({config: makeConfig('configuration/HCO')});
574
+ });
575
+ wrapper.update();
576
+ await act(async () => {
577
+ await delayPromise(10);
578
+ wrapper.update();
579
+ });
580
+ store.profile.entity = prevEntity;
581
+ expect(wrapper.find(ProfileLayout).prop('layout')).toStrictEqual([
582
+ {height: 20, id: 'table1', minHeight: 10, width: 2, x: 2, y: 0}
583
+ ]);
584
+ });
585
+
586
+ it('should save layout on change with debounce', async () => {
587
+ const delay = 200;
588
+ (debounce as jest.Mock).mockImplementationOnce((fn) => originalDebounce(fn, delay));
589
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
590
+ await act(async () => {
591
+ resolveSavedState(null);
592
+ });
593
+ wrapper.update();
594
+ const newLayout = [
595
+ {minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 10},
596
+ {minHeight: 10, x: 0, width: 2, y: 2, id: 'table1', height: 10}
597
+ ];
598
+ expect(props.saveState).not.toBeCalled();
599
+ await act(async () => {
600
+ wrapper.find(ProfileLayout).prop('onLayoutChanged')(newLayout);
601
+ wrapper.find(ProfileLayout).prop('onLayoutChanged')(newLayout);
602
+ wrapper.find(ProfileLayout).prop('onLayoutChanged')(newLayout);
603
+ await delayPromise(delay);
604
+ });
605
+ expect(props.saveState).toBeCalledTimes(1);
606
+ });
607
+
608
+ it('should save update correct layout based on entity type', async () => {
609
+ const state = {
610
+ 'configuration/HCP': {
611
+ layout: [{minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 20}],
612
+ views: [{class: 'Class1', id: 'tree1'}]
613
+ },
614
+ 'configuration/HCO': {
615
+ layout: [{minHeight: 10, x: 2, width: 2, y: 0, id: 'table1', height: 20}],
616
+ views: [{'react-class': 'TreeClass2', id: 'table1'}]
617
+ }
618
+ };
619
+ const makeConfig = (entityType) => ({
620
+ id: 'ProfileView',
621
+ ...state[entityType],
622
+ sidePanelViews: []
623
+ });
624
+ const componentProps = {...props, config: makeConfig('configuration/HCP')};
625
+ const wrapper = mount(<ProfilePerspectiveView {...componentProps} />);
626
+ await act(async () => {
627
+ resolveSavedState(state);
628
+ });
629
+ wrapper.update();
630
+
631
+ const newHCPLayout = [{minHeight: 10, x: 0, width: 2, y: 0, id: 'tree1', height: 10}];
632
+ await act(async () => {
633
+ wrapper.find(ProfileLayout).prop('onLayoutChanged')(newHCPLayout);
634
+ await delayPromise(300);
635
+ });
636
+ wrapper.update();
637
+ const updatedState = props.saveState.mock.calls[0][0];
638
+ expect(updatedState['configuration/HCP'].layout).toStrictEqual([newHCPLayout[0]]);
639
+ expect(updatedState['configuration/HCO']).toStrictEqual(state['configuration/HCO']);
640
+ });
641
+ });
642
+
643
+ describe('useCollaboration behavior', () => {
644
+ const setStore = () => {
645
+ store = {
646
+ ...store,
647
+ profile: {
648
+ ...store.profile,
649
+ history: {
650
+ diff: {
651
+ appearance: {}
652
+ }
653
+ }
654
+ },
655
+ ui: {
656
+ paths: {
657
+ ...store.ui.paths,
658
+ collaborationPath: '123',
659
+ workflowPath: 'workflowPath',
660
+ workflowEnvironmentURL: 'workflowEnvironmentURL'
661
+ },
662
+ sidePanelViews: []
663
+ }
664
+ };
665
+ };
666
+
667
+ it('should not call getCommentsCount if collaboration is not enabled', () => {
668
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
669
+ expect(wrapper.find(CollaborationContextProvider).prop('collaboration')).toMatchObject({
670
+ commentsMap: null
671
+ });
672
+ expect(mdmSdk.getCommentsCount).not.toHaveBeenCalled();
673
+ });
674
+
675
+ it('should call getCommentsCount if collaboration is enabled and set CollaborationContextProvider collaboration value', async () => {
676
+ setStore();
677
+ (mdmSdk.getCommentsCount as jest.Mock).mockReturnValue(
678
+ Promise.resolve([
679
+ {
680
+ objectId: 'uri1',
681
+ comments: [
682
+ {
683
+ commentId: 'id1',
684
+ status: 'open',
685
+ replies: 1
686
+ },
687
+ {
688
+ commentId: 'id2',
689
+ status: 'open',
690
+ replies: 2
691
+ }
692
+ ]
693
+ }
694
+ ])
695
+ );
696
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
697
+ expect(mdmSdk.getCommentsCount).toHaveBeenCalledWith({
698
+ uris: [store.profile.entity.uri],
699
+ tenant: 't1',
700
+ collaborationPath: store.ui.paths.collaborationPath
701
+ });
702
+ await act(async () => {
703
+ await Promise.resolve();
704
+ });
705
+ wrapper.update();
706
+ expect(wrapper.find(CollaborationContextProvider).prop('collaboration')).toMatchObject({
707
+ commentsMap: {
708
+ uri1: [
709
+ {
710
+ commentId: 'id1',
711
+ status: 'open',
712
+ replies: 1
713
+ },
714
+ {
715
+ commentId: 'id2',
716
+ status: 'open',
717
+ replies: 2
718
+ }
719
+ ]
720
+ }
721
+ });
722
+ });
723
+
724
+ it('should set CollaborationContextProvider collaboration value as null in case of unsuccessful request', async () => {
725
+ setStore();
726
+ (mdmSdk.getCommentsCount as jest.Mock).mockReturnValue(Promise.reject());
727
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
728
+ expect(mdmSdk.getCommentsCount).toHaveBeenCalled();
729
+ await act(async () => {
730
+ await Promise.resolve();
731
+ });
732
+ wrapper.update();
733
+ expect(wrapper.find(CollaborationContextProvider).prop('collaboration')).toMatchObject({
734
+ commentsMap: null
735
+ });
736
+ });
737
+ });
738
+
739
+ describe('useWorkflowTasks behavior', () => {
740
+ const setStore = ({workflowConfigEnabled = true} = {}) => {
741
+ store = {
742
+ ...store,
743
+ profile: {
744
+ ...store.profile,
745
+ history: {
746
+ diff: {
747
+ appearance: {}
748
+ }
749
+ },
750
+ lastLoadedTime: 1674037143100
751
+ },
752
+ ui: {
753
+ paths: {
754
+ ...store.ui.paths,
755
+ workflowPath: 'workflowPath',
756
+ workflowEnvironmentURL: 'workflowEnvironmentURL'
757
+ },
758
+ sidePanelViews: [],
759
+ config: {
760
+ 'com.reltio.plugins.workflow.configuration': {
761
+ enabled: workflowConfigEnabled
762
+ }
763
+ }
764
+ },
765
+ user: {
766
+ userPermissions: {
767
+ permissions: {
768
+ 'workflow:data.tasks': {
769
+ READ: ['t1']
770
+ }
771
+ }
772
+ }
773
+ }
774
+ };
775
+ };
776
+
777
+ it('should not call getTasksForEntity if workflow is not enabled', async () => {
778
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
779
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
780
+ loading: false,
781
+ tasks: null,
782
+ total: 0
783
+ });
784
+ expect(mdmSdk.getTasksForEntity).not.toHaveBeenCalled();
785
+ });
786
+
787
+ it('should not call getTasksForEntity if workflow is not enabled in ui config', async () => {
788
+ setStore({workflowConfigEnabled: false});
789
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
790
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
791
+ loading: false,
792
+ tasks: null,
793
+ total: 0
794
+ });
795
+ expect(mdmSdk.getTasksForEntity).not.toHaveBeenCalled();
796
+ });
797
+
798
+ it('should not call getTasksForEntity if user has no permissions to view tasks', async () => {
799
+ setStore();
800
+ store.user.userPermissions.permissions = {
801
+ 'workflow:data.tasks': {
802
+ READ: ['otherTenant']
803
+ }
804
+ };
805
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
806
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
807
+ loading: false,
808
+ tasks: null,
809
+ total: 0
810
+ });
811
+ expect(mdmSdk.getTasksForEntity).not.toHaveBeenCalled();
812
+ });
813
+
814
+ it('should call getTasksForEntity if workflow is enabled and set WorkflowTasksContext.Provider value', async () => {
815
+ setStore();
816
+ const response = {
817
+ status: 'OK',
818
+ data: [{taskId: 'taskId1'}, {taskId: 'taskId2'}]
819
+ };
820
+ let resolveHandler;
821
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValue(
822
+ new Promise((resolve) => {
823
+ resolveHandler = resolve;
824
+ })
825
+ );
826
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
827
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
828
+ entityUri: store.profile.entity.uri,
829
+ workflowPath: 'workflowPath',
830
+ environment: 'workflowEnvironmentURL',
831
+ tenant: 't1',
832
+ filter: {
833
+ assignee: undefined,
834
+ processType: null
835
+ },
836
+ includeClosed: false
837
+ });
838
+ await act(async () => {
839
+ await Promise.resolve();
840
+ });
841
+ wrapper.update();
842
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
843
+ loading: true,
844
+ tasks: null,
845
+ total: 0
846
+ });
847
+ await act(async () => {
848
+ resolveHandler(response);
849
+ await Promise.resolve();
850
+ });
851
+ wrapper.update();
852
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
853
+ loading: false,
854
+ tasks: response.data,
855
+ total: response.data.length
856
+ });
857
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(1);
858
+ });
859
+
860
+ it('should call getTasksForEntity on change lastLoadedTime', async () => {
861
+ setStore();
862
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
863
+ store.profile.lastLoadedTime = 1674037143200;
864
+ wrapper.setProps({config: {...props.config}});
865
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(2);
866
+ });
867
+
868
+ it('should call clear tasks and total after switching to temporary entity', async () => {
869
+ setStore();
870
+ const response = {
871
+ status: 'OK',
872
+ data: [{taskId: 'taskId1'}, {taskId: 'taskId2'}]
873
+ };
874
+ let resolveHandler;
875
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValue(
876
+ new Promise((resolve) => {
877
+ resolveHandler = resolve;
878
+ })
879
+ );
880
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
881
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
882
+ entityUri: store.profile.entity.uri,
883
+ workflowPath: 'workflowPath',
884
+ environment: 'workflowEnvironmentURL',
885
+ tenant: 't1',
886
+ filter: {
887
+ assignee: undefined,
888
+ processType: null
889
+ },
890
+ includeClosed: false
891
+ });
892
+ await act(async () => {
893
+ await Promise.resolve();
894
+ });
895
+ wrapper.update();
896
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
897
+ loading: true,
898
+ tasks: null,
899
+ total: 0
900
+ });
901
+ await act(async () => {
902
+ resolveHandler(response);
903
+ await Promise.resolve();
904
+ });
905
+ wrapper.update();
906
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
907
+ loading: false,
908
+ tasks: response.data,
909
+ total: response.data.length
910
+ });
911
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(1);
912
+
913
+ // switching to temp entity
914
+ store.profile.entity = {
915
+ ...store.profile.entity,
916
+ uri: 'entities/uri$$123'
917
+ };
918
+ wrapper.setProps({config: {...props.config}});
919
+ wrapper.update();
920
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(1);
921
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
922
+ loading: false,
923
+ tasks: null,
924
+ total: 0
925
+ });
926
+ });
927
+
928
+ it('should update workflow tasks via updateTaskState from WorkflowTasksContext.Provider value', async () => {
929
+ setStore();
930
+ const response = {
931
+ status: 'OK',
932
+ data: [{taskId: 'taskId1'}, {taskId: 'taskId2', dueDate: 0}]
933
+ };
934
+ let resolveHandler;
935
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValue(
936
+ new Promise((resolve) => {
937
+ resolveHandler = resolve;
938
+ })
939
+ );
940
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
941
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
942
+ entityUri: store.profile.entity.uri,
943
+ workflowPath: 'workflowPath',
944
+ environment: 'workflowEnvironmentURL',
945
+ tenant: 't1',
946
+ filter: {
947
+ assignee: undefined,
948
+ processType: null
949
+ },
950
+ includeClosed: false
951
+ });
952
+ await act(async () => {
953
+ await Promise.resolve();
954
+ });
955
+ wrapper.update();
956
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
957
+ loading: true,
958
+ tasks: null,
959
+ total: 0
960
+ });
961
+ await act(async () => {
962
+ resolveHandler(response);
963
+ await Promise.resolve();
964
+ });
965
+ wrapper.update();
966
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
967
+ loading: false,
968
+ tasks: response.data,
969
+ total: response.data.length
970
+ });
971
+
972
+ act(() => {
973
+ wrapper.find(WorkflowTasksContext.Provider).prop('value').updateTaskState('taskId2', {dueDate: 5});
974
+ });
975
+ wrapper.update();
976
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
977
+ loading: false,
978
+ tasks: [{taskId: 'taskId1'}, {taskId: 'taskId2', dueDate: 5}],
979
+ total: response.data.length
980
+ });
981
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(1);
982
+ });
983
+
984
+ it('should dispatch entityDeletionFinished action in case of "Delete" action performing', async () => {
985
+ setStore();
986
+ const response = {
987
+ status: 'OK',
988
+ data: [{taskId: 'taskId1'}, {taskId: 'taskId2'}]
989
+ };
990
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValue(Promise.resolve(response));
991
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
992
+ await act(async () => {
993
+ await Promise.resolve();
994
+ });
995
+ wrapper.update();
996
+
997
+ dispatch.mockClear();
998
+
999
+ wrapper.find(WorkflowTasksContext.Provider).prop('value').onActionSuccess('Delete');
1000
+
1001
+ expect(dispatch).toHaveBeenCalledWith(ui.actions.entityDeletionFinished());
1002
+ expect(dispatch).toHaveBeenCalledTimes(1);
1003
+ });
1004
+
1005
+ it('should dispatch refresh entity action in case of other action performing', async () => {
1006
+ setStore();
1007
+ const response = {
1008
+ status: 'OK',
1009
+ data: [{taskId: 'taskId1'}, {taskId: 'taskId2'}]
1010
+ };
1011
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValue(Promise.resolve(response));
1012
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
1013
+ await act(async () => {
1014
+ await Promise.resolve();
1015
+ });
1016
+ wrapper.update();
1017
+
1018
+ const contextValue = wrapper.find(WorkflowTasksContext.Provider).prop('value');
1019
+
1020
+ dispatch.mockClear();
1021
+
1022
+ contextValue.onActionSuccess('notDelete');
1023
+
1024
+ expect(dispatch).toHaveBeenCalledWith(profile.entity.actions.loadEntity({uri: '1', viewId: null}));
1025
+ expect(dispatch).toHaveBeenCalledTimes(1);
1026
+ });
1027
+
1028
+ describe('workflow config behavior', () => {
1029
+ it('should use config.workflow.assignee in request', async () => {
1030
+ setStore();
1031
+ const assignee = 'user1';
1032
+ const config = {
1033
+ id: 'view1',
1034
+ views: [],
1035
+ layout: [],
1036
+ workflow: {
1037
+ assignee
1038
+ },
1039
+ sidePanelViews: []
1040
+ };
1041
+ const response = {
1042
+ status: 'OK',
1043
+ data: [
1044
+ {taskId: 'taskId1', assignee},
1045
+ {taskId: 'taskId2', assignee: 'user2'}
1046
+ ]
1047
+ };
1048
+ let resolveHandler;
1049
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValue(
1050
+ new Promise((resolve) => {
1051
+ resolveHandler = resolve;
1052
+ })
1053
+ );
1054
+ const wrapper = mount(<ProfilePerspectiveView {...props} config={config} />);
1055
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
1056
+ entityUri: store.profile.entity.uri,
1057
+ workflowPath: 'workflowPath',
1058
+ environment: 'workflowEnvironmentURL',
1059
+ tenant: 't1',
1060
+ filter: {
1061
+ assignee,
1062
+ processType: null
1063
+ },
1064
+ includeClosed: false
1065
+ });
1066
+ await act(async () => {
1067
+ resolveHandler(response);
1068
+ });
1069
+ wrapper.update();
1070
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
1071
+ loading: false,
1072
+ tasks: [{taskId: 'taskId1', assignee: 'user1'}],
1073
+ total: 1
1074
+ });
1075
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(1);
1076
+ });
1077
+
1078
+ it('should use config.workflow.showClosedTasks in request', async () => {
1079
+ setStore();
1080
+ const showClosedTasks = true;
1081
+ const config = {
1082
+ id: 'view1',
1083
+ views: [],
1084
+ layout: [],
1085
+ workflow: {
1086
+ showClosedTasks
1087
+ },
1088
+ sidePanelViews: []
1089
+ };
1090
+ const response = {
1091
+ status: 'OK',
1092
+ data: [
1093
+ {taskId: 'taskId1', assignee: 'user1'},
1094
+ {taskId: 'taskId2', assignee: 'user2'}
1095
+ ]
1096
+ };
1097
+ let resolveHandler;
1098
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValue(
1099
+ new Promise((resolve) => {
1100
+ resolveHandler = resolve;
1101
+ })
1102
+ );
1103
+ const wrapper = mount(<ProfilePerspectiveView {...props} config={config} />);
1104
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
1105
+ entityUri: store.profile.entity.uri,
1106
+ workflowPath: 'workflowPath',
1107
+ environment: 'workflowEnvironmentURL',
1108
+ tenant: 't1',
1109
+ filter: {
1110
+ assignee: undefined,
1111
+ processType: null
1112
+ },
1113
+ includeClosed: showClosedTasks
1114
+ });
1115
+ await act(async () => {
1116
+ resolveHandler(response);
1117
+ });
1118
+ wrapper.update();
1119
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
1120
+ loading: false,
1121
+ tasks: response.data,
1122
+ total: response.data.length
1123
+ });
1124
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(1);
1125
+ });
1126
+
1127
+ describe('config.workflow.processTypes behavior', () => {
1128
+ it('should use several requests for config.workflow.processTypes', async () => {
1129
+ setStore();
1130
+ const processTypes = ['type1', 'type2'];
1131
+ const config = {
1132
+ id: 'view1',
1133
+ views: [],
1134
+ layout: [],
1135
+ workflow: {
1136
+ processTypes
1137
+ },
1138
+ sidePanelViews: []
1139
+ };
1140
+ const response1 = {
1141
+ status: 'OK',
1142
+ data: [
1143
+ {taskId: 'taskId1', assignee: 'user1', processType: 'type1'},
1144
+ {taskId: 'taskId2', assignee: 'user2', processType: 'type1'}
1145
+ ]
1146
+ };
1147
+ const response2 = {
1148
+ status: 'OK',
1149
+ data: [
1150
+ {taskId: 'taskId2', assignee: 'user2', processType: 'type1'},
1151
+ {taskId: 'taskId3', assignee: 'user3', processType: 'type2'}
1152
+ ]
1153
+ };
1154
+ let resolveHandler1, resolveHandler2;
1155
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValueOnce(
1156
+ new Promise((resolve) => {
1157
+ resolveHandler1 = resolve;
1158
+ })
1159
+ );
1160
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValueOnce(
1161
+ new Promise((resolve) => {
1162
+ resolveHandler2 = resolve;
1163
+ })
1164
+ );
1165
+ const wrapper = mount(<ProfilePerspectiveView {...props} config={config} />);
1166
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
1167
+ entityUri: store.profile.entity.uri,
1168
+ workflowPath: 'workflowPath',
1169
+ environment: 'workflowEnvironmentURL',
1170
+ tenant: 't1',
1171
+ filter: {
1172
+ assignee: undefined,
1173
+ processType: 'type1'
1174
+ },
1175
+ includeClosed: false
1176
+ });
1177
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
1178
+ entityUri: store.profile.entity.uri,
1179
+ workflowPath: 'workflowPath',
1180
+ environment: 'workflowEnvironmentURL',
1181
+ tenant: 't1',
1182
+ filter: {
1183
+ assignee: undefined,
1184
+ processType: 'type2'
1185
+ },
1186
+ includeClosed: false
1187
+ });
1188
+ await act(async () => {
1189
+ resolveHandler1(response1);
1190
+ resolveHandler2(response2);
1191
+ });
1192
+ wrapper.update();
1193
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
1194
+ loading: false,
1195
+ tasks: [
1196
+ {taskId: 'taskId1', assignee: 'user1', processType: 'type1'},
1197
+ {taskId: 'taskId2', assignee: 'user2', processType: 'type1'},
1198
+ {taskId: 'taskId3', assignee: 'user3', processType: 'type2'}
1199
+ ],
1200
+ total: 3
1201
+ });
1202
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(2);
1203
+ });
1204
+
1205
+ it('should use usual flow if config.workflow.processTypes contains "*"', async () => {
1206
+ setStore();
1207
+ const processTypes = ['type1', 'type2', '*'];
1208
+ const config = {
1209
+ id: 'view1',
1210
+ views: [],
1211
+ layout: [],
1212
+ workflow: {
1213
+ processTypes
1214
+ },
1215
+ sidePanelViews: []
1216
+ };
1217
+ const response = {
1218
+ status: 'OK',
1219
+ data: [
1220
+ {taskId: 'taskId1', assignee: 'user1', processType: 'type1'},
1221
+ {taskId: 'taskId2', assignee: 'user2', processType: 'type111'}
1222
+ ]
1223
+ };
1224
+ let resolveHandler;
1225
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValue(
1226
+ new Promise((resolve) => {
1227
+ resolveHandler = resolve;
1228
+ })
1229
+ );
1230
+ const wrapper = mount(<ProfilePerspectiveView {...props} config={config} />);
1231
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
1232
+ entityUri: store.profile.entity.uri,
1233
+ workflowPath: 'workflowPath',
1234
+ environment: 'workflowEnvironmentURL',
1235
+ tenant: 't1',
1236
+ filter: {
1237
+ assignee: undefined,
1238
+ processType: null
1239
+ },
1240
+ includeClosed: false
1241
+ });
1242
+ await act(async () => {
1243
+ resolveHandler(response);
1244
+ });
1245
+ wrapper.update();
1246
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
1247
+ loading: false,
1248
+ tasks: response.data,
1249
+ total: response.data.length
1250
+ });
1251
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(1);
1252
+ });
1253
+ });
1254
+
1255
+ it('should be able to use all config.workflow options', async () => {
1256
+ setStore();
1257
+ const assignee = 'user1';
1258
+ const processTypes = ['type1', 'type2'];
1259
+ const showClosedTasks = true;
1260
+ const config = {
1261
+ id: 'view1',
1262
+ views: [],
1263
+ layout: [],
1264
+ workflow: {
1265
+ assignee,
1266
+ showClosedTasks,
1267
+ processTypes
1268
+ },
1269
+ sidePanelViews: []
1270
+ };
1271
+ const response1 = {
1272
+ status: 'OK',
1273
+ data: [
1274
+ {taskId: 'taskId1', assignee, processType: 'type1'},
1275
+ {taskId: 'taskId2', assignee: 'user2', processType: 'type1'}
1276
+ ]
1277
+ };
1278
+ const response2 = {
1279
+ status: 'OK',
1280
+ data: [
1281
+ {taskId: 'taskId2', assignee: 'user2', processType: 'type1'},
1282
+ {taskId: 'taskId3', assignee: 'user3', processType: 'type2'}
1283
+ ]
1284
+ };
1285
+ let resolveHandler1, resolveHandler2;
1286
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValueOnce(
1287
+ new Promise((resolve) => {
1288
+ resolveHandler1 = resolve;
1289
+ })
1290
+ );
1291
+ (mdmSdk.getTasksForEntity as jest.Mock).mockReturnValueOnce(
1292
+ new Promise((resolve) => {
1293
+ resolveHandler2 = resolve;
1294
+ })
1295
+ );
1296
+ const wrapper = mount(<ProfilePerspectiveView {...props} config={config} />);
1297
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
1298
+ entityUri: store.profile.entity.uri,
1299
+ workflowPath: 'workflowPath',
1300
+ environment: 'workflowEnvironmentURL',
1301
+ tenant: 't1',
1302
+ filter: {
1303
+ assignee,
1304
+ processType: 'type1'
1305
+ },
1306
+ includeClosed: true
1307
+ });
1308
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledWith({
1309
+ entityUri: store.profile.entity.uri,
1310
+ workflowPath: 'workflowPath',
1311
+ environment: 'workflowEnvironmentURL',
1312
+ tenant: 't1',
1313
+ filter: {
1314
+ assignee,
1315
+ processType: 'type2'
1316
+ },
1317
+ includeClosed: true
1318
+ });
1319
+ await act(async () => {
1320
+ resolveHandler1(response1);
1321
+ resolveHandler2(response2);
1322
+ });
1323
+ wrapper.update();
1324
+ expect(wrapper.find(WorkflowTasksContext.Provider).prop('value')).toMatchObject({
1325
+ loading: false,
1326
+ tasks: [{taskId: 'taskId1', assignee, processType: 'type1'}],
1327
+ total: 1
1328
+ });
1329
+ expect(mdmSdk.getTasksForEntity).toHaveBeenCalledTimes(2);
1330
+ });
1331
+ });
1332
+ });
1333
+
1334
+ describe('useProfileValidation behaviour', () => {
1335
+ const setStore = ({
1336
+ disableReadModeValidation = false,
1337
+ disableEntity = false,
1338
+ mode = Mode.Viewing,
1339
+ entityFromDataTenant = false,
1340
+ entityUri = store.profile.entity.uri,
1341
+ profileViews = ['view1']
1342
+ } = {}) => {
1343
+ store = {
1344
+ ...store,
1345
+ profile: {
1346
+ ...store.profile,
1347
+ entity: disableEntity
1348
+ ? {}
1349
+ : {
1350
+ ...store.profile.entity,
1351
+ uri: entityUri,
1352
+ dataTenant: entityFromDataTenant ? 'dataTenant' : undefined
1353
+ },
1354
+ mode,
1355
+ views: profileViews
1356
+ },
1357
+ ui: {
1358
+ ...store.ui,
1359
+ config: {
1360
+ 'com.reltio.plugins.entity.Validation': {
1361
+ validateReadMode: !disableReadModeValidation
1362
+ }
1363
+ }
1364
+ }
1365
+ };
1366
+ };
1367
+ const validateProfileAction = profile.actions.validateProfile();
1368
+ it('should dispatch validateProfile action when read mode validation not disabled in config and mode is Viewing and entity defined', () => {
1369
+ setStore();
1370
+ mount(<ProfilePerspectiveView {...props} />);
1371
+ expect(dispatch).toHaveBeenCalledWith(validateProfileAction);
1372
+ });
1373
+
1374
+ it('should dispatch validateProfile action when entity uri changed', async () => {
1375
+ setStore();
1376
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
1377
+ dispatch.mockClear();
1378
+ store.profile.entity.uri = 'newUri';
1379
+ rerenderWrapper(wrapper);
1380
+ expect(dispatch).toHaveBeenCalledWith(validateProfileAction);
1381
+ });
1382
+
1383
+ it('should dispatch validateProfile action when entity updatedTime changed', async () => {
1384
+ setStore();
1385
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
1386
+ dispatch.mockClear();
1387
+ store.profile.entity.updatedTime = 2;
1388
+ rerenderWrapper(wrapper);
1389
+ expect(dispatch).toHaveBeenCalledWith(validateProfileAction);
1390
+ });
1391
+
1392
+ it('should not dispatch validateProfile action for entity from data tenant', async () => {
1393
+ setStore({entityFromDataTenant: true});
1394
+ mount(<ProfilePerspectiveView {...props} />);
1395
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1396
+ });
1397
+
1398
+ it('should dispatch validateProfile action when mode changed', async () => {
1399
+ setStore({mode: Mode.Editing});
1400
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
1401
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1402
+ setStore({mode: Mode.Viewing});
1403
+ rerenderWrapper(wrapper);
1404
+ expect(dispatch).toHaveBeenCalledWith(validateProfileAction);
1405
+ });
1406
+
1407
+ it('should not dispatch validateProfile action once when mode and entity uri changes in sequence and uri is temporary', async () => {
1408
+ (debounce as jest.Mock).mockImplementation((fn) => originalDebounce(fn, 100));
1409
+ setStore({mode: Mode.Editing});
1410
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
1411
+ setStore({mode: Mode.Viewing});
1412
+ store.profile.entity.uri = 'entities/uri$$newUri';
1413
+ rerenderWrapper(wrapper);
1414
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1415
+
1416
+ await act(async () => {
1417
+ await delayPromise(200);
1418
+ });
1419
+
1420
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1421
+ });
1422
+
1423
+ it('should dispatch validateProfile action once when mode and entity uri changes in sequence', async () => {
1424
+ (debounce as jest.Mock).mockImplementation((fn) => originalDebounce(fn, 100));
1425
+ setStore({mode: Mode.Editing});
1426
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
1427
+ setStore({mode: Mode.Viewing});
1428
+ store.profile.entity.uri = 'entities/nextUri';
1429
+ rerenderWrapper(wrapper);
1430
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1431
+
1432
+ await act(async () => {
1433
+ await delayPromise(200);
1434
+ });
1435
+
1436
+ expect(dispatch).toHaveBeenCalledWith(validateProfileAction);
1437
+ });
1438
+
1439
+ it('should not dispatch validateProfile action when read mode validation disabled in config', () => {
1440
+ setStore({disableReadModeValidation: true});
1441
+ mount(<ProfilePerspectiveView {...props} />);
1442
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1443
+ });
1444
+
1445
+ it('should not dispatch validateProfile action when entity is empty', () => {
1446
+ setStore({disableEntity: true});
1447
+ mount(<ProfilePerspectiveView {...props} />);
1448
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1449
+ });
1450
+
1451
+ it('should not dispatch validateProfile action when mode is not Viewing', () => {
1452
+ setStore({mode: Mode.Editing});
1453
+ mount(<ProfilePerspectiveView {...props} />);
1454
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1455
+ });
1456
+
1457
+ it('should not dispatch validateProfile action for new entity with temp uri ', () => {
1458
+ setStore({entityUri: 'uri$$Temp'});
1459
+ mount(<ProfilePerspectiveView {...props} />);
1460
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1461
+ });
1462
+
1463
+ it('should not dispatch validateProfile action until profile views will be set ', async () => {
1464
+ setStore({profileViews: null});
1465
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
1466
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1467
+ setStore({profileViews: null});
1468
+ rerenderWrapper(wrapper);
1469
+ expect(dispatch).not.toHaveBeenCalledWith(validateProfileAction);
1470
+ setStore({profileViews: ['view2']});
1471
+ wrapper.setProps({config: {...props.config}});
1472
+ wrapper.update();
1473
+ expect(dispatch).toHaveBeenCalledWith(validateProfileAction);
1474
+ });
1475
+ });
1476
+
1477
+ describe('history behaviour', () => {
1478
+ const setStore = (history) => {
1479
+ store = {
1480
+ ...store,
1481
+ profile: {
1482
+ ...store.profile,
1483
+ history
1484
+ }
1485
+ };
1486
+ };
1487
+
1488
+ it('should render contexts with correct values if history is active', () => {
1489
+ const slice = {aEntity: {}, bEntity: {}};
1490
+ store.profile.history = {slice};
1491
+ (useHistorySlice as jest.Mock).mockReturnValue(slice);
1492
+ (useHistoryDiff as jest.Mock).mockReturnValue('diff');
1493
+
1494
+ setStore(history);
1495
+ const wrapper = mount(<ProfilePerspectiveView {...props} />);
1496
+ expect(wrapper.find(CollaborationContextProvider).prop('collaboration')).toMatchObject({
1497
+ commentsMap: null
1498
+ });
1499
+ expect(wrapper.find(ProfileErrorsPanel)).toHaveLength(0);
1500
+ expect(wrapper.find(HistoryDiffContext.Provider).prop('value')).toBe('diff');
1501
+ });
1502
+ });
1503
+ });