@pega/react-sdk-overrides 23.1.10 → 23.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/SECURITY.md +10 -0
  4. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +6 -14
  5. package/lib/designSystemExtension/Banner/Banner.tsx +14 -11
  6. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +27 -22
  8. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +14 -20
  9. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  10. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +44 -19
  11. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +7 -12
  12. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +21 -32
  13. package/lib/designSystemExtension/Operator/Operator.tsx +94 -82
  14. package/lib/designSystemExtension/Pulse/Pulse.tsx +14 -16
  15. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +6 -5
  16. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +14 -14
  17. package/lib/field/AutoComplete/AutoComplete.tsx +24 -26
  18. package/lib/field/AutoComplete/config-ext.json +2 -3
  19. package/lib/field/CancelAlert/CancelAlert.tsx +98 -84
  20. package/lib/field/CancelAlert/index.tsx +1 -1
  21. package/lib/field/Checkbox/Checkbox.tsx +120 -63
  22. package/lib/field/Checkbox/config-ext.json +2 -3
  23. package/lib/field/Currency/Currency.tsx +25 -50
  24. package/lib/field/Currency/config-ext.json +2 -3
  25. package/lib/field/Currency/currency-utils.ts +9 -16
  26. package/lib/field/Date/Date.tsx +15 -11
  27. package/lib/field/Date/config-ext.json +2 -3
  28. package/lib/field/DateTime/DateTime.tsx +9 -9
  29. package/lib/field/DateTime/config-ext.json +1 -2
  30. package/lib/field/Decimal/Decimal.tsx +33 -44
  31. package/lib/field/Decimal/config-ext.json +1 -2
  32. package/lib/field/Decimal/index.tsx +1 -1
  33. package/lib/field/Dropdown/Dropdown.tsx +122 -31
  34. package/lib/field/Dropdown/config-ext.json +1 -2
  35. package/lib/field/Email/Email.tsx +11 -10
  36. package/lib/field/Email/config-ext.json +1 -2
  37. package/lib/field/Email/index.tsx +1 -1
  38. package/lib/field/Group/Group.tsx +39 -0
  39. package/lib/field/Group/config-ext.json +7 -0
  40. package/lib/field/Group/index.tsx +1 -0
  41. package/lib/field/Integer/Integer.tsx +8 -7
  42. package/lib/field/Integer/config-ext.json +1 -2
  43. package/lib/field/MultiSelect/Multiselect.tsx +244 -0
  44. package/lib/field/MultiSelect/index.tsx +1 -0
  45. package/lib/field/MultiSelect/utils.ts +230 -0
  46. package/lib/field/Percentage/Percentage.tsx +46 -41
  47. package/lib/field/Percentage/config-ext.json +1 -2
  48. package/lib/field/Phone/Phone.tsx +13 -12
  49. package/lib/field/Phone/index.tsx +1 -1
  50. package/lib/field/RadioButtons/RadioButtons.tsx +20 -18
  51. package/lib/field/RadioButtons/config-ext.json +1 -2
  52. package/lib/field/RichText/RichText.tsx +8 -7
  53. package/lib/field/ScalarList/ScalarList.tsx +3 -13
  54. package/lib/field/ScalarList/config-ext.json +1 -2
  55. package/lib/field/SemanticLink/SemanticLink.tsx +7 -7
  56. package/lib/field/SemanticLink/config-ext.json +1 -2
  57. package/lib/field/SemanticLink/utils.ts +8 -11
  58. package/lib/field/TextArea/TextArea.tsx +7 -6
  59. package/lib/field/TextArea/config-ext.json +1 -2
  60. package/lib/field/TextContent/TextContent.tsx +4 -6
  61. package/lib/field/TextContent/config-ext.json +1 -2
  62. package/lib/field/TextInput/TextInput.tsx +9 -7
  63. package/lib/field/TextInput/config-ext.json +1 -2
  64. package/lib/field/TextInput/index.tsx +1 -1
  65. package/lib/field/Time/Time.tsx +11 -11
  66. package/lib/field/Time/config-ext.json +1 -2
  67. package/lib/field/URL/URL.tsx +9 -8
  68. package/lib/field/URL/config-ext.json +1 -2
  69. package/lib/field/URL/index.tsx +1 -1
  70. package/lib/field/UserReference/UserReference.tsx +18 -16
  71. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  72. package/lib/field/UserReference/config-ext.json +1 -2
  73. package/lib/helpers/attachmentHelpers.ts +13 -8
  74. package/lib/helpers/case-utils.tsx +4 -8
  75. package/lib/helpers/common-utils.ts +5 -1
  76. package/lib/helpers/data_page.ts +3 -7
  77. package/lib/helpers/date-format-utils.ts +3 -3
  78. package/lib/helpers/event-utils.ts +3 -3
  79. package/lib/helpers/field-group-utils.ts +1 -1
  80. package/lib/helpers/formatters/Boolean.ts +9 -26
  81. package/lib/helpers/formatters/Currency.ts +15 -21
  82. package/lib/helpers/formatters/CurrencyMap.ts +505 -501
  83. package/lib/helpers/formatters/Date.ts +20 -26
  84. package/lib/helpers/formatters/common.ts +1 -2
  85. package/lib/helpers/formatters/index.ts +26 -19
  86. package/lib/helpers/instructions-utils.ts +38 -0
  87. package/lib/helpers/reactContextHelpers.ts +2 -2
  88. package/lib/helpers/simpleTableHelpers.ts +59 -83
  89. package/lib/helpers/state-utils.tsx +5 -9
  90. package/lib/helpers/template-utils.ts +3 -6
  91. package/lib/helpers/utils.ts +5 -5
  92. package/lib/helpers/versionHelpers.ts +1 -4
  93. package/lib/infra/ActionButtons/ActionButtons.tsx +38 -29
  94. package/lib/infra/ActionButtons/index.tsx +1 -1
  95. package/lib/infra/Assignment/Assignment.tsx +99 -79
  96. package/lib/infra/Assignment/index.tsx +1 -1
  97. package/lib/infra/AssignmentCard/AssignmentCard.tsx +13 -16
  98. package/lib/infra/AssignmentCard/index.tsx +1 -1
  99. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -213
  100. package/lib/infra/Containers/FlowContainer/helpers.ts +34 -45
  101. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
  103. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  104. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +227 -218
  105. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  106. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  107. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  108. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  109. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +36 -46
  110. package/lib/infra/Containers/helpers.ts +6 -0
  111. package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -42
  112. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -43
  113. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -28
  114. package/lib/infra/DeferLoad/index.tsx +1 -1
  115. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +16 -30
  116. package/lib/infra/MultiStep/MultiStep.css +11 -15
  117. package/lib/infra/MultiStep/MultiStep.tsx +176 -212
  118. package/lib/infra/MultiStep/index.tsx +1 -1
  119. package/lib/infra/NavBar/NavBar.css +103 -105
  120. package/lib/infra/NavBar/NavBar.tsx +19 -31
  121. package/lib/infra/Reference/Reference.tsx +16 -18
  122. package/lib/infra/Region/Region.tsx +4 -6
  123. package/lib/infra/RootContainer/RootContainer.tsx +75 -111
  124. package/lib/infra/RootContainer/index.tsx +1 -1
  125. package/lib/infra/Stages/Stages.tsx +32 -39
  126. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +11 -11
  127. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +21 -28
  128. package/lib/infra/View/View.tsx +17 -21
  129. package/lib/template/AppShell/AppShell.css +22 -23
  130. package/lib/template/AppShell/AppShell.tsx +39 -74
  131. package/lib/template/BannerPage/BannerPage.tsx +12 -14
  132. package/lib/template/CaseSummary/CaseSummary.tsx +58 -18
  133. package/lib/template/CaseSummary/config-ext.json +1 -2
  134. package/lib/template/CaseView/CaseView.tsx +34 -63
  135. package/lib/template/CaseView/config-ext.json +1 -2
  136. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +63 -19
  137. package/lib/template/Confirmation/Confirmation.tsx +12 -17
  138. package/lib/template/Confirmation/config-ext.json +1 -2
  139. package/lib/template/DataReference/DataReference.tsx +95 -121
  140. package/lib/template/DataReference/config-ext.json +1 -2
  141. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  142. package/lib/template/DefaultForm/DefaultForm.tsx +13 -16
  143. package/lib/template/DefaultForm/config-ext.json +1 -2
  144. package/lib/template/Details/Details/Details.tsx +19 -22
  145. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +9 -13
  146. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  147. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -24
  148. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  149. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +19 -25
  150. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  151. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  152. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +15 -14
  153. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +15 -22
  154. package/lib/template/InlineDashboard/InlineDashboard.tsx +12 -14
  155. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +12 -16
  156. package/lib/template/ListPage/ListPage.tsx +5 -10
  157. package/lib/template/ListPage/config-ext.json +1 -2
  158. package/lib/template/ListView/DefaultViewMeta.ts +1 -3
  159. package/lib/template/ListView/ListView.tsx +185 -175
  160. package/lib/template/ListView/config-ext.json +1 -2
  161. package/lib/template/ListView/hooks.ts +24 -26
  162. package/lib/template/ListView/utils.ts +51 -87
  163. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +20 -20
  164. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  165. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +25 -38
  166. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +20 -25
  167. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  168. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  169. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +14 -24
  170. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  171. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +9 -19
  172. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  173. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +14 -15
  174. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  175. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +3 -10
  176. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  177. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +6 -10
  178. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  179. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  180. package/lib/template/PromotedFilters/PromotedFilters.tsx +32 -28
  181. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +37 -33
  182. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  183. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -121
  184. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +24 -25
  185. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +30 -30
  186. package/lib/template/SubTabs/SubTabs.tsx +22 -40
  187. package/lib/template/SubTabs/config-ext.json +1 -2
  188. package/lib/template/SubTabs/tabUtils.ts +2 -5
  189. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  190. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +30 -28
  191. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  192. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +3 -10
  193. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  194. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +30 -28
  195. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  196. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  197. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +22 -34
  198. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +24 -28
  199. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  200. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  201. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +13 -21
  202. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  203. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +8 -16
  204. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  205. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  206. package/lib/template/WssNavBar/WssNavBar.tsx +18 -21
  207. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +29 -28
  208. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  209. package/lib/widget/Attachment/Attachment.css +60 -1
  210. package/lib/widget/Attachment/Attachment.tsx +378 -405
  211. package/lib/widget/Attachment/index.tsx +1 -1
  212. package/lib/widget/CaseHistory/CaseHistory.tsx +64 -66
  213. package/lib/widget/CaseHistory/config-ext.json +1 -2
  214. package/lib/widget/CaseHistory/index.tsx +1 -1
  215. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +16 -18
  216. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  217. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +310 -246
  218. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  219. package/lib/widget/Followers/Followers.tsx +23 -20
  220. package/lib/widget/Followers/config-ext.json +1 -2
  221. package/lib/widget/QuickCreate/QuickCreate.tsx +68 -42
  222. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  223. package/lib/widget/SummaryItem/SummaryItem.tsx +58 -58
  224. package/lib/widget/SummaryItem/index.tsx +1 -1
  225. package/lib/widget/SummaryList/SummaryList.tsx +7 -10
  226. package/lib/widget/ToDo/ToDo.css +4 -4
  227. package/lib/widget/ToDo/ToDo.tsx +52 -53
  228. package/lib/widget/ToDo/config-ext.json +1 -2
  229. package/package.json +5 -2
  230. package/lib/helpers/auth.js +0 -834
  231. package/lib/helpers/authManager.ts +0 -933
  232. package/lib/helpers/config_access.js +0 -186
@@ -1,29 +1,25 @@
1
- import React from "react";
2
1
  import { makeStyles } from '@material-ui/core/styles';
3
-
4
2
  import Button from '@material-ui/core/Button';
5
- import { Grid, Divider } from "@material-ui/core";
3
+ import { Grid, Divider } from '@material-ui/core';
6
4
 
7
5
  // ActionButtons does NOT have getPConnect. So, no need to extend from PConnProps
8
6
  interface ActionButtonsProps {
9
7
  // If any, enter additional props that only exist on this component
10
- arMainButtons?: Array<any>,
11
- arSecondaryButtons?: Array<any>,
12
- onButtonPress: any
8
+ arMainButtons?: any[];
9
+ arSecondaryButtons?: any[];
10
+ onButtonPress: any;
13
11
  }
14
12
 
15
-
16
13
  const useStyles = makeStyles((/* theme */) => ({
17
14
  button: {
18
- padding: "0px 5px",
15
+ padding: '0px 5px'
19
16
  },
20
17
  divider: {
21
- marginTop: "10px",
22
- marginBottom: "10px"
18
+ marginTop: '10px',
19
+ marginBottom: '10px'
23
20
  }
24
21
  }));
25
22
 
26
-
27
23
  export default function ActionButtons(props: ActionButtonsProps) {
28
24
  const { arMainButtons = [], arSecondaryButtons = [], onButtonPress } = props;
29
25
  const classes = useStyles();
@@ -31,35 +27,48 @@ export default function ActionButtons(props: ActionButtonsProps) {
31
27
  const localeCategory = 'Assignment';
32
28
 
33
29
  function _onButtonPress(sAction: string, sButtonType: string) {
34
-
35
30
  onButtonPress(sAction, sButtonType);
36
31
  }
37
32
 
38
33
  return (
39
- <React.Fragment>
40
- <Divider className={classes.divider}/>
41
- <Grid container spacing={4} justifyContent="space-between">
34
+ <>
35
+ <Divider className={classes.divider} />
36
+ <Grid container spacing={4} justifyContent='space-between'>
42
37
  <Grid item>
43
38
  <Grid container spacing={1}>
44
- {arSecondaryButtons.map((sButton) => (
45
- <Grid item key={sButton.name}>
46
- <Button variant="contained" color="secondary" onClick={() => { _onButtonPress(sButton.jsAction, "secondary")}} >{localizedVal(sButton.name, localeCategory)}</Button>
47
- </Grid>
48
- ))}
39
+ {arSecondaryButtons.map(sButton => (
40
+ <Grid item key={sButton.name}>
41
+ <Button
42
+ variant='contained'
43
+ color='secondary'
44
+ onClick={() => {
45
+ _onButtonPress(sButton.jsAction, 'secondary');
46
+ }}
47
+ >
48
+ {localizedVal(sButton.name, localeCategory)}
49
+ </Button>
50
+ </Grid>
51
+ ))}
49
52
  </Grid>
50
53
  </Grid>
51
54
  <Grid item>
52
55
  <Grid container spacing={1}>
53
- {arMainButtons.map((mButton) => (
54
- <Grid item key={mButton.name}>
55
- <Button variant="contained" color="primary" onClick={() => { _onButtonPress(mButton.jsAction, "primary")}} >{localizedVal(mButton.name, localeCategory)}</Button>
56
- </Grid>
57
- ))}
56
+ {arMainButtons.map(mButton => (
57
+ <Grid item key={mButton.name}>
58
+ <Button
59
+ variant='contained'
60
+ color='primary'
61
+ onClick={() => {
62
+ _onButtonPress(mButton.jsAction, 'primary');
63
+ }}
64
+ >
65
+ {localizedVal(mButton.name, localeCategory)}
66
+ </Button>
67
+ </Grid>
68
+ ))}
58
69
  </Grid>
59
70
  </Grid>
60
71
  </Grid>
61
-
62
- </React.Fragment>
63
-
64
- )
72
+ </>
73
+ );
65
74
  }
@@ -1 +1 @@
1
- export { default } from './ActionButtons';
1
+ export { default } from './ActionButtons';
@@ -1,29 +1,25 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { PropsWithChildren, useEffect, useState } from 'react';
2
2
  import Snackbar from '@material-ui/core/Snackbar';
3
3
  import IconButton from '@material-ui/core/IconButton';
4
4
  import CloseIcon from '@material-ui/icons/Close';
5
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
5
 
7
- // import type { PConnProps } from '../../../types/PConnProps';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
7
 
9
- // Can't use AssignmentProps until the following are NOT private
10
- // getCaseInfo().isAssignmentInCreateStage()
11
- // getCaseInfo().isLocalAction()
12
- // interface AssignmentProps extends PConnProps {
13
- // // If any, enter additional props that only exist on this component
14
- // children: Array<any>,
15
- // itemKey: string,
16
- // isInModal: boolean,
17
- // banners: Array<any>
18
- // // eslint-disable-next-line react/no-unused-prop-types
19
- // actionButtons: Array<any>,
20
- // }
8
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
21
9
 
10
+ interface AssignmentProps extends PConnProps {
11
+ // If any, enter additional props that only exist on this component
12
+ itemKey: string;
13
+ isInModal: boolean;
14
+ banners: any[];
15
+ // eslint-disable-next-line react/no-unused-prop-types
16
+ actionButtons: any[];
17
+ }
22
18
 
23
- export default function Assignment(props /* : AssignmentProps */) {
19
+ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
24
20
  // Get emitted components from map (so we can get any override that may exist)
25
- const AssignmentCard = getComponentFromMap("AssignmentCard");
26
- const MultiStep = getComponentFromMap("MultiStep");
21
+ const AssignmentCard = getComponentFromMap('AssignmentCard');
22
+ const MultiStep = getComponentFromMap('MultiStep');
27
23
 
28
24
  const { getPConnect, children, itemKey = '', isInModal = false, banners = [] } = props;
29
25
  const thePConn = getPConnect();
@@ -31,8 +27,8 @@ export default function Assignment(props /* : AssignmentProps */) {
31
27
  const [bHasNavigation, setHasNavigation] = useState(false);
32
28
  const [actionButtons, setActionButtons] = useState([]);
33
29
  const [bIsVertical, setIsVertical] = useState(false);
34
- const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<Array<any>>([]);
35
- const [arNavigationSteps, setArNavigationSteps] = useState<Array<any>>([]);
30
+ const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<any[]>([]);
31
+ const [arNavigationSteps, setArNavigationSteps] = useState<any[]>([]);
36
32
 
37
33
  const actionsAPI = thePConn.getActionsApi();
38
34
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
@@ -50,18 +46,14 @@ export default function Assignment(props /* : AssignmentProps */) {
50
46
  const [showSnackbar, setShowSnackbar] = useState(false);
51
47
  const [snackbarMessage, setSnackbarMessage] = useState('');
52
48
 
53
- function findCurrentIndicies(
54
- arStepperSteps: Array<any>,
55
- arIndicies: Array<number>,
56
- depth: number
57
- ): Array<number> {
49
+ function findCurrentIndicies(arStepperSteps: any[], arIndicies: number[], depth: number): number[] {
58
50
  let count = 0;
59
51
  arStepperSteps.forEach(step => {
60
52
  if (step.visited_status === 'current') {
61
53
  arIndicies[depth] = count;
62
54
 
63
55
  // add in
64
- step['step_status'] = '';
56
+ step.step_status = '';
65
57
  } else if (step.visited_status === 'success') {
66
58
  count += 1;
67
59
  step.step_status = 'completed';
@@ -78,16 +70,29 @@ export default function Assignment(props /* : AssignmentProps */) {
78
70
  return arIndicies;
79
71
  }
80
72
 
81
- useEffect(() => {
82
- if (children && children.length > 0) {
83
- // debugger;
73
+ function getStepsInfo(steps, formedSteps: any = []) {
74
+ steps.forEach(step => {
75
+ if (step.name) {
76
+ step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
77
+ }
78
+ if (step.steps) {
79
+ formedSteps = getStepsInfo(step.steps, formedSteps);
80
+ } else {
81
+ formedSteps.push(step);
82
+ }
83
+ });
84
+ return formedSteps;
85
+ }
84
86
 
85
- const oWorkItem = children[0].props.getPConnect();
87
+ useEffect(() => {
88
+ if (children) {
89
+ const firstChild = Array.isArray(children) ? children[0] : children;
90
+ const oWorkItem = firstChild.props.getPConnect();
86
91
  const oWorkData = oWorkItem.getDataObject();
87
- const oData = thePConn.getDataObject(''); // 1st arg empty string until typedefs allow it to be optional
92
+ const oData: any = thePConn.getDataObject(''); // 1st arg empty string until typedefs allow it to be optional
88
93
 
89
94
  if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
90
- const oCaseInfo = oData["caseInfo"];
95
+ const oCaseInfo = oData.caseInfo;
91
96
 
92
97
  if (oCaseInfo && oCaseInfo.actionButtons) {
93
98
  setActionButtons(oCaseInfo.actionButtons);
@@ -97,28 +102,23 @@ export default function Assignment(props /* : AssignmentProps */) {
97
102
  setHasNavigation(true);
98
103
 
99
104
  if (
100
- oCaseInfo.navigation.template &&
101
- oCaseInfo.navigation.template.toLowerCase() === 'standard'
105
+ (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'standard') ||
106
+ oCaseInfo?.navigation?.steps?.length === 1
102
107
  ) {
103
108
  setHasNavigation(false);
104
- } else if (
105
- oCaseInfo.navigation.template &&
106
- oCaseInfo.navigation.template.toLowerCase() === 'vertical'
107
- ) {
109
+ } else if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'vertical') {
108
110
  setIsVertical(true);
109
111
  } else {
110
112
  setIsVertical(false);
111
113
  }
112
- const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
113
- steps.forEach(step => {
114
- if (step.name) {
115
- step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
116
- }
117
- });
118
- setArNavigationSteps(steps);
119
- setArCurrentStepIndicies(
120
- findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0)
121
- );
114
+
115
+ if (oCaseInfo?.navigation?.steps) {
116
+ const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
117
+ const formedSteps = getStepsInfo(steps);
118
+ setArNavigationSteps(formedSteps);
119
+ }
120
+
121
+ setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
122
122
  }
123
123
  }
124
124
  }
@@ -141,10 +141,7 @@ export default function Assignment(props /* : AssignmentProps */) {
141
141
 
142
142
  function onSaveActionSuccess(data) {
143
143
  actionsAPI.cancelAssignment(itemKey).then(() => {
144
- PCore.getPubSubUtils().publish(
145
- PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED,
146
- data
147
- );
144
+ PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
148
145
  });
149
146
  }
150
147
 
@@ -170,9 +167,7 @@ export default function Assignment(props /* : AssignmentProps */) {
170
167
 
171
168
  savePromise
172
169
  .then(() => {
173
- const caseType = thePConn
174
- .getCaseInfo()
175
- .c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
170
+ const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
176
171
  onSaveActionSuccess({ caseType, caseID, assignmentID });
177
172
  })
178
173
  .catch(() => {
@@ -186,11 +181,12 @@ export default function Assignment(props /* : AssignmentProps */) {
186
181
  // check if create stage (modal)
187
182
  const { PUB_SUB_EVENTS } = PCore.getConstants();
188
183
  const { publish } = PCore.getPubSubUtils();
184
+ // @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
189
185
  const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
190
186
  const isLocalAction =
187
+ // @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
191
188
  thePConn.getCaseInfo().isLocalAction() ||
192
- (PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION &&
193
- getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION, ''));// 2nd arg empty string until typedefs allow it to be optional
189
+ (PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
194
190
  if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
195
191
  const cancelPromise = cancelCreateStageAssignment(itemKey);
196
192
 
@@ -239,11 +235,50 @@ export default function Assignment(props /* : AssignmentProps */) {
239
235
  }
240
236
  }
241
237
 
238
+ function getRefreshProps(refreshConditions) {
239
+ // refreshConditions cuurently supports only "Changes" event
240
+ if (!refreshConditions) {
241
+ return [];
242
+ }
243
+ return refreshConditions.filter(item => item.event && item.event === 'Changes').map(item => [item.field, item.field?.substring(1)]) || [];
244
+ }
245
+
246
+ // expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
247
+ // @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
248
+ const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
249
+ const context = thePConn.getContextName();
250
+ const pageReference = thePConn.getPageReference();
251
+
252
+ // refresh api de-registration
253
+ PCore.getRefreshManager().deRegisterForRefresh(context);
254
+
255
+ // refresh api registration
256
+ const refreshProps = getRefreshProps(refreshConditions);
257
+ const caseKey = thePConn.getCaseInfo().getKey();
258
+ const refreshOptions = {
259
+ autoDetectRefresh: true,
260
+ preserveClientChanges: false
261
+ };
262
+ if (refreshProps.length > 0) {
263
+ refreshProps.forEach(prop => {
264
+ PCore.getRefreshManager().registerForRefresh(
265
+ 'PROP_CHANGE',
266
+ thePConn.getActionsApi().refreshCaseView.bind(thePConn.getActionsApi(), caseKey, null, pageReference, {
267
+ ...refreshOptions,
268
+ refreshFor: prop[0]
269
+ }),
270
+ `${pageReference}.${prop[1]}`,
271
+ `${context}/${pageReference}`,
272
+ context
273
+ );
274
+ });
275
+ }
276
+
242
277
  return (
243
278
  <div id='Assignment'>
244
279
  {banners}
245
280
  {bHasNavigation ? (
246
- <React.Fragment>
281
+ <>
247
282
  <MultiStep
248
283
  getPConnect={getPConnect}
249
284
  itemKey={itemKey}
@@ -261,25 +296,15 @@ export default function Assignment(props /* : AssignmentProps */) {
261
296
  onClose={handleSnackbarClose}
262
297
  message={snackbarMessage}
263
298
  action={
264
- <IconButton
265
- size='small'
266
- aria-label='close'
267
- color='inherit'
268
- onClick={handleSnackbarClose}
269
- >
299
+ <IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
270
300
  <CloseIcon fontSize='small' />
271
301
  </IconButton>
272
302
  }
273
303
  />
274
- </React.Fragment>
304
+ </>
275
305
  ) : (
276
- <React.Fragment>
277
- <AssignmentCard
278
- getPConnect={getPConnect}
279
- itemKey={itemKey}
280
- actionButtons={actionButtons}
281
- onButtonPress={buttonPress}
282
- >
306
+ <>
307
+ <AssignmentCard getPConnect={getPConnect} itemKey={itemKey} actionButtons={actionButtons} onButtonPress={buttonPress}>
283
308
  {children}
284
309
  </AssignmentCard>
285
310
  <Snackbar
@@ -288,17 +313,12 @@ export default function Assignment(props /* : AssignmentProps */) {
288
313
  onClose={handleSnackbarClose}
289
314
  message={snackbarMessage}
290
315
  action={
291
- <IconButton
292
- size='small'
293
- aria-label='close'
294
- color='inherit'
295
- onClick={handleSnackbarClose}
296
- >
316
+ <IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
297
317
  <CloseIcon fontSize='small' />
298
318
  </IconButton>
299
319
  }
300
320
  />
301
- </React.Fragment>
321
+ </>
302
322
  )}
303
323
  </div>
304
324
  );
@@ -1 +1 @@
1
- export { default } from './Assignment';
1
+ export { default } from './Assignment';
@@ -1,27 +1,24 @@
1
- import React, { useState, useEffect } from "react";
2
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
1
+ import { PropsWithChildren, useEffect, useState } from 'react';
2
+
3
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
5
 
5
6
  interface AssignmentCardProps extends PConnProps {
6
7
  // If any, enter additional props that only exist on this component
7
- children: Array<any>,
8
- actionButtons: any,
9
- onButtonPress: any,
10
- // eslint-disable-next-line react/no-unused-prop-types
11
- itemKey?: string
8
+ actionButtons: any;
9
+ onButtonPress: any;
12
10
  }
13
11
 
14
-
15
- export default function AssignmentCard(props: AssignmentCardProps) {
12
+ export default function AssignmentCard(props: PropsWithChildren<AssignmentCardProps>) {
16
13
  // Get emitted components from map (so we can get any override that may exist)
17
- const ActionButtons = getComponentFromMap("ActionButtons");
14
+ const ActionButtons = getComponentFromMap('ActionButtons');
18
15
 
19
- const { children, actionButtons, onButtonPress} = props;
16
+ const { children, actionButtons, onButtonPress } = props;
20
17
 
21
18
  const [arMainButtons, setArMainButtons] = useState([]);
22
19
  const [arSecondaryButtons, setArSecondaryButtons] = useState([]);
23
20
 
24
- useEffect( ()=> {
21
+ useEffect(() => {
25
22
  if (actionButtons) {
26
23
  setArMainButtons(actionButtons.main);
27
24
  setArSecondaryButtons(actionButtons.secondary);
@@ -35,9 +32,9 @@ export default function AssignmentCard(props: AssignmentCardProps) {
35
32
  return (
36
33
  <>
37
34
  {children}
38
- {
39
- arMainButtons && arSecondaryButtons && <ActionButtons arMainButtons={arMainButtons} arSecondaryButtons={arSecondaryButtons} onButtonPress={buttonPress}></ActionButtons>
40
- }
35
+ {arMainButtons && arSecondaryButtons && (
36
+ <ActionButtons arMainButtons={arMainButtons} arSecondaryButtons={arSecondaryButtons} onButtonPress={buttonPress} />
37
+ )}
41
38
  </>
42
- )
39
+ );
43
40
  }
@@ -1 +1 @@
1
- export { default } from './AssignmentCard';
1
+ export { default } from './AssignmentCard';