@pega/react-sdk-overrides 24.1.10 → 24.2.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 (103) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +1 -1
  2. package/lib/designSystemExtension/Banner/Banner.tsx +1 -1
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +11 -2
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +4 -4
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +4 -4
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +4 -4
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +6 -6
  9. package/lib/designSystemExtension/Operator/Operator.tsx +6 -5
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +2 -2
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +3 -2
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
  13. package/lib/field/AutoComplete/AutoComplete.tsx +4 -4
  14. package/lib/field/CancelAlert/CancelAlert.tsx +4 -7
  15. package/lib/field/Checkbox/Checkbox.tsx +4 -4
  16. package/lib/field/Currency/Currency.tsx +10 -7
  17. package/lib/field/Date/Date.tsx +27 -42
  18. package/lib/field/DateTime/DateTime.tsx +39 -36
  19. package/lib/field/Decimal/Decimal.tsx +9 -4
  20. package/lib/field/Dropdown/Dropdown.tsx +29 -22
  21. package/lib/field/Email/Email.tsx +29 -8
  22. package/lib/field/Group/Group.tsx +2 -2
  23. package/lib/field/Integer/Integer.tsx +22 -8
  24. package/lib/field/Multiselect/Multiselect.tsx +8 -14
  25. package/lib/field/Percentage/Percentage.tsx +8 -4
  26. package/lib/field/Phone/Phone.tsx +6 -5
  27. package/lib/field/Phone/config-ext.json +8 -0
  28. package/lib/field/RadioButtons/RadioButtons.tsx +3 -6
  29. package/lib/field/RichText/RichText.tsx +1 -1
  30. package/lib/field/RichText/config-ext.json +10 -0
  31. package/lib/field/ScalarList/ScalarList.tsx +3 -4
  32. package/lib/field/SemanticLink/SemanticLink.tsx +4 -4
  33. package/lib/field/TextArea/TextArea.tsx +26 -8
  34. package/lib/field/TextContent/TextContent.tsx +1 -1
  35. package/lib/field/TextInput/TextInput.tsx +2 -2
  36. package/lib/field/Time/Time.tsx +28 -21
  37. package/lib/field/URL/URL.tsx +26 -7
  38. package/lib/field/UserReference/UserReference.tsx +3 -5
  39. package/lib/helpers/common-utils.ts +24 -1
  40. package/lib/helpers/field-group-utils.ts +2 -2
  41. package/lib/helpers/formatters/Currency.ts +11 -16
  42. package/lib/helpers/formatters/common.ts +2 -1
  43. package/lib/helpers/formatters/index.ts +2 -4
  44. package/lib/helpers/simpleTableHelpers.ts +1 -1
  45. package/lib/infra/ActionButtons/ActionButtons.tsx +3 -3
  46. package/lib/infra/Assignment/Assignment.tsx +12 -12
  47. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +16 -28
  48. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  49. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +9 -4
  50. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +8 -8
  51. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  52. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +1 -1
  53. package/lib/infra/DashboardFilter/DashboardFilter.tsx +3 -4
  54. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
  55. package/lib/infra/DeferLoad/DeferLoad.tsx +8 -8
  56. package/lib/infra/MultiStep/MultiStep.tsx +15 -14
  57. package/lib/infra/NavBar/NavBar.css +1 -0
  58. package/lib/infra/NavBar/NavBar.tsx +25 -17
  59. package/lib/infra/RootContainer/RootContainer.tsx +5 -6
  60. package/lib/infra/Stages/Stages.tsx +4 -4
  61. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +4 -3
  62. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +2 -2
  63. package/lib/infra/View/View.tsx +37 -3
  64. package/lib/template/AppShell/AppShell.tsx +60 -10
  65. package/lib/template/BannerPage/config-ext.json +9 -0
  66. package/lib/template/CaseView/CaseView.tsx +10 -9
  67. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +7 -7
  68. package/lib/template/Confirmation/Confirmation.tsx +3 -2
  69. package/lib/template/DataReference/DataReference.tsx +2 -2
  70. package/lib/template/Details/Details/Details.tsx +2 -2
  71. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +3 -3
  72. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +2 -2
  73. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +2 -2
  74. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +4 -4
  75. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +10 -5
  76. package/lib/template/InlineDashboard/InlineDashboard.tsx +2 -2
  77. package/lib/template/InlineDashboardPage/config-ext.json +9 -0
  78. package/lib/template/ListView/ListView.tsx +79 -70
  79. package/lib/template/ListView/utils.ts +1 -2
  80. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +2 -2
  81. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +2 -2
  82. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
  83. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
  84. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +110 -86
  85. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
  86. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  87. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +2 -2
  88. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +2 -2
  89. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +2 -2
  90. package/lib/template/WssNavBar/WssNavBar.tsx +9 -9
  91. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +2 -2
  92. package/lib/widget/Attachment/Attachment.css +1 -0
  93. package/lib/widget/Attachment/Attachment.tsx +7 -9
  94. package/lib/widget/CaseHistory/CaseHistory.tsx +12 -10
  95. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -1
  96. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +5 -4
  97. package/lib/widget/Followers/Followers.tsx +2 -2
  98. package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
  99. package/lib/widget/QuickCreate/config-ext.json +9 -0
  100. package/lib/widget/SummaryItem/SummaryItem.tsx +4 -3
  101. package/lib/widget/ToDo/ToDo.tsx +92 -22
  102. package/package.json +1 -1
  103. /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
@@ -1,7 +1,8 @@
1
- import { KeyboardTimePicker } from '@material-ui/pickers';
2
- import AccessTimeIcon from '@material-ui/icons/AccessTime';
1
+ import { TimePicker } from '@mui/x-date-pickers/TimePicker';
2
+ // import AccessTimeIcon from '@mui/icons-material/AccessTime';
3
3
  import dayjs from 'dayjs';
4
4
 
5
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
7
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
8
 
@@ -14,10 +15,12 @@ export default function Time(props: TimeProps) {
14
15
  const FieldValueList = getComponentFromMap('FieldValueList');
15
16
  const TextInput = getComponentFromMap('TextInput');
16
17
 
17
- const { label, required, disabled, value = '', validatemessage, status, onChange, readOnly, helperText, displayMode, hideLabel, testId } = props;
18
+ const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, helperText, displayMode, hideLabel, testId } = props;
18
19
  const helperTextToDisplay = validatemessage || helperText;
19
-
20
- if (displayMode === 'LABELS_LEFT') {
20
+ const pConn = getPConnect();
21
+ const actions = pConn.getActionsApi();
22
+ const propName = (pConn.getStateProps() as any).value;
23
+ if (displayMode === 'DISPLAY_ONLY') {
21
24
  return <FieldValueList name={hideLabel ? '' : label} value={value} />;
22
25
  }
23
26
 
@@ -36,12 +39,12 @@ export default function Time(props: TimeProps) {
36
39
  };
37
40
 
38
41
  const handleChange = date => {
39
- const theValue = date && date.isValid() ? date.format('HH:mm') : null;
40
- onChange({ value: theValue });
42
+ const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;
43
+ handleEvent(actions, 'changeNblur', propName, theValue);
41
44
  };
42
45
 
43
46
  let timeValue: any = null;
44
- if (value) {
47
+ if (value && Object.keys(value).length) {
45
48
  const timeArray = value.split(':').map(itm => Number(itm));
46
49
  timeValue = dayjs().hour(timeArray[0]).minute(timeArray[1]);
47
50
  }
@@ -52,25 +55,29 @@ export default function Time(props: TimeProps) {
52
55
  //
53
56
 
54
57
  return (
55
- <KeyboardTimePicker
56
- variant='inline'
57
- inputVariant='outlined'
58
- placeholder='hh:mm am'
59
- keyboardIcon={<AccessTimeIcon />}
60
- fullWidth
61
- required={required}
58
+ <TimePicker
59
+ // keyboardIcon={<AccessTimeIcon />}
60
+ // fullWidth
61
+
62
62
  disabled={disabled}
63
- error={status === 'error'}
64
- helperText={helperTextToDisplay}
65
63
  minutesStep={5}
66
- size='small'
67
64
  label={label}
68
- autoOk
69
- mask='__:__ _m'
65
+ // autoOk
66
+ // mask='__:__ _m'
70
67
  format='hh:mm a'
71
68
  value={timeValue}
72
69
  onChange={handleChange}
73
- InputProps={{ inputProps: { ...testProp } }}
70
+ slotProps={{
71
+ textField: {
72
+ variant: 'outlined',
73
+ placeholder: 'hh:mm am',
74
+ required,
75
+ error: status === 'error',
76
+ helperText: helperTextToDisplay,
77
+ size: 'small',
78
+ InputProps: { ...testProp }
79
+ }
80
+ }}
74
81
  />
75
82
  );
76
83
  }
@@ -1,5 +1,7 @@
1
- import { TextField } from '@material-ui/core';
1
+ import { useEffect, useState } from 'react';
2
+ import { TextField } from '@mui/material';
2
3
 
4
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
3
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
6
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
7
 
@@ -16,14 +18,13 @@ export default function URLComponent(props: URLComponentProps) {
16
18
  const TextInput = getComponentFromMap('TextInput');
17
19
 
18
20
  const {
21
+ getPConnect,
19
22
  label,
20
23
  required,
21
24
  disabled,
22
25
  value = '',
23
26
  validatemessage,
24
27
  status,
25
- onChange,
26
- onBlur,
27
28
  readOnly,
28
29
  testId,
29
30
  helperText,
@@ -33,7 +34,17 @@ export default function URLComponent(props: URLComponentProps) {
33
34
  } = props;
34
35
  const helperTextToDisplay = validatemessage || helperText;
35
36
 
36
- if (displayMode === 'LABELS_LEFT') {
37
+ const [inputValue, setInputValue] = useState('');
38
+
39
+ const pConn = getPConnect();
40
+ const actions = pConn.getActionsApi();
41
+ const propName = (pConn.getStateProps() as any).value;
42
+
43
+ useEffect(() => {
44
+ setInputValue(value);
45
+ }, [value]);
46
+
47
+ if (displayMode === 'DISPLAY_ONLY') {
37
48
  return <FieldValueList name={hideLabel ? '' : label} value={value} />;
38
49
  }
39
50
 
@@ -51,6 +62,14 @@ export default function URLComponent(props: URLComponentProps) {
51
62
  'data-test-id': testId
52
63
  };
53
64
 
65
+ const handleChange = event => {
66
+ setInputValue(event?.target?.value);
67
+ };
68
+
69
+ function handleBlur() {
70
+ handleEvent(actions, 'changeNblur', propName, inputValue);
71
+ }
72
+
54
73
  return (
55
74
  <TextField
56
75
  type='url'
@@ -61,11 +80,11 @@ export default function URLComponent(props: URLComponentProps) {
61
80
  size='small'
62
81
  required={required}
63
82
  disabled={disabled}
64
- onChange={onChange}
65
- onBlur={!readOnly ? onBlur : undefined}
83
+ onChange={handleChange}
84
+ onBlur={!readOnly ? handleBlur : undefined}
66
85
  error={status === 'error'}
67
86
  label={label}
68
- value={value}
87
+ value={inputValue}
69
88
  InputProps={{ inputProps: { ...testProp } }}
70
89
  />
71
90
  );
@@ -1,5 +1,5 @@
1
1
  import { memo, useEffect, useState } from 'react';
2
- import { Typography } from '@material-ui/core';
2
+ import { Typography } from '@mui/material';
3
3
 
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
5
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
@@ -80,10 +80,8 @@ const UserReference = (props: UserReferenceProps) => {
80
80
  };
81
81
 
82
82
  PCore.getRestClient()
83
- // @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
84
- // @ts-ignore - Expected 3 arguments, but got 2
85
83
  .invokeRestApi('getListData', { queryPayload })
86
- .then((res: any) => {
84
+ .then(res => {
87
85
  const ddDataSource = res.data.data.map(listItem => ({
88
86
  key: listItem.pyUserIdentifier,
89
87
  value: listItem.pyUserName
@@ -99,7 +97,7 @@ const UserReference = (props: UserReferenceProps) => {
99
97
 
100
98
  let userReferenceComponent: any = null;
101
99
 
102
- if (displayMode === 'LABELS_LEFT') {
100
+ if (displayMode === 'DISPLAY_ONLY') {
103
101
  return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} />;
104
102
  }
105
103
 
@@ -1,4 +1,27 @@
1
- /* eslint-disable import/prefer-default-export */
2
1
  export function isEmptyObject(obj: Object): boolean {
3
2
  return Object.keys(obj).length === 0;
4
3
  }
4
+
5
+ /**
6
+ * Get a localized value from the Generic Fields
7
+ * @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')
8
+ * @param key - The key of the string to localize
9
+ * @returns The localized string or the key itself if no translation is found
10
+ */
11
+ export function getGenericFieldsLocalizedValue(path: string, key: string): string {
12
+ const GENERIC_BUNDLE_KEY = PCore.getLocaleUtils().GENERIC_BUNDLE_KEY;
13
+ const localeStore = PCore.getLocaleUtils().localeStore[GENERIC_BUNDLE_KEY];
14
+
15
+ if (!localeStore) return key;
16
+
17
+ // Split the path and traverse the object
18
+ const pathParts = path.split('.');
19
+ let currentObj = localeStore;
20
+
21
+ for (const part of pathParts) {
22
+ if (!currentObj[part]) return key;
23
+ currentObj = currentObj[part];
24
+ }
25
+
26
+ return currentObj[key] || key;
27
+ }
@@ -49,8 +49,8 @@ export function buildView(pConn, index, viewConfigPath): ReactElement {
49
49
  };
50
50
 
51
51
  const view = PCore.createPConnect(config);
52
- if (pConn.getConfigProps()?.displayMode === 'LABELS_LEFT') {
53
- view.getPConnect()?.setInheritedProp('displayMode', 'LABELS_LEFT');
52
+ if (pConn.getConfigProps()?.displayMode === 'DISPLAY_ONLY') {
53
+ view.getPConnect()?.setInheritedProp('displayMode', 'DISPLAY_ONLY');
54
54
  }
55
55
  return createElement(createPConnectComponent(), view);
56
56
  }
@@ -5,10 +5,7 @@ import CurrencyMap from './CurrencyMap';
5
5
  function NumberFormatter(value, { locale = 'en-US', decPlaces = 2, style = '', currency = 'USD' } = {}): string {
6
6
  const currentLocale: string | undefined = getLocale(locale);
7
7
  if (value !== null && value !== undefined) {
8
- return Number(value).toLocaleString(currentLocale, {
9
- minimumFractionDigits: decPlaces,
10
- maximumFractionDigits: decPlaces
11
- });
8
+ return Number(value).toLocaleString(currentLocale, { minimumFractionDigits: decPlaces, maximumFractionDigits: decPlaces });
12
9
  }
13
10
  return value;
14
11
  }
@@ -20,14 +17,16 @@ function CurrencyFormatter(
20
17
  const currentLocale: string | undefined = getLocale(locale);
21
18
  let formattedValue: string = value;
22
19
  if (value !== null && value !== undefined && value !== '') {
23
- formattedValue = NumberFormatter(value, {
24
- locale: currentLocale,
25
- decPlaces,
26
- style,
27
- currency
28
- });
20
+ formattedValue = NumberFormatter(value, { locale: currentLocale, decPlaces, style, currency });
29
21
 
30
- let countryCode: string | undefined = currentLocale?.split('-')[1].toUpperCase();
22
+ // For currency other than EUR, we need to determine the country code from currency code
23
+ // If currency is EUR, we use the locale to determine the country code
24
+ let countryCode: string | undefined;
25
+ if (currency !== 'EUR') {
26
+ countryCode = currency.substring(0, 2);
27
+ } else {
28
+ countryCode = currentLocale?.split('-')[1].toUpperCase();
29
+ }
31
30
 
32
31
  // If countryCode is still undefined, setting it as US
33
32
  if (!countryCode) {
@@ -67,11 +66,7 @@ export default {
67
66
  Currency: (value, options) => CurrencyFormatter(value, options),
68
67
  'Currency-Code': (value, options) => CurrencyFormatter(value, { ...options, symbol: false }),
69
68
  Decimal: (value, options) => NumberFormatter(value, options),
70
- 'Decimal-Auto': (value, options) =>
71
- NumberFormatter(value, {
72
- ...options,
73
- decPlaces: Number.isInteger(value) ? 0 : 2
74
- }),
69
+ 'Decimal-Auto': (value, options) => NumberFormatter(value, { ...options, decPlaces: Number.isInteger(value) ? 0 : 2 }),
75
70
  Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),
76
71
  Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })
77
72
  };
@@ -7,7 +7,8 @@ export function getLocale(locale: string = '') {
7
7
  return Intl.DateTimeFormat().resolvedOptions().locale;
8
8
  }
9
9
 
10
- export function getCurrentTimezone(timezone: string = 'America/New_York') {
10
+ export function getCurrentTimezone(timezone?: string) {
11
+ // use timezone if specified
11
12
  if (timezone) return timezone;
12
13
  return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
13
14
  }
@@ -18,10 +18,8 @@ function getDateObject(text): Date {
18
18
  const day = parseInt(timeStamp.substr(6, 2), 10);
19
19
 
20
20
  const date = new Date();
21
-
22
- date.setDate(day);
23
- date.setMonth(month);
24
- date.setFullYear(year);
21
+ // Fix to handle all the dates, raised via https://github.com/pegasystems/react-sdk-components/issues/442
22
+ date.setFullYear(year, month, day);
25
23
 
26
24
  if (isDateTime) {
27
25
  const hours = parseInt(timeStamp.substr(9, 2), 10);
@@ -231,7 +231,7 @@ export const filterData = filterByColumns => {
231
231
  case 'Date':
232
232
  case 'DateTime':
233
233
  case 'Time':
234
- value = item[filterObj.ref] !== null ?? item[filterObj.ref] !== '' ? Utils.getSeconds(item[filterObj.ref]) : null;
234
+ value = (item[filterObj.ref] !== null ?? item[filterObj.ref] !== '') ? Utils.getSeconds(item[filterObj.ref]) : null;
235
235
  filterValue =
236
236
  filterObj.containsFilterValue !== null && filterObj.containsFilterValue !== '' ? Utils.getSeconds(filterObj.containsFilterValue) : null;
237
237
 
@@ -1,6 +1,6 @@
1
- import { makeStyles } from '@material-ui/core/styles';
2
- import Button from '@material-ui/core/Button';
3
- import { Grid, Divider } from '@material-ui/core';
1
+ import makeStyles from '@mui/styles/makeStyles';
2
+ import Button from '@mui/material/Button';
3
+ import { Grid, Divider } from '@mui/material';
4
4
 
5
5
  // ActionButtons does NOT have getPConnect. So, no need to extend from PConnProps
6
6
  interface ActionButtonsProps {
@@ -1,9 +1,10 @@
1
1
  import React, { PropsWithChildren, useEffect, useState } from 'react';
2
- import Snackbar from '@material-ui/core/Snackbar';
3
- import IconButton from '@material-ui/core/IconButton';
4
- import CloseIcon from '@material-ui/icons/Close';
2
+ import Snackbar from '@mui/material/Snackbar';
3
+ import IconButton from '@mui/material/IconButton';
4
+ import CloseIcon from '@mui/icons-material/Close';
5
5
 
6
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
+ import { useFocusFirstField, useScrolltoTop } from '@pega/react-sdk-components/lib/hooks';
7
8
 
8
9
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
10
 
@@ -86,6 +87,10 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
86
87
  return formedSteps;
87
88
  }
88
89
 
90
+ const scrollId = window.location.href.includes('embedded') ? '#pega-part-of-page' : '#portal';
91
+ useScrolltoTop(scrollId, children);
92
+ useFocusFirstField('Assignment', children);
93
+
89
94
  useEffect(() => {
90
95
  if (children) {
91
96
  const firstChild = Array.isArray(children) ? children[0] : children;
@@ -94,7 +99,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
94
99
  const oData: any = thePConn.getDataObject(''); // 1st arg empty string until typedefs allow it to be optional
95
100
 
96
101
  if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
97
- const oCaseInfo = oData.caseInfo;
102
+ const oCaseInfo = oData?.caseInfo;
98
103
 
99
104
  if (oCaseInfo && oCaseInfo.actionButtons) {
100
105
  setActionButtons(oCaseInfo.actionButtons);
@@ -134,7 +139,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
134
139
  setShowSnackbar(true);
135
140
  }
136
141
 
137
- function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
142
+ function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
138
143
  if (reason === 'clickaway') {
139
144
  return;
140
145
  }
@@ -142,7 +147,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
142
147
  }
143
148
 
144
149
  function onSaveActionSuccess(data) {
145
- actionsAPI.cancelAssignment(itemKey).then(() => {
150
+ actionsAPI.cancelAssignment(itemKey, false).then(() => {
146
151
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
147
152
  });
148
153
  }
@@ -169,7 +174,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
169
174
 
170
175
  savePromise
171
176
  .then(() => {
172
- // @ts-ignore - Property 'c11nEnv' is private and only accessible within class 'CaseInfo'.
173
177
  const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
174
178
  onSaveActionSuccess({ caseType, caseID, assignmentID });
175
179
  })
@@ -184,10 +188,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
184
188
  // check if create stage (modal)
185
189
  const { PUB_SUB_EVENTS } = PCore.getConstants();
186
190
  const { publish } = PCore.getPubSubUtils();
187
- // @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
188
191
  const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
189
192
  const isLocalAction =
190
- // @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
191
193
  thePConn.getCaseInfo().isLocalAction() ||
192
194
  (PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
193
195
  if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
@@ -201,7 +203,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
201
203
  showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
202
204
  });
203
205
  } else {
204
- const cancelPromise = cancelAssignment(itemKey);
206
+ const cancelPromise = cancelAssignment(itemKey, false);
205
207
 
206
208
  cancelPromise
207
209
  .then(data => {
@@ -230,7 +232,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
230
232
  break;
231
233
  }
232
234
  } else if (sButtonType === 'primary') {
233
- // eslint-disable-next-line sonarjs/no-small-switch
234
235
  switch (sAction) {
235
236
  case 'finishAssignment': {
236
237
  const finishPromise = finishAssignment(itemKey);
@@ -271,7 +272,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
271
272
  }
272
273
 
273
274
  // expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
274
- // @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
275
275
  const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
276
276
  const context = thePConn.getContextName();
277
277
  const pageReference = thePConn.getPageReference();
@@ -1,20 +1,19 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
 
3
3
  import { useState, useEffect, useContext } from 'react';
4
- import { makeStyles } from '@material-ui/core/styles';
5
- import { Card, CardHeader, Avatar, Typography } from '@material-ui/core';
6
- import { Alert } from '@material-ui/lab';
7
- import DayjsUtils from '@date-io/dayjs';
8
- import { MuiPickersUtilsProvider } from '@material-ui/pickers';
4
+ import makeStyles from '@mui/styles/makeStyles';
5
+ import { Alert, Card, CardHeader, Avatar, Typography } from '@mui/material';
9
6
 
10
7
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
11
8
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
12
- import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
9
+ import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/infra/Containers/container-helpers';
13
10
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
14
- import { withSimpleViewContainerRenderer } from '../SimpleView/SimpleView';
11
+ import { withSimpleViewContainerRenderer } from '@pega/react-sdk-components/lib/components/infra/Containers/SimpleView/SimpleView';
15
12
 
16
13
  import { addContainerItem, getToDoAssignments, showBanner, hasContainerItems } from './helpers';
17
14
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
15
+ import { LocalizationProvider } from '@mui/x-date-pickers';
16
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
18
17
 
19
18
  interface FlowContainerProps extends PConnProps {
20
19
  // If any, enter additional props that only exist on this component
@@ -118,12 +117,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
118
117
  if (caseViewMode && caseViewMode === 'review') {
119
118
  return true;
120
119
  }
121
- // eslint-disable-next-line sonarjs/prefer-single-boolean-return
122
- if (caseViewMode && caseViewMode === 'perform') {
123
- return false;
124
- }
125
-
126
- return true;
120
+ return !(caseViewMode && caseViewMode === 'perform');
127
121
  }
128
122
 
129
123
  function initComponent() {
@@ -182,11 +176,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
182
176
 
183
177
  const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
184
178
  // const allAssignments = [];
185
- // eslint-disable-next-line sonarjs/prefer-single-boolean-return
186
- if (childCases && childCases.length > 0) {
187
- return true;
188
- }
189
- return false;
179
+ return !!(childCases && childCases.length > 0);
190
180
  }
191
181
 
192
182
  function hasAssignments() {
@@ -267,17 +257,15 @@ export const FlowContainer = (props: FlowContainerProps) => {
267
257
  // if have caseMessage show message and end
268
258
  const theCaseMessages = localizedVal(thePConn.getValue('caseMessages', ''), localeCategory); // 2nd arg empty string until typedefs properly allow optional
269
259
 
270
- if (theCaseMessages || !hasAssignments()) {
260
+ // caseMessages's behavior has changed in 24.2, and hence it doesn't let Optional Action work.
261
+ // Changing the below condition for now. Was: (theCaseMessages || !hasAssignments())
262
+ if (!hasAssignments()) {
271
263
  // Temp fix for 8.7 change: confirmationNote no longer coming through in caseMessages$.
272
264
  // So, if we get here and caseMessages$ is empty, use default value in DX API response
273
265
  setCaseMessages(theCaseMessages || localizedVal('Thank you! The next step in this case has been routed appropriately.', localeCategory));
274
266
  setHasCaseMessages(true);
275
267
  setShowConfirm(true);
276
268
 
277
- // publish this "assignmentFinished" for mashup, need to get approved as a standard
278
- // @ts-ignore - second parameter “payload” for publish method should be optional
279
- PCore.getPubSubUtils().publish('assignmentFinished');
280
-
281
269
  // debugger;
282
270
  setCheckSvg(Utils.getImageSrc('check', Utils.getSDKStaticConentUrl()));
283
271
  } else {
@@ -289,7 +277,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
289
277
 
290
278
  const caseId = thePConn.getCaseSummary().content.pyID;
291
279
  const urgency = getPConnect().getCaseSummary().assignments ? getPConnect().getCaseSummary().assignments?.[0].urgency : '';
292
- const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName());
280
+ const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName() || '');
293
281
 
294
282
  const bShowBanner = showBanner(getPConnect);
295
283
 
@@ -313,21 +301,21 @@ export const FlowContainer = (props: FlowContainerProps) => {
313
301
  avatar={<Avatar className={`${classes.avatar} psdk-avatar`}>{operatorInitials}</Avatar>}
314
302
  />
315
303
  {displayPageMessages()}
316
- <MuiPickersUtilsProvider utils={DayjsUtils}>
304
+ <LocalizationProvider dateAdapter={AdapterDayjs}>
317
305
  <Assignment getPConnect={getPConnect} itemKey={itemKey}>
318
306
  {rootViewElement}
319
307
  </Assignment>
320
- </MuiPickersUtilsProvider>
308
+ </LocalizationProvider>
321
309
  </Card>
322
310
  ) : (
323
311
  <Card className={`${classes.root} psdk-root`}>
324
312
  <Typography variant='h6'>{localizedVal(containerName, undefined, key)}</Typography>
325
313
  {displayPageMessages()}
326
- <MuiPickersUtilsProvider utils={DayjsUtils}>
314
+ <LocalizationProvider dateAdapter={AdapterDayjs}>
327
315
  <Assignment getPConnect={getPConnect} itemKey={itemKey}>
328
316
  {rootViewElement}
329
317
  </Assignment>
330
- </MuiPickersUtilsProvider>
318
+ </LocalizationProvider>
331
319
  </Card>
332
320
  )
333
321
  ) : (
@@ -88,11 +88,7 @@ export const hasAssignments = pConnect => {
88
88
  const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS);
89
89
  const childCasesAssignments = getChildCaseAssignments(pConnect);
90
90
 
91
- // eslint-disable-next-line sonarjs/prefer-single-boolean-return
92
- if (assignments || childCasesAssignments || isCaseWideLocalAction(pConnect)) {
93
- return true;
94
- }
95
- return false;
91
+ return !!(assignments || childCasesAssignments || isCaseWideLocalAction(pConnect));
96
92
  };
97
93
 
98
94
  export const showBanner = getPConnect => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
- import Button from '@material-ui/core/Button';
3
- import { makeStyles } from '@material-ui/core/styles';
2
+ import Button from '@mui/material/Button';
3
+ import makeStyles from '@mui/styles/makeStyles';
4
4
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  const useStyles = makeStyles((/* theme */) => ({
@@ -49,10 +49,15 @@ function ListViewActionButtons(props: ListViewActionButtonsProps) {
49
49
  getPConnect()
50
50
  .getActionsApi()
51
51
  .submitEmbeddedDataModal(context)
52
- .then(() => {})
52
+ .then(() => {
53
+ closeActionsDialog();
54
+ })
55
+ .catch(err => {
56
+ // eslint-disable-next-line no-console
57
+ console.log(err);
58
+ })
53
59
  .finally(() => {
54
60
  setIsDisabled(false);
55
- closeActionsDialog();
56
61
  });
57
62
  }}
58
63
  >
@@ -1,10 +1,10 @@
1
1
  import { createElement, useEffect, useRef, useState } from 'react';
2
- import Dialog from '@material-ui/core/Dialog';
3
- import DialogContent from '@material-ui/core/DialogContent';
4
- import DialogTitle from '@material-ui/core/DialogTitle';
5
- import { makeStyles } from '@material-ui/core/styles';
6
- import { MuiPickersUtilsProvider } from '@material-ui/pickers';
7
- import DayjsUtils from '@date-io/dayjs';
2
+ import Dialog from '@mui/material/Dialog';
3
+ import DialogContent from '@mui/material/DialogContent';
4
+ import DialogTitle from '@mui/material/DialogTitle';
5
+ import makeStyles from '@mui/styles/makeStyles';
6
+ import { LocalizationProvider } from '@mui/x-date-pickers';
7
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
8
8
  import difference from 'lodash.difference';
9
9
 
10
10
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
@@ -315,7 +315,7 @@ export default function ModalViewContainer(props: ModalViewContainerProps) {
315
315
  </DialogTitle>
316
316
  <DialogContent className={`${classes.dlgContent} psdk-dialog-content`}>
317
317
  {bShowModal ? (
318
- <MuiPickersUtilsProvider utils={DayjsUtils}>
318
+ <LocalizationProvider dateAdapter={AdapterDayjs}>
319
319
  <Assignment
320
320
  getPConnect={createdView.configObject.getPConnect}
321
321
  itemKey={itemKey}
@@ -327,7 +327,7 @@ export default function ModalViewContainer(props: ModalViewContainerProps) {
327
327
  >
328
328
  {arNewChildrenAsReact}
329
329
  </Assignment>
330
- </MuiPickersUtilsProvider>
330
+ </LocalizationProvider>
331
331
  ) : null}
332
332
  </DialogContent>
333
333
 
@@ -1,7 +1,7 @@
1
1
  import { useEffect, createElement } from 'react';
2
2
 
3
3
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
- import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
4
+ import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/infra/Containers/container-helpers';
5
5
 
6
6
  const processRootViewDetails = (rootView, containerItem, options) => {
7
7
  const {
@@ -1,5 +1,5 @@
1
1
  import React, { createElement, useContext, useEffect, useState } from 'react';
2
- import { Box, CircularProgress } from '@material-ui/core';
2
+ import { Box, CircularProgress } from '@mui/material';
3
3
 
4
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
5
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-shadow */
2
- /* eslint-disable operator-assignment */
3
2
  import { forwardRef, PropsWithChildren, useEffect, useRef, useState } from 'react';
4
- import { TextField } from '@material-ui/core';
3
+ import { TextField } from '@mui/material';
5
4
  import { v4 as uuidv4 } from 'uuid';
6
5
  import { debounce } from 'throttle-debounce';
7
6
  import DatePicker from 'react-datepicker';
@@ -20,7 +19,7 @@ interface DashboardFilterProps extends PConnProps {
20
19
  }
21
20
 
22
21
  export default function DashboardFilter(props: PropsWithChildren<DashboardFilterProps>) {
23
- const { children = [], name, filterProp, type = '', metadata = null, getPConnect } = props;
22
+ const { children, name, filterProp, type = '', metadata = null, getPConnect } = props;
24
23
  const { current: filterId } = useRef(uuidv4());
25
24
 
26
25
  const [startDate, setStartDate] = useState(null);
@@ -35,7 +34,7 @@ export default function DashboardFilter(props: PropsWithChildren<DashboardFilter
35
34
  } else if (type === 'RadioButtons') {
36
35
  const reference = getPConnect().getFullReference() + filterProp;
37
36
  const radList = document.getElementsByName(reference);
38
- for (let i = 0; i < radList.length; i = i + 1) {
37
+ for (let i = 0; i < radList.length; i += 1) {
39
38
  if ((radList[i] as HTMLInputElement).value === '') {
40
39
  (radList[i] as HTMLInputElement).checked = true;
41
40
  } else {