@reltio/components 1.4.1409 → 1.4.1410

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 (57) hide show
  1. package/cjs/components/ProfileBand/styles.d.ts +1 -1
  2. package/cjs/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +1 -1
  3. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +5 -4
  4. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.js +5 -2
  5. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +2 -2
  6. package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  7. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +3 -4
  8. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  9. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.js +21 -22
  10. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +2 -3
  11. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +23 -24
  12. package/cjs/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +3 -5
  13. package/cjs/components/workflow/components/TaskActionButtons/TaskActionButtons.d.ts +7 -0
  14. package/cjs/components/workflow/components/TaskActionButtons/TaskActionButtons.js +25 -0
  15. package/cjs/components/workflow/helpers/dcrHelpers.d.ts +3 -1
  16. package/cjs/components/workflow/helpers/dcrHelpers.js +9 -1
  17. package/cjs/components/workflow/hooks/useChangeRequest.d.ts +1 -1
  18. package/cjs/components/workflow/hooks/useWorkflowActions.d.ts +2 -1
  19. package/cjs/components/workflow/hooks/useWorkflowActions.js +6 -38
  20. package/cjs/components/workflow/hooks/useWorkflowDefaultActionSuccessHandler.d.ts +1 -0
  21. package/cjs/components/workflow/hooks/useWorkflowDefaultActionSuccessHandler.js +47 -0
  22. package/cjs/components/workflow/hooks/useWorkflowTasks.js +1 -1
  23. package/cjs/components/workflow/index.d.ts +2 -0
  24. package/cjs/components/workflow/index.js +5 -1
  25. package/esm/components/ProfileBand/styles.d.ts +1 -1
  26. package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +1 -1
  27. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +5 -4
  28. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.js +6 -3
  29. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +2 -2
  30. package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  31. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +1 -2
  32. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  33. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.js +13 -14
  34. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +2 -3
  35. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +1 -2
  36. package/esm/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +3 -5
  37. package/esm/components/workflow/components/TaskActionButtons/TaskActionButtons.d.ts +7 -0
  38. package/esm/components/workflow/components/TaskActionButtons/TaskActionButtons.js +18 -0
  39. package/esm/components/workflow/helpers/dcrHelpers.d.ts +3 -1
  40. package/esm/components/workflow/helpers/dcrHelpers.js +7 -1
  41. package/esm/components/workflow/hooks/useChangeRequest.d.ts +1 -1
  42. package/esm/components/workflow/hooks/useWorkflowActions.d.ts +2 -1
  43. package/esm/components/workflow/hooks/useWorkflowActions.js +5 -17
  44. package/esm/components/workflow/hooks/useWorkflowDefaultActionSuccessHandler.d.ts +1 -0
  45. package/esm/components/workflow/hooks/useWorkflowDefaultActionSuccessHandler.js +20 -0
  46. package/esm/components/workflow/hooks/useWorkflowTasks.js +2 -2
  47. package/esm/components/workflow/index.d.ts +2 -0
  48. package/esm/components/workflow/index.js +2 -0
  49. package/package.json +3 -3
  50. package/cjs/components/workflow/constants/operations.d.ts +0 -25
  51. package/cjs/components/workflow/constants/operations.js +0 -30
  52. package/cjs/components/workflow/types/dcrTypes.d.ts +0 -69
  53. package/cjs/components/workflow/types/dcrTypes.js +0 -2
  54. package/esm/components/workflow/constants/operations.d.ts +0 -25
  55. package/esm/components/workflow/constants/operations.js +0 -27
  56. package/esm/components/workflow/types/dcrTypes.d.ts +0 -69
  57. package/esm/components/workflow/types/dcrTypes.js +0 -1
@@ -1,2 +1,2 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"inactive" | "label" | "entityType" | "secondaryLabel" | "profileBand" | "entityId" | "badge" | "profileIcon" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "businessCard" | "specialInfo">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"inactive" | "label" | "secondaryLabel" | "entityType" | "profileBand" | "entityId" | "badge" | "profileIcon" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "businessCard" | "specialInfo">;
2
2
  export default useStyles;
@@ -12,6 +12,6 @@ var DataChangeRequestTaskCard = function (_a) {
12
12
  var _b = useChangeRequest(dcrUri), dcr = _b.dcr, groupedObjects = _b.groupedObjects;
13
13
  return (React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon }, dcr &&
14
14
  groupedObjects.map(function (object, index) { return (React.createElement(LineDecorator, { key: index, last: index === groupedObjects.length - 1, divider: true },
15
- React.createElement(AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo }))); })));
15
+ React.createElement(AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo, dcrUri: dcrUri }))); })));
16
16
  };
17
17
  export default DataChangeRequestTaskCard;
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { DCRChanges, DCRObjectsInfo, EntityInfo, RelationInfo } from '../../types/dcrTypes';
2
+ import { DCRChanges, DCRObjectsInfo, DCREntityInfo, DCRRelationInfo } from '@reltio/mdm-sdk';
3
3
  declare type Props = {
4
4
  changes: DCRChanges;
5
5
  objectsInfo: DCRObjectsInfo;
6
- entityInfo: EntityInfo;
7
- relationsInfo?: RelationInfo[];
6
+ entityInfo: DCREntityInfo;
7
+ dcrUri: string;
8
+ relationsInfo?: DCRRelationInfo[];
8
9
  max?: number;
9
10
  };
10
- declare const AttributesChanges: ({ changes, objectsInfo, entityInfo, relationsInfo, max }: Props) => JSX.Element;
11
+ declare const AttributesChanges: ({ changes, dcrUri, objectsInfo, entityInfo, relationsInfo, max }: Props) => JSX.Element;
11
12
  export default AttributesChanges;
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { useSelector } from 'react-redux';
3
3
  import i18n from 'ui-i18n';
4
- import { flatten } from 'ramda';
4
+ import { always, any, flatten, ifElse, propOr } from 'ramda';
5
5
  import mdmModule from '@reltio/mdm-module';
6
6
  import { getEntityUriForLink, getLabel } from '@reltio/mdm-sdk';
7
7
  import { mergeChanges } from './helpers/mergeHelpers';
@@ -10,9 +10,10 @@ import DCRChangesList from './components/DCRChangesList/DCRChangesList';
10
10
  import { AttributesChangesContext } from './contexts/AttributesChangesContext';
11
11
  import { useCollapsibleList } from './hooks/useCollapsibleList';
12
12
  import EntityUriLink from '../../../EntityUriLink/EntityUriLink';
13
+ import { getEntityUriForChangeRequest, isCreateEntityOperation } from '../../helpers/dcrHelpers';
13
14
  import { useStyles } from './styles';
14
15
  var AttributesChanges = function (_a) {
15
- var changes = _a.changes, objectsInfo = _a.objectsInfo, entityInfo = _a.entityInfo, relationsInfo = _a.relationsInfo, max = _a.max;
16
+ var changes = _a.changes, dcrUri = _a.dcrUri, objectsInfo = _a.objectsInfo, entityInfo = _a.entityInfo, relationsInfo = _a.relationsInfo, max = _a.max;
16
17
  var styles = useStyles();
17
18
  var metadata = useSelector(mdmModule.selectors.getMetadata);
18
19
  var _b = useMemo(function () { return mergeChanges(metadata, changes, entityInfo, relationsInfo); }, [metadata, changes, entityInfo, relationsInfo]), mergedEntityChanges = _b[0], mergedRelationsChanges = _b[1];
@@ -23,9 +24,11 @@ var AttributesChanges = function (_a) {
23
24
  : mergedEntityChanges;
24
25
  }, [mergedEntityChanges, mergedRelationsChanges]);
25
26
  var _c = useCollapsibleList(changesList, max), isExpanded = _c.isExpanded, onToggle = _c.onToggle, itemsToShow = _c.itemsToShow, collapsedSuggestionsCount = _c.collapsedSuggestionsCount;
27
+ var entityUri = ifElse(any(isCreateEntityOperation), always(getEntityUriForChangeRequest(dcrUri, entityInfo.uri)), always(getEntityUriForLink(entityInfo)))(propOr([], entityInfo.uri, changes));
28
+ var screen = ifElse(any(isCreateEntityOperation), always('dcrReview'), always('profile'))(propOr([], entityInfo.uri, changes));
26
29
  return (React.createElement(AttributesChangesContext.Provider, { value: objectsInfo },
27
30
  React.createElement("div", { className: styles.container },
28
- React.createElement(EntityUriLink, { className: styles.uri, value: getEntityUriForLink(entityInfo) },
31
+ React.createElement(EntityUriLink, { className: styles.uri, value: entityUri, screen: screen },
29
32
  React.createElement("div", { className: styles.label }, getLabel(entityInfo.label))),
30
33
  React.createElement(DCRChangesList, { changes: itemsToShow }),
31
34
  collapsedSuggestionsCount > 0 && (React.createElement(ShowMoreLink, { onClick: onToggle, suggestionsCount: collapsedSuggestionsCount, isExpanded: isExpanded, className: styles.showMoreLink })))));
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { OperationTypes } from '../../../../constants/operations';
2
+ import { DCROperationTypes } from '@reltio/mdm-sdk';
3
3
  declare type Props = {
4
4
  label: React.ReactNode;
5
5
  oldValue?: React.ReactNode;
6
6
  newValue?: React.ReactNode;
7
- operation?: OperationTypes;
7
+ operation?: DCROperationTypes;
8
8
  className?: string;
9
9
  };
10
10
  declare const ChangeView: ({ label, oldValue, newValue, operation, className }: Props) => JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- import { DCRObjectsInfo } from '../../../types/dcrTypes';
2
+ import { DCRObjectsInfo } from '@reltio/mdm-sdk';
3
3
  export declare const AttributesChangesContext: React.Context<DCRObjectsInfo>;
@@ -10,10 +10,9 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { complement, curry, flatten, is, isEmpty, pathOr, propOr, times } from 'ramda';
13
- import { DataTypes, getAttributeTypeSubAttributes, getLabel, getRelationAttributesList, getRelationType, isEmptyValue, isSpecialAttribute } from '@reltio/mdm-sdk';
13
+ import { DataTypes, DCRTypes, getAttributeTypeSubAttributes, getLabel, getRelationAttributesList, getRelationType, isEmptyValue, isSpecialAttribute } from '@reltio/mdm-sdk';
14
14
  import { getFilteredAttrTypes } from '../../../../attributes/helpers/attributesView';
15
15
  import { getOperationType } from './helpers';
16
- import { DCRTypes } from '../../../constants/operations';
17
16
  var getValues = function (attributes, attrType) {
18
17
  if ('newValue' in attributes || 'oldValue' in attributes) {
19
18
  var newValue = attributes.newValue, oldValue = attributes.oldValue, type_1 = attributes.type;
@@ -1,10 +1,8 @@
1
- import { AttributeType } from '@reltio/mdm-sdk';
2
- import { OperationTypes } from '../../../constants/operations';
3
- import { DCRAttributeValue, DCRObjectsInfo, Value } from '../../../types/dcrTypes';
4
- export declare const getOperationType: (type: string, oldValue?: DCRAttributeValue) => OperationTypes;
5
- export declare const getOperationLabel: (operation: OperationTypes) => string;
1
+ import { AttributeType, DCRAttributeValue, DCRObjectsInfo, DCROperationTypes, DCRValue } from '@reltio/mdm-sdk';
2
+ export declare const getOperationType: (type: string, oldValue?: DCRAttributeValue) => DCROperationTypes;
3
+ export declare const getOperationLabel: (operation: DCROperationTypes) => string;
6
4
  export declare const getAttributeDescription: (attrType: AttributeType, value: DCRAttributeValue, currentEntityUri: string, objectsInfo?: DCRObjectsInfo) => {
7
5
  objectUri: string;
8
6
  objectLabel: string;
9
7
  };
10
- export declare const getDataTypeDefinition: (attributeType: AttributeType, attributeValue: Value) => any;
8
+ export declare const getDataTypeDefinition: (attributeType: AttributeType, attributeValue: DCRValue) => any;
@@ -1,35 +1,34 @@
1
1
  import i18n from 'ui-i18n';
2
2
  import { allPass, always, equals, evolve, pipe, prop, when } from 'ramda';
3
- import { DataTypes, getAttrDataTypeDefinition, isUrl } from '@reltio/mdm-sdk';
4
- import { DCRTypes, OperationTypes } from '../../../constants/operations';
3
+ import { DataTypes, DCRTypes, getAttrDataTypeDefinition, isUrl, DCROperationTypes } from '@reltio/mdm-sdk';
5
4
  export var getOperationType = function (type, oldValue) {
6
5
  switch (type) {
7
6
  case DCRTypes.CREATE_RELATIONSHIP:
8
7
  case DCRTypes.INSERT_ATTRIBUTE:
9
- return OperationTypes.ADDED;
8
+ return DCROperationTypes.ADDED;
10
9
  case DCRTypes.UPDATE_TAGS:
11
10
  case DCRTypes.UPDATE_ROLES:
12
11
  case DCRTypes.UPDATE_ATTRIBUTE:
13
- return OperationTypes.EDITED;
12
+ return DCROperationTypes.EDITED;
14
13
  case DCRTypes.DELETE_ATTRIBUTE:
15
14
  case DCRTypes.DELETE_RELATIONSHIP:
16
- return OperationTypes.DELETED;
15
+ return DCROperationTypes.DELETED;
17
16
  case DCRTypes.PIN_ATTRIBUTE:
18
- return (oldValue === null || oldValue === void 0 ? void 0 : oldValue.pin) ? OperationTypes.PIN_DELETED : OperationTypes.PINNED;
17
+ return (oldValue === null || oldValue === void 0 ? void 0 : oldValue.pin) ? DCROperationTypes.PIN_DELETED : DCROperationTypes.PINNED;
19
18
  case DCRTypes.IGNORE_ATTRIBUTE:
20
- return (oldValue === null || oldValue === void 0 ? void 0 : oldValue.ignored) ? OperationTypes.IGNORE_DELETED : OperationTypes.IGNORED;
19
+ return (oldValue === null || oldValue === void 0 ? void 0 : oldValue.ignored) ? DCROperationTypes.IGNORE_DELETED : DCROperationTypes.IGNORED;
21
20
  }
22
21
  };
23
22
  export var getOperationLabel = function (operation) {
24
23
  var _a;
25
24
  var labels = (_a = {},
26
- _a[OperationTypes.ADDED] = i18n.text('added'),
27
- _a[OperationTypes.EDITED] = i18n.text('edited'),
28
- _a[OperationTypes.DELETED] = i18n.text('deleted'),
29
- _a[OperationTypes.PINNED] = i18n.text('pinned'),
30
- _a[OperationTypes.PIN_DELETED] = i18n.text('pin deleted'),
31
- _a[OperationTypes.IGNORED] = i18n.text('ignored'),
32
- _a[OperationTypes.IGNORE_DELETED] = i18n.text('ignore deleted'),
25
+ _a[DCROperationTypes.ADDED] = i18n.text('added'),
26
+ _a[DCROperationTypes.EDITED] = i18n.text('edited'),
27
+ _a[DCROperationTypes.DELETED] = i18n.text('deleted'),
28
+ _a[DCROperationTypes.PINNED] = i18n.text('pinned'),
29
+ _a[DCROperationTypes.PIN_DELETED] = i18n.text('pin deleted'),
30
+ _a[DCROperationTypes.IGNORED] = i18n.text('ignored'),
31
+ _a[DCROperationTypes.IGNORE_DELETED] = i18n.text('ignore deleted'),
33
32
  _a);
34
33
  return labels[operation] || '';
35
34
  };
@@ -1,5 +1,4 @@
1
- import { Metadata } from '@reltio/mdm-sdk';
1
+ import { DCRChanges, DCREntityInfo, Metadata, DCRRelationInfo } from '@reltio/mdm-sdk';
2
2
  import { Diff } from '../types/diffTypes';
3
- import { DCRChanges, EntityInfo, RelationInfo } from '../../../types/dcrTypes';
4
- declare const mergeChanges: (metadata: Metadata, changes: DCRChanges, entityInfo: EntityInfo, relationsInfo: RelationInfo[]) => [Diff[], Diff[]];
3
+ declare const mergeChanges: (metadata: Metadata, changes: DCRChanges, entityInfo: DCREntityInfo, relationsInfo: DCRRelationInfo[]) => [Diff[], Diff[]];
5
4
  export { mergeChanges };
@@ -10,8 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { concat, curry, difference, flatten, identity, isNil, omit, path, pick, pipe, propEq, propOr, reduce } from 'ramda';
13
- import { EntityAttrTypes, generateTempUri, getRoleLabel, isEmptyValue } from '@reltio/mdm-sdk';
14
- import { DCRTypes } from '../../../constants/operations';
13
+ import { DCRTypes, EntityAttrTypes, generateTempUri, getRoleLabel, isEmptyValue } from '@reltio/mdm-sdk';
15
14
  import { getEntityChanges, getRelationChanges } from './attributesHelpers';
16
15
  var ATTRIBUTE_DELIMITER = '/';
17
16
  var SPECIAL_ATTRIBUTES_NAMES = [
@@ -1,7 +1,5 @@
1
- import { AttributeType } from '@reltio/mdm-sdk';
2
- import { ChangeValue, DCRAttributeValue, RelationInfo } from '../../../types/dcrTypes';
3
- import { OperationTypes } from '../../../constants/operations';
4
- export declare type RelationAttributeValue = DCRAttributeValue & RelationInfo;
1
+ import { AttributeType, ChangeValue, DCRAttributeValue, DCROperationTypes, DCRRelationInfo } from '@reltio/mdm-sdk';
2
+ export declare type RelationAttributeValue = DCRAttributeValue & DCRRelationInfo;
5
3
  export declare type Diff = {
6
4
  level: number;
7
5
  label: string;
@@ -9,7 +7,7 @@ export declare type Diff = {
9
7
  attributeValue?: DCRAttributeValue | RelationAttributeValue;
10
8
  newValue?: ChangeValue;
11
9
  oldValue?: ChangeValue;
12
- operation?: OperationTypes;
10
+ operation?: DCROperationTypes;
13
11
  };
14
12
  export declare type Title = {
15
13
  label: string;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { WorkflowTaskData } from '@reltio/mdm-sdk';
3
+ declare type Props = {
4
+ task: WorkflowTaskData;
5
+ };
6
+ export declare const TaskActionButtons: ({ task }: Props) => JSX.Element;
7
+ export {};
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { partition, propEq } from 'ramda';
3
+ import Button from '@material-ui/core/Button';
4
+ import { useWorkflowActions } from '../../hooks/useWorkflowActions';
5
+ export var TaskActionButtons = function (_a) {
6
+ var task = _a.task;
7
+ var taskId = task.taskId, possibleActions = task.possibleActions, assignee = task.assignee, isOpen = task.isOpen, preferredAction = task.preferredAction;
8
+ var _b = useWorkflowActions({
9
+ taskId: taskId,
10
+ possibleActions: possibleActions,
11
+ assignee: assignee,
12
+ isOpen: isOpen
13
+ }), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
14
+ var _c = partition(propEq('text', preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
15
+ return (React.createElement(React.Fragment, null,
16
+ otherActions.map(function (action) { return (React.createElement(Button, { variant: "outlined", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); }),
17
+ preferredActions.map(function (action) { return (React.createElement(Button, { variant: "contained", color: "primary", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); })));
18
+ };
@@ -1,7 +1,9 @@
1
- import { GroupedObjectsInfo, DCRChanges, DCRObjectInfo, DCRObjectsInfo } from '../types/dcrTypes';
1
+ import { ChangeRequest, DCRChanges, DCRObjectInfo, DCRObjectsInfo, GroupedObjectsInfo } from '@reltio/mdm-sdk';
2
2
  export declare const getEntitiesObjects: any;
3
3
  export declare const getRelationsObjects: any;
4
4
  export declare const extractObjectsFromChangeRequest: (changes: DCRChanges, objectsInfo: DCRObjectsInfo) => DCRObjectInfo[];
5
5
  export declare const createEntityRelationsObjectByEntity: any;
6
6
  export declare const createEntityRelationsObjectByRelation: any;
7
7
  export declare const concatEntityRelationsObjects: (acc: Record<string, GroupedObjectsInfo>, object: GroupedObjectsInfo) => Record<string, GroupedObjectsInfo>;
8
+ export declare const getEntityUriForChangeRequest: (dcrUri: string, entityUri: string) => string;
9
+ export declare const isCreateEntityOperation: (dcr: ChangeRequest) => boolean;
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { isEntityUri, isRelationUri } from '@reltio/mdm-sdk';
12
+ import { DCRTypes, isEntityUri, isRelationUri } from '@reltio/mdm-sdk';
13
13
  import { allPass, concat, curry, equals, filter, keys, map, pathOr, pipe, prop, uniq } from 'ramda';
14
14
  export var getEntitiesObjects = filter(pipe(prop('uri'), isEntityUri));
15
15
  export var getRelationsObjects = filter(pipe(prop('uri'), isRelationUri));
@@ -41,3 +41,9 @@ export var concatEntityRelationsObjects = function (acc, object) {
41
41
  };
42
42
  return acc;
43
43
  };
44
+ export var getEntityUriForChangeRequest = function (dcrUri, entityUri) {
45
+ return "".concat(dcrUri, "/changes/").concat(entityUri);
46
+ };
47
+ export var isCreateEntityOperation = function (dcr) {
48
+ return dcr.type === DCRTypes.CREATE_ENTITY;
49
+ };
@@ -1,4 +1,4 @@
1
- import { GroupedObjectsInfo, ChangeRequest } from '../types/dcrTypes';
1
+ import { ChangeRequest, GroupedObjectsInfo } from '@reltio/mdm-sdk';
2
2
  export declare const useChangeRequest: (dcrUri: string) => {
3
3
  dcr: ChangeRequest;
4
4
  groupedObjects: GroupedObjectsInfo[];
@@ -3,7 +3,8 @@ declare type TaskAction = {
3
3
  text: string;
4
4
  onClick: () => void;
5
5
  };
6
- export declare const useWorkflowActions: ({ possibleActions, assignee, taskId, isOpen }: Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assignee' | 'isOpen'>) => {
6
+ declare type Props = Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assignee' | 'isOpen'>;
7
+ export declare const useWorkflowActions: ({ possibleActions, assignee, taskId, isOpen }: Props) => {
7
8
  actions: TaskAction[];
8
9
  actionRequestIsInProgress: boolean;
9
10
  };
@@ -1,22 +1,18 @@
1
1
  import { useCallback, useContext, useMemo, useState } from 'react';
2
- import { useDispatch, useSelector } from 'react-redux';
2
+ import { useSelector } from 'react-redux';
3
3
  import { runTaskAction } from '@reltio/mdm-sdk';
4
- import mdmModule, { profile, ui } from '@reltio/mdm-module';
5
- import { ViewIdContext } from '../../../contexts/ViewIdContext';
4
+ import mdmModule from '@reltio/mdm-module';
6
5
  import { showWorkflowError } from '../helpers/errors';
7
6
  import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
8
7
  import { isOpenTask } from '../helpers';
9
8
  export var useWorkflowActions = function (_a) {
10
9
  var possibleActions = _a.possibleActions, assignee = _a.assignee, taskId = _a.taskId, isOpen = _a.isOpen;
11
- var _b = useContext(WorkflowTasksContext) || {}, loadTasks = _b.loadTasks, onActionSuccess = _b.onActionSuccess;
10
+ var onActionSuccess = (useContext(WorkflowTasksContext) || {}).onActionSuccess;
12
11
  var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
13
12
  var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
14
13
  var tenant = useSelector(mdmModule.selectors.getTenant);
15
14
  var username = useSelector(mdmModule.selectors.getUserName);
16
- var entityUri = useSelector(mdmModule.selectors.getEntityUri);
17
- var _c = useState(false), actionRequestIsInProgress = _c[0], setActionRequestIsInProgress = _c[1];
18
- var viewId = useContext(ViewIdContext);
19
- var dispatch = useDispatch();
15
+ var _b = useState(false), actionRequestIsInProgress = _b[0], setActionRequestIsInProgress = _b[1];
20
16
  var performTaskAction = useCallback(function (action) { return function () {
21
17
  if (workflowPath && taskId) {
22
18
  setActionRequestIsInProgress(true);
@@ -28,14 +24,6 @@ export var useWorkflowActions = function (_a) {
28
24
  action: action
29
25
  })
30
26
  .then(function () {
31
- if (action === 'Delete') {
32
- dispatch(ui.actions.entityDeletionFinished());
33
- }
34
- else {
35
- // entity refreshing
36
- dispatch(profile.entity.actions.loadEntity({ viewId: viewId, uri: entityUri }));
37
- loadTasks === null || loadTasks === void 0 ? void 0 : loadTasks();
38
- }
39
27
  onActionSuccess === null || onActionSuccess === void 0 ? void 0 : onActionSuccess(action);
40
28
  })
41
29
  .catch(showWorkflowError)
@@ -43,7 +31,7 @@ export var useWorkflowActions = function (_a) {
43
31
  setActionRequestIsInProgress(false);
44
32
  });
45
33
  }
46
- }; }, [workflowPath, taskId, environment, tenant, dispatch, entityUri, viewId, loadTasks]);
34
+ }; }, [workflowPath, taskId, environment, tenant, onActionSuccess]);
47
35
  var actions = useMemo(function () {
48
36
  return username === assignee && isOpenTask(isOpen)
49
37
  ? (possibleActions || []).map(function (_a) {
@@ -0,0 +1 @@
1
+ export declare const useWorkflowDefaultActionSuccessHandler: () => (action: string) => void;
@@ -0,0 +1,20 @@
1
+ import { useCallback, useContext } from 'react';
2
+ import { useDispatch, useSelector } from 'react-redux';
3
+ import mdmModule, { profile, ui } from '@reltio/mdm-module';
4
+ import { ViewIdContext, WorkflowTasksContext } from '../../../contexts';
5
+ export var useWorkflowDefaultActionSuccessHandler = function () {
6
+ var loadTasks = (useContext(WorkflowTasksContext) || {}).loadTasks;
7
+ var viewId = useContext(ViewIdContext);
8
+ var entityUri = useSelector(mdmModule.selectors.getEntityUri);
9
+ var dispatch = useDispatch();
10
+ return useCallback(function (action) {
11
+ if (action === 'Delete') {
12
+ dispatch(ui.actions.entityDeletionFinished());
13
+ }
14
+ else {
15
+ // entity refreshing
16
+ dispatch(profile.entity.actions.loadEntity({ viewId: viewId, uri: entityUri }));
17
+ loadTasks === null || loadTasks === void 0 ? void 0 : loadTasks();
18
+ }
19
+ }, [dispatch, entityUri, loadTasks, viewId]);
20
+ };
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useState } from 'react';
2
2
  import { useSelector } from 'react-redux';
3
3
  import { filter, flatten, isNil, map, mergeLeft, pipe, prop, propEq, reject, uniqBy, when } from 'ramda';
4
4
  import mdmModule from '@reltio/mdm-module';
5
- import { getTasksForEntity, isTempUri } from '@reltio/mdm-sdk';
5
+ import { getEntityUriFromDCRUri, getTasksForEntity, isDCRUri, isTempUri } from '@reltio/mdm-sdk';
6
6
  import { useSafePromise } from '../../../hooks/useSafePromise';
7
7
  import { useWorkflowCheckPermission } from './useWorkflowCheckPermission';
8
8
  export var useWorkflowTasks = function (config) {
@@ -25,7 +25,7 @@ export var useWorkflowTasks = function (config) {
25
25
  var parsedProcessTypes = !Array.isArray(processTypes) || processTypes.includes('*') ? null : processTypes;
26
26
  var requests = (parsedProcessTypes || [null]).map(function (processType) {
27
27
  return getTasksForEntity({
28
- entityUri: entityUri,
28
+ entityUri: isDCRUri(entityUri) ? getEntityUriFromDCRUri(entityUri) : entityUri,
29
29
  workflowPath: workflowPath,
30
30
  environment: environment,
31
31
  tenant: tenant,
@@ -7,3 +7,5 @@ export { useWorkflowAssignee } from './hooks/useWorkflowAssignee';
7
7
  export { useWorkflowComments } from './hooks/useWorkflowComments';
8
8
  export { useWorkflowCheckPermission } from './hooks/useWorkflowCheckPermission';
9
9
  export { useWorkflowTasks } from './hooks/useWorkflowTasks';
10
+ export { TaskActionButtons } from './components/TaskActionButtons/TaskActionButtons';
11
+ export { useWorkflowDefaultActionSuccessHandler } from './hooks/useWorkflowDefaultActionSuccessHandler';
@@ -7,3 +7,5 @@ export { useWorkflowAssignee } from './hooks/useWorkflowAssignee';
7
7
  export { useWorkflowComments } from './hooks/useWorkflowComments';
8
8
  export { useWorkflowCheckPermission } from './hooks/useWorkflowCheckPermission';
9
9
  export { useWorkflowTasks } from './hooks/useWorkflowTasks';
10
+ export { TaskActionButtons } from './components/TaskActionButtons/TaskActionButtons';
11
+ export { useWorkflowDefaultActionSuccessHandler } from './hooks/useWorkflowDefaultActionSuccessHandler';
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1409",
3
+ "version": "1.4.1410",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
7
7
  "dependencies": {
8
8
  "@date-io/moment": "^1.3.5",
9
9
  "@react-google-maps/api": "2.7.0",
10
- "@reltio/mdm-module": "^1.4.1409",
11
- "@reltio/mdm-sdk": "^1.4.1409",
10
+ "@reltio/mdm-module": "^1.4.1410",
11
+ "@reltio/mdm-sdk": "^1.4.1410",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",
@@ -1,25 +0,0 @@
1
- export declare enum OperationTypes {
2
- ADDED = "added",
3
- EDITED = "edited",
4
- DELETED = "deleted",
5
- PINNED = "pinned",
6
- IGNORED = "ignored",
7
- PIN_DELETED = "pin_deleted",
8
- IGNORE_DELETED = "ignore_deleted"
9
- }
10
- export declare enum DCRTypes {
11
- INSERT_ATTRIBUTE = "INSERT_ATTRIBUTE",
12
- UPDATE_ATTRIBUTE = "UPDATE_ATTRIBUTE",
13
- DELETE_ATTRIBUTE = "DELETE_ATTRIBUTE",
14
- PIN_ATTRIBUTE = "PIN_ATTRIBUTE",
15
- IGNORE_ATTRIBUTE = "IGNORE_ATTRIBUTE",
16
- CREATE_ENTITY = "CREATE_ENTITY",
17
- CREATE_RELATIONSHIP = "CREATE_RELATIONSHIP",
18
- UPDATE_TAGS = "UPDATE_TAGS",
19
- UPDATE_ROLES = "UPDATE_ROLES",
20
- UPDATE_START_DATE = "UPDATE_START_DATE",
21
- UPDATE_END_DATE = "UPDATE_END_DATE",
22
- UPDATE_PROFILE_PIC_BY_URL = "UPDATE_PROFILE_PIC_BY_URL",
23
- UPDATE_PROFILE_PIC_BY_URI = "UPDATE_PROFILE_PIC_BY_URI",
24
- DELETE_RELATIONSHIP = "DELETE_RELATIONSHIP"
25
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DCRTypes = exports.OperationTypes = void 0;
4
- var OperationTypes;
5
- (function (OperationTypes) {
6
- OperationTypes["ADDED"] = "added";
7
- OperationTypes["EDITED"] = "edited";
8
- OperationTypes["DELETED"] = "deleted";
9
- OperationTypes["PINNED"] = "pinned";
10
- OperationTypes["IGNORED"] = "ignored";
11
- OperationTypes["PIN_DELETED"] = "pin_deleted";
12
- OperationTypes["IGNORE_DELETED"] = "ignore_deleted";
13
- })(OperationTypes = exports.OperationTypes || (exports.OperationTypes = {}));
14
- var DCRTypes;
15
- (function (DCRTypes) {
16
- DCRTypes["INSERT_ATTRIBUTE"] = "INSERT_ATTRIBUTE";
17
- DCRTypes["UPDATE_ATTRIBUTE"] = "UPDATE_ATTRIBUTE";
18
- DCRTypes["DELETE_ATTRIBUTE"] = "DELETE_ATTRIBUTE";
19
- DCRTypes["PIN_ATTRIBUTE"] = "PIN_ATTRIBUTE";
20
- DCRTypes["IGNORE_ATTRIBUTE"] = "IGNORE_ATTRIBUTE";
21
- DCRTypes["CREATE_ENTITY"] = "CREATE_ENTITY";
22
- DCRTypes["CREATE_RELATIONSHIP"] = "CREATE_RELATIONSHIP";
23
- DCRTypes["UPDATE_TAGS"] = "UPDATE_TAGS";
24
- DCRTypes["UPDATE_ROLES"] = "UPDATE_ROLES";
25
- DCRTypes["UPDATE_START_DATE"] = "UPDATE_START_DATE";
26
- DCRTypes["UPDATE_END_DATE"] = "UPDATE_END_DATE";
27
- DCRTypes["UPDATE_PROFILE_PIC_BY_URL"] = "UPDATE_PROFILE_PIC_BY_URL";
28
- DCRTypes["UPDATE_PROFILE_PIC_BY_URI"] = "UPDATE_PROFILE_PIC_BY_URI";
29
- DCRTypes["DELETE_RELATIONSHIP"] = "DELETE_RELATIONSHIP";
30
- })(DCRTypes = exports.DCRTypes || (exports.DCRTypes = {}));
@@ -1,69 +0,0 @@
1
- import { Crosswalk, Entity, NestedAttributeValue, ReferenceAttributeValue, Relation, SimpleAttributeValue, PrimitiveValue } from '@reltio/mdm-sdk';
2
- import { DCRTypes } from '../constants/operations';
3
- export declare type ChangeRequest = {
4
- changes: DCRChanges;
5
- createdBy: string;
6
- createdTime: number;
7
- objectsInfo: DCRObjectsInfo;
8
- state: string;
9
- type: string;
10
- updatedBy: string;
11
- updatedTime: number;
12
- uri: string;
13
- };
14
- export declare type GroupedObjectsInfo = {
15
- entity: EntityInfo;
16
- relations: RelationInfo[];
17
- };
18
- export declare type EntityInfo = {
19
- isExist: boolean;
20
- label: string;
21
- secondaryLabel: string;
22
- type: string;
23
- uri?: string;
24
- };
25
- export declare type RelationInfo = {
26
- type: string;
27
- startObjectLabel: string;
28
- startObjectUri: string;
29
- endObjectLabel: string;
30
- endObjectUri: string;
31
- isExist: boolean;
32
- uri?: string;
33
- };
34
- export declare type DCRObjectInfo = EntityInfo | RelationInfo;
35
- export declare type DCRObjectsInfo = {
36
- [key: string]: DCRObjectInfo;
37
- };
38
- export declare type DCRAttributes = {
39
- [attributeName: string]: (ChangeValue | DCRChange)[];
40
- };
41
- export declare type Value = DCRAttributes | DCRChange | PrimitiveValue;
42
- export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue, 'uri' | 'value'> & {
43
- value: Value;
44
- refObjectURI?: string;
45
- refEntity?: {
46
- objectURI: string;
47
- };
48
- uri?: string;
49
- };
50
- export declare type ChangeValue = DCRAttributeValue | string[] | Entity | Relation;
51
- export declare type DCRChange = {
52
- attributePath?: string;
53
- attributeType?: string;
54
- conflict?: string;
55
- conflictDetails?: string;
56
- createdBy?: string;
57
- createdTime?: string;
58
- crosswalk?: Crosswalk;
59
- id?: string;
60
- newPinOrIgnoreValue?: boolean;
61
- newValue?: ChangeValue;
62
- oldValue?: ChangeValue;
63
- type?: DCRTypes;
64
- refAttributeType?: string;
65
- refObjectURI?: string;
66
- };
67
- export declare type DCRChanges = {
68
- [key: string]: DCRChange[];
69
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,25 +0,0 @@
1
- export declare enum OperationTypes {
2
- ADDED = "added",
3
- EDITED = "edited",
4
- DELETED = "deleted",
5
- PINNED = "pinned",
6
- IGNORED = "ignored",
7
- PIN_DELETED = "pin_deleted",
8
- IGNORE_DELETED = "ignore_deleted"
9
- }
10
- export declare enum DCRTypes {
11
- INSERT_ATTRIBUTE = "INSERT_ATTRIBUTE",
12
- UPDATE_ATTRIBUTE = "UPDATE_ATTRIBUTE",
13
- DELETE_ATTRIBUTE = "DELETE_ATTRIBUTE",
14
- PIN_ATTRIBUTE = "PIN_ATTRIBUTE",
15
- IGNORE_ATTRIBUTE = "IGNORE_ATTRIBUTE",
16
- CREATE_ENTITY = "CREATE_ENTITY",
17
- CREATE_RELATIONSHIP = "CREATE_RELATIONSHIP",
18
- UPDATE_TAGS = "UPDATE_TAGS",
19
- UPDATE_ROLES = "UPDATE_ROLES",
20
- UPDATE_START_DATE = "UPDATE_START_DATE",
21
- UPDATE_END_DATE = "UPDATE_END_DATE",
22
- UPDATE_PROFILE_PIC_BY_URL = "UPDATE_PROFILE_PIC_BY_URL",
23
- UPDATE_PROFILE_PIC_BY_URI = "UPDATE_PROFILE_PIC_BY_URI",
24
- DELETE_RELATIONSHIP = "DELETE_RELATIONSHIP"
25
- }
@@ -1,27 +0,0 @@
1
- export var OperationTypes;
2
- (function (OperationTypes) {
3
- OperationTypes["ADDED"] = "added";
4
- OperationTypes["EDITED"] = "edited";
5
- OperationTypes["DELETED"] = "deleted";
6
- OperationTypes["PINNED"] = "pinned";
7
- OperationTypes["IGNORED"] = "ignored";
8
- OperationTypes["PIN_DELETED"] = "pin_deleted";
9
- OperationTypes["IGNORE_DELETED"] = "ignore_deleted";
10
- })(OperationTypes || (OperationTypes = {}));
11
- export var DCRTypes;
12
- (function (DCRTypes) {
13
- DCRTypes["INSERT_ATTRIBUTE"] = "INSERT_ATTRIBUTE";
14
- DCRTypes["UPDATE_ATTRIBUTE"] = "UPDATE_ATTRIBUTE";
15
- DCRTypes["DELETE_ATTRIBUTE"] = "DELETE_ATTRIBUTE";
16
- DCRTypes["PIN_ATTRIBUTE"] = "PIN_ATTRIBUTE";
17
- DCRTypes["IGNORE_ATTRIBUTE"] = "IGNORE_ATTRIBUTE";
18
- DCRTypes["CREATE_ENTITY"] = "CREATE_ENTITY";
19
- DCRTypes["CREATE_RELATIONSHIP"] = "CREATE_RELATIONSHIP";
20
- DCRTypes["UPDATE_TAGS"] = "UPDATE_TAGS";
21
- DCRTypes["UPDATE_ROLES"] = "UPDATE_ROLES";
22
- DCRTypes["UPDATE_START_DATE"] = "UPDATE_START_DATE";
23
- DCRTypes["UPDATE_END_DATE"] = "UPDATE_END_DATE";
24
- DCRTypes["UPDATE_PROFILE_PIC_BY_URL"] = "UPDATE_PROFILE_PIC_BY_URL";
25
- DCRTypes["UPDATE_PROFILE_PIC_BY_URI"] = "UPDATE_PROFILE_PIC_BY_URI";
26
- DCRTypes["DELETE_RELATIONSHIP"] = "DELETE_RELATIONSHIP";
27
- })(DCRTypes || (DCRTypes = {}));