@pega/react-sdk-overrides 0.23.26 → 8.8.20

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 (139) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
  2. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  3. package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
  9. package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
  12. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  13. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
  14. package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
  15. package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
  16. package/lib/field/Checkbox/Checkbox.tsx +41 -17
  17. package/lib/field/Currency/Currency.tsx +23 -15
  18. package/lib/field/Currency/currency-utils.ts +1 -2
  19. package/lib/field/Date/Date.tsx +31 -17
  20. package/lib/field/DateTime/DateTime.tsx +26 -15
  21. package/lib/field/Decimal/Decimal.tsx +82 -19
  22. package/lib/field/Dropdown/Dropdown.tsx +57 -14
  23. package/lib/field/Email/Email.tsx +17 -9
  24. package/lib/field/Integer/Integer.tsx +15 -7
  25. package/lib/field/Percentage/Percentage.tsx +15 -7
  26. package/lib/field/Phone/Phone.tsx +21 -12
  27. package/lib/field/RadioButtons/RadioButtons.tsx +54 -27
  28. package/lib/field/RichText/RichText.tsx +93 -0
  29. package/lib/field/RichText/index.tsx +1 -0
  30. package/lib/field/ScalarList/ScalarList.tsx +64 -0
  31. package/lib/field/ScalarList/config-ext.json +8 -0
  32. package/lib/field/ScalarList/index.tsx +1 -0
  33. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  34. package/lib/field/SemanticLink/utils.ts +2 -1
  35. package/lib/field/TextArea/TextArea.tsx +14 -5
  36. package/lib/field/TextContent/TextContent.tsx +10 -1
  37. package/lib/field/TextInput/TextInput.tsx +40 -11
  38. package/lib/field/Time/Time.tsx +29 -26
  39. package/lib/field/URL/URL.tsx +24 -8
  40. package/lib/field/UserReference/UserReference.tsx +52 -60
  41. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
  42. package/lib/helpers/auth.js +741 -390
  43. package/lib/helpers/authManager.ts +933 -0
  44. package/lib/helpers/case-utils.tsx +103 -0
  45. package/lib/helpers/common-utils.ts +4 -0
  46. package/lib/helpers/config_access.js +63 -145
  47. package/lib/helpers/data_page.ts +2 -1
  48. package/lib/helpers/date-format-utils.ts +29 -19
  49. package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
  50. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
  51. package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
  52. package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
  53. package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
  54. package/lib/helpers/formatters/{common.js → common.ts} +4 -4
  55. package/lib/helpers/formatters/{index.js → index.ts} +3 -3
  56. package/lib/helpers/simpleTableHelpers.ts +10 -6
  57. package/lib/helpers/state-utils.tsx +47 -0
  58. package/lib/helpers/template-utils.ts +3 -4
  59. package/lib/helpers/utils.ts +12 -4
  60. package/lib/helpers/versionHelpers.ts +0 -1
  61. package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
  62. package/lib/infra/Assignment/Assignment.tsx +38 -32
  63. package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
  64. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
  65. package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
  66. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -27
  67. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
  68. package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
  69. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
  70. package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
  71. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
  72. package/lib/infra/MultiStep/MultiStep.tsx +24 -24
  73. package/lib/infra/NavBar/NavBar.tsx +23 -24
  74. package/lib/infra/Reference/Reference.tsx +13 -18
  75. package/lib/infra/Region/Region.tsx +8 -6
  76. package/lib/infra/RootContainer/RootContainer.tsx +32 -39
  77. package/lib/infra/Stages/Stages.tsx +15 -9
  78. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
  79. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  80. package/lib/infra/View/View.tsx +28 -56
  81. package/lib/template/AppShell/AppShell.tsx +51 -34
  82. package/lib/template/BannerPage/BannerPage.tsx +26 -31
  83. package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
  84. package/lib/template/CaseView/CaseView.tsx +137 -100
  85. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
  86. package/lib/template/Confirmation/Confirmation.tsx +29 -52
  87. package/lib/template/DataReference/DataReference.tsx +50 -52
  88. package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
  89. package/lib/template/DefaultForm/utils/index.ts +33 -0
  90. package/lib/template/Details/Details/Details.tsx +16 -17
  91. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
  92. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
  93. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
  94. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
  95. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  96. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
  97. package/lib/template/ListPage/ListPage.tsx +14 -13
  98. package/lib/template/ListView/ListView.tsx +140 -152
  99. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  100. package/lib/template/ListView/{utils.js → utils.ts} +172 -23
  101. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
  102. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  103. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  104. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  105. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  106. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  107. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  108. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  109. package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
  110. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
  111. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +28 -7
  112. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
  113. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -36
  114. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  115. package/lib/template/SubTabs/tabUtils.ts +0 -2
  116. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  117. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  118. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  119. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  120. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  121. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  122. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  123. package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
  124. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  125. package/lib/widget/Attachment/Attachment.css +15 -3
  126. package/lib/widget/Attachment/Attachment.tsx +51 -32
  127. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  128. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  129. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
  130. package/lib/widget/Followers/Followers.tsx +10 -11
  131. package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
  132. package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
  133. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  134. package/lib/widget/ToDo/ToDo.tsx +69 -104
  135. package/package.json +1 -1
  136. package/lib/helpers/authManager.js +0 -631
  137. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  138. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  139. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -1,23 +1,34 @@
1
1
  /* eslint-disable react/jsx-boolean-value */
2
2
 
3
- import React, { useState, useEffect, useContext } from "react";
4
- import PropTypes from "prop-types";
3
+ import React, { useState, useEffect, useContext } from 'react';
5
4
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
6
- import { Card, CardHeader, Avatar, Typography, Divider } from "@material-ui/core";
5
+ import { Card, CardHeader, Avatar, Typography, Divider } from '@material-ui/core';
7
6
  import { makeStyles } from '@material-ui/core/styles';
8
7
  import Box from '@material-ui/core/Box';
9
8
  import Button from '@material-ui/core/Button';
10
9
  import Grid from '@material-ui/core/Grid';
11
10
 
12
- 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';
11
+ import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
12
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
16
13
 
14
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
15
+
16
+ interface CaseViewProps extends PConnProps {
17
+ // If any, enter additional props that only exist on this component
18
+ icon: string,
19
+ children: Array<any>,
20
+ subheader: string,
21
+ header: string,
22
+ showIconInHeader: boolean,
23
+ caseInfo: any,
24
+ }
25
+
26
+
27
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
28
+ declare const PCore: any;
17
29
 
18
- declare const PCore;
19
30
 
20
- const useStyles = makeStyles((theme) => ({
31
+ const useStyles = makeStyles(theme => ({
21
32
  root: {
22
33
  paddingRight: theme.spacing(1),
23
34
  paddingLeft: theme.spacing(1),
@@ -26,55 +37,77 @@ const useStyles = makeStyles((theme) => ({
26
37
  marginRight: theme.spacing(1),
27
38
  marginLeft: theme.spacing(1),
28
39
  marginTop: theme.spacing(1),
29
- marginBottom: theme.spacing(1),
40
+ marginBottom: theme.spacing(1)
30
41
  },
31
42
  caseViewHeader: {
32
43
  backgroundColor: theme.palette.info.light,
33
44
  color: theme.palette.getContrastText(theme.palette.info.light),
34
- borderRadius: "inherit",
45
+ borderRadius: 'inherit'
35
46
  },
36
47
  caseViewIconBox: {
37
48
  backgroundColor: theme.palette.info.dark,
38
49
  width: theme.spacing(8),
39
50
  height: theme.spacing(8),
40
- padding: theme.spacing(1),
51
+ padding: theme.spacing(1)
41
52
  },
42
53
  caseViewIconImage: {
43
54
  filter: 'invert(100%)'
44
55
  }
45
56
  }));
46
57
 
47
- export default function CaseView(props) {
58
+ export default function CaseView(props: CaseViewProps) {
59
+ // Get emitted components from map (so we can get any override that may exist)
60
+ const CaseViewActionsMenu = getComponentFromMap("CaseViewActionsMenu");
61
+ const VerticalTabs = getComponentFromMap("VerticalTabs");
62
+ const DeferLoad = getComponentFromMap("DeferLoad");
63
+
48
64
  const {
49
65
  getPConnect,
50
- icon,
66
+ icon = '',
51
67
  header,
52
68
  subheader,
53
- children,
54
- caseInfo: { availableActions = [], availableProcesses = [], hasNewAttachments }
69
+ children = [],
70
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
71
+ showIconInHeader = true,
72
+ caseInfo: {
73
+ availableActions = [],
74
+ availableProcesses = [],
75
+ hasNewAttachments,
76
+ caseTypeID = '',
77
+ caseTypeName = ''
78
+ }
55
79
  } = props;
56
80
  const currentCaseID = props.caseInfo.ID;
57
81
  let isComponentMounted = true;
58
82
 
59
- const { displayOnlyFA } = useContext(StoreContext);
83
+ const { displayOnlyFA } = useContext<any>(StoreContext);
60
84
 
61
85
  const thePConn = getPConnect();
62
86
 
63
87
  const classes = useStyles();
64
88
 
65
- const editAction = availableActions.find((action) => action.ID === 'pyUpdateCaseDetails');
89
+ const editAction = availableActions.find(action => action.ID === 'pyUpdateCaseDetails');
90
+
91
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
92
+ const localeCategory = 'CaseView';
93
+ const localeKey = `${caseTypeID}!CASE!${caseTypeName}`.toUpperCase();
66
94
 
67
95
  /**
68
96
  *
69
97
  * @param inName the metadata <em>name</em> that will cause a region to be returned
70
98
  */
71
- function getChildRegionByName(inName: string): any {
72
-
99
+ function getChildRegionByName(inName: string): any {
73
100
  for (const child of children) {
74
- const theMetadataType: string = child.props.getPConnect().getRawMetadata()['type'].toLowerCase();
75
- const theMetadataName: string = child.props.getPConnect().getRawMetadata()['name'].toLowerCase();
76
-
77
- if ((theMetadataType === "region") && (theMetadataName === inName )) {
101
+ const theMetadataType: string = child.props
102
+ .getPConnect()
103
+ .getRawMetadata()
104
+ ['type'].toLowerCase();
105
+ const theMetadataName: string = child.props
106
+ .getPConnect()
107
+ .getRawMetadata()
108
+ ['name'].toLowerCase();
109
+
110
+ if (theMetadataType === 'region' && theMetadataName === inName) {
78
111
  return child;
79
112
  }
80
113
  }
@@ -82,14 +115,13 @@ export default function CaseView(props) {
82
115
  return null;
83
116
  }
84
117
 
118
+ const theSummaryRegion = getChildRegionByName('summary');
119
+ const theStagesRegion = getChildRegionByName('stages');
120
+ const theTodoRegion = getChildRegionByName('todo');
121
+ const theUtilitiesRegion = getChildRegionByName('utilities');
122
+ const theTabsRegion = getChildRegionByName('tabs');
85
123
 
86
- const theSummaryRegion = getChildRegionByName("summary");
87
- const theStagesRegion = getChildRegionByName("stages");
88
- const theTodoRegion = getChildRegionByName("todo");
89
- const theUtilitiesRegion = getChildRegionByName("utilities");
90
- const theTabsRegion = getChildRegionByName("tabs");
91
-
92
- const svgCase = Utils.getImageSrc(icon, PCore.getAssetLoader().getStaticServerUrl());
124
+ const svgCase = Utils.getImageSrc(icon, Utils.getSDKStaticConentUrl());
93
125
 
94
126
  const [activeVertTab, setActiveVertTab] = useState(0);
95
127
 
@@ -127,8 +159,6 @@ export default function CaseView(props) {
127
159
  });
128
160
  }
129
161
 
130
-
131
-
132
162
  function handleVerticalTabClick(eventDetail: any) {
133
163
  const theItem = parseInt(eventDetail.additionalData.itemClicked, 10);
134
164
 
@@ -138,14 +168,13 @@ export default function CaseView(props) {
138
168
  }
139
169
  }
140
170
 
141
-
142
171
  // Add and Remove event listener for VerticalTabClick only at startup and teardown
143
172
  useEffect(() => {
144
173
  document.addEventListener('VerticalTabClick', (event: any) => {
145
174
  handleVerticalTabClick(event.detail);
146
175
  });
147
176
 
148
- return ():void => {
177
+ return (): void => {
149
178
  // inform that the component is unmounted so other code can
150
179
  // know not to try to call useState setters (to avoid console warnings)
151
180
  isComponentMounted = false;
@@ -153,74 +182,103 @@ export default function CaseView(props) {
153
182
  document.removeEventListener('VerticalTabClick', (event: any) => {
154
183
  handleVerticalTabClick(event.detail);
155
184
  });
156
- }
157
- }, [])
185
+ };
186
+ }, []);
158
187
 
159
188
  useEffect(() => {
160
189
  if (hasNewAttachments) {
161
- PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, true);
190
+ PCore.getPubSubUtils().publish(
191
+ PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
192
+ true
193
+ );
162
194
  }
163
195
  }, [hasNewAttachments]);
164
196
 
165
197
  function _editClick() {
166
-
167
198
  const actionsAPI = thePConn.getActionsApi();
168
199
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
169
200
 
170
- openLocalAction( editAction.ID, { ...editAction});
201
+ openLocalAction(editAction.ID, { ...editAction });
171
202
  }
172
203
 
173
-
174
204
  function getActionButtonsHtml(): any {
175
-
176
- const aBHtml = <Box>
177
- {editAction && (<Button onClick={() => {_editClick()}}>Edit</Button>)}
178
- <CaseViewActionsMenu getPConnect={getPConnect} availableActions={availableActions} availableProcesses={availableProcesses} />
179
- </Box>;
180
-
205
+ const aBHtml = (
206
+ <Box>
207
+ {editAction && (
208
+ <Button
209
+ onClick={() => {
210
+ _editClick();
211
+ }}
212
+ >
213
+ {localizedVal('Edit', localeCategory)}
214
+ </Button>
215
+ )}
216
+ <CaseViewActionsMenu
217
+ getPConnect={getPConnect}
218
+ availableActions={availableActions}
219
+ availableProcesses={availableProcesses}
220
+ caseTypeName={caseTypeName}
221
+ caseTypeID={caseTypeID}
222
+ />
223
+ </Box>
224
+ );
181
225
 
182
226
  return aBHtml;
183
-
184
227
  }
185
228
 
186
-
187
229
  function getContainerContents() {
188
-
189
230
  if (!displayOnlyFA) {
190
231
  // show full portal
191
232
  return (
192
233
  <Grid container>
193
234
  <Grid item xs={3}>
194
- <div hidden={true} id="current-caseID">{currentCaseID}</div>
195
- <Card className={classes.root} >
196
- <CardHeader className={classes.caseViewHeader}
197
- title={<Typography variant="h6" component="div">{header}</Typography>}
198
- subheader={<Typography variant="body1" component="div" id="caseId">{subheader}</Typography>}
199
- avatar={
200
- <Avatar className={classes.caseViewIconBox} variant="square">
201
- <img src={svgCase} className={classes.caseViewIconImage}/>
202
- </Avatar>
203
- }
204
- />
205
- {getActionButtonsHtml()}
206
- <Divider />
207
- {theSummaryRegion}
208
- <Divider />
209
- { vertTabInfo.length > 1 && <VerticalTabs tabconfig={vertTabInfo} />}
210
- </Card>
211
- </Grid>
235
+ <div hidden={true} id='current-caseID'>
236
+ {currentCaseID}
237
+ </div>
238
+ <Card className={classes.root}>
239
+ <CardHeader
240
+ className={classes.caseViewHeader}
241
+ title={
242
+ <Typography variant='h6' component='div'>
243
+ {PCore.getLocaleUtils().getLocaleValue(header, '', localeKey)}
244
+ </Typography>
245
+ }
246
+ subheader={
247
+ <Typography variant='body1' component='div' id='caseId'>
248
+ {subheader}
249
+ </Typography>
250
+ }
251
+ avatar={
252
+ <Avatar className={classes.caseViewIconBox} variant='square'>
253
+ <img src={svgCase} className={classes.caseViewIconImage} />
254
+ </Avatar>
255
+ }
256
+ />
257
+ {getActionButtonsHtml()}
258
+ <Divider />
259
+ {theSummaryRegion}
260
+ <Divider />
261
+ {vertTabInfo.length > 1 && <VerticalTabs tabconfig={vertTabInfo} />}
262
+ </Card>
263
+ </Grid>
212
264
 
213
- <Grid item xs={6}>
214
- {theStagesRegion}
215
- {theTodoRegion}
216
- { deferLoadInfo.length > 0 && <DeferLoad getPConnect={getPConnect} name={deferLoadInfo[activeVertTab].config.name } isTab />}
217
- </Grid>
265
+ <Grid item xs={6}>
266
+ {theStagesRegion}
267
+ {theTodoRegion}
268
+ {deferLoadInfo.length > 0 && (
269
+ <DeferLoad
270
+ getPConnect={getPConnect}
271
+ name={deferLoadInfo[activeVertTab].config.name}
272
+ isTab
273
+ />
274
+ )}
275
+ </Grid>
218
276
 
219
- <Grid item xs={3}>
220
- {theUtilitiesRegion}
277
+ <Grid item xs={3}>
278
+ {theUtilitiesRegion}
279
+ </Grid>
221
280
  </Grid>
222
- </Grid>
223
- )
281
+ );
224
282
  } else {
225
283
  // displayOnlyFA - only show the "todo" region
226
284
  return (
@@ -229,30 +287,9 @@ export default function CaseView(props) {
229
287
  {theTodoRegion}
230
288
  </Grid>
231
289
  </Grid>
232
- )
290
+ );
233
291
  }
234
292
  }
235
293
 
236
-
237
- return (
238
- getContainerContents()
239
- );
294
+ return getContainerContents();
240
295
  }
241
-
242
- CaseView.defaultProps = {
243
- icon: "",
244
- children: [],
245
- caseInfo: {},
246
- showIconInHeader: true,
247
- getPConnect: null
248
- };
249
-
250
- CaseView.propTypes = {
251
- icon: PropTypes.string,
252
- children: PropTypes.arrayOf(PropTypes.node),
253
- subheader: PropTypes.string.isRequired,
254
- header: PropTypes.string.isRequired,
255
- showIconInHeader: PropTypes.bool,
256
- caseInfo: PropTypes.objectOf(PropTypes.any),
257
- getPConnect: PropTypes.func
258
- };
@@ -1,13 +1,25 @@
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';
5
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+
7
+ interface CaseViewActionsMenuProps extends PConnProps {
8
+ // If any, enter additional props that only exist on this component
9
+ availableActions: Array<any>,
10
+ availableProcesses: Array<any>,
11
+ caseTypeID: string,
12
+ caseTypeName: string
13
+ }
14
+
6
15
 
7
- export default function CaseViewActionsMenu(props) {
8
- const {getPConnect, availableActions, availableProcesses} = props;
16
+ export default function CaseViewActionsMenu(props:CaseViewActionsMenuProps) {
17
+ const { getPConnect, availableActions, availableProcesses, caseTypeID, caseTypeName } = props;
9
18
  const thePConn = getPConnect();
10
19
 
20
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
21
+ const localeCategory = 'CaseView';
22
+ const localeKey = `${caseTypeID}!CASE!${caseTypeName}`.toUpperCase();
11
23
 
12
24
  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
13
25
 
@@ -21,35 +33,34 @@ export default function CaseViewActionsMenu(props) {
21
33
 
22
34
  const arMenuItems: Array<any> = [];
23
35
 
24
-
25
36
  function _actionMenuActionsClick(data) {
26
-
27
37
  const actionsAPI = thePConn.getActionsApi();
28
38
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
29
39
 
30
- openLocalAction( data.ID, { ...data, containerName: 'modal', type: 'express'});
40
+ openLocalAction(data.ID, { ...data, containerName: 'modal', type: 'express' });
31
41
  // after doing the action, close the menu...
32
42
  handleClose();
33
-
34
43
  }
35
44
 
36
-
37
- availableActions.forEach( (action) => {
38
- arMenuItems.push( <MenuItem key={action.ID} onClick={() => _actionMenuActionsClick(action)}>{action.name}</MenuItem> )
45
+ availableActions.forEach(action => {
46
+ arMenuItems.push(
47
+ <MenuItem key={action.ID} onClick={() => _actionMenuActionsClick(action)}>
48
+ {localizedVal(action.name, '', localeKey)}
49
+ </MenuItem>
50
+ );
39
51
  });
40
52
 
41
- availableProcesses.forEach( (process) => {
42
- arMenuItems.push( <MenuItem onClick={handleClose}>{process.name}</MenuItem> )
53
+ availableProcesses.forEach(process => {
54
+ arMenuItems.push(<MenuItem onClick={handleClose}>{process.name}</MenuItem>);
43
55
  });
44
56
 
45
-
46
57
  return (
47
58
  <React.Fragment>
48
- <Button aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick}>
49
- Actions...
59
+ <Button aria-controls='simple-menu' aria-haspopup='true' onClick={handleClick}>
60
+ {localizedVal('Actions...', localeCategory)}
50
61
  </Button>
51
62
  <Menu
52
- id="simple-menu"
63
+ id='simple-menu'
53
64
  anchorEl={anchorEl}
54
65
  keepMounted
55
66
  open={Boolean(anchorEl)}
@@ -60,14 +71,3 @@ export default function CaseViewActionsMenu(props) {
60
71
  </React.Fragment>
61
72
  );
62
73
  }
63
-
64
- CaseViewActionsMenu.defaultProps = {
65
- availableActions: [],
66
- availableProcesses: []
67
- }
68
-
69
- CaseViewActionsMenu.propTypes = {
70
- getPConnect: PropTypes.func.isRequired,
71
- availableActions: PropTypes.arrayOf(PropTypes.object),
72
- availableProcesses: PropTypes.arrayOf(PropTypes.any)
73
- };
@@ -1,17 +1,25 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  /* eslint-disable no-unused-vars */
3
3
  /* 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';
4
+ import React, { useState } from 'react';
10
5
  import { Button, Card, makeStyles } from '@material-ui/core';
6
+ import { getToDoAssignments } from '@pega/react-sdk-components/lib/components/infra/Containers/FlowContainer/helpers';
7
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
+
9
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
+
11
+ // Confirmation does NOT have getPConnect. So, no need to extend from PConnProps
11
12
 
12
- declare const PCore;
13
+ interface ConfirmationProps extends PConnProps {
14
+ // If any, enter additional props that only exist on this component
15
+ children: Array<any>;
16
+ datasource: { source: any };
17
+ label: string;
18
+ showLabel: boolean;
19
+ showTasks: boolean;
20
+ }
13
21
 
14
- const useStyles = makeStyles(theme => ({
22
+ const useStyles = makeStyles((theme) => ({
15
23
  root: {
16
24
  paddingRight: theme.spacing(1),
17
25
  paddingLeft: theme.spacing(1),
@@ -24,7 +32,11 @@ const useStyles = makeStyles(theme => ({
24
32
  }
25
33
  }));
26
34
 
27
- export default function Confirmation(props) {
35
+ export default function Confirmation(props: ConfirmationProps) {
36
+ // Get emitted components from map (so we can get any override that may exist)
37
+ const ToDo = getComponentFromMap('Todo'); // NOTE: ConstellationJS Engine uses "Todo" and not "ToDo"!!!
38
+ const Details = getComponentFromMap('Details');
39
+
28
40
  const classes = useStyles();
29
41
  const CONSTS = PCore.getConstants();
30
42
  const [showConfirmView, setShowConfirmView] = useState(true);
@@ -32,20 +44,12 @@ export default function Confirmation(props) {
32
44
  // Get the inherited props from the parent to determine label settings
33
45
  // Not using whatsNext at the moment, need to figure out the use of it
34
46
  const whatsNext = datasource?.source;
35
- const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
36
- const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(
37
- getPConnect().getTarget()
38
- );
39
- const rootInfo = PCore.getContainerUtils().getContainerItemData(
40
- getPConnect().getTarget(),
41
- activeContainerItemID
42
- );
47
+ const items = whatsNext.length > 0 ? whatsNext.map((item) => item.label) : '';
48
+ const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget());
49
+ const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), activeContainerItemID);
43
50
  const onConfirmViewClose = () => {
44
51
  setShowConfirmView(false);
45
- PCore.getPubSubUtils().publish(
46
- PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CLOSE_CONFIRM_VIEW,
47
- rootInfo
48
- );
52
+ PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CLOSE_CONFIRM_VIEW, rootInfo);
49
53
  };
50
54
  const todoProps = { ...props, renderTodoInConfirm: true };
51
55
  const toDoList = getToDoAssignments(getPConnect());
@@ -53,49 +57,22 @@ export default function Confirmation(props) {
53
57
  const showDetails = detailProps?.children?.[0]?.props?.getPConnect()?.getChildren()?.length > 0;
54
58
  return showConfirmView ? (
55
59
  <Card className={classes.root}>
56
- <h2 id='confirm-label'>{props.showLabel ? props.label : ''}</h2>
60
+ <h2 id="confirm-label">{props.showLabel ? props.label : ''}</h2>
57
61
  {showDetails ? <Details {...detailProps} /> : undefined}
58
62
  {showTasks ? (
59
63
  toDoList && toDoList.length > 0 ? (
60
- <ToDo
61
- {...todoProps}
62
- datasource={{ source: toDoList }}
63
- getPConnect={getPConnect}
64
- type={CONSTS.TODO}
65
- headerText='Open Tasks'
66
- isConfirm
67
- />
64
+ <ToDo {...todoProps} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText="Open Tasks" isConfirm />
68
65
  ) : undefined
69
66
  ) : undefined}
70
67
  <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
71
- <Button variant='contained' color='primary' onClick={onConfirmViewClose}>
68
+ <Button variant="contained" color="primary" onClick={onConfirmViewClose}>
72
69
  Done
73
70
  </Button>
74
71
  </div>
75
72
  </Card>
76
73
  ) : toDoList && toDoList.length > 0 ? (
77
74
  <Card className={classes.root}>
78
- <ToDo
79
- {...props}
80
- datasource={{ source: toDoList }}
81
- getPConnect={getPConnect}
82
- type={CONSTS.TODO}
83
- headerText='Tasks'
84
- isConfirm
85
- />
75
+ <ToDo {...props} datasource={{ source: toDoList }} getPConnect={getPConnect} type={CONSTS.TODO} headerText="Tasks" isConfirm />
86
76
  </Card>
87
77
  ) : null;
88
78
  }
89
-
90
- Confirmation.defaultProps = {
91
- datasource: undefined,
92
- label: '',
93
- showLabel: true
94
- };
95
-
96
- Confirmation.propTypes = {
97
- getPConnect: PropTypes.func.isRequired,
98
- datasource: PropTypes.objectOf(PropTypes.any),
99
- label: PropTypes.string,
100
- showLabel: PropTypes.bool
101
- };