@pega/react-sdk-overrides 0.25.1 → 0.25.3

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 (144) hide show
  1. package/lib/designSystemExtension/Banner/Banner.css +1 -1
  2. package/lib/designSystemExtension/Banner/Banner.tsx +7 -7
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +52 -36
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -13
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +8 -9
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +9 -9
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +7 -8
  9. package/lib/designSystemExtension/Operator/Operator.tsx +21 -19
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +1 -1
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +28 -3
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +4 -4
  13. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -1
  14. package/lib/field/AutoComplete/AutoComplete.tsx +1 -1
  15. package/lib/field/CancelAlert/CancelAlert.css +4 -4
  16. package/lib/field/CancelAlert/CancelAlert.tsx +6 -6
  17. package/lib/field/Checkbox/Checkbox.tsx +97 -4
  18. package/lib/field/Currency/Currency.tsx +3 -3
  19. package/lib/field/Currency/currency-utils.ts +1 -2
  20. package/lib/field/Date/Date.tsx +3 -7
  21. package/lib/field/DateTime/DateTime.tsx +3 -8
  22. package/lib/field/Decimal/Decimal.tsx +3 -5
  23. package/lib/field/Dropdown/Dropdown.tsx +5 -7
  24. package/lib/field/Email/Email.tsx +11 -13
  25. package/lib/field/Group/Group.tsx +7 -7
  26. package/lib/field/Integer/Integer.tsx +5 -7
  27. package/lib/field/Location/Location.tsx +256 -0
  28. package/lib/field/Location/config-ext.json +8 -0
  29. package/lib/field/Location/index.tsx +1 -0
  30. package/lib/field/ObjectReference/ObjectReference.tsx +235 -0
  31. package/lib/field/ObjectReference/index.tsx +1 -0
  32. package/lib/field/ObjectReference/utils.ts +111 -0
  33. package/lib/field/Percentage/Percentage.tsx +3 -7
  34. package/lib/field/Phone/Phone.tsx +7 -5
  35. package/lib/field/RadioButtons/RadioButtons.tsx +47 -2
  36. package/lib/field/RichText/RichText.tsx +1 -1
  37. package/lib/field/ScalarList/ScalarList.tsx +2 -3
  38. package/lib/field/SelectableCard/SelectableCard.tsx +175 -0
  39. package/lib/field/SelectableCard/index.tsx +1 -0
  40. package/lib/field/SelectableCard/utils.tsx +226 -0
  41. package/lib/field/SemanticLink/SemanticLink.tsx +160 -28
  42. package/lib/field/SemanticLink/utils.ts +1 -1
  43. package/lib/field/TextArea/TextArea.tsx +5 -7
  44. package/lib/field/TextContent/TextContent.tsx +1 -2
  45. package/lib/field/TextInput/TextInput.tsx +5 -7
  46. package/lib/field/Time/Time.tsx +3 -7
  47. package/lib/field/URL/URL.tsx +5 -7
  48. package/lib/field/UserReference/UserReference.tsx +1 -2
  49. package/lib/helpers/attachmentHelpers.ts +56 -35
  50. package/lib/helpers/common-utils.ts +2 -2
  51. package/lib/helpers/data_page.ts +0 -1
  52. package/lib/helpers/field-group-utils.ts +1 -1
  53. package/lib/helpers/formatters/CurrencyMap.ts +0 -2
  54. package/lib/helpers/simpleTableHelpers.ts +118 -6
  55. package/lib/helpers/utils.ts +8 -1
  56. package/lib/helpers/versionHelpers.ts +0 -1
  57. package/lib/infra/ActionButtons/ActionButtons.tsx +28 -21
  58. package/lib/infra/Assignment/Assignment.tsx +4 -4
  59. package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
  60. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +15 -94
  61. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +1 -2
  62. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +3 -3
  63. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +4 -5
  64. package/lib/infra/Containers/container-helpers.ts +47 -1
  65. package/lib/infra/DashboardFilter/DashboardFilter.tsx +2 -4
  66. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
  67. package/lib/infra/DeferLoad/DeferLoad.tsx +2 -4
  68. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -3
  69. package/lib/infra/MultiStep/MultiStep.css +8 -8
  70. package/lib/infra/MultiStep/MultiStep.tsx +2 -2
  71. package/lib/infra/NavBar/NavBar.css +1 -1
  72. package/lib/infra/NavBar/NavBar.tsx +29 -27
  73. package/lib/infra/Reference/Reference.tsx +3 -4
  74. package/lib/infra/Region/Region.tsx +1 -1
  75. package/lib/infra/RootContainer/RootContainer.tsx +2 -3
  76. package/lib/infra/Stages/Stages.tsx +1 -1
  77. package/lib/infra/View/View.tsx +2 -2
  78. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +0 -1
  79. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +3 -9
  80. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +3 -4
  81. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +1 -1
  82. package/lib/template/AppShell/AppShell.css +1 -1
  83. package/lib/template/AppShell/AppShell.tsx +6 -10
  84. package/lib/template/BannerPage/BannerPage.tsx +2 -2
  85. package/lib/template/CaseSummary/CaseSummary.tsx +2 -3
  86. package/lib/template/CaseView/CaseView.tsx +15 -21
  87. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +1 -1
  88. package/lib/template/Confirmation/Confirmation.tsx +2 -3
  89. package/lib/template/DataReference/DataReference.tsx +9 -12
  90. package/lib/template/DataReference/SearchForm.tsx +6 -5
  91. package/lib/template/DataReference/{utils.js → utils.ts} +3 -3
  92. package/lib/template/DefaultForm/DefaultForm.tsx +3 -3
  93. package/lib/template/Details/Details/Details.tsx +11 -11
  94. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +2 -2
  95. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +11 -11
  96. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +11 -11
  97. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +1 -1
  98. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +2 -3
  99. package/lib/template/InlineDashboard/InlineDashboard.tsx +14 -16
  100. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
  101. package/lib/template/ListPage/ListPage.tsx +1 -1
  102. package/lib/template/ListView/ListView.tsx +10 -22
  103. package/lib/template/ListView/hooks.ts +1 -5
  104. package/lib/template/ListView/utils.ts +1 -1
  105. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +1 -1
  106. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +5 -5
  107. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +11 -11
  108. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
  109. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
  110. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -7
  111. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
  112. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
  113. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
  114. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +2 -3
  115. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +35 -32
  116. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +1 -1
  117. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +1 -1
  118. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  119. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +9 -10
  120. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
  121. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +9 -10
  122. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +5 -5
  123. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +11 -11
  124. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
  125. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
  126. package/lib/template/WssNavBar/WssNavBar.css +1 -1
  127. package/lib/template/WssNavBar/WssNavBar.tsx +5 -5
  128. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +1 -1
  129. package/lib/widget/Attachment/Attachment.css +6 -8
  130. package/lib/widget/Attachment/Attachment.tsx +62 -58
  131. package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
  132. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +0 -14
  133. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +3 -3
  134. package/lib/widget/FileUtility/FileUtility/FileUtility.css +7 -6
  135. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +5 -7
  136. package/lib/widget/Followers/Followers.tsx +2 -4
  137. package/lib/widget/QuickCreate/QuickCreate.tsx +1 -2
  138. package/lib/widget/SummaryItem/SummaryItem.css +9 -11
  139. package/lib/widget/SummaryItem/SummaryItem.tsx +2 -2
  140. package/lib/widget/SummaryList/SummaryList.tsx +1 -1
  141. package/lib/widget/ToDo/ToDo.css +1 -13
  142. package/lib/widget/ToDo/ToDo.tsx +26 -26
  143. package/package.json +1 -1
  144. /package/lib/template/DataReference/{DataReferenceAdvancedSearchContext.js → DataReferenceAdvancedSearchContext.ts} +0 -0
@@ -89,6 +89,51 @@ export const getApiContext = (processedData, pConnect, reorderCB) => {
89
89
  };
90
90
  };
91
91
 
92
+ const PRIMARY_FIELDS = 'pyPrimaryFields';
93
+ const SUPPORTED_FIELD_TYPES = [
94
+ 'Address',
95
+ 'TextArea',
96
+ 'TextInput',
97
+ 'Phone',
98
+ 'Email',
99
+ 'Time',
100
+ 'URL',
101
+ 'Percentage',
102
+ 'Integer',
103
+ 'Decimal',
104
+ 'Date',
105
+ 'DateTime',
106
+ 'Currency',
107
+ 'Checkbox',
108
+ 'Dropdown',
109
+ 'AutoComplete',
110
+ 'UserReference',
111
+ 'RichText'
112
+ ];
113
+
114
+ export const getConfigFields = (rawFields, contextClass, primaryFieldsViewIndex) => {
115
+ let primaryFields: any = [];
116
+ let configFields: any = [];
117
+
118
+ if (primaryFieldsViewIndex > -1) {
119
+ let primaryFieldVMD: any = PCore.getMetadataUtils().resolveView(PRIMARY_FIELDS);
120
+ if (Array.isArray(primaryFieldVMD)) {
121
+ primaryFieldVMD = primaryFieldVMD.find(primaryFieldView => primaryFieldView.classID === contextClass);
122
+ primaryFields = primaryFieldVMD?.children?.[0]?.children || [];
123
+ } else if (primaryFieldVMD?.classID === contextClass) {
124
+ primaryFields = primaryFieldVMD?.children?.[0]?.children || [];
125
+ }
126
+
127
+ if (primaryFields.length) {
128
+ primaryFields = primaryFields.filter(primaryField => SUPPORTED_FIELD_TYPES.includes(primaryField.type));
129
+ }
130
+ }
131
+
132
+ configFields = [...rawFields.slice(0, primaryFieldsViewIndex), ...primaryFields, ...rawFields.slice(primaryFieldsViewIndex + 1)];
133
+ // filter duplicate fields after combining raw fields and primary fields
134
+ return configFields.filter((field, index) => configFields.findIndex(_field => field.config?.value === _field.config?.value) === index);
135
+ };
136
+
92
137
  export const buildMetaForListView = (fieldMetadata, fields, type, ruleClass, name, propertyLabel, isDataObject, parameters) => {
93
138
  return {
94
139
  name,
@@ -126,11 +171,80 @@ export const buildMetaForListView = (fieldMetadata, fields, type, ruleClass, nam
126
171
  };
127
172
  };
128
173
 
129
- export const buildFieldsForTable = (configFields, fields, showDeleteButton) => {
174
+ export function isFLProperty(label) {
175
+ return label?.startsWith('@FL');
176
+ }
177
+
178
+ /**
179
+ * [getFieldLabel]
180
+ * Description - A utility that returns resolved field label for "@FL" annotation i.e from data model.
181
+ * @param {Object} fieldConfig
182
+ * @returns {string} resolved label string
183
+ *
184
+ * example:
185
+ * fieldConfig = {label: "@FL .pyID", classID: "TestCase-Work"};
186
+ * return "Case ID"
187
+ */
188
+ export function getFieldLabel(fieldConfig) {
189
+ const { label, classID, caption } = fieldConfig;
190
+ let fieldLabel = (label ?? caption)?.substring(4);
191
+ const labelSplit = fieldLabel?.split('.');
192
+ const propertyName = labelSplit?.pop();
193
+ const fieldMetaData: any = PCore.getMetadataUtils().getPropertyMetadata(propertyName, classID) ?? {};
194
+ fieldLabel = fieldMetaData.label ?? fieldMetaData.caption ?? propertyName;
195
+ return fieldLabel;
196
+ }
197
+
198
+ export const updateFieldLabels = (fields, configFields, primaryFieldsViewIndex, pConnect, options) => {
199
+ const labelsOfFields: any = [];
200
+ const { columnsRawConfig = [] } = options;
201
+ fields.forEach((field, idx) => {
202
+ const rawColumnConfig = columnsRawConfig[idx]?.config;
203
+ if (field.config.value === PRIMARY_FIELDS) {
204
+ labelsOfFields.push('');
205
+ } else if (isFLProperty(rawColumnConfig?.label ?? rawColumnConfig?.caption)) {
206
+ labelsOfFields.push(getFieldLabel(rawColumnConfig) || field.config.label || field.config.caption);
207
+ } else {
208
+ labelsOfFields.push(field.config.label || field.config.caption);
209
+ }
210
+ });
211
+
212
+ if (primaryFieldsViewIndex > -1) {
213
+ const totalPrimaryFieldsColumns = configFields.length - fields.length + 1;
214
+ if (totalPrimaryFieldsColumns) {
215
+ const primaryFieldLabels: any = [];
216
+ for (let i = primaryFieldsViewIndex; i < primaryFieldsViewIndex + totalPrimaryFieldsColumns; i += 1) {
217
+ let label = configFields[i].config?.label;
218
+ if (isFLProperty(label)) {
219
+ label = getFieldLabel(configFields[i].config);
220
+ } else if (label.startsWith('@')) {
221
+ label = label.substring(3);
222
+ }
223
+ if (pConnect) {
224
+ label = pConnect.getLocalizedValue(label);
225
+ }
226
+ primaryFieldLabels.push(label);
227
+ }
228
+ labelsOfFields.splice(primaryFieldsViewIndex, 1, ...primaryFieldLabels);
229
+ } else {
230
+ labelsOfFields.splice(primaryFieldsViewIndex, 1);
231
+ }
232
+ }
233
+ return labelsOfFields;
234
+ };
235
+
236
+ export const buildFieldsForTable = (configFields, pConnect, showDeleteButton, options) => {
237
+ const { primaryFieldsViewIndex, fields } = options;
238
+
239
+ // get resolved field labels for primary fields raw config included in configFields
240
+ const fieldsLabels = updateFieldLabels(fields, configFields, primaryFieldsViewIndex, pConnect, {
241
+ columnsRawConfig: pConnect.getRawConfigProps()?.children.find(item => item?.name === 'Columns')?.children
242
+ });
243
+
130
244
  const fieldDefs = configFields.map((field, index) => {
131
245
  return {
132
246
  type: 'text',
133
- label: fields[index].config.label || fields[index].config.caption,
247
+ label: fieldsLabels[index],
134
248
  fillAvailableSpace: !!field.config.fillAvailableSpace,
135
249
  id: `${index}`,
136
250
  name: field.config.value.substr(4),
@@ -213,7 +327,7 @@ export function createPConnect(contextName, referenceList, pageReference): any {
213
327
  };
214
328
 
215
329
  // create PConnect object
216
- const config = { meta: {}, options };
330
+ const config: any = { meta: {}, options };
217
331
  const { getPConnect } = PCore.createPConnect(config);
218
332
 
219
333
  return getPConnect();
@@ -231,11 +345,10 @@ export const filterData = filterByColumns => {
231
345
  case 'Date':
232
346
  case 'DateTime':
233
347
  case 'Time':
234
- value = (item[filterObj.ref] !== null ?? item[filterObj.ref] !== '') ? Utils.getSeconds(item[filterObj.ref]) : null;
348
+ value = item[filterObj.ref] !== null || item[filterObj.ref] !== '' ? Utils.getSeconds(item[filterObj.ref]) : null;
235
349
  filterValue =
236
350
  filterObj.containsFilterValue !== null && filterObj.containsFilterValue !== '' ? Utils.getSeconds(filterObj.containsFilterValue) : null;
237
351
 
238
- // eslint-disable-next-line sonarjs/no-nested-switch
239
352
  switch (filterObj.containsFilter) {
240
353
  case 'notequal':
241
354
  // becasue filterValue is in minutes, need to have a range of less than 60 secons
@@ -302,7 +415,6 @@ export const filterData = filterByColumns => {
302
415
  value = item[filterObj.ref].toLowerCase();
303
416
  filterValue = filterObj.containsFilterValue.toLowerCase();
304
417
 
305
- // eslint-disable-next-line sonarjs/no-nested-switch
306
418
  switch (filterObj.containsFilter) {
307
419
  case 'contains':
308
420
  if (value.indexOf(filterValue) < 0) {
@@ -48,7 +48,6 @@ export class Utils {
48
48
  // eslint-disable-next-line no-case-declarations
49
49
  const dataPage = configProps.datasource;
50
50
  if (typeof dataPage === 'string' && dataObject[dataPage]) {
51
- // eslint-disable-next-line no-alert
52
51
  alert('need to handle data page');
53
52
  } else {
54
53
  let listSourceItems = configProps.listOutput;
@@ -337,6 +336,14 @@ export class Utils {
337
336
  static isObject(objValue) {
338
337
  return objValue && typeof objValue === 'object' && objValue.constructor === Object;
339
338
  }
339
+
340
+ static getMappedKey(key) {
341
+ const mappedKey = PCore.getEnvironmentInfo().getKeyMapping(key);
342
+ if (!mappedKey) {
343
+ return key;
344
+ }
345
+ return mappedKey;
346
+ }
340
347
  }
341
348
 
342
349
  export default Utils;
@@ -10,6 +10,5 @@ export const sdkVersion = '8.7';
10
10
  export function compareSdkPCoreVersions() {
11
11
  // const theConstellationVersion = PCore.getPCoreVersion();
12
12
 
13
- // eslint-disable-next-line no-console
14
13
  console.warn(`Using Constellation version ${PCore.getPCoreVersion()}. Ensure this is the same version as your Infinity server.`);
15
14
  }
@@ -1,6 +1,6 @@
1
1
  import makeStyles from '@mui/styles/makeStyles';
2
2
  import Button from '@mui/material/Button';
3
- import { Grid, Divider } from '@mui/material';
3
+ import { Grid2, Divider } from '@mui/material';
4
4
 
5
5
  // ActionButtons does NOT have getPConnect. So, no need to extend from PConnProps
6
6
  interface ActionButtonsProps {
@@ -10,13 +10,18 @@ interface ActionButtonsProps {
10
10
  onButtonPress: any;
11
11
  }
12
12
 
13
- const useStyles = makeStyles((/* theme */) => ({
14
- button: {
15
- padding: '0px 5px'
16
- },
13
+ const useStyles = makeStyles(theme => ({
17
14
  divider: {
18
15
  marginTop: '10px',
19
16
  marginBottom: '10px'
17
+ },
18
+ secondaryButton: {
19
+ backgroundColor: theme.actionButtons.secondary.backgroundColor,
20
+ color: theme.actionButtons.secondary.color
21
+ },
22
+ primaryButton: {
23
+ backgroundColor: theme.actionButtons.primary.backgroundColor,
24
+ color: theme.actionButtons.primary.color
20
25
  }
21
26
  }));
22
27
 
@@ -33,42 +38,44 @@ export default function ActionButtons(props: ActionButtonsProps) {
33
38
  return (
34
39
  <>
35
40
  <Divider className={classes.divider} />
36
- <Grid container spacing={4} justifyContent='space-between'>
37
- <Grid item>
38
- <Grid container spacing={1}>
41
+ <Grid2 container spacing={4} justifyContent='space-between'>
42
+ <Grid2>
43
+ <Grid2 container spacing={1}>
39
44
  {arSecondaryButtons.map(sButton => (
40
- <Grid item key={sButton.name}>
45
+ <Grid2 key={sButton.name}>
41
46
  <Button
42
- variant='contained'
47
+ className={classes.secondaryButton}
43
48
  color='secondary'
49
+ variant='contained'
44
50
  onClick={() => {
45
51
  _onButtonPress(sButton.jsAction, 'secondary');
46
52
  }}
47
53
  >
48
54
  {localizedVal(sButton.name, localeCategory)}
49
55
  </Button>
50
- </Grid>
56
+ </Grid2>
51
57
  ))}
52
- </Grid>
53
- </Grid>
54
- <Grid item>
55
- <Grid container spacing={1}>
58
+ </Grid2>
59
+ </Grid2>
60
+ <Grid2>
61
+ <Grid2 container spacing={1}>
56
62
  {arMainButtons.map(mButton => (
57
- <Grid item key={mButton.name}>
63
+ <Grid2 key={mButton.name}>
58
64
  <Button
59
- variant='contained'
65
+ className={classes.primaryButton}
60
66
  color='primary'
67
+ variant='contained'
61
68
  onClick={() => {
62
69
  _onButtonPress(mButton.jsAction, 'primary');
63
70
  }}
64
71
  >
65
72
  {localizedVal(mButton.name, localeCategory)}
66
73
  </Button>
67
- </Grid>
74
+ </Grid2>
68
75
  ))}
69
- </Grid>
70
- </Grid>
71
- </Grid>
76
+ </Grid2>
77
+ </Grid2>
78
+ </Grid2>
72
79
  </>
73
80
  );
74
81
  }
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren, useEffect, useState } from 'react';
1
+ import React, { type PropsWithChildren, useEffect, useState } from 'react';
2
2
  import Snackbar from '@mui/material/Snackbar';
3
3
  import IconButton from '@mui/material/IconButton';
4
4
  import CloseIcon from '@mui/icons-material/Close';
@@ -6,14 +6,14 @@ import CloseIcon from '@mui/icons-material/Close';
6
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
7
  import { useFocusFirstField, useScrolltoTop } from '@pega/react-sdk-components/lib/hooks';
8
8
 
9
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
10
 
11
11
  interface AssignmentProps extends PConnProps {
12
12
  // If any, enter additional props that only exist on this component
13
13
  itemKey: string;
14
14
  isInModal: boolean;
15
15
  banners: any[];
16
- // eslint-disable-next-line react/no-unused-prop-types
16
+
17
17
  actionButtons: any[];
18
18
  }
19
19
 
@@ -133,7 +133,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
133
133
 
134
134
  function showToast(message: string) {
135
135
  const theMessage = `Assignment: ${message}`;
136
- // eslint-disable-next-line no-console
136
+
137
137
  console.error(theMessage);
138
138
  setSnackbarMessage(message);
139
139
  setShowSnackbar(true);
@@ -1,6 +1,6 @@
1
- import { PropsWithChildren, useEffect, useState } from 'react';
1
+ import { type PropsWithChildren, useEffect, useState } from 'react';
2
2
 
3
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
5
 
6
6
  interface AssignmentCardProps extends PConnProps {
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-nested-ternary */
2
-
3
1
  import { useState, useEffect, useContext } from 'react';
4
2
  import makeStyles from '@mui/styles/makeStyles';
5
3
  import { Alert, Card, CardHeader, Avatar, Typography } from '@mui/material';
@@ -11,7 +9,7 @@ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpe
11
9
  import { withSimpleViewContainerRenderer } from '@pega/react-sdk-components/lib/components/infra/Containers/SimpleView/SimpleView';
12
10
 
13
11
  import { addContainerItem, getToDoAssignments, showBanner, hasContainerItems } from './helpers';
14
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
12
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
15
13
  import { LocalizationProvider } from '@mui/x-date-pickers';
16
14
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
17
15
 
@@ -58,7 +56,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
58
56
  const AlertBanner = getComponentFromMap('AlertBanner');
59
57
 
60
58
  const pCoreConstants = PCore.getConstants();
61
- const PCoreVersion = PCore.getPCoreVersion();
62
59
  const { TODO } = pCoreConstants;
63
60
  const todo_headerText = 'To do';
64
61
 
@@ -78,6 +75,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
78
75
  const getPConnect = getPConnectOfActiveContainerItem || getPConnectOfFlowContainer;
79
76
  const thePConn = getPConnect();
80
77
  const containerName = assignmentNames && assignmentNames.length > 0 ? assignmentNames[0] : '';
78
+ const bShowBanner = showBanner(getPConnect);
81
79
  // const [init, setInit] = useState(true);
82
80
  // const [fcState, setFCState] = useState({ hasError: false });
83
81
 
@@ -104,7 +102,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
104
102
  function getBuildName(): string {
105
103
  const ourPConn = getPConnect();
106
104
 
107
- // let { getPConnect, name } = this.pConn$.pConn;
108
105
  const context = ourPConn.getContextName();
109
106
  let viewContainerName = ourPConn.getContainerName();
110
107
 
@@ -113,7 +110,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
113
110
  }
114
111
 
115
112
  function getTodoVisibility() {
116
- const caseViewMode = getPConnect().getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
113
+ const caseViewMode = getPConnect().getValue('context_data.caseViewMode');
117
114
  if (caseViewMode && caseViewMode === 'review') {
118
115
  return true;
119
116
  }
@@ -123,16 +120,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
123
120
  function initComponent() {
124
121
  const ourPConn = getPConnect();
125
122
 
126
- // debugging/investigation help
127
- // console.log(`${ourPConn.getComponentName()}: children update for main draw`);
128
-
129
- // const oData = ourPConn.getDataObject();
130
-
131
- // const activeActionLabel = "";
132
- // const child0_getPConnect = arNewChildren[0].getPConnect();
133
-
134
- // this.templateName$ = this.configProps$["template"];
135
-
136
123
  // debugger;
137
124
  setShowTodo(getTodoVisibility());
138
125
 
@@ -148,7 +135,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
148
135
  }, []);
149
136
 
150
137
  useEffect(() => {
151
- // @ts-ignore - Property 'getMetadata' is private and only accessible within class 'C11nEnv'
138
+ // @ts-expect-error - Property 'getMetadata' is private and only accessible within class 'C11nEnv'
152
139
  if (isInitialized && pConnectOfFlowContainer.getMetadata().children && !hasItems) {
153
140
  // ensuring not to add container items, if container already has items
154
141
  // because during multi doc mode, we will have container items already in store
@@ -156,63 +143,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
156
143
  }
157
144
  }, [isInitialized, hasItems]);
158
145
 
159
- function isCaseWideLocalAction() {
160
- const ourPConn = getPConnect();
161
-
162
- const actionID = ourPConn.getValue(pCoreConstants.CASE_INFO.ACTIVE_ACTION_ID, ''); // 2nd arg empty string until typedefs properly allow optional
163
- const caseActions = ourPConn.getValue(pCoreConstants.CASE_INFO.AVAILABLEACTIONS, ''); // 2nd arg empty string until typedefs properly allow optional
164
- let bCaseWideAction = false;
165
- if (caseActions && actionID) {
166
- const actionObj = caseActions.find(caseAction => caseAction.ID === actionID);
167
- if (actionObj) {
168
- bCaseWideAction = actionObj.type === 'Case';
169
- }
170
- }
171
- return bCaseWideAction;
172
- }
173
-
174
- function hasChildCaseAssignments() {
175
- const ourPConn = getPConnect();
176
-
177
- const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
178
- // const allAssignments = [];
179
- return !!(childCases && childCases.length > 0);
180
- }
181
-
182
- function hasAssignments() {
183
- const ourPConn = getPConnect();
184
-
185
- let bHasAssignments = false;
186
- const assignmentsList: any[] = ourPConn.getValue(pCoreConstants.CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS, ''); // 2nd arg empty string until typedefs properly allow optional
187
- const isEmbedded = window.location.href.includes('embedded');
188
- let bAssignmentsForThisOperator = false;
189
- // 8.7 includes assignments in Assignments List that may be assigned to
190
- // a different operator. So, see if there are any assignments for
191
- // the current operator
192
- if (PCoreVersion?.includes('8.7') || isEmbedded) {
193
- const thisOperator = PCore.getEnvironmentInfo().getOperatorIdentifier();
194
- for (const assignment of assignmentsList) {
195
- if (assignment.assigneeInfo.ID === thisOperator) {
196
- bAssignmentsForThisOperator = true;
197
- }
198
- }
199
- } else {
200
- bAssignmentsForThisOperator = true;
201
- }
202
- // Bail out if there isn't an assignmentsList
203
- if (!assignmentsList) {
204
- return bHasAssignments;
205
- }
206
-
207
- const bHasChildCaseAssignments = hasChildCaseAssignments();
208
-
209
- if (bAssignmentsForThisOperator || bHasChildCaseAssignments || isCaseWideLocalAction()) {
210
- bHasAssignments = true;
211
- }
212
-
213
- return bHasAssignments;
214
- }
215
-
216
146
  // From SDK-WC updateSelf - so do this in useEffect that's run only when the props change...
217
147
  useEffect(() => {
218
148
  setBuildName(getBuildName());
@@ -222,29 +152,21 @@ export const FlowContainer = (props: FlowContainerProps) => {
222
152
 
223
153
  let loadingInfo: any;
224
154
  try {
225
- loadingInfo = thePConn.getLoadingStatus(''); // 1st arg empty string until typedefs properly allow optional
155
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
156
+ loadingInfo = thePConn.getLoadingStatus();
157
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
226
158
  } catch (ex) {
227
- // eslint-disable-next-line no-console
228
159
  console.error(`${thePConn.getComponentName()}: loadingInfo catch block`);
229
160
  }
230
161
 
231
- // let configProps = this.thePConn.resolveConfigProps(this.thePConn.getConfigProps());
232
-
233
- if (!loadingInfo) {
234
- // turn off spinner
235
- // this.psService.sendMessage(false);
236
- }
237
-
238
- const caseViewMode = thePConn.getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
162
+ const caseViewMode = thePConn.getValue('context_data.caseViewMode');
239
163
  const { CASE_INFO: CASE_CONSTS } = pCoreConstants;
240
164
  if (caseViewMode && caseViewMode === 'review') {
241
165
  setTimeout(() => {
242
166
  // updated for 8.7 - 30-Mar-2022
243
167
  const todoAssignments = getToDoAssignments(thePConn);
244
- if (todoAssignments && todoAssignments.length > 0) {
245
- setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID, '')); // 2nd arg empty string until typedefs properly allow optional
246
- setTodoDatasource({ source: todoAssignments });
247
- }
168
+ setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID));
169
+ setTodoDatasource({ source: todoAssignments });
248
170
  setShowTodo(true);
249
171
  setShowTodoList(false);
250
172
  }, 100);
@@ -255,11 +177,12 @@ export const FlowContainer = (props: FlowContainerProps) => {
255
177
  }
256
178
 
257
179
  // if have caseMessage show message and end
258
- const theCaseMessages = localizedVal(thePConn.getValue('caseMessages', ''), localeCategory); // 2nd arg empty string until typedefs properly allow optional
180
+ const theCaseMessages = localizedVal(thePConn.getValue('caseMessages'), localeCategory);
181
+
182
+ const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), itemKey);
183
+ const bConfirmView = rootInfo && bShowBanner;
259
184
 
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()) {
185
+ if (bConfirmView) {
263
186
  // Temp fix for 8.7 change: confirmationNote no longer coming through in caseMessages$.
264
187
  // So, if we get here and caseMessages$ is empty, use default value in DX API response
265
188
  setCaseMessages(theCaseMessages || localizedVal('Thank you! The next step in this case has been routed appropriately.', localeCategory));
@@ -279,8 +202,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
279
202
  const urgency = getPConnect().getCaseSummary().assignments ? getPConnect().getCaseSummary().assignments?.[0].urgency : '';
280
203
  const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName() || '');
281
204
 
282
- const bShowBanner = showBanner(getPConnect);
283
-
284
205
  const displayPageMessages = () => {
285
206
  let hasBanner = false;
286
207
  const messages = pageMessages ? pageMessages.map(msg => localizedVal(msg.message, 'Messages')) : pageMessages;
@@ -1,7 +1,7 @@
1
1
  import { useState } from 'react';
2
2
  import Button from '@mui/material/Button';
3
3
  import makeStyles from '@mui/styles/makeStyles';
4
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  const useStyles = makeStyles((/* theme */) => ({
7
7
  button: {
@@ -53,7 +53,6 @@ function ListViewActionButtons(props: ListViewActionButtonsProps) {
53
53
  closeActionsDialog();
54
54
  })
55
55
  .catch(err => {
56
- // eslint-disable-next-line no-console
57
56
  console.log(err);
58
57
  })
59
58
  .finally(() => {
@@ -11,7 +11,7 @@ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react
11
11
  // Need to get correct implementation from component map for Assignment and CancelAlert
12
12
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
13
13
  import { getBanners } from '@pega/react-sdk-components/lib/components/helpers/case-utils';
14
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
14
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
15
15
 
16
16
  interface ModalViewContainerProps extends PConnProps {
17
17
  // If any, enter additional props that only exist on this component
@@ -43,7 +43,7 @@ function getKeyAndLatestItem(routinginfo, pConn, options) {
43
43
  if (PCore.getContainerUtils().hasContainerItems(buildName(pConn, containerName))) {
44
44
  const { accessedOrder, items } = routinginfo;
45
45
  let key;
46
- // eslint-disable-next-line no-plusplus
46
+
47
47
  for (let i = accessedOrder.length - 1; i >= 0; i--) {
48
48
  const tempkey = accessedOrder[i];
49
49
  if ((acTertiary && items[tempkey].acTertiary) || (!acTertiary && !items[tempkey].acTertiary)) {
@@ -216,7 +216,7 @@ export default function ModalViewContainer(props: ModalViewContainerProps) {
216
216
  ERROR_WHILE_RENDERING,
217
217
  error => {
218
218
  // setError(true);
219
- // eslint-disable-next-line no-console
219
+
220
220
  console.error(error);
221
221
  },
222
222
  `${ERROR_WHILE_RENDERING}-mc-${getPConnect().getContextName()}`,
@@ -1,10 +1,12 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1
2
  import React, { createElement, useContext, useEffect, useState } from 'react';
2
3
  import { Box, CircularProgress } from '@mui/material';
3
4
 
4
5
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
6
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
6
7
  import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
7
- import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+ import { configureBrowserBookmark } from '@pega/react-sdk-components/lib/components/infra/Containers/container-helpers';
8
10
 
9
11
  interface ViewContainerProps extends PConnProps {
10
12
  // If any, enter additional props that only exist on this component
@@ -131,10 +133,7 @@ export default function ViewContainer(props: ViewContainerProps) {
131
133
 
132
134
  if (!displayOnlyFA) {
133
135
  // configureForBrowserBookmark not applicable in Embedded mode
134
- PCore.configureForBrowserBookmark({
135
- ...objectForAddContainer,
136
- defaultViewLabel
137
- });
136
+ configureBrowserBookmark(pConn);
138
137
  }
139
138
  }, []);
140
139
 
@@ -1,6 +1,52 @@
1
- // eslint-disable-next-line import/prefer-default-export
2
1
  export const isContainerInitialized = pConnect => {
3
2
  const context = pConnect.getContextName();
4
3
  const containerName = pConnect.getContainerName();
5
4
  return PCore.getContainerUtils().isContainerInitialized(context, containerName);
6
5
  };
6
+
7
+ export const configureBrowserBookmark = pConnect => {
8
+ const context = pConnect.getContextName();
9
+ const containerName = pConnect.getContainerName();
10
+ const envInfo = PCore.getEnvironmentInfo();
11
+ const { APP } = PCore.getConstants();
12
+
13
+ const navPages = pConnect.getValue('pyPortal.pyPrimaryNavPages');
14
+ let ruleName = '';
15
+ let className = '';
16
+ let defaultViewLabel = '';
17
+
18
+ const isNextGenLandingPageRouting = (envInfo?.environmentInfoObject as any)?.pyExecutionRuntimeName === (APP as any).INFINITY_RUNTIME;
19
+
20
+ if (Array.isArray(navPages) && navPages.length > 0) {
21
+ const firstNavPage = navPages[0];
22
+ const nestedNavPage = firstNavPage.NavigationPages?.[0];
23
+
24
+ if (isNextGenLandingPageRouting) {
25
+ if (nestedNavPage?.pyRuleName) {
26
+ ruleName = nestedNavPage.pyRuleName;
27
+ className = nestedNavPage.pyClassName || '';
28
+ } else if (firstNavPage?.pyRuleName) {
29
+ ruleName = firstNavPage.pyRuleName;
30
+ className = firstNavPage.pyClassName || '';
31
+ } else if (nestedNavPage?.pyLabel) {
32
+ defaultViewLabel = nestedNavPage.pyLabel;
33
+ } else if (firstNavPage?.pyLabel) {
34
+ defaultViewLabel = firstNavPage.pyLabel;
35
+ }
36
+ } else if (nestedNavPage?.pyLabel) {
37
+ defaultViewLabel = nestedNavPage.pyLabel;
38
+ } else if (firstNavPage?.pyLabel) {
39
+ defaultViewLabel = firstNavPage.pyLabel;
40
+ }
41
+ }
42
+
43
+ PCore.configureForBrowserBookmark({
44
+ context,
45
+ containerName,
46
+ acName: containerName,
47
+ semanticURL: '',
48
+ defaultViewLabel,
49
+ ruleName,
50
+ className
51
+ });
52
+ };