@pega/react-sdk-overrides 23.1.10 → 23.1.12

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