@pega/react-sdk-overrides 8.23.11 → 23.1.11

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 (233) 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 +12 -16
  5. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  6. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  8. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  9. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  10. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  11. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +14 -11
  12. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  13. package/lib/designSystemExtension/Operator/Operator.tsx +100 -84
  14. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  15. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  16. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  17. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  18. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  19. package/lib/field/AutoComplete/config-ext.json +2 -3
  20. package/lib/field/CancelAlert/CancelAlert.tsx +100 -81
  21. package/lib/field/CancelAlert/index.tsx +1 -1
  22. package/lib/field/Checkbox/Checkbox.tsx +27 -16
  23. package/lib/field/Checkbox/config-ext.json +2 -3
  24. package/lib/field/Currency/Currency.tsx +30 -47
  25. package/lib/field/Currency/config-ext.json +2 -3
  26. package/lib/field/Currency/currency-utils.ts +10 -21
  27. package/lib/field/Date/Date.tsx +24 -13
  28. package/lib/field/Date/config-ext.json +2 -3
  29. package/lib/field/DateTime/DateTime.tsx +21 -10
  30. package/lib/field/DateTime/config-ext.json +1 -2
  31. package/lib/field/Decimal/Decimal.tsx +31 -40
  32. package/lib/field/Decimal/config-ext.json +1 -2
  33. package/lib/field/Decimal/index.tsx +1 -1
  34. package/lib/field/Dropdown/Dropdown.tsx +128 -31
  35. package/lib/field/Dropdown/config-ext.json +1 -2
  36. package/lib/field/Email/Email.tsx +16 -7
  37. package/lib/field/Email/config-ext.json +1 -2
  38. package/lib/field/Email/index.tsx +1 -1
  39. package/lib/field/Group/Group.tsx +39 -0
  40. package/lib/field/Group/config-ext.json +7 -0
  41. package/lib/field/Group/index.tsx +1 -0
  42. package/lib/field/Integer/Integer.tsx +15 -6
  43. package/lib/field/Integer/config-ext.json +1 -2
  44. package/lib/field/Percentage/Percentage.tsx +52 -39
  45. package/lib/field/Percentage/config-ext.json +1 -2
  46. package/lib/field/Phone/Phone.tsx +15 -6
  47. package/lib/field/Phone/index.tsx +1 -1
  48. package/lib/field/RadioButtons/RadioButtons.tsx +26 -34
  49. package/lib/field/RadioButtons/config-ext.json +1 -2
  50. package/lib/field/RichText/RichText.tsx +96 -0
  51. package/lib/field/RichText/index.tsx +1 -0
  52. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  53. package/lib/field/ScalarList/config-ext.json +7 -0
  54. package/lib/field/ScalarList/index.tsx +1 -0
  55. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  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 +15 -5
  59. package/lib/field/TextArea/config-ext.json +1 -2
  60. package/lib/field/TextContent/TextContent.tsx +9 -2
  61. package/lib/field/TextContent/config-ext.json +1 -2
  62. package/lib/field/TextInput/TextInput.tsx +18 -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 +14 -19
  66. package/lib/field/Time/config-ext.json +1 -2
  67. package/lib/field/URL/URL.tsx +15 -6
  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 +52 -60
  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 +15 -10
  74. package/lib/helpers/case-utils.tsx +5 -10
  75. package/lib/helpers/common-utils.ts +6 -2
  76. package/lib/helpers/data_page.ts +3 -7
  77. package/lib/helpers/date-format-utils.ts +4 -4
  78. package/lib/helpers/event-utils.ts +4 -4
  79. package/lib/helpers/field-group-utils.ts +6 -8
  80. package/lib/helpers/formatters/Boolean.ts +9 -26
  81. package/lib/helpers/formatters/Currency.ts +22 -28
  82. package/lib/helpers/formatters/CurrencyMap.ts +512 -505
  83. package/lib/helpers/formatters/Date.ts +20 -26
  84. package/lib/helpers/formatters/common.ts +2 -7
  85. package/lib/helpers/formatters/index.ts +29 -22
  86. package/lib/helpers/reactContextHelpers.ts +2 -2
  87. package/lib/helpers/simpleTableHelpers.ts +63 -87
  88. package/lib/helpers/state-utils.tsx +5 -12
  89. package/lib/helpers/template-utils.ts +4 -10
  90. package/lib/helpers/utils.ts +5 -5
  91. package/lib/helpers/versionHelpers.ts +1 -7
  92. package/lib/infra/ActionButtons/ActionButtons.tsx +44 -45
  93. package/lib/infra/ActionButtons/index.tsx +1 -1
  94. package/lib/infra/Assignment/Assignment.tsx +102 -86
  95. package/lib/infra/Assignment/index.tsx +1 -1
  96. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  97. package/lib/infra/AssignmentCard/index.tsx +1 -1
  98. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +93 -240
  99. package/lib/infra/Containers/FlowContainer/helpers.ts +34 -48
  100. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  101. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  103. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +229 -223
  104. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  105. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  106. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  107. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  108. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +47 -64
  109. package/lib/infra/Containers/helpers.ts +6 -0
  110. package/lib/infra/DashboardFilter/DashboardFilter.tsx +25 -54
  111. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -42
  112. package/lib/infra/DeferLoad/DeferLoad.tsx +21 -33
  113. package/lib/infra/DeferLoad/index.tsx +1 -1
  114. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -39
  115. package/lib/infra/MultiStep/MultiStep.css +11 -15
  116. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  117. package/lib/infra/MultiStep/index.tsx +1 -1
  118. package/lib/infra/NavBar/NavBar.css +103 -105
  119. package/lib/infra/NavBar/NavBar.tsx +26 -45
  120. package/lib/infra/Reference/Reference.tsx +16 -22
  121. package/lib/infra/Region/Region.tsx +9 -9
  122. package/lib/infra/RootContainer/RootContainer.tsx +75 -120
  123. package/lib/infra/RootContainer/index.tsx +1 -1
  124. package/lib/infra/Stages/Stages.tsx +36 -41
  125. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  126. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  127. package/lib/infra/View/View.tsx +25 -29
  128. package/lib/template/AppShell/AppShell.css +22 -23
  129. package/lib/template/AppShell/AppShell.tsx +47 -71
  130. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  131. package/lib/template/CaseSummary/CaseSummary.tsx +66 -19
  132. package/lib/template/CaseSummary/config-ext.json +1 -2
  133. package/lib/template/CaseView/CaseView.tsx +44 -74
  134. package/lib/template/CaseView/config-ext.json +1 -2
  135. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +66 -31
  136. package/lib/template/Confirmation/Confirmation.tsx +24 -55
  137. package/lib/template/Confirmation/config-ext.json +1 -2
  138. package/lib/template/DataReference/DataReference.tsx +112 -142
  139. package/lib/template/DataReference/config-ext.json +1 -2
  140. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  141. package/lib/template/DefaultForm/DefaultForm.tsx +15 -16
  142. package/lib/template/DefaultForm/config-ext.json +1 -2
  143. package/lib/template/Details/Details/Details.tsx +24 -28
  144. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  145. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  146. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  147. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  151. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  152. package/lib/template/Details/DynamicTabs/config.json +36 -0
  153. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  154. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +22 -35
  155. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  156. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  157. package/lib/template/ListPage/ListPage.tsx +12 -16
  158. package/lib/template/ListPage/config-ext.json +1 -2
  159. package/lib/template/ListView/DefaultViewMeta.ts +1 -3
  160. package/lib/template/ListView/ListView.tsx +247 -309
  161. package/lib/template/ListView/config-ext.json +1 -2
  162. package/lib/template/ListView/hooks.ts +24 -26
  163. package/lib/template/ListView/utils.ts +205 -94
  164. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -34
  165. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  166. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  167. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  168. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  169. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  170. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  171. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  172. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  173. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  174. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  175. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  177. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  179. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  180. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  181. package/lib/template/PromotedFilters/PromotedFilters.tsx +39 -33
  182. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +113 -15
  183. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  184. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -104
  185. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -44
  186. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  187. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  188. package/lib/template/SubTabs/config-ext.json +1 -2
  189. package/lib/template/SubTabs/tabUtils.ts +2 -9
  190. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  191. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  192. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  193. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  194. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  196. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  197. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  198. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  199. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  200. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  201. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  202. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  203. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  204. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  205. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  207. package/lib/template/WssNavBar/WssNavBar.tsx +24 -10
  208. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  209. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  210. package/lib/widget/Attachment/Attachment.css +60 -1
  211. package/lib/widget/Attachment/Attachment.tsx +379 -394
  212. package/lib/widget/Attachment/index.tsx +1 -1
  213. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  214. package/lib/widget/CaseHistory/config-ext.json +1 -2
  215. package/lib/widget/CaseHistory/index.tsx +1 -1
  216. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  217. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  218. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +322 -245
  219. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  220. package/lib/widget/Followers/Followers.tsx +27 -25
  221. package/lib/widget/Followers/config-ext.json +1 -2
  222. package/lib/widget/QuickCreate/QuickCreate.tsx +71 -39
  223. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  224. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -52
  225. package/lib/widget/SummaryItem/index.tsx +1 -1
  226. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  227. package/lib/widget/ToDo/ToDo.css +4 -4
  228. package/lib/widget/ToDo/ToDo.tsx +72 -116
  229. package/lib/widget/ToDo/config-ext.json +1 -2
  230. package/package.json +5 -2
  231. package/lib/helpers/auth.js +0 -483
  232. package/lib/helpers/authManager.js +0 -634
  233. package/lib/helpers/config_access.js +0 -259
@@ -1,22 +1,25 @@
1
1
  /* eslint-disable react/jsx-boolean-value */
2
2
 
3
- import React, { useState, useEffect, useContext } from 'react';
4
- import PropTypes from 'prop-types';
5
- import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
6
- import { Card, CardHeader, Avatar, Typography, Divider } from '@material-ui/core';
3
+ import { PropsWithChildren, ReactElement, useContext, useEffect, useState } from 'react';
4
+ import { Avatar, Card, CardHeader, Divider, Typography } from '@material-ui/core';
7
5
  import { makeStyles } from '@material-ui/core/styles';
8
6
  import Box from '@material-ui/core/Box';
9
7
  import Button from '@material-ui/core/Button';
10
8
  import Grid from '@material-ui/core/Grid';
11
9
 
10
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
12
11
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
13
- import CaseViewActionsMenu from '@pega/react-sdk-components/lib/components/template/CaseViewActionsMenu';
14
- import VerticalTabs from '@pega/react-sdk-components/lib/components/infra/VerticalTabs/VerticalTabs';
15
- import DeferLoad from '@pega/react-sdk-components/lib/components/infra/DeferLoad';
16
-
17
- // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
18
- declare const PCore: any;
19
-
12
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
13
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
14
+
15
+ interface CaseViewProps extends PConnProps {
16
+ // If any, enter additional props that only exist on this component
17
+ icon: string;
18
+ subheader: string;
19
+ header: string;
20
+ showIconInHeader: boolean;
21
+ caseInfo: any;
22
+ }
20
23
 
21
24
  const useStyles = makeStyles(theme => ({
22
25
  root: {
@@ -45,21 +48,23 @@ const useStyles = makeStyles(theme => ({
45
48
  }
46
49
  }));
47
50
 
48
- export default function CaseView(props) {
51
+ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
52
+ // Get emitted components from map (so we can get any override that may exist)
53
+ const CaseViewActionsMenu = getComponentFromMap('CaseViewActionsMenu');
54
+ const VerticalTabs = getComponentFromMap('VerticalTabs');
55
+ const DeferLoad = getComponentFromMap('DeferLoad');
56
+
49
57
  const {
50
58
  getPConnect,
51
- icon,
59
+ icon = '',
52
60
  header,
53
61
  subheader,
54
- children,
55
- caseInfo: {
56
- availableActions = [],
57
- availableProcesses = [],
58
- hasNewAttachments,
59
- caseTypeID = '',
60
- caseTypeName = ''
61
- }
62
+ children = [],
63
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
64
+ showIconInHeader = true,
65
+ caseInfo: { availableActions = [], availableProcesses = [], hasNewAttachments, caseTypeID = '', caseTypeName = '' }
62
66
  } = props;
67
+
63
68
  const currentCaseID = props.caseInfo.ID;
64
69
  let isComponentMounted = true;
65
70
 
@@ -80,15 +85,9 @@ export default function CaseView(props) {
80
85
  * @param inName the metadata <em>name</em> that will cause a region to be returned
81
86
  */
82
87
  function getChildRegionByName(inName: string): any {
83
- for (const child of children) {
84
- const theMetadataType: string = child.props
85
- .getPConnect()
86
- .getRawMetadata()
87
- ['type'].toLowerCase();
88
- const theMetadataName: string = child.props
89
- .getPConnect()
90
- .getRawMetadata()
91
- ['name'].toLowerCase();
88
+ for (const child of children as ReactElement[]) {
89
+ const theMetadataType: string = (child as ReactElement).props.getPConnect().getRawMetadata().type.toLowerCase();
90
+ const theMetadataName: string = (child as ReactElement).props.getPConnect().getRawMetadata().name.toLowerCase();
92
91
 
93
92
  if (theMetadataType === 'region' && theMetadataName === inName) {
94
93
  return child;
@@ -115,10 +114,10 @@ export default function CaseView(props) {
115
114
  const theTabsRegionChildren = theTabsRegion.props.getPConnect().getChildren();
116
115
 
117
116
  // vertTabInfo is sent to VerticalTabs component
118
- const vertTabInfo: Array<Object> = [];
117
+ const vertTabInfo: Object[] = [];
119
118
 
120
119
  // deferLoadInfo is sent to DeferLoad component (currently selected entry)
121
- const deferLoadInfo: Array<any> = [];
120
+ const deferLoadInfo: any[] = [];
122
121
 
123
122
  if (theTabsRegionChildren) {
124
123
  // populate vertTabInfo and deferLoadInfo
@@ -170,10 +169,8 @@ export default function CaseView(props) {
170
169
 
171
170
  useEffect(() => {
172
171
  if (hasNewAttachments) {
173
- PCore.getPubSubUtils().publish(
174
- PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
175
- true
176
- );
172
+ // @ts-ignore - Argument of type 'boolean' is not assignable to parameter of type 'object'
173
+ PCore.getPubSubUtils().publish((PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, true);
177
174
  }
178
175
  }, [hasNewAttachments]);
179
176
 
@@ -181,11 +178,11 @@ export default function CaseView(props) {
181
178
  const actionsAPI = thePConn.getActionsApi();
182
179
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
183
180
 
184
- openLocalAction(editAction.ID, { ...editAction });
181
+ openLocalAction(editAction.ID, { ...editAction, containerName: 'modal', type: 'express' });
185
182
  }
186
183
 
187
184
  function getActionButtonsHtml(): any {
188
- const aBHtml = (
185
+ return (
189
186
  <Box>
190
187
  {editAction && (
191
188
  <Button
@@ -205,8 +202,6 @@ export default function CaseView(props) {
205
202
  />
206
203
  </Box>
207
204
  );
208
-
209
- return aBHtml;
210
205
  }
211
206
 
212
207
  function getContainerContents() {
@@ -248,13 +243,7 @@ export default function CaseView(props) {
248
243
  <Grid item xs={6}>
249
244
  {theStagesRegion}
250
245
  {theTodoRegion}
251
- {deferLoadInfo.length > 0 && (
252
- <DeferLoad
253
- getPConnect={getPConnect}
254
- name={deferLoadInfo[activeVertTab].config.name}
255
- isTab
256
- />
257
- )}
246
+ {deferLoadInfo.length > 0 && <DeferLoad getPConnect={getPConnect} name={deferLoadInfo[activeVertTab].config.name} isTab />}
258
247
  </Grid>
259
248
 
260
249
  <Grid item xs={3}>
@@ -262,35 +251,16 @@ export default function CaseView(props) {
262
251
  </Grid>
263
252
  </Grid>
264
253
  );
265
- } else {
266
- // displayOnlyFA - only show the "todo" region
267
- return (
268
- <Grid container>
269
- <Grid item xs={12}>
270
- {theTodoRegion}
271
- </Grid>
272
- </Grid>
273
- );
274
254
  }
255
+ // displayOnlyFA - only show the "todo" region
256
+ return (
257
+ <Grid container>
258
+ <Grid item xs={12}>
259
+ {theTodoRegion}
260
+ </Grid>
261
+ </Grid>
262
+ );
275
263
  }
276
264
 
277
265
  return getContainerContents();
278
266
  }
279
-
280
- CaseView.defaultProps = {
281
- icon: '',
282
- children: [],
283
- caseInfo: {},
284
- showIconInHeader: true,
285
- getPConnect: null
286
- };
287
-
288
- CaseView.propTypes = {
289
- icon: PropTypes.string,
290
- children: PropTypes.arrayOf(PropTypes.node),
291
- subheader: PropTypes.string.isRequired,
292
- header: PropTypes.string.isRequired,
293
- showIconInHeader: PropTypes.bool,
294
- caseInfo: PropTypes.objectOf(PropTypes.any),
295
- getPConnect: PropTypes.func
296
- };
@@ -4,6 +4,5 @@
4
4
  "description": "Standard case page",
5
5
  "type": "Template",
6
6
  "subtype": "CASEVIEW",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,15 +1,22 @@
1
1
  import React, { useState } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import Button from '@material-ui/core/Button';
4
3
  import Menu from '@material-ui/core/Menu';
5
4
  import MenuItem from '@material-ui/core/MenuItem';
6
5
 
7
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
8
-
9
- declare const PCore: typeof PCoreType;
10
-
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+ import Snackbar from '@material-ui/core/Snackbar';
8
+ import IconButton from '@material-ui/core/IconButton';
9
+ import CloseIcon from '@material-ui/icons/Close';
10
+
11
+ interface CaseViewActionsMenuProps extends PConnProps {
12
+ // If any, enter additional props that only exist on this component
13
+ availableActions: any[];
14
+ availableProcesses: any[];
15
+ caseTypeID: string;
16
+ caseTypeName: string;
17
+ }
11
18
 
12
- export default function CaseViewActionsMenu(props) {
19
+ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
13
20
  const { getPConnect, availableActions, availableProcesses, caseTypeID, caseTypeName } = props;
14
21
  const thePConn = getPConnect();
15
22
 
@@ -19,6 +26,9 @@ export default function CaseViewActionsMenu(props) {
19
26
 
20
27
  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
21
28
 
29
+ const [showSnackbar, setShowSnackbar] = useState(false);
30
+ const [snackbarMessage, setSnackbarMessage]: any = useState('');
31
+
22
32
  const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
23
33
  setAnchorEl(event.currentTarget);
24
34
  };
@@ -27,17 +37,46 @@ export default function CaseViewActionsMenu(props) {
27
37
  setAnchorEl(null);
28
38
  };
29
39
 
30
- const arMenuItems: Array<any> = [];
40
+ const arMenuItems: any[] = [];
41
+
42
+ function showToast(message: string) {
43
+ setSnackbarMessage(message);
44
+ setShowSnackbar(true);
45
+ }
46
+
47
+ function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
48
+ if (reason === 'clickaway') {
49
+ return;
50
+ }
51
+ setShowSnackbar(false);
52
+ }
31
53
 
32
54
  function _actionMenuActionsClick(data) {
33
55
  const actionsAPI = thePConn.getActionsApi();
34
56
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
35
57
 
36
- openLocalAction(data.ID, { ...data, containerName: 'modal', type: 'express' });
58
+ openLocalAction(data.ID, {
59
+ ...data,
60
+ containerName: 'modal',
61
+ type: 'express'
62
+ });
37
63
  // after doing the action, close the menu...
38
64
  handleClose();
39
65
  }
40
66
 
67
+ function _actionMenuProcessClick(process) {
68
+ const actionsAPI = thePConn.getActionsApi();
69
+ const openProcessAction = actionsAPI.openProcessAction.bind(actionsAPI);
70
+ openProcessAction(process.ID, {
71
+ ...process
72
+ })
73
+ .then(() => {})
74
+ .catch(() => {
75
+ showToast(`${process.name} Submit failed!`);
76
+ });
77
+ handleClose();
78
+ }
79
+
41
80
  availableActions.forEach(action => {
42
81
  arMenuItems.push(
43
82
  <MenuItem key={action.ID} onClick={() => _actionMenuActionsClick(action)}>
@@ -47,36 +86,32 @@ export default function CaseViewActionsMenu(props) {
47
86
  });
48
87
 
49
88
  availableProcesses.forEach(process => {
50
- arMenuItems.push(<MenuItem onClick={handleClose}>{process.name}</MenuItem>);
89
+ arMenuItems.push(
90
+ <MenuItem key={process.ID} onClick={() => _actionMenuProcessClick(process)}>
91
+ {localizedVal(process.name, '', localeKey)}
92
+ </MenuItem>
93
+ );
51
94
  });
52
95
 
53
96
  return (
54
- <React.Fragment>
97
+ <>
55
98
  <Button aria-controls='simple-menu' aria-haspopup='true' onClick={handleClick}>
56
99
  {localizedVal('Actions...', localeCategory)}
57
100
  </Button>
58
- <Menu
59
- id='simple-menu'
60
- anchorEl={anchorEl}
61
- keepMounted
62
- open={Boolean(anchorEl)}
63
- onClose={handleClose}
64
- >
101
+ <Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
65
102
  {arMenuItems}
66
103
  </Menu>
67
- </React.Fragment>
104
+ <Snackbar
105
+ open={showSnackbar}
106
+ autoHideDuration={3000}
107
+ onClose={handleSnackbarClose}
108
+ message={snackbarMessage}
109
+ action={
110
+ <IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
111
+ <CloseIcon fontSize='small' />
112
+ </IconButton>
113
+ }
114
+ />
115
+ </>
68
116
  );
69
117
  }
70
-
71
- CaseViewActionsMenu.defaultProps = {
72
- availableActions: [],
73
- availableProcesses: []
74
- };
75
-
76
- CaseViewActionsMenu.propTypes = {
77
- getPConnect: PropTypes.func.isRequired,
78
- availableActions: PropTypes.arrayOf(PropTypes.object),
79
- availableProcesses: PropTypes.arrayOf(PropTypes.any),
80
- caseTypeID: PropTypes.string,
81
- caseTypeName: PropTypes.string
82
- };
@@ -1,18 +1,18 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- /* eslint-disable no-unused-vars */
3
1
  /* eslint-disable no-nested-ternary */
4
- import { Fragment, useState } from 'react';
5
- import PropTypes from 'prop-types';
6
- import React from 'react';
7
- import { getToDoAssignments } from '@pega/react-sdk-components/lib/components/infra/Containers/FlowContainer/helpers';
8
- import ToDo from '@pega/react-sdk-components/lib/components/widget/ToDo';
9
- import Details from '@pega/react-sdk-components/lib/components/template/Details/Details';
2
+ import { PropsWithChildren, useState } from 'react';
10
3
  import { Button, Card, makeStyles } from '@material-ui/core';
11
4
 
12
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
13
-
14
- declare const PCore: typeof PCoreType;
5
+ import { getToDoAssignments } from '@pega/react-sdk-components/lib/components/infra/Containers/FlowContainer/helpers';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
15
8
 
9
+ interface ConfirmationProps extends PConnProps {
10
+ // If any, enter additional props that only exist on this component
11
+ datasource: { source: any };
12
+ label: string;
13
+ showLabel: boolean;
14
+ showTasks: boolean;
15
+ }
16
16
 
17
17
  const useStyles = makeStyles(theme => ({
18
18
  root: {
@@ -27,28 +27,24 @@ const useStyles = makeStyles(theme => ({
27
27
  }
28
28
  }));
29
29
 
30
- export default function Confirmation(props) {
30
+ export default function Confirmation(props: PropsWithChildren<ConfirmationProps>) {
31
+ // Get emitted components from map (so we can get any override that may exist)
32
+ const ToDo = getComponentFromMap('Todo'); // NOTE: ConstellationJS Engine uses "Todo" and not "ToDo"!!!
33
+ const Details = getComponentFromMap('Details');
34
+
31
35
  const classes = useStyles();
32
36
  const CONSTS = PCore.getConstants();
33
37
  const [showConfirmView, setShowConfirmView] = useState(true);
34
- const { showTasks, getPConnect, datasource } = props;
38
+ const { showTasks, getPConnect } = props;
35
39
  // Get the inherited props from the parent to determine label settings
36
40
  // Not using whatsNext at the moment, need to figure out the use of it
37
- const whatsNext = datasource?.source;
38
- const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
39
- const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(
40
- getPConnect().getTarget()
41
- );
42
- const rootInfo = PCore.getContainerUtils().getContainerItemData(
43
- getPConnect().getTarget(),
44
- activeContainerItemID
45
- );
41
+ // const whatsNext = datasource?.source;
42
+ // const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
43
+ const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget());
44
+ const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), activeContainerItemID);
46
45
  const onConfirmViewClose = () => {
47
46
  setShowConfirmView(false);
48
- PCore.getPubSubUtils().publish(
49
- PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CLOSE_CONFIRM_VIEW,
50
- rootInfo
51
- );
47
+ PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CLOSE_CONFIRM_VIEW, rootInfo);
52
48
  };
53
49
  const todoProps = { ...props, renderTodoInConfirm: true };
54
50
  const toDoList = getToDoAssignments(getPConnect());
@@ -60,14 +56,7 @@ export default function Confirmation(props) {
60
56
  {showDetails ? <Details {...detailProps} /> : undefined}
61
57
  {showTasks ? (
62
58
  toDoList && toDoList.length > 0 ? (
63
- <ToDo
64
- {...todoProps}
65
- datasource={{ source: toDoList }}
66
- getPConnect={getPConnect}
67
- type={CONSTS.TODO}
68
- headerText='Open Tasks'
69
- isConfirm
70
- />
59
+ <ToDo {...todoProps} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText='Open Tasks' isConfirm />
71
60
  ) : undefined
72
61
  ) : undefined}
73
62
  <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
@@ -78,27 +67,7 @@ export default function Confirmation(props) {
78
67
  </Card>
79
68
  ) : toDoList && toDoList.length > 0 ? (
80
69
  <Card className={classes.root}>
81
- <ToDo
82
- {...props}
83
- datasource={{ source: toDoList }}
84
- getPConnect={getPConnect}
85
- type={CONSTS.TODO}
86
- headerText='Tasks'
87
- isConfirm
88
- />
70
+ <ToDo {...props} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText='Tasks' isConfirm />
89
71
  </Card>
90
72
  ) : null;
91
73
  }
92
-
93
- Confirmation.defaultProps = {
94
- datasource: undefined,
95
- label: '',
96
- showLabel: true
97
- };
98
-
99
- Confirmation.propTypes = {
100
- getPConnect: PropTypes.func.isRequired,
101
- datasource: PropTypes.objectOf(PropTypes.any),
102
- label: PropTypes.string,
103
- showLabel: PropTypes.bool
104
- };
@@ -7,6 +7,5 @@
7
7
  "icon": "confirm-view.svg",
8
8
  "hideTemplateEdit": true,
9
9
  "hideViewName": true,
10
- "properties": [
11
- ]
10
+ "properties": []
12
11
  }