@pega/react-sdk-overrides 0.23.6

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