@pega/react-sdk-overrides 0.23.26 → 0.23.27
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.
- package/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
- package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
- package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +29 -19
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +27 -38
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -18
- package/lib/field/Date/Date.tsx +33 -15
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +22 -11
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +64 -17
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +154 -18
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +16 -7
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +37 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +15 -6
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/Percentage/Percentage.tsx +14 -6
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +17 -7
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +96 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +63 -0
- package/lib/field/ScalarList/config-ext.json +7 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -10
- package/lib/field/TextArea/TextArea.tsx +15 -5
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +9 -2
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +41 -10
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +21 -18
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +23 -6
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +52 -58
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
- package/lib/helpers/case-utils.tsx +99 -0
- package/lib/helpers/common-utils.ts +8 -0
- package/lib/helpers/data_page.ts +3 -6
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
- package/lib/helpers/formatters/Boolean.ts +21 -0
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
- package/lib/helpers/formatters/CurrencyMap.ts +915 -0
- package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
- package/lib/helpers/formatters/{common.js → common.ts} +3 -4
- package/lib/helpers/formatters/{index.js → index.ts} +22 -22
- package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
- package/lib/helpers/simpleTableHelpers.ts +65 -85
- package/lib/helpers/state-utils.tsx +43 -0
- package/lib/helpers/template-utils.ts +4 -8
- package/lib/helpers/utils.ts +16 -8
- package/lib/helpers/versionHelpers.ts +1 -5
- package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -84
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
- package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
- package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
- package/lib/infra/Containers/SimpleView/helper.ts +125 -0
- package/lib/infra/Containers/SimpleView/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +180 -216
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +28 -43
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +82 -125
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +38 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +32 -63
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +51 -69
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +122 -114
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
- package/lib/template/Confirmation/Confirmation.tsx +25 -53
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -140
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +24 -28
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
- package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
- package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
- package/lib/template/ListPage/ListPage.tsx +12 -16
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
- package/lib/template/ListView/ListView.tsx +245 -306
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
- package/lib/template/ListView/{utils.js → utils.ts} +202 -91
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
- package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
- package/lib/template/SubTabs/SubTabs.tsx +26 -45
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -7
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
- package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
- package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
- package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +75 -4
- package/lib/widget/Attachment/Attachment.tsx +370 -388
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +27 -25
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +15 -4
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +80 -116
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -483
- package/lib/helpers/authManager.js +0 -631
- package/lib/helpers/config_access.js +0 -268
- package/lib/helpers/formatters/Boolean.js +0 -38
- package/lib/helpers/formatters/CurrencyMap.js +0 -908
- package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect, useContext } from 'react';
|
|
5
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
6
5
|
import { Card, CardHeader, Avatar, Typography } from '@material-ui/core';
|
|
7
|
-
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
8
6
|
import { Alert } from '@material-ui/lab';
|
|
9
|
-
|
|
10
|
-
import Assignment from '@pega/react-sdk-components/lib/components/infra/Assignment';
|
|
11
|
-
import ToDo from '@pega/react-sdk-components/lib/components/widget/ToDo';
|
|
12
|
-
|
|
13
|
-
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
14
|
-
import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
|
|
15
7
|
import DayjsUtils from '@date-io/dayjs';
|
|
16
8
|
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
|
|
17
9
|
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
|
|
11
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
12
|
+
import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
|
|
13
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
14
|
+
import { withSimpleViewContainerRenderer } from '../SimpleView/SimpleView';
|
|
15
|
+
|
|
16
|
+
import { addContainerItem, getToDoAssignments, showBanner, hasContainerItems } from './helpers';
|
|
17
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
18
|
+
|
|
19
|
+
interface FlowContainerProps extends PConnProps {
|
|
20
|
+
// If any, enter additional props that only exist on this component
|
|
21
|
+
pageMessages: any[];
|
|
22
|
+
rootViewElement: React.ReactNode;
|
|
23
|
+
getPConnectOfActiveContainerItem: Function;
|
|
24
|
+
assignmentNames: string[];
|
|
25
|
+
activeContainerItemID: string;
|
|
26
|
+
}
|
|
21
27
|
|
|
22
28
|
//
|
|
23
29
|
// WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
|
|
@@ -46,64 +52,55 @@ const useStyles = makeStyles(theme => ({
|
|
|
46
52
|
}
|
|
47
53
|
}));
|
|
48
54
|
|
|
49
|
-
export
|
|
55
|
+
export const FlowContainer = (props: FlowContainerProps) => {
|
|
56
|
+
// Get the proper implementation (local or Pega-provided) for these components that are emitted below
|
|
57
|
+
const Assignment = getComponentFromMap('Assignment');
|
|
58
|
+
const ToDo = getComponentFromMap('Todo'); // NOTE: ConstellationJS Engine uses "Todo" and not "ToDo"!!!
|
|
59
|
+
const AlertBanner = getComponentFromMap('AlertBanner');
|
|
60
|
+
|
|
50
61
|
const pCoreConstants = PCore.getConstants();
|
|
62
|
+
const PCoreVersion = PCore.getPCoreVersion();
|
|
51
63
|
const { TODO } = pCoreConstants;
|
|
52
64
|
const todo_headerText = 'To do';
|
|
53
65
|
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
const {
|
|
67
|
+
getPConnect: getPConnectOfFlowContainer,
|
|
68
|
+
pageMessages,
|
|
69
|
+
rootViewElement,
|
|
70
|
+
getPConnectOfActiveContainerItem,
|
|
71
|
+
assignmentNames,
|
|
72
|
+
activeContainerItemID: itemKey
|
|
73
|
+
} = props;
|
|
74
|
+
|
|
75
|
+
const { displayOnlyFA } = useContext<any>(StoreContext);
|
|
76
|
+
const pConnectOfFlowContainer = getPConnectOfFlowContainer();
|
|
77
|
+
const isInitialized = isContainerInitialized(pConnectOfFlowContainer);
|
|
78
|
+
const hasItems = isInitialized && hasContainerItems(pConnectOfFlowContainer);
|
|
79
|
+
const getPConnect = getPConnectOfActiveContainerItem || getPConnectOfFlowContainer;
|
|
58
80
|
const thePConn = getPConnect();
|
|
59
|
-
|
|
81
|
+
const containerName = assignmentNames && assignmentNames.length > 0 ? assignmentNames[0] : '';
|
|
60
82
|
// const [init, setInit] = useState(true);
|
|
61
83
|
// const [fcState, setFCState] = useState({ hasError: false });
|
|
62
|
-
const [arNewChildren, setArNewChildren] = useState<Array<any>>(thePConn.getChildren());
|
|
63
|
-
const [arNewChildrenAsReact, setArNewChildrenAsReact] = useState<Array<any>>([]);
|
|
64
84
|
|
|
65
85
|
const [todo_showTodo, setShowTodo] = useState(false);
|
|
66
86
|
const [todo_caseInfoID, setCaseInfoID] = useState('');
|
|
67
87
|
const [todo_showTodoList, setShowTodoList] = useState(false);
|
|
68
88
|
const [todo_datasource, setTodoDatasource] = useState({});
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70
90
|
const [todo_context, setTodoContext] = useState('');
|
|
71
91
|
|
|
72
92
|
const [caseMessages, setCaseMessages] = useState('');
|
|
73
93
|
const [bHasCaseMessages, setHasCaseMessages] = useState(false);
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
75
95
|
const [checkSvg, setCheckSvg] = useState('');
|
|
76
96
|
|
|
77
|
-
const [itemKey, setItemKey] = useState('');
|
|
78
|
-
const [containerName, setContainerName] = useState('');
|
|
79
97
|
const [buildName, setBuildName] = useState('');
|
|
80
98
|
const [bShowConfirm, setShowConfirm] = useState(false);
|
|
99
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
100
|
+
const localeCategory = 'Messages';
|
|
81
101
|
|
|
82
102
|
const classes = useStyles();
|
|
83
103
|
|
|
84
|
-
function initContainer() {
|
|
85
|
-
const ourPConn = getPConnect();
|
|
86
|
-
const containerMgr = ourPConn.getContainerManager();
|
|
87
|
-
const baseContext = ourPConn.getContextName();
|
|
88
|
-
const theContainerName = ourPConn.getContainerName();
|
|
89
|
-
const containerType = 'single';
|
|
90
|
-
|
|
91
|
-
const flowContainerTarget = `${baseContext}/${theContainerName}`;
|
|
92
|
-
const isContainerItemAvailable =
|
|
93
|
-
PCore.getContainerUtils().getActiveContainerItemName(flowContainerTarget);
|
|
94
|
-
|
|
95
|
-
window.sessionStorage.setItem('okToInitFlowContainer', 'false');
|
|
96
|
-
|
|
97
|
-
if (!isContainerItemAvailable) {
|
|
98
|
-
containerMgr.initializeContainers({
|
|
99
|
-
type: containerType
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// updated for 8.7 - 30-Mar-2022
|
|
103
|
-
addContainerItem(ourPConn);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
104
|
function getBuildName(): string {
|
|
108
105
|
const ourPConn = getPConnect();
|
|
109
106
|
|
|
@@ -116,7 +113,7 @@ export default function FlowContainer(props) {
|
|
|
116
113
|
}
|
|
117
114
|
|
|
118
115
|
function getTodoVisibility() {
|
|
119
|
-
const caseViewMode = getPConnect().getValue('context_data.caseViewMode');
|
|
116
|
+
const caseViewMode = getPConnect().getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
|
|
120
117
|
if (caseViewMode && caseViewMode === 'review') {
|
|
121
118
|
return true;
|
|
122
119
|
}
|
|
@@ -128,14 +125,9 @@ export default function FlowContainer(props) {
|
|
|
128
125
|
return true;
|
|
129
126
|
}
|
|
130
127
|
|
|
131
|
-
function initComponent(
|
|
128
|
+
function initComponent() {
|
|
132
129
|
const ourPConn = getPConnect();
|
|
133
130
|
|
|
134
|
-
// when true, update arChildren from pConn, otherwise, arChilren will be updated in updateSelf()
|
|
135
|
-
if (bLoadChildren) {
|
|
136
|
-
setArNewChildren(ourPConn.getChildren());
|
|
137
|
-
}
|
|
138
|
-
|
|
139
131
|
// debugging/investigation help
|
|
140
132
|
// console.log(`${ourPConn.getComponentName()}: children update for main draw`);
|
|
141
133
|
|
|
@@ -149,46 +141,31 @@ export default function FlowContainer(props) {
|
|
|
149
141
|
// debugger;
|
|
150
142
|
setShowTodo(getTodoVisibility());
|
|
151
143
|
|
|
152
|
-
// create pointers to functions
|
|
153
|
-
// const containerMgr = ourPConn.getContainerManager();
|
|
154
|
-
// const actionsAPI = thePConn.getActionsApi();
|
|
155
|
-
const baseContext = ourPConn.getContextName();
|
|
156
|
-
const acName = ourPConn.getContainerName();
|
|
157
|
-
|
|
158
|
-
// for now, in general this should be overridden by updateSelf(), and not be blank
|
|
159
|
-
if (itemKey === '') {
|
|
160
|
-
// debugger;
|
|
161
|
-
setItemKey(baseContext.concat('/').concat(acName));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
144
|
ourPConn.isBoundToState();
|
|
165
145
|
|
|
166
|
-
// inside
|
|
167
|
-
// get fist kid, get the name and displa
|
|
168
|
-
// pass first kid to a view container, which will disperse it to a view which will use one column, two column, etc.
|
|
169
|
-
const oWorkItem = arNewChildren[0].getPConnect(); // child0_getPConnect;
|
|
170
|
-
const oWorkData = oWorkItem.getDataObject();
|
|
171
|
-
|
|
172
|
-
if (bLoadChildren && oWorkData) {
|
|
173
|
-
// debugger;
|
|
174
|
-
setContainerName(oWorkData.caseInfo.assignments?.[0].name);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
146
|
// debugger;
|
|
178
147
|
setBuildName(getBuildName());
|
|
179
148
|
}
|
|
180
149
|
|
|
181
150
|
useEffect(() => {
|
|
182
151
|
// from WC SDK connectedCallback (mount)
|
|
183
|
-
initComponent(
|
|
184
|
-
initContainer();
|
|
152
|
+
initComponent();
|
|
185
153
|
}, []);
|
|
186
154
|
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
// @ts-ignore - Property 'getMetadata' is private and only accessible within class 'C11nEnv'
|
|
157
|
+
if (isInitialized && pConnectOfFlowContainer.getMetadata().children && !hasItems) {
|
|
158
|
+
// ensuring not to add container items, if container already has items
|
|
159
|
+
// because during multi doc mode, we will have container items already in store
|
|
160
|
+
addContainerItem(pConnectOfFlowContainer);
|
|
161
|
+
}
|
|
162
|
+
}, [isInitialized, hasItems]);
|
|
163
|
+
|
|
187
164
|
function isCaseWideLocalAction() {
|
|
188
165
|
const ourPConn = getPConnect();
|
|
189
166
|
|
|
190
|
-
const actionID = ourPConn.getValue(pCoreConstants.CASE_INFO.ACTIVE_ACTION_ID);
|
|
191
|
-
const caseActions = ourPConn.getValue(pCoreConstants.CASE_INFO.AVAILABLEACTIONS);
|
|
167
|
+
const actionID = ourPConn.getValue(pCoreConstants.CASE_INFO.ACTIVE_ACTION_ID, ''); // 2nd arg empty string until typedefs properly allow optional
|
|
168
|
+
const caseActions = ourPConn.getValue(pCoreConstants.CASE_INFO.AVAILABLEACTIONS, ''); // 2nd arg empty string until typedefs properly allow optional
|
|
192
169
|
let bCaseWideAction = false;
|
|
193
170
|
if (caseActions && actionID) {
|
|
194
171
|
const actionObj = caseActions.find(caseAction => caseAction.ID === actionID);
|
|
@@ -202,7 +179,7 @@ export default function FlowContainer(props) {
|
|
|
202
179
|
function hasChildCaseAssignments() {
|
|
203
180
|
const ourPConn = getPConnect();
|
|
204
181
|
|
|
205
|
-
const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS);
|
|
182
|
+
const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
|
|
206
183
|
// const allAssignments = [];
|
|
207
184
|
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
208
185
|
if (childCases && childCases.length > 0) {
|
|
@@ -215,26 +192,27 @@ export default function FlowContainer(props) {
|
|
|
215
192
|
const ourPConn = getPConnect();
|
|
216
193
|
|
|
217
194
|
let bHasAssignments = false;
|
|
218
|
-
const assignmentsList:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const thisOperator = PCore.getEnvironmentInfo().getOperatorIdentifier();
|
|
195
|
+
const assignmentsList: any[] = ourPConn.getValue(pCoreConstants.CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS, ''); // 2nd arg empty string until typedefs properly allow optional
|
|
196
|
+
const isEmbedded = window.location.href.includes('embedded');
|
|
197
|
+
let bAssignmentsForThisOperator = false;
|
|
222
198
|
// 8.7 includes assignments in Assignments List that may be assigned to
|
|
223
199
|
// a different operator. So, see if there are any assignments for
|
|
224
200
|
// the current operator
|
|
225
|
-
|
|
226
|
-
|
|
201
|
+
if (PCoreVersion?.includes('8.7') || isEmbedded) {
|
|
202
|
+
const thisOperator = PCore.getEnvironmentInfo().getOperatorIdentifier();
|
|
203
|
+
for (const assignment of assignmentsList) {
|
|
204
|
+
if (assignment.assigneeInfo.ID === thisOperator) {
|
|
205
|
+
bAssignmentsForThisOperator = true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
bAssignmentsForThisOperator = true;
|
|
210
|
+
}
|
|
227
211
|
// Bail out if there isn't an assignmentsList
|
|
228
212
|
if (!assignmentsList) {
|
|
229
213
|
return bHasAssignments;
|
|
230
214
|
}
|
|
231
215
|
|
|
232
|
-
for (const assignment of assignmentsList) {
|
|
233
|
-
if (assignment['assigneeInfo']['ID'] === thisOperator) {
|
|
234
|
-
bAssignmentsForThisOperator = true;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
216
|
const bHasChildCaseAssignments = hasChildCaseAssignments();
|
|
239
217
|
|
|
240
218
|
if (bAssignmentsForThisOperator || bHasChildCaseAssignments || isCaseWideLocalAction()) {
|
|
@@ -244,26 +222,8 @@ export default function FlowContainer(props) {
|
|
|
244
222
|
return bHasAssignments;
|
|
245
223
|
}
|
|
246
224
|
|
|
247
|
-
function getActiveViewLabel() {
|
|
248
|
-
const ourPConn = getPConnect();
|
|
249
|
-
|
|
250
|
-
let activeActionLabel = '';
|
|
251
|
-
|
|
252
|
-
const { CASE_INFO: CASE_CONSTS } = pCoreConstants;
|
|
253
|
-
|
|
254
|
-
const caseActions = ourPConn.getValue(CASE_CONSTS.CASE_INFO_ACTIONS);
|
|
255
|
-
const activeActionID = ourPConn.getValue(CASE_CONSTS.ACTIVE_ACTION_ID);
|
|
256
|
-
const activeAction = caseActions?.find(action => action.ID === activeActionID);
|
|
257
|
-
if (activeAction) {
|
|
258
|
-
activeActionLabel = activeAction.name;
|
|
259
|
-
}
|
|
260
|
-
return activeActionLabel;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
225
|
// From SDK-WC updateSelf - so do this in useEffect that's run only when the props change...
|
|
264
226
|
useEffect(() => {
|
|
265
|
-
const localPConn = arNewChildren[0].getPConnect();
|
|
266
|
-
|
|
267
227
|
setBuildName(getBuildName());
|
|
268
228
|
|
|
269
229
|
// routingInfo was added as component prop in populateAdditionalProps
|
|
@@ -271,7 +231,7 @@ export default function FlowContainer(props) {
|
|
|
271
231
|
|
|
272
232
|
let loadingInfo: any;
|
|
273
233
|
try {
|
|
274
|
-
loadingInfo = thePConn.getLoadingStatus();
|
|
234
|
+
loadingInfo = thePConn.getLoadingStatus(''); // 1st arg empty string until typedefs properly allow optional
|
|
275
235
|
} catch (ex) {
|
|
276
236
|
// eslint-disable-next-line no-console
|
|
277
237
|
console.error(`${thePConn.getComponentName()}: loadingInfo catch block`);
|
|
@@ -284,136 +244,61 @@ export default function FlowContainer(props) {
|
|
|
284
244
|
// this.psService.sendMessage(false);
|
|
285
245
|
}
|
|
286
246
|
|
|
287
|
-
const caseViewMode = thePConn.getValue('context_data.caseViewMode');
|
|
247
|
+
const caseViewMode = thePConn.getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
|
|
288
248
|
const { CASE_INFO: CASE_CONSTS } = pCoreConstants;
|
|
289
249
|
if (caseViewMode && caseViewMode === 'review') {
|
|
290
250
|
setTimeout(() => {
|
|
291
251
|
// updated for 8.7 - 30-Mar-2022
|
|
292
252
|
const todoAssignments = getToDoAssignments(thePConn);
|
|
293
253
|
if (todoAssignments && todoAssignments.length > 0) {
|
|
294
|
-
setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID));
|
|
254
|
+
setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID, '')); // 2nd arg empty string until typedefs properly allow optional
|
|
295
255
|
setTodoDatasource({ source: todoAssignments });
|
|
296
256
|
}
|
|
297
257
|
setShowTodo(true);
|
|
298
258
|
setShowTodoList(false);
|
|
299
259
|
}, 100);
|
|
300
|
-
|
|
301
|
-
// in React, when cancel is called, somehow the constructor for flowContainer is called which
|
|
302
|
-
// does init/add of containers. This mimics that
|
|
303
|
-
initContainer();
|
|
304
260
|
} else if (caseViewMode && caseViewMode === 'perform') {
|
|
305
261
|
// perform
|
|
306
262
|
// debugger;
|
|
307
263
|
setShowTodo(false);
|
|
308
|
-
|
|
309
|
-
// this is different than Angular SDK, as we need to initContainer if root container reloaded
|
|
310
|
-
if (window.sessionStorage.getItem('okToInitFlowContainer') === 'true') {
|
|
311
|
-
initContainer();
|
|
312
|
-
}
|
|
313
264
|
}
|
|
314
265
|
|
|
315
266
|
// if have caseMessage show message and end
|
|
316
|
-
const theCaseMessages = thePConn.getValue('caseMessages');
|
|
267
|
+
const theCaseMessages = localizedVal(thePConn.getValue('caseMessages', ''), localeCategory); // 2nd arg empty string until typedefs properly allow optional
|
|
317
268
|
|
|
318
269
|
if (theCaseMessages || !hasAssignments()) {
|
|
319
270
|
// Temp fix for 8.7 change: confirmationNote no longer coming through in caseMessages$.
|
|
320
271
|
// So, if we get here and caseMessages$ is empty, use default value in DX API response
|
|
321
|
-
setCaseMessages(
|
|
322
|
-
theCaseMessages || 'Thank you! The next step in this case has been routed appropriately.'
|
|
323
|
-
);
|
|
272
|
+
setCaseMessages(theCaseMessages || localizedVal('Thank you! The next step in this case has been routed appropriately.', localeCategory));
|
|
324
273
|
setHasCaseMessages(true);
|
|
325
274
|
setShowConfirm(true);
|
|
326
275
|
|
|
327
276
|
// publish this "assignmentFinished" for mashup, need to get approved as a standard
|
|
277
|
+
// @ts-ignore - second parameter “payload” for publish method should be optional
|
|
328
278
|
PCore.getPubSubUtils().publish('assignmentFinished');
|
|
329
279
|
|
|
330
280
|
// debugger;
|
|
331
|
-
setCheckSvg(Utils.getImageSrc('check',
|
|
281
|
+
setCheckSvg(Utils.getImageSrc('check', Utils.getSDKStaticConentUrl()));
|
|
332
282
|
} else {
|
|
333
283
|
// debugger;
|
|
334
284
|
setHasCaseMessages(false);
|
|
335
285
|
setShowConfirm(false);
|
|
336
286
|
}
|
|
337
|
-
|
|
338
|
-
// this check in routingInfo, mimic React to check and get the internals of the
|
|
339
|
-
// flowContainer and force updates to pConnect/redux
|
|
340
|
-
if (routingInfo && loadingInfo !== undefined) {
|
|
341
|
-
// debugging/investigation help
|
|
342
|
-
// console.log(`${thePConn.getComponentName()}: >>routingInfo: ${JSON.stringify(routingInfo)}`);
|
|
343
|
-
|
|
344
|
-
const currentOrder = routingInfo.accessedOrder;
|
|
345
|
-
const currentItems = routingInfo.items;
|
|
346
|
-
const type = routingInfo.type;
|
|
347
|
-
if (currentOrder && currentItems) {
|
|
348
|
-
// JA - making more similar to React version
|
|
349
|
-
const key = currentOrder[currentOrder.length - 1];
|
|
350
|
-
|
|
351
|
-
// save off itemKey to be used for finishAssignment, etc.
|
|
352
|
-
// debugger;
|
|
353
|
-
setItemKey(key);
|
|
354
|
-
|
|
355
|
-
if (
|
|
356
|
-
currentOrder.length > 0 &&
|
|
357
|
-
currentItems[key] &&
|
|
358
|
-
currentItems[key].view &&
|
|
359
|
-
type === 'single' &&
|
|
360
|
-
!Utils.isEmptyObject(currentItems[key].view)
|
|
361
|
-
) {
|
|
362
|
-
const currentItem = currentItems[key];
|
|
363
|
-
const rootView = currentItem.view;
|
|
364
|
-
const { context } = rootView.config;
|
|
365
|
-
const config = { meta: rootView };
|
|
366
|
-
|
|
367
|
-
config['options'] = {
|
|
368
|
-
context: currentItem.context,
|
|
369
|
-
pageReference: context || localPConn.getPageReference(),
|
|
370
|
-
hasForm: true,
|
|
371
|
-
isFlowContainer: true,
|
|
372
|
-
containerName: localPConn.getContainerName(),
|
|
373
|
-
containerItemName: key,
|
|
374
|
-
parentPageReference: localPConn.getPageReference()
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
const configObject = PCore.createPConnect(config);
|
|
378
|
-
|
|
379
|
-
// Since we're setting an array, need to add in an appropriate key
|
|
380
|
-
// to remove React warning.
|
|
381
|
-
configObject['key'] = config['options'].parentPageReference;
|
|
382
|
-
|
|
383
|
-
// keep track of these changes
|
|
384
|
-
const theNewChildren: Array<Object> = [];
|
|
385
|
-
theNewChildren.push(configObject);
|
|
386
|
-
setArNewChildren(theNewChildren);
|
|
387
|
-
|
|
388
|
-
// JEA - adapted from Constellation DX Components FlowContainer since we want to render children that are React components
|
|
389
|
-
const root = createElement(createPConnectComponent(), configObject);
|
|
390
|
-
setArNewChildrenAsReact([root]);
|
|
391
|
-
|
|
392
|
-
const oWorkItem = configObject.getPConnect(); // was theNewChildren[0].getPConnect()
|
|
393
|
-
const oWorkData = oWorkItem.getDataObject();
|
|
394
|
-
|
|
395
|
-
// check if have oWorkData, there are times due to timing of state change, when this
|
|
396
|
-
// may not be available
|
|
397
|
-
if (oWorkData) {
|
|
398
|
-
setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
287
|
}, [props]);
|
|
404
288
|
|
|
405
289
|
const caseId = thePConn.getCaseSummary().content.pyID;
|
|
406
|
-
const urgency = getPConnect().getCaseSummary().assignments
|
|
407
|
-
? getPConnect().getCaseSummary().assignments?.[0].urgency
|
|
408
|
-
: '';
|
|
290
|
+
const urgency = getPConnect().getCaseSummary().assignments ? getPConnect().getCaseSummary().assignments?.[0].urgency : '';
|
|
409
291
|
const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName());
|
|
410
|
-
let instructionText = thePConn.getCaseSummary()?.assignments?.[0]?.instructions;
|
|
411
|
-
if (instructionText === undefined) {
|
|
412
|
-
instructionText = '';
|
|
413
|
-
}
|
|
414
292
|
|
|
415
293
|
const bShowBanner = showBanner(getPConnect);
|
|
416
294
|
|
|
295
|
+
const displayPageMessages = () => {
|
|
296
|
+
let hasBanner = false;
|
|
297
|
+
const messages = pageMessages ? pageMessages.map(msg => localizedVal(msg.message, 'Messages')) : pageMessages;
|
|
298
|
+
hasBanner = messages && messages.length > 0;
|
|
299
|
+
return hasBanner && <AlertBanner id='flowContainerBanner' variant='urgent' messages={messages} />;
|
|
300
|
+
};
|
|
301
|
+
|
|
417
302
|
return (
|
|
418
303
|
<div style={{ textAlign: 'left' }} id={buildName} className='psdk-flow-container-top'>
|
|
419
304
|
{!bShowConfirm &&
|
|
@@ -424,25 +309,21 @@ export default function FlowContainer(props) {
|
|
|
424
309
|
title={<Typography variant='h6'>{containerName}</Typography>}
|
|
425
310
|
subheader={`Task in ${caseId} \u2022 Priority ${urgency}`}
|
|
426
311
|
avatar={<Avatar className={classes.avatar}>{operatorInitials}</Avatar>}
|
|
427
|
-
|
|
428
|
-
{
|
|
429
|
-
<Typography variant='caption'>{instructionText}</Typography>
|
|
430
|
-
) : null}
|
|
312
|
+
/>
|
|
313
|
+
{displayPageMessages()}
|
|
431
314
|
<MuiPickersUtilsProvider utils={DayjsUtils}>
|
|
432
315
|
<Assignment getPConnect={getPConnect} itemKey={itemKey}>
|
|
433
|
-
{
|
|
316
|
+
{rootViewElement}
|
|
434
317
|
</Assignment>
|
|
435
318
|
</MuiPickersUtilsProvider>
|
|
436
319
|
</Card>
|
|
437
320
|
) : (
|
|
438
321
|
<Card className={classes.root}>
|
|
439
322
|
<Typography variant='h6'>{containerName}</Typography>
|
|
440
|
-
{
|
|
441
|
-
<Typography variant='caption'>{instructionText}</Typography>
|
|
442
|
-
) : null}
|
|
323
|
+
{displayPageMessages()}
|
|
443
324
|
<MuiPickersUtilsProvider utils={DayjsUtils}>
|
|
444
325
|
<Assignment getPConnect={getPConnect} itemKey={itemKey}>
|
|
445
|
-
{
|
|
326
|
+
{rootViewElement}
|
|
446
327
|
</Assignment>
|
|
447
328
|
</MuiPickersUtilsProvider>
|
|
448
329
|
</Card>
|
|
@@ -450,6 +331,7 @@ export default function FlowContainer(props) {
|
|
|
450
331
|
) : (
|
|
451
332
|
<div>
|
|
452
333
|
<ToDo
|
|
334
|
+
key={Math.random()}
|
|
453
335
|
getPConnect={getPConnect}
|
|
454
336
|
caseInfoID={todo_caseInfoID}
|
|
455
337
|
datasource={todo_datasource}
|
|
@@ -458,7 +340,8 @@ export default function FlowContainer(props) {
|
|
|
458
340
|
type={TODO}
|
|
459
341
|
context={todo_context}
|
|
460
342
|
itemKey={itemKey}
|
|
461
|
-
|
|
343
|
+
isConfirm
|
|
344
|
+
/>
|
|
462
345
|
</div>
|
|
463
346
|
))}
|
|
464
347
|
{bHasCaseMessages && (
|
|
@@ -466,26 +349,9 @@ export default function FlowContainer(props) {
|
|
|
466
349
|
<Alert severity='success'>{caseMessages}</Alert>
|
|
467
350
|
</div>
|
|
468
351
|
)}
|
|
469
|
-
{bShowConfirm && bShowBanner && <div>{
|
|
352
|
+
{bShowConfirm && bShowBanner && <div>{rootViewElement}</div>}
|
|
470
353
|
</div>
|
|
471
354
|
);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
FlowContainer.defaultProps = {
|
|
475
|
-
children: null,
|
|
476
|
-
getPConnect: null,
|
|
477
|
-
name: '',
|
|
478
|
-
routingInfo: null,
|
|
479
|
-
pageMessages: null
|
|
480
355
|
};
|
|
481
356
|
|
|
482
|
-
|
|
483
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
484
|
-
children: PropTypes.node,
|
|
485
|
-
getPConnect: PropTypes.func,
|
|
486
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
487
|
-
name: PropTypes.string,
|
|
488
|
-
routingInfo: PropTypes.objectOf(PropTypes.any),
|
|
489
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
490
|
-
pageMessages: PropTypes.arrayOf(PropTypes.any)
|
|
491
|
-
};
|
|
357
|
+
export default withSimpleViewContainerRenderer(FlowContainer);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Moved PCore.getConstants() into each function in which it's used until we can
|
|
2
|
+
// make sure that this code isn't run until PCore is defined (after onPCoreReady)
|
|
3
|
+
// const { CASE_INFO } = PCore.getConstants();
|
|
4
|
+
|
|
5
|
+
export const addContainerItem = pConnect => {
|
|
6
|
+
const containerManager = pConnect.getContainerManager();
|
|
7
|
+
const contextName = pConnect.getContextName(); // here we will get parent context name, as flow container is child of view container
|
|
8
|
+
const caseViewMode = pConnect.getValue('context_data.caseViewMode');
|
|
9
|
+
|
|
10
|
+
let key;
|
|
11
|
+
let flowName;
|
|
12
|
+
|
|
13
|
+
if (caseViewMode !== 'review') {
|
|
14
|
+
const target = contextName.substring(0, contextName.lastIndexOf('_'));
|
|
15
|
+
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(target);
|
|
16
|
+
const containerItemData = PCore.getContainerUtils().getContainerItemData(target, activeContainerItemID);
|
|
17
|
+
|
|
18
|
+
if (containerItemData) {
|
|
19
|
+
({ key, flowName } = containerItemData);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
containerManager.addContainerItem({
|
|
24
|
+
semanticURL: '',
|
|
25
|
+
key,
|
|
26
|
+
flowName,
|
|
27
|
+
caseViewMode: 'perform',
|
|
28
|
+
resourceType: 'ASSIGNMENT',
|
|
29
|
+
data: pConnect.getDataObject(contextName)
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const hasContainerItems = pConnect => {
|
|
34
|
+
const contextName = pConnect.getContextName();
|
|
35
|
+
const containerName = pConnect.getContainerName();
|
|
36
|
+
return PCore.getContainerUtils().hasContainerItems(`${contextName}/${containerName}`);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const getActiveCaseActionName = pConnect => {
|
|
40
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
41
|
+
const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
|
|
42
|
+
const activeActionID = pConnect.getValue(CASE_INFO.ACTIVE_ACTION_ID);
|
|
43
|
+
const activeAction = caseActions.find(action => action.ID === activeActionID);
|
|
44
|
+
return activeAction?.name || '';
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const getFirstCaseActionName = pConnect => {
|
|
48
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
49
|
+
const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
|
|
50
|
+
return caseActions[0]?.name || '';
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const hasNotificationMessages = pConnect => {
|
|
54
|
+
return !!pConnect.getValue('caseMessages');
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const isCaseWideLocalAction = pConnect => {
|
|
58
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
59
|
+
const actionID = pConnect.getValue(CASE_INFO.ACTIVE_ACTION_ID);
|
|
60
|
+
const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
|
|
61
|
+
if (caseActions && actionID) {
|
|
62
|
+
const activeAction = caseActions.find(caseAction => caseAction.ID === actionID);
|
|
63
|
+
return activeAction?.type === 'Case';
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const getChildCaseAssignments = pConnect => {
|
|
69
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
70
|
+
const childCases = pConnect.getValue(CASE_INFO.CHILD_ASSIGNMENTS);
|
|
71
|
+
let allAssignments = [];
|
|
72
|
+
if (childCases && childCases.length > 0) {
|
|
73
|
+
childCases.forEach(({ assignments, Name }) => {
|
|
74
|
+
if (assignments) {
|
|
75
|
+
const childCaseAssignments = assignments.map(assignment => ({
|
|
76
|
+
...assignment,
|
|
77
|
+
caseName: Name
|
|
78
|
+
}));
|
|
79
|
+
allAssignments = allAssignments.concat(childCaseAssignments);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return allAssignments;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const hasAssignments = pConnect => {
|
|
87
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
88
|
+
const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS);
|
|
89
|
+
const childCasesAssignments = getChildCaseAssignments(pConnect);
|
|
90
|
+
|
|
91
|
+
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
92
|
+
if (assignments || childCasesAssignments || isCaseWideLocalAction(pConnect)) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const showBanner = getPConnect => {
|
|
99
|
+
const pConnect = getPConnect();
|
|
100
|
+
return hasNotificationMessages(pConnect) || !hasAssignments(pConnect);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const showTodo = pConnect => {
|
|
104
|
+
const caseViewMode = pConnect.getValue('context_data.caseViewMode');
|
|
105
|
+
return caseViewMode !== 'perform';
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const isRenderWithToDoWrapper = (getPConnect, options) => {
|
|
109
|
+
const pConnect = getPConnect();
|
|
110
|
+
const { showWithToDo } = options;
|
|
111
|
+
return showWithToDo && (!isCaseWideLocalAction(pConnect) || showTodo(pConnect));
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const getToDoAssignments = pConnect => {
|
|
115
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
116
|
+
const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
|
|
117
|
+
const assignmentLabel = pConnect.getValue(CASE_INFO.ASSIGNMENT_LABEL);
|
|
118
|
+
const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS) || [];
|
|
119
|
+
const childCasesAssignments = getChildCaseAssignments(pConnect) || [];
|
|
120
|
+
let childCasesAssignmentsCopy = JSON.parse(JSON.stringify(childCasesAssignments));
|
|
121
|
+
|
|
122
|
+
childCasesAssignmentsCopy = childCasesAssignmentsCopy.map(assignment => {
|
|
123
|
+
assignment.isChild = true;
|
|
124
|
+
return assignment;
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const todoAssignments = [...assignments, ...childCasesAssignmentsCopy];
|
|
128
|
+
let todoAssignmentsCopy = JSON.parse(JSON.stringify(todoAssignments));
|
|
129
|
+
|
|
130
|
+
if (caseActions && !showTodo(pConnect)) {
|
|
131
|
+
todoAssignmentsCopy = todoAssignmentsCopy.map(assignment => {
|
|
132
|
+
assignment.name = getActiveCaseActionName(pConnect) || assignmentLabel;
|
|
133
|
+
return assignment;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return todoAssignmentsCopy;
|
|
138
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './FlowContainer';
|
|
1
|
+
export { default } from './FlowContainer';
|