@pega/react-sdk-overrides 0.23.26 → 8.8.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
  2. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  3. package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
  9. package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
  12. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  13. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
  14. package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
  15. package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
  16. package/lib/field/Checkbox/Checkbox.tsx +41 -17
  17. package/lib/field/Currency/Currency.tsx +23 -15
  18. package/lib/field/Currency/currency-utils.ts +1 -2
  19. package/lib/field/Date/Date.tsx +31 -17
  20. package/lib/field/DateTime/DateTime.tsx +26 -15
  21. package/lib/field/Decimal/Decimal.tsx +82 -19
  22. package/lib/field/Dropdown/Dropdown.tsx +57 -14
  23. package/lib/field/Email/Email.tsx +17 -9
  24. package/lib/field/Integer/Integer.tsx +15 -7
  25. package/lib/field/Percentage/Percentage.tsx +15 -7
  26. package/lib/field/Phone/Phone.tsx +21 -12
  27. package/lib/field/RadioButtons/RadioButtons.tsx +54 -27
  28. package/lib/field/RichText/RichText.tsx +93 -0
  29. package/lib/field/RichText/index.tsx +1 -0
  30. package/lib/field/ScalarList/ScalarList.tsx +64 -0
  31. package/lib/field/ScalarList/config-ext.json +8 -0
  32. package/lib/field/ScalarList/index.tsx +1 -0
  33. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  34. package/lib/field/SemanticLink/utils.ts +2 -1
  35. package/lib/field/TextArea/TextArea.tsx +14 -5
  36. package/lib/field/TextContent/TextContent.tsx +10 -1
  37. package/lib/field/TextInput/TextInput.tsx +40 -11
  38. package/lib/field/Time/Time.tsx +29 -26
  39. package/lib/field/URL/URL.tsx +24 -8
  40. package/lib/field/UserReference/UserReference.tsx +52 -60
  41. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
  42. package/lib/helpers/auth.js +741 -390
  43. package/lib/helpers/authManager.ts +933 -0
  44. package/lib/helpers/case-utils.tsx +103 -0
  45. package/lib/helpers/common-utils.ts +4 -0
  46. package/lib/helpers/config_access.js +63 -145
  47. package/lib/helpers/data_page.ts +2 -1
  48. package/lib/helpers/date-format-utils.ts +29 -19
  49. package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
  50. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
  51. package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
  52. package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
  53. package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
  54. package/lib/helpers/formatters/{common.js → common.ts} +4 -4
  55. package/lib/helpers/formatters/{index.js → index.ts} +3 -3
  56. package/lib/helpers/simpleTableHelpers.ts +10 -6
  57. package/lib/helpers/state-utils.tsx +47 -0
  58. package/lib/helpers/template-utils.ts +3 -4
  59. package/lib/helpers/utils.ts +12 -4
  60. package/lib/helpers/versionHelpers.ts +0 -1
  61. package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
  62. package/lib/infra/Assignment/Assignment.tsx +38 -32
  63. package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
  64. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
  65. package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
  66. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -27
  67. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
  68. package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
  69. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
  70. package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
  71. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
  72. package/lib/infra/MultiStep/MultiStep.tsx +24 -24
  73. package/lib/infra/NavBar/NavBar.tsx +23 -24
  74. package/lib/infra/Reference/Reference.tsx +13 -18
  75. package/lib/infra/Region/Region.tsx +8 -6
  76. package/lib/infra/RootContainer/RootContainer.tsx +32 -39
  77. package/lib/infra/Stages/Stages.tsx +15 -9
  78. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
  79. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  80. package/lib/infra/View/View.tsx +28 -56
  81. package/lib/template/AppShell/AppShell.tsx +51 -34
  82. package/lib/template/BannerPage/BannerPage.tsx +26 -31
  83. package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
  84. package/lib/template/CaseView/CaseView.tsx +137 -100
  85. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
  86. package/lib/template/Confirmation/Confirmation.tsx +29 -52
  87. package/lib/template/DataReference/DataReference.tsx +50 -52
  88. package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
  89. package/lib/template/DefaultForm/utils/index.ts +33 -0
  90. package/lib/template/Details/Details/Details.tsx +16 -17
  91. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
  92. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
  93. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
  94. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
  95. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  96. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
  97. package/lib/template/ListPage/ListPage.tsx +14 -13
  98. package/lib/template/ListView/ListView.tsx +140 -152
  99. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  100. package/lib/template/ListView/{utils.js → utils.ts} +172 -23
  101. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
  102. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  103. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  104. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  105. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  106. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  107. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  108. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  109. package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
  110. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
  111. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +28 -7
  112. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
  113. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -36
  114. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  115. package/lib/template/SubTabs/tabUtils.ts +0 -2
  116. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  117. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  118. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  119. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  120. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  121. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  122. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  123. package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
  124. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  125. package/lib/widget/Attachment/Attachment.css +15 -3
  126. package/lib/widget/Attachment/Attachment.tsx +51 -32
  127. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  128. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  129. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
  130. package/lib/widget/Followers/Followers.tsx +10 -11
  131. package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
  132. package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
  133. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  134. package/lib/widget/ToDo/ToDo.tsx +69 -104
  135. package/package.json +1 -1
  136. package/lib/helpers/authManager.js +0 -631
  137. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  138. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  139. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -1,23 +1,36 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
  /* eslint-disable camelcase */
3
3
  import React, { useState, useEffect, useContext, createElement } from 'react';
4
- import PropTypes from 'prop-types';
5
4
  import { makeStyles } from '@material-ui/core/styles';
6
5
  import { Card, CardHeader, Avatar, Typography } from '@material-ui/core';
7
6
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
8
7
  import { Alert } from '@material-ui/lab';
9
8
 
10
- import Assignment from '@pega/react-sdk-components/lib/components/infra/Assignment';
11
- import ToDo from '@pega/react-sdk-components/lib/components/widget/ToDo';
12
-
13
9
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
14
10
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
15
11
  import DayjsUtils from '@date-io/dayjs';
16
12
  import { MuiPickersUtilsProvider } from '@material-ui/pickers';
17
13
 
18
14
  import { addContainerItem, getToDoAssignments, showBanner } from './helpers';
19
-
20
- declare const PCore;
15
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
16
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
17
+
18
+ // import type { PConnProps } from '../../../../types/PConnProps';
19
+
20
+ // Can't use PConnProps until getPConnect().getChildren() types are ok
21
+ // interface FlowContainerProps extends PConnProps {
22
+ // // If any, enter additional props that only exist on this component
23
+ // // eslint-disable-next-line react/no-unused-prop-types
24
+ // children?: Array<any>,
25
+ // // eslint-disable-next-line react/no-unused-prop-types
26
+ // name?: string,
27
+ // routingInfo?: any,
28
+ // // eslint-disable-next-line react/no-unused-prop-types
29
+ // pageMessages: Array<any>
30
+ // }
31
+
32
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 3 errors)
33
+ declare const PCore: any;
21
34
 
22
35
  //
23
36
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -46,14 +59,20 @@ const useStyles = makeStyles(theme => ({
46
59
  }
47
60
  }));
48
61
 
49
- export default function FlowContainer(props) {
62
+ export default function FlowContainer(props /* : FlowContainerProps */) {
63
+ // Get the proper implementation (local or Pega-provided) for these components that are emitted below
64
+ const Assignment = getComponentFromMap('Assignment');
65
+ const ToDo = getComponentFromMap('Todo'); // NOTE: ConstellationJS Engine uses "Todo" and not "ToDo"!!!
66
+ const AlertBanner = getComponentFromMap("AlertBanner");
67
+
50
68
  const pCoreConstants = PCore.getConstants();
69
+ const PCoreVersion = PCore.getPCoreVersion();
51
70
  const { TODO } = pCoreConstants;
52
71
  const todo_headerText = 'To do';
53
72
 
54
- const { getPConnect, routingInfo } = props;
73
+ const { getPConnect, routingInfo, pageMessages } = props;
55
74
 
56
- const { displayOnlyFA } = useContext(StoreContext);
75
+ const { displayOnlyFA } = useContext<any>(StoreContext);
57
76
 
58
77
  const thePConn = getPConnect();
59
78
 
@@ -78,6 +97,10 @@ export default function FlowContainer(props) {
78
97
  const [containerName, setContainerName] = useState('');
79
98
  const [buildName, setBuildName] = useState('');
80
99
  const [bShowConfirm, setShowConfirm] = useState(false);
100
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
101
+ const localeCategory = 'Messages';
102
+ const caseInfo = getPConnect().getCaseInfo();
103
+ const localeReference = `${caseInfo?.getClassName()}!CASE!${caseInfo.getName()}`.toUpperCase();
81
104
 
82
105
  const classes = useStyles();
83
106
 
@@ -116,7 +139,7 @@ export default function FlowContainer(props) {
116
139
  }
117
140
 
118
141
  function getTodoVisibility() {
119
- const caseViewMode = getPConnect().getValue('context_data.caseViewMode');
142
+ const caseViewMode = getPConnect().getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
120
143
  if (caseViewMode && caseViewMode === 'review') {
121
144
  return true;
122
145
  }
@@ -171,7 +194,7 @@ export default function FlowContainer(props) {
171
194
 
172
195
  if (bLoadChildren && oWorkData) {
173
196
  // debugger;
174
- setContainerName(oWorkData.caseInfo.assignments?.[0].name);
197
+ setContainerName(localizedVal(oWorkData.caseInfo.assignments?.[0].name, undefined, localeReference));
175
198
  }
176
199
 
177
200
  // debugger;
@@ -187,8 +210,8 @@ export default function FlowContainer(props) {
187
210
  function isCaseWideLocalAction() {
188
211
  const ourPConn = getPConnect();
189
212
 
190
- const actionID = ourPConn.getValue(pCoreConstants.CASE_INFO.ACTIVE_ACTION_ID);
191
- const caseActions = ourPConn.getValue(pCoreConstants.CASE_INFO.AVAILABLEACTIONS);
213
+ const actionID = ourPConn.getValue(pCoreConstants.CASE_INFO.ACTIVE_ACTION_ID, ''); // 2nd arg empty string until typedefs properly allow optional
214
+ const caseActions = ourPConn.getValue(pCoreConstants.CASE_INFO.AVAILABLEACTIONS, ''); // 2nd arg empty string until typedefs properly allow optional
192
215
  let bCaseWideAction = false;
193
216
  if (caseActions && actionID) {
194
217
  const actionObj = caseActions.find(caseAction => caseAction.ID === actionID);
@@ -202,7 +225,7 @@ export default function FlowContainer(props) {
202
225
  function hasChildCaseAssignments() {
203
226
  const ourPConn = getPConnect();
204
227
 
205
- const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS);
228
+ const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
206
229
  // const allAssignments = [];
207
230
  // eslint-disable-next-line sonarjs/prefer-single-boolean-return
208
231
  if (childCases && childCases.length > 0) {
@@ -216,25 +239,28 @@ export default function FlowContainer(props) {
216
239
 
217
240
  let bHasAssignments = false;
218
241
  const assignmentsList: Array<any> = ourPConn.getValue(
219
- pCoreConstants.CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS
220
- );
221
- const thisOperator = PCore.getEnvironmentInfo().getOperatorIdentifier();
242
+ pCoreConstants.CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS, ''
243
+ ); // 2nd arg empty string until typedefs properly allow optional
244
+ const isEmbedded = window.location.href.includes('embedded');
245
+ let bAssignmentsForThisOperator = false;
222
246
  // 8.7 includes assignments in Assignments List that may be assigned to
223
247
  // a different operator. So, see if there are any assignments for
224
248
  // the current operator
225
- let bAssignmentsForThisOperator = false;
226
-
249
+ if (PCoreVersion?.includes('8.7') || isEmbedded) {
250
+ const thisOperator = PCore.getEnvironmentInfo().getOperatorIdentifier();
251
+ for (const assignment of assignmentsList) {
252
+ if (assignment['assigneeInfo']['ID'] === thisOperator) {
253
+ bAssignmentsForThisOperator = true;
254
+ }
255
+ }
256
+ } else {
257
+ bAssignmentsForThisOperator = true;
258
+ }
227
259
  // Bail out if there isn't an assignmentsList
228
260
  if (!assignmentsList) {
229
261
  return bHasAssignments;
230
262
  }
231
263
 
232
- for (const assignment of assignmentsList) {
233
- if (assignment['assigneeInfo']['ID'] === thisOperator) {
234
- bAssignmentsForThisOperator = true;
235
- }
236
- }
237
-
238
264
  const bHasChildCaseAssignments = hasChildCaseAssignments();
239
265
 
240
266
  if (bAssignmentsForThisOperator || bHasChildCaseAssignments || isCaseWideLocalAction()) {
@@ -251,8 +277,8 @@ export default function FlowContainer(props) {
251
277
 
252
278
  const { CASE_INFO: CASE_CONSTS } = pCoreConstants;
253
279
 
254
- const caseActions = ourPConn.getValue(CASE_CONSTS.CASE_INFO_ACTIONS);
255
- const activeActionID = ourPConn.getValue(CASE_CONSTS.ACTIVE_ACTION_ID);
280
+ const caseActions = ourPConn.getValue(CASE_CONSTS.CASE_INFO_ACTIONS, ''); // 2nd arg empty string until typedefs properly allow optionalv
281
+ const activeActionID = ourPConn.getValue(CASE_CONSTS.ACTIVE_ACTION_ID, ''); // 2nd arg empty string until typedefs properly allow optional
256
282
  const activeAction = caseActions?.find(action => action.ID === activeActionID);
257
283
  if (activeAction) {
258
284
  activeActionLabel = activeAction.name;
@@ -271,7 +297,7 @@ export default function FlowContainer(props) {
271
297
 
272
298
  let loadingInfo: any;
273
299
  try {
274
- loadingInfo = thePConn.getLoadingStatus();
300
+ loadingInfo = thePConn.getLoadingStatus(''); // 1st arg empty string until typedefs properly allow optional
275
301
  } catch (ex) {
276
302
  // eslint-disable-next-line no-console
277
303
  console.error(`${thePConn.getComponentName()}: loadingInfo catch block`);
@@ -284,14 +310,14 @@ export default function FlowContainer(props) {
284
310
  // this.psService.sendMessage(false);
285
311
  }
286
312
 
287
- const caseViewMode = thePConn.getValue('context_data.caseViewMode');
313
+ const caseViewMode = thePConn.getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
288
314
  const { CASE_INFO: CASE_CONSTS } = pCoreConstants;
289
315
  if (caseViewMode && caseViewMode === 'review') {
290
316
  setTimeout(() => {
291
317
  // updated for 8.7 - 30-Mar-2022
292
318
  const todoAssignments = getToDoAssignments(thePConn);
293
319
  if (todoAssignments && todoAssignments.length > 0) {
294
- setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID));
320
+ setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID, '')); // 2nd arg empty string until typedefs properly allow optional
295
321
  setTodoDatasource({ source: todoAssignments });
296
322
  }
297
323
  setShowTodo(true);
@@ -313,13 +339,13 @@ export default function FlowContainer(props) {
313
339
  }
314
340
 
315
341
  // if have caseMessage show message and end
316
- const theCaseMessages = thePConn.getValue('caseMessages');
342
+ const theCaseMessages = localizedVal(thePConn.getValue('caseMessages', ''), localeCategory); // 2nd arg empty string until typedefs properly allow optional
317
343
 
318
344
  if (theCaseMessages || !hasAssignments()) {
319
345
  // Temp fix for 8.7 change: confirmationNote no longer coming through in caseMessages$.
320
346
  // So, if we get here and caseMessages$ is empty, use default value in DX API response
321
347
  setCaseMessages(
322
- theCaseMessages || 'Thank you! The next step in this case has been routed appropriately.'
348
+ theCaseMessages || localizedVal('Thank you! The next step in this case has been routed appropriately.', localeCategory)
323
349
  );
324
350
  setHasCaseMessages(true);
325
351
  setShowConfirm(true);
@@ -328,7 +354,7 @@ export default function FlowContainer(props) {
328
354
  PCore.getPubSubUtils().publish('assignmentFinished');
329
355
 
330
356
  // debugger;
331
- setCheckSvg(Utils.getImageSrc('check', PCore.getAssetLoader().getStaticServerUrl()));
357
+ setCheckSvg(Utils.getImageSrc('check', Utils.getSDKStaticConentUrl()));
332
358
  } else {
333
359
  // debugger;
334
360
  setHasCaseMessages(false);
@@ -357,7 +383,7 @@ export default function FlowContainer(props) {
357
383
  currentItems[key] &&
358
384
  currentItems[key].view &&
359
385
  type === 'single' &&
360
- !Utils.isEmptyObject(currentItems[key].view)
386
+ !isEmptyObject(currentItems[key].view)
361
387
  ) {
362
388
  const currentItem = currentItems[key];
363
389
  const rootView = currentItem.view;
@@ -395,7 +421,7 @@ export default function FlowContainer(props) {
395
421
  // check if have oWorkData, there are times due to timing of state change, when this
396
422
  // may not be available
397
423
  if (oWorkData) {
398
- setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name);
424
+ setContainerName(localizedVal(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name, undefined, localeReference));
399
425
  }
400
426
  }
401
427
  }
@@ -407,13 +433,20 @@ export default function FlowContainer(props) {
407
433
  ? getPConnect().getCaseSummary().assignments?.[0].urgency
408
434
  : '';
409
435
  const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName());
410
- let instructionText = thePConn.getCaseSummary()?.assignments?.[0]?.instructions;
411
- if (instructionText === undefined) {
412
- instructionText = '';
413
- }
414
436
 
415
437
  const bShowBanner = showBanner(getPConnect);
416
438
 
439
+ const displayPageMessages = () => {
440
+ let hasBanner = false;
441
+ const messages = pageMessages
442
+ ? pageMessages.map(msg => localizedVal(msg.message, 'Messages'))
443
+ : pageMessages;
444
+ hasBanner = messages && messages.length > 0;
445
+ return (
446
+ hasBanner && <AlertBanner id='flowContainerBanner' variant='urgent' messages={messages} />
447
+ );
448
+ };
449
+
417
450
  return (
418
451
  <div style={{ textAlign: 'left' }} id={buildName} className='psdk-flow-container-top'>
419
452
  {!bShowConfirm &&
@@ -425,9 +458,7 @@ export default function FlowContainer(props) {
425
458
  subheader={`Task in ${caseId} \u2022 Priority ${urgency}`}
426
459
  avatar={<Avatar className={classes.avatar}>{operatorInitials}</Avatar>}
427
460
  ></CardHeader>
428
- {instructionText !== '' ? (
429
- <Typography variant='caption'>{instructionText}</Typography>
430
- ) : null}
461
+ {displayPageMessages()}
431
462
  <MuiPickersUtilsProvider utils={DayjsUtils}>
432
463
  <Assignment getPConnect={getPConnect} itemKey={itemKey}>
433
464
  {arNewChildrenAsReact}
@@ -437,9 +468,7 @@ export default function FlowContainer(props) {
437
468
  ) : (
438
469
  <Card className={classes.root}>
439
470
  <Typography variant='h6'>{containerName}</Typography>
440
- {instructionText !== '' ? (
441
- <Typography variant='caption'>{instructionText}</Typography>
442
- ) : null}
471
+ {displayPageMessages()}
443
472
  <MuiPickersUtilsProvider utils={DayjsUtils}>
444
473
  <Assignment getPConnect={getPConnect} itemKey={itemKey}>
445
474
  {arNewChildrenAsReact}
@@ -450,6 +479,7 @@ export default function FlowContainer(props) {
450
479
  ) : (
451
480
  <div>
452
481
  <ToDo
482
+ key={Math.random()}
453
483
  getPConnect={getPConnect}
454
484
  caseInfoID={todo_caseInfoID}
455
485
  datasource={todo_datasource}
@@ -458,6 +488,7 @@ export default function FlowContainer(props) {
458
488
  type={TODO}
459
489
  context={todo_context}
460
490
  itemKey={itemKey}
491
+ isConfirm={bHasCaseMessages}
461
492
  ></ToDo>
462
493
  </div>
463
494
  ))}
@@ -470,22 +501,3 @@ export default function FlowContainer(props) {
470
501
  </div>
471
502
  );
472
503
  }
473
-
474
- FlowContainer.defaultProps = {
475
- children: null,
476
- getPConnect: null,
477
- name: '',
478
- routingInfo: null,
479
- pageMessages: null
480
- };
481
-
482
- FlowContainer.propTypes = {
483
- // eslint-disable-next-line react/no-unused-prop-types
484
- children: PropTypes.node,
485
- getPConnect: PropTypes.func,
486
- // eslint-disable-next-line react/no-unused-prop-types
487
- name: PropTypes.string,
488
- routingInfo: PropTypes.objectOf(PropTypes.any),
489
- // eslint-disable-next-line react/no-unused-prop-types
490
- pageMessages: PropTypes.arrayOf(PropTypes.any)
491
- };
@@ -1,4 +1,4 @@
1
- // From CosmosReact DX Components
1
+
2
2
 
3
3
  // Moved PCore.getConstants() into each function in which it's used until we can
4
4
  // make sure that this code isn't run until PCore is defined (after onPCoreReady)
@@ -14,8 +14,8 @@ export const addContainerItem = (pConnect) => {
14
14
 
15
15
  if(caseViewMode !== "review") {
16
16
  const target = contextName.substring(0, contextName.lastIndexOf("_"));
17
- const activeContainerItemID = window.PCore.getContainerUtils().getActiveContainerItemName(target);
18
- const containerItemData = window.PCore.getContainerUtils().getContainerItemData(target, activeContainerItemID);
17
+ const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(target);
18
+ const containerItemData = PCore.getContainerUtils().getContainerItemData(target, activeContainerItemID);
19
19
 
20
20
  if(containerItemData) {
21
21
  ({ key, flowName } = containerItemData);
@@ -35,11 +35,11 @@ export const addContainerItem = (pConnect) => {
35
35
  export const hasContainerItems = (pConnect) => {
36
36
  const contextName = pConnect.getContextName();
37
37
  const containerName = pConnect.getContainerName();
38
- return window.PCore.getContainerUtils().hasContainerItems(`${contextName}/${containerName}`);
38
+ return PCore.getContainerUtils().hasContainerItems(`${contextName}/${containerName}`);
39
39
  }
40
40
 
41
41
  export const getActiveCaseActionName = (pConnect) => {
42
- const { CASE_INFO } = window.PCore.getConstants();
42
+ const { CASE_INFO } = PCore.getConstants();
43
43
  const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
44
44
  const activeActionID = pConnect.getValue(CASE_INFO.ACTIVE_ACTION_ID);
45
45
  const activeAction = caseActions.find(
@@ -49,7 +49,7 @@ export const getActiveCaseActionName = (pConnect) => {
49
49
  };
50
50
 
51
51
  export const getFirstCaseActionName = (pConnect) => {
52
- const { CASE_INFO } = window.PCore.getConstants();
52
+ const { CASE_INFO } = PCore.getConstants();
53
53
  const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
54
54
  return caseActions[0]?.name || "";
55
55
  };
@@ -59,7 +59,7 @@ export const hasNotificationMessages = (pConnect) => {
59
59
  };
60
60
 
61
61
  export const isCaseWideLocalAction = (pConnect) => {
62
- const { CASE_INFO } = window.PCore.getConstants();
62
+ const { CASE_INFO } = PCore.getConstants();
63
63
  const actionID = pConnect.getValue(CASE_INFO.ACTIVE_ACTION_ID);
64
64
  const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
65
65
  if (caseActions && actionID) {
@@ -72,23 +72,25 @@ export const isCaseWideLocalAction = (pConnect) => {
72
72
  };
73
73
 
74
74
  export const getChildCaseAssignments = (pConnect) => {
75
- const { CASE_INFO } = window.PCore.getConstants();
75
+ const { CASE_INFO } = PCore.getConstants();
76
76
  const childCases = pConnect.getValue(CASE_INFO.CHILD_ASSIGNMENTS);
77
77
  let allAssignments = [];
78
78
  if (childCases && childCases.length > 0) {
79
- childCases.forEach(({ assignments = [], Name }) => {
80
- const childCaseAssignments = assignments.map((assignment) => ({
81
- ...assignment,
82
- caseName: Name
83
- }));
84
- allAssignments = allAssignments.concat(childCaseAssignments);
79
+ childCases.forEach(({ assignments, Name }) => {
80
+ if (assignments) {
81
+ const childCaseAssignments = assignments.map((assignment) => ({
82
+ ...assignment,
83
+ caseName: Name
84
+ }));
85
+ allAssignments = allAssignments.concat(childCaseAssignments);
86
+ }
85
87
  });
86
88
  }
87
89
  return allAssignments;
88
90
  };
89
91
 
90
92
  export const hasAssignments = (pConnect) => {
91
- const { CASE_INFO } = window.PCore.getConstants();
93
+ const { CASE_INFO } = PCore.getConstants();
92
94
  const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS);
93
95
  const childCasesAssignments = getChildCaseAssignments(pConnect);
94
96
 
@@ -118,7 +120,7 @@ export const isRenderWithToDoWrapper = (getPConnect, options) => {
118
120
  };
119
121
 
120
122
  export const getToDoAssignments = (pConnect) => {
121
- const { CASE_INFO } = window.PCore.getConstants();
123
+ const { CASE_INFO } = PCore.getConstants();
122
124
  const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
123
125
  const assignmentLabel = pConnect.getValue(CASE_INFO.ASSIGNMENT_LABEL);
124
126
  const assignments =
@@ -1,16 +1,28 @@
1
1
  import React, { useEffect, useRef, useState, createElement } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import isEqual from 'fast-deep-equal';
4
3
  import Dialog from '@material-ui/core/Dialog';
5
4
  import DialogContent from '@material-ui/core/DialogContent';
6
5
  import DialogTitle from '@material-ui/core/DialogTitle';
7
6
  import { makeStyles } from '@material-ui/core/styles';
8
7
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
9
- import Assignment from '@pega/react-sdk-components/lib/components/infra/Assignment';
10
- import CancelAlert from '@pega/react-sdk-components/lib/components/field/CancelAlert';
11
- import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
8
+ // Need to get correct implementation from component map for Assignment and CancelAlert
9
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
10
+ import { getBanners } from '@pega/react-sdk-components/lib/components/helpers/case-utils';
11
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
12
+
13
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
14
+
15
+ interface ModalViewContainerProps extends PConnProps {
16
+ // If any, enter additional props that only exist on this component
17
+ loadingInfo?: string,
18
+ routingInfo?: any,
19
+ pageMessages?: Array<string>
20
+ }
21
+
22
+
23
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 8 errors)
24
+ declare const PCore: any;
12
25
 
13
- declare const PCore;
14
26
 
15
27
  function buildName(pConnect, name = '') {
16
28
  const context = pConnect.getContextName();
@@ -67,11 +79,15 @@ const useStyles = makeStyles(theme => ({
67
79
  }
68
80
  }));
69
81
 
70
- const ModalViewContainer = props => {
82
+ export default function ModalViewContainer(props: ModalViewContainerProps) {
83
+ // Get the proper implementation (local or Pega-provided) for these components that are emitted below
84
+ const Assignment = getComponentFromMap("Assignment");
85
+ const CancelAlert = getComponentFromMap("CancelAlert");
86
+
71
87
  const classes = useStyles();
72
88
 
73
89
  const routingInfoRef = useRef({});
74
- const { getPConnect, routingInfo, loadingInfo } = props;
90
+ const { getPConnect, routingInfo = null, loadingInfo = '', pageMessages = [] } = props;
75
91
  const pConn = getPConnect();
76
92
  const {
77
93
  CONTAINER_TYPE: { MULTIPLE },
@@ -88,6 +104,10 @@ const ModalViewContainer = props => {
88
104
  const [itemKey, setItemKey] = useState('');
89
105
  const [cancelPConn, setCancelPConn] = useState(null);
90
106
 
107
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
108
+ const localeCategory = 'Data Object';
109
+
110
+
91
111
  function showAlert(payload) {
92
112
  const { latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn);
93
113
  const { isModalAction } = payload;
@@ -160,7 +180,7 @@ const ModalViewContainer = props => {
160
180
  if (
161
181
  currentItems[key] &&
162
182
  currentItems[key].view &&
163
- !Utils.isEmptyObject(currentItems[key].view)
183
+ !isEmptyObject(currentItems[key].view)
164
184
  ) {
165
185
  const currentItem = currentItems[key];
166
186
  const rootView = currentItem.view;
@@ -188,8 +208,8 @@ const ModalViewContainer = props => {
188
208
  const newComp = configObject.getPConnect();
189
209
  // const newCompName = newComp.getComponentName();
190
210
  const caseInfo =
191
- newComp && newComp.getDataObject() && newComp.getDataObject().caseInfo
192
- ? newComp.getDataObject().caseInfo
211
+ newComp && newComp.getDataObject() && newComp.getDataObject(newComp.getContextName()).caseInfo
212
+ ? newComp.getDataObject(newComp.getContextName()).caseInfo
193
213
  : null;
194
214
 
195
215
  // console.log(`ModalViewContainer just created newComp: ${newCompName}`);
@@ -218,7 +238,7 @@ const ModalViewContainer = props => {
218
238
  const caseName = theNewCaseInfo.getName();
219
239
  const ID = theNewCaseInfo.getID();
220
240
 
221
- setTitle(actionName || `New ${caseName} (${ID})`);
241
+ setTitle(actionName || `${localizedVal('New', localeCategory)} ${caseName} (${ID})`);
222
242
 
223
243
  let arChildrenAsReact: Array<any> = [];
224
244
 
@@ -255,7 +275,7 @@ const ModalViewContainer = props => {
255
275
  if (bShowModal) {
256
276
  setShowModal(false);
257
277
  }
258
- if (!Utils.isEmptyObject(oCaseInfo)) {
278
+ if (!isEmptyObject(oCaseInfo)) {
259
279
  setOCaseInfo({});
260
280
  }
261
281
  }
@@ -286,7 +306,15 @@ const ModalViewContainer = props => {
286
306
  </DialogTitle>
287
307
  <DialogContent className={classes.dlgContent}>
288
308
  {bShowModal ? (
289
- <Assignment getPConnect={createdView.getPConnect} itemKey={itemKey} isInModal>
309
+ <Assignment
310
+ getPConnect={createdView.getPConnect}
311
+ itemKey={itemKey}
312
+ isInModal
313
+ banners={getBanners({
314
+ target: itemKey,
315
+ pageMessages
316
+ })}
317
+ >
290
318
  {arNewChildrenAsReact}
291
319
  </Assignment>
292
320
  ) : (
@@ -304,17 +332,3 @@ const ModalViewContainer = props => {
304
332
  </>
305
333
  );
306
334
  };
307
-
308
- export default ModalViewContainer;
309
-
310
- ModalViewContainer.defaultProps = {
311
- getPConnect: null,
312
- loadingInfo: false,
313
- routingInfo: null
314
- };
315
-
316
- ModalViewContainer.propTypes = {
317
- getPConnect: PropTypes.func,
318
- loadingInfo: PropTypes.bool,
319
- routingInfo: PropTypes.objectOf(PropTypes.any)
320
- };
@@ -1,15 +1,24 @@
1
1
  import React, { useEffect, useState, useContext, createElement } from "react";
2
- import PropTypes from "prop-types";
3
2
  import { Box, CircularProgress } from "@material-ui/core";
4
3
  import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
5
4
  import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
6
- import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
6
+
7
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+
9
+ interface ViewContainerProps extends PConnProps {
10
+ // If any, enter additional props that only exist on this component
11
+ name?: string,
12
+ loadingInfo?: any, // can't be boolean until setDispatchObjState expects loadingInfo to be type null
13
+ routingInfo?: any,
14
+ mode?: string,
15
+ limit?: number
16
+ }
17
+
7
18
 
8
19
  // ViewContainer can emit View
9
20
  // import View from '../View';
10
21
 
11
- declare const PCore;
12
-
13
22
  //
14
23
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
15
24
  // Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
@@ -17,11 +26,11 @@ declare const PCore;
17
26
  //
18
27
 
19
28
 
20
- export default function ViewContainer(props) {
29
+ export default function ViewContainer(props: ViewContainerProps) {
21
30
  // const { getPConnect, children, routingInfo, name } = props;
22
- const { getPConnect, name, mode, limit, loadingInfo, routingInfo } = props;
31
+ const { getPConnect, name = '', mode = 'single', limit = 16, loadingInfo = false, routingInfo = null} = props;
23
32
 
24
- const { displayOnlyFA } = useContext(StoreContext);
33
+ const { displayOnlyFA } = useContext<any>(StoreContext);
25
34
 
26
35
 
27
36
  const { CONTAINER_TYPE, APP } = PCore.getConstants();
@@ -43,7 +52,7 @@ export default function ViewContainer(props) {
43
52
  // beginning of functions for use by ViewContainer
44
53
 
45
54
  function buildName() {
46
- const context = thePConn.getContextName();
55
+ const context = thePConn?.getContextName();
47
56
  let viewContainerName = name;
48
57
  if (!viewContainerName) viewContainerName = "";
49
58
  return `${context.toUpperCase()}/${viewContainerName.toUpperCase()}`;
@@ -119,7 +128,7 @@ export default function ViewContainer(props) {
119
128
  }
120
129
 
121
130
  // Getting default view label
122
- const navPages = pConn.getValue("pyPortal.pyPrimaryNavPages");
131
+ const navPages = pConn.getValue("pyPortal.pyPrimaryNavPages", ''); // 2nd arg empty string until typedefs allow optional
123
132
  const defaultViewLabel =
124
133
  Array.isArray(navPages) && navPages[0] ? navPages[0].pyLabel : "";
125
134
  // TODO: Plan is to rename window.constellationCore to window.pega (or similar)
@@ -157,7 +166,7 @@ export default function ViewContainer(props) {
157
166
  if (
158
167
  items[key] &&
159
168
  items[key].view &&
160
- !Utils.isEmptyObject(items[key].view)
169
+ !isEmptyObject(items[key].view)
161
170
  ) {
162
171
  const latestItem = items[key];
163
172
  const rootView = latestItem.view;
@@ -196,21 +205,3 @@ export default function ViewContainer(props) {
196
205
  );
197
206
 
198
207
  }
199
-
200
- ViewContainer.defaultProps = {
201
- getPConnect: null,
202
- name: "",
203
- loadingInfo: false,
204
- routingInfo: null,
205
- mode: "single",
206
- limit: 16
207
- };
208
-
209
- ViewContainer.propTypes = {
210
- getPConnect: PropTypes.func,
211
- name: PropTypes.string,
212
- loadingInfo: PropTypes.bool,
213
- routingInfo: PropTypes.objectOf(PropTypes.any),
214
- mode: PropTypes.string,
215
- limit: PropTypes.number
216
- };