@pega/react-sdk-overrides 8.8.21 → 8.23.11-debug

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 (128) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +9 -13
  2. package/lib/designSystemExtension/Banner/Banner.tsx +1 -12
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +10 -15
  4. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -10
  5. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +3 -10
  6. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +3 -11
  7. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +3 -11
  8. package/lib/designSystemExtension/Operator/Operator.tsx +12 -16
  9. package/lib/designSystemExtension/Pulse/Pulse.tsx +7 -11
  10. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -10
  11. package/lib/field/AutoComplete/AutoComplete.tsx +18 -37
  12. package/lib/field/CancelAlert/CancelAlert.tsx +4 -9
  13. package/lib/field/Checkbox/Checkbox.tsx +16 -39
  14. package/lib/field/Currency/Currency.tsx +15 -23
  15. package/lib/field/Currency/currency-utils.ts +5 -1
  16. package/lib/field/Date/Date.tsx +15 -22
  17. package/lib/field/DateTime/DateTime.tsx +14 -25
  18. package/lib/field/Decimal/Decimal.tsx +14 -25
  19. package/lib/field/Dropdown/Dropdown.tsx +26 -30
  20. package/lib/field/Email/Email.tsx +9 -17
  21. package/lib/field/Integer/Integer.tsx +7 -15
  22. package/lib/field/Percentage/Percentage.tsx +7 -15
  23. package/lib/field/Phone/Phone.tsx +11 -19
  24. package/lib/field/RadioButtons/RadioButtons.tsx +37 -25
  25. package/lib/field/SemanticLink/SemanticLink.tsx +25 -26
  26. package/lib/field/TextArea/TextArea.tsx +5 -14
  27. package/lib/field/TextContent/TextContent.tsx +1 -10
  28. package/lib/field/TextInput/TextInput.tsx +6 -15
  29. package/lib/field/Time/Time.tsx +27 -22
  30. package/lib/field/URL/URL.tsx +8 -16
  31. package/lib/field/UserReference/UserReference.tsx +60 -50
  32. package/lib/helpers/attachmentHelpers.ts +4 -4
  33. package/lib/helpers/auth.js +397 -741
  34. package/lib/helpers/authManager.js +634 -0
  35. package/lib/helpers/case-utils.tsx +9 -8
  36. package/lib/helpers/common-utils.ts +1 -1
  37. package/lib/helpers/config_access.js +73 -0
  38. package/lib/helpers/date-format-utils.ts +1 -1
  39. package/lib/helpers/event-utils.ts +1 -1
  40. package/lib/helpers/formatters/Currency.ts +11 -11
  41. package/lib/helpers/formatters/CurrencyMap.ts +5 -8
  42. package/lib/helpers/formatters/Date.ts +1 -1
  43. package/lib/helpers/formatters/common.ts +6 -2
  44. package/lib/helpers/formatters/index.ts +3 -3
  45. package/lib/helpers/simpleTableHelpers.ts +7 -7
  46. package/lib/helpers/state-utils.tsx +3 -0
  47. package/lib/helpers/template-utils.ts +6 -3
  48. package/lib/helpers/versionHelpers.ts +3 -0
  49. package/lib/infra/ActionButtons/ActionButtons.tsx +19 -9
  50. package/lib/infra/Assignment/Assignment.tsx +28 -21
  51. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -15
  52. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +58 -57
  53. package/lib/infra/Containers/FlowContainer/helpers.ts +3 -0
  54. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +19 -14
  55. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +25 -14
  56. package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -13
  57. package/lib/infra/DashboardFilter/filterUtils.tsx +1 -1
  58. package/lib/infra/DeferLoad/DeferLoad.tsx +20 -14
  59. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +14 -10
  60. package/lib/infra/MultiStep/MultiStep.tsx +22 -22
  61. package/lib/infra/NavBar/NavBar.tsx +21 -14
  62. package/lib/infra/Reference/Reference.tsx +18 -13
  63. package/lib/infra/Region/Region.tsx +6 -8
  64. package/lib/infra/RootContainer/RootContainer.tsx +25 -16
  65. package/lib/infra/Stages/Stages.tsx +8 -10
  66. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +1 -8
  67. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  68. package/lib/infra/View/View.tsx +22 -21
  69. package/lib/template/AppShell/AppShell.tsx +25 -36
  70. package/lib/template/BannerPage/BannerPage.tsx +31 -26
  71. package/lib/template/CaseSummary/CaseSummary.tsx +8 -15
  72. package/lib/template/CaseView/CaseView.tsx +25 -24
  73. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +19 -10
  74. package/lib/template/Confirmation/Confirmation.tsx +53 -27
  75. package/lib/template/DataReference/DataReference.tsx +52 -48
  76. package/lib/template/DefaultForm/DefaultForm.tsx +12 -14
  77. package/lib/template/Details/Details/Details.tsx +17 -16
  78. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +16 -13
  79. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +18 -19
  80. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +18 -20
  81. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +28 -22
  82. package/lib/template/InlineDashboard/InlineDashboard.tsx +7 -11
  83. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +17 -19
  84. package/lib/template/ListPage/ListPage.tsx +13 -14
  85. package/lib/template/ListView/ListView.tsx +186 -189
  86. package/lib/template/ListView/utils.ts +23 -170
  87. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +19 -10
  88. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +1 -16
  89. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +18 -19
  90. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +1 -9
  91. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  92. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -8
  93. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  94. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +7 -5
  95. package/lib/template/PromotedFilters/PromotedFilters.tsx +14 -16
  96. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +8 -102
  97. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +7 -24
  98. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -23
  99. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +36 -34
  100. package/lib/template/SubTabs/SubTabs.tsx +11 -10
  101. package/lib/template/SubTabs/tabUtils.ts +4 -0
  102. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +15 -10
  103. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  104. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +12 -10
  105. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +3 -17
  106. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +25 -35
  107. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +1 -7
  108. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +17 -15
  109. package/lib/template/WssNavBar/WssNavBar.tsx +1 -18
  110. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +21 -13
  111. package/lib/widget/Attachment/Attachment.tsx +16 -28
  112. package/lib/widget/CaseHistory/CaseHistory.tsx +10 -12
  113. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -13
  114. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +22 -35
  115. package/lib/widget/Followers/Followers.tsx +11 -10
  116. package/lib/widget/QuickCreate/QuickCreate.tsx +5 -11
  117. package/lib/widget/SummaryItem/SummaryItem.tsx +1 -11
  118. package/lib/widget/SummaryList/SummaryList.tsx +3 -17
  119. package/lib/widget/ToDo/ToDo.tsx +105 -62
  120. package/package.json +1 -1
  121. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +0 -121
  122. package/lib/designSystemExtension/RichTextEditor/index.tsx +0 -1
  123. package/lib/field/RichText/RichText.tsx +0 -93
  124. package/lib/field/RichText/index.tsx +0 -1
  125. package/lib/field/ScalarList/ScalarList.tsx +0 -64
  126. package/lib/field/ScalarList/config-ext.json +0 -8
  127. package/lib/field/ScalarList/index.tsx +0 -1
  128. package/lib/helpers/authManager.ts +0 -933
@@ -1,6 +1,7 @@
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';
4
5
  import { makeStyles } from '@material-ui/core/styles';
5
6
  import { Card, CardHeader, Avatar, Typography } from '@material-ui/core';
6
7
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
@@ -13,25 +14,14 @@ import { MuiPickersUtilsProvider } from '@material-ui/pickers';
13
14
 
14
15
  import { addContainerItem, getToDoAssignments, showBanner } from './helpers';
15
16
  import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
17
+ // Need to get correct implementation from component map for Assignment and ToDo
16
18
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
17
19
 
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
20
 
32
21
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 3 errors)
33
22
  declare const PCore: any;
34
23
 
24
+
35
25
  //
36
26
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
37
27
  // Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
@@ -59,18 +49,16 @@ const useStyles = makeStyles(theme => ({
59
49
  }
60
50
  }));
61
51
 
62
- export default function FlowContainer(props /* : FlowContainerProps */) {
52
+ export default function FlowContainer(props) {
63
53
  // 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");
54
+ const Assignment = getComponentFromMap("Assignment");
55
+ const ToDo = getComponentFromMap("Todo"); // NOTE: ConstellationJS Engine uses "Todo" and not "ToDo"!!!
67
56
 
68
57
  const pCoreConstants = PCore.getConstants();
69
- const PCoreVersion = PCore.getPCoreVersion();
70
58
  const { TODO } = pCoreConstants;
71
59
  const todo_headerText = 'To do';
72
60
 
73
- const { getPConnect, routingInfo, pageMessages } = props;
61
+ const { getPConnect, routingInfo } = props;
74
62
 
75
63
  const { displayOnlyFA } = useContext<any>(StoreContext);
76
64
 
@@ -104,6 +92,7 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
104
92
 
105
93
  const classes = useStyles();
106
94
 
95
+
107
96
  function initContainer() {
108
97
  const ourPConn = getPConnect();
109
98
  const containerMgr = ourPConn.getContainerManager();
@@ -139,7 +128,7 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
139
128
  }
140
129
 
141
130
  function getTodoVisibility() {
142
- const caseViewMode = getPConnect().getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
131
+ const caseViewMode = getPConnect().getValue('context_data.caseViewMode');
143
132
  if (caseViewMode && caseViewMode === 'review') {
144
133
  return true;
145
134
  }
@@ -210,8 +199,8 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
210
199
  function isCaseWideLocalAction() {
211
200
  const ourPConn = getPConnect();
212
201
 
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
202
+ const actionID = ourPConn.getValue(pCoreConstants.CASE_INFO.ACTIVE_ACTION_ID);
203
+ const caseActions = ourPConn.getValue(pCoreConstants.CASE_INFO.AVAILABLEACTIONS);
215
204
  let bCaseWideAction = false;
216
205
  if (caseActions && actionID) {
217
206
  const actionObj = caseActions.find(caseAction => caseAction.ID === actionID);
@@ -225,7 +214,7 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
225
214
  function hasChildCaseAssignments() {
226
215
  const ourPConn = getPConnect();
227
216
 
228
- const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
217
+ const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS);
229
218
  // const allAssignments = [];
230
219
  // eslint-disable-next-line sonarjs/prefer-single-boolean-return
231
220
  if (childCases && childCases.length > 0) {
@@ -239,28 +228,25 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
239
228
 
240
229
  let bHasAssignments = false;
241
230
  const assignmentsList: Array<any> = ourPConn.getValue(
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;
231
+ pCoreConstants.CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS
232
+ );
233
+ const thisOperator = PCore.getEnvironmentInfo().getOperatorIdentifier();
246
234
  // 8.7 includes assignments in Assignments List that may be assigned to
247
235
  // a different operator. So, see if there are any assignments for
248
236
  // the current operator
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
- }
237
+ let bAssignmentsForThisOperator = false;
238
+
259
239
  // Bail out if there isn't an assignmentsList
260
240
  if (!assignmentsList) {
261
241
  return bHasAssignments;
262
242
  }
263
243
 
244
+ for (const assignment of assignmentsList) {
245
+ if (assignment['assigneeInfo']['ID'] === thisOperator) {
246
+ bAssignmentsForThisOperator = true;
247
+ }
248
+ }
249
+
264
250
  const bHasChildCaseAssignments = hasChildCaseAssignments();
265
251
 
266
252
  if (bAssignmentsForThisOperator || bHasChildCaseAssignments || isCaseWideLocalAction()) {
@@ -277,8 +263,8 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
277
263
 
278
264
  const { CASE_INFO: CASE_CONSTS } = pCoreConstants;
279
265
 
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
266
+ const caseActions = ourPConn.getValue(CASE_CONSTS.CASE_INFO_ACTIONS);
267
+ const activeActionID = ourPConn.getValue(CASE_CONSTS.ACTIVE_ACTION_ID);
282
268
  const activeAction = caseActions?.find(action => action.ID === activeActionID);
283
269
  if (activeAction) {
284
270
  activeActionLabel = activeAction.name;
@@ -297,7 +283,7 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
297
283
 
298
284
  let loadingInfo: any;
299
285
  try {
300
- loadingInfo = thePConn.getLoadingStatus(''); // 1st arg empty string until typedefs properly allow optional
286
+ loadingInfo = thePConn.getLoadingStatus();
301
287
  } catch (ex) {
302
288
  // eslint-disable-next-line no-console
303
289
  console.error(`${thePConn.getComponentName()}: loadingInfo catch block`);
@@ -310,14 +296,14 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
310
296
  // this.psService.sendMessage(false);
311
297
  }
312
298
 
313
- const caseViewMode = thePConn.getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
299
+ const caseViewMode = thePConn.getValue('context_data.caseViewMode');
314
300
  const { CASE_INFO: CASE_CONSTS } = pCoreConstants;
315
301
  if (caseViewMode && caseViewMode === 'review') {
316
302
  setTimeout(() => {
317
303
  // updated for 8.7 - 30-Mar-2022
318
304
  const todoAssignments = getToDoAssignments(thePConn);
319
305
  if (todoAssignments && todoAssignments.length > 0) {
320
- setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID, '')); // 2nd arg empty string until typedefs properly allow optional
306
+ setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID));
321
307
  setTodoDatasource({ source: todoAssignments });
322
308
  }
323
309
  setShowTodo(true);
@@ -339,7 +325,7 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
339
325
  }
340
326
 
341
327
  // if have caseMessage show message and end
342
- const theCaseMessages = localizedVal(thePConn.getValue('caseMessages', ''), localeCategory); // 2nd arg empty string until typedefs properly allow optional
328
+ const theCaseMessages = localizedVal(thePConn.getValue('caseMessages'), localeCategory);
343
329
 
344
330
  if (theCaseMessages || !hasAssignments()) {
345
331
  // Temp fix for 8.7 change: confirmationNote no longer coming through in caseMessages$.
@@ -433,20 +419,13 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
433
419
  ? getPConnect().getCaseSummary().assignments?.[0].urgency
434
420
  : '';
435
421
  const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName());
422
+ let instructionText = thePConn.getCaseSummary()?.assignments?.[0]?.instructions;
423
+ if (instructionText === undefined) {
424
+ instructionText = '';
425
+ }
436
426
 
437
427
  const bShowBanner = showBanner(getPConnect);
438
428
 
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
-
450
429
  return (
451
430
  <div style={{ textAlign: 'left' }} id={buildName} className='psdk-flow-container-top'>
452
431
  {!bShowConfirm &&
@@ -458,7 +437,9 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
458
437
  subheader={`Task in ${caseId} \u2022 Priority ${urgency}`}
459
438
  avatar={<Avatar className={classes.avatar}>{operatorInitials}</Avatar>}
460
439
  ></CardHeader>
461
- {displayPageMessages()}
440
+ {instructionText !== '' ? (
441
+ <Typography variant='caption'>{instructionText}</Typography>
442
+ ) : null}
462
443
  <MuiPickersUtilsProvider utils={DayjsUtils}>
463
444
  <Assignment getPConnect={getPConnect} itemKey={itemKey}>
464
445
  {arNewChildrenAsReact}
@@ -468,7 +449,9 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
468
449
  ) : (
469
450
  <Card className={classes.root}>
470
451
  <Typography variant='h6'>{containerName}</Typography>
471
- {displayPageMessages()}
452
+ {instructionText !== '' ? (
453
+ <Typography variant='caption'>{instructionText}</Typography>
454
+ ) : null}
472
455
  <MuiPickersUtilsProvider utils={DayjsUtils}>
473
456
  <Assignment getPConnect={getPConnect} itemKey={itemKey}>
474
457
  {arNewChildrenAsReact}
@@ -488,7 +471,6 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
488
471
  type={TODO}
489
472
  context={todo_context}
490
473
  itemKey={itemKey}
491
- isConfirm={bHasCaseMessages}
492
474
  ></ToDo>
493
475
  </div>
494
476
  ))}
@@ -501,3 +483,22 @@ export default function FlowContainer(props /* : FlowContainerProps */) {
501
483
  </div>
502
484
  );
503
485
  }
486
+
487
+ FlowContainer.defaultProps = {
488
+ children: null,
489
+ getPConnect: null,
490
+ name: '',
491
+ routingInfo: null,
492
+ pageMessages: null
493
+ };
494
+
495
+ FlowContainer.propTypes = {
496
+ // eslint-disable-next-line react/no-unused-prop-types
497
+ children: PropTypes.node,
498
+ getPConnect: PropTypes.func,
499
+ // eslint-disable-next-line react/no-unused-prop-types
500
+ name: PropTypes.string,
501
+ routingInfo: PropTypes.objectOf(PropTypes.any),
502
+ // eslint-disable-next-line react/no-unused-prop-types
503
+ pageMessages: PropTypes.arrayOf(PropTypes.any)
504
+ };
@@ -1,3 +1,6 @@
1
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
2
+
3
+ declare const PCore: typeof PCoreType;
1
4
 
2
5
 
3
6
  // Moved PCore.getConstants() into each function in which it's used until we can
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useRef, useState, createElement } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import isEqual from 'fast-deep-equal';
3
4
  import Dialog from '@material-ui/core/Dialog';
4
5
  import DialogContent from '@material-ui/core/DialogContent';
@@ -10,16 +11,6 @@ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpe
10
11
  import { getBanners } from '@pega/react-sdk-components/lib/components/helpers/case-utils';
11
12
  import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
12
13
 
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
14
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 8 errors)
24
15
  declare const PCore: any;
25
16
 
@@ -79,7 +70,7 @@ const useStyles = makeStyles(theme => ({
79
70
  }
80
71
  }));
81
72
 
82
- export default function ModalViewContainer(props: ModalViewContainerProps) {
73
+ const ModalViewContainer = props => {
83
74
  // Get the proper implementation (local or Pega-provided) for these components that are emitted below
84
75
  const Assignment = getComponentFromMap("Assignment");
85
76
  const CancelAlert = getComponentFromMap("CancelAlert");
@@ -87,7 +78,7 @@ export default function ModalViewContainer(props: ModalViewContainerProps) {
87
78
  const classes = useStyles();
88
79
 
89
80
  const routingInfoRef = useRef({});
90
- const { getPConnect, routingInfo = null, loadingInfo = '', pageMessages = [] } = props;
81
+ const { getPConnect, routingInfo, loadingInfo, pageMessages } = props;
91
82
  const pConn = getPConnect();
92
83
  const {
93
84
  CONTAINER_TYPE: { MULTIPLE },
@@ -208,8 +199,8 @@ export default function ModalViewContainer(props: ModalViewContainerProps) {
208
199
  const newComp = configObject.getPConnect();
209
200
  // const newCompName = newComp.getComponentName();
210
201
  const caseInfo =
211
- newComp && newComp.getDataObject() && newComp.getDataObject(newComp.getContextName()).caseInfo
212
- ? newComp.getDataObject(newComp.getContextName()).caseInfo
202
+ newComp && newComp.getDataObject() && newComp.getDataObject().caseInfo
203
+ ? newComp.getDataObject().caseInfo
213
204
  : null;
214
205
 
215
206
  // console.log(`ModalViewContainer just created newComp: ${newCompName}`);
@@ -332,3 +323,17 @@ export default function ModalViewContainer(props: ModalViewContainerProps) {
332
323
  </>
333
324
  );
334
325
  };
326
+
327
+ export default ModalViewContainer;
328
+
329
+ ModalViewContainer.defaultProps = {
330
+ getPConnect: null,
331
+ loadingInfo: false,
332
+ routingInfo: null
333
+ };
334
+
335
+ ModalViewContainer.propTypes = {
336
+ getPConnect: PropTypes.func,
337
+ loadingInfo: PropTypes.bool,
338
+ routingInfo: PropTypes.objectOf(PropTypes.any)
339
+ };
@@ -1,19 +1,12 @@
1
1
  import React, { useEffect, useState, useContext, createElement } from "react";
2
+ import PropTypes from "prop-types";
2
3
  import { Box, CircularProgress } from "@material-ui/core";
3
4
  import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
4
5
  import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
5
6
  import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
7
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
6
8
 
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
- }
9
+ declare const PCore: typeof PCoreType;
17
10
 
18
11
 
19
12
  // ViewContainer can emit View
@@ -26,9 +19,9 @@ interface ViewContainerProps extends PConnProps {
26
19
  //
27
20
 
28
21
 
29
- export default function ViewContainer(props: ViewContainerProps) {
22
+ export default function ViewContainer(props) {
30
23
  // const { getPConnect, children, routingInfo, name } = props;
31
- const { getPConnect, name = '', mode = 'single', limit = 16, loadingInfo = false, routingInfo = null} = props;
24
+ const { getPConnect, name, mode, limit, loadingInfo, routingInfo } = props;
32
25
 
33
26
  const { displayOnlyFA } = useContext<any>(StoreContext);
34
27
 
@@ -52,7 +45,7 @@ export default function ViewContainer(props: ViewContainerProps) {
52
45
  // beginning of functions for use by ViewContainer
53
46
 
54
47
  function buildName() {
55
- const context = thePConn?.getContextName();
48
+ const context = thePConn.getContextName();
56
49
  let viewContainerName = name;
57
50
  if (!viewContainerName) viewContainerName = "";
58
51
  return `${context.toUpperCase()}/${viewContainerName.toUpperCase()}`;
@@ -128,7 +121,7 @@ export default function ViewContainer(props: ViewContainerProps) {
128
121
  }
129
122
 
130
123
  // Getting default view label
131
- const navPages = pConn.getValue("pyPortal.pyPrimaryNavPages", ''); // 2nd arg empty string until typedefs allow optional
124
+ const navPages = pConn.getValue("pyPortal.pyPrimaryNavPages");
132
125
  const defaultViewLabel =
133
126
  Array.isArray(navPages) && navPages[0] ? navPages[0].pyLabel : "";
134
127
  // TODO: Plan is to rename window.constellationCore to window.pega (or similar)
@@ -205,3 +198,21 @@ export default function ViewContainer(props: ViewContainerProps) {
205
198
  );
206
199
 
207
200
  }
201
+
202
+ ViewContainer.defaultProps = {
203
+ getPConnect: null,
204
+ name: "",
205
+ loadingInfo: false,
206
+ routingInfo: null,
207
+ mode: "single",
208
+ limit: 16
209
+ };
210
+
211
+ ViewContainer.propTypes = {
212
+ getPConnect: PropTypes.func,
213
+ name: PropTypes.string,
214
+ loadingInfo: PropTypes.bool,
215
+ routingInfo: PropTypes.objectOf(PropTypes.any),
216
+ mode: PropTypes.string,
217
+ limit: PropTypes.number
218
+ };
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable @typescript-eslint/no-shadow */
3
3
  /* eslint-disable operator-assignment */
4
4
  import { useRef, useEffect, useState, Fragment, forwardRef } from 'react';
5
+ import PropTypes from 'prop-types';
5
6
  import { v4 as uuidv4 } from 'uuid';
6
7
  import { debounce } from 'throttle-debounce';
7
8
  import { createFilter, combineFilters, getFormattedDate } from './filterUtils';
@@ -12,20 +13,13 @@ import DatePicker from 'react-datepicker';
12
13
 
13
14
  import 'react-datepicker/dist/react-datepicker.css';
14
15
 
15
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
16
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
16
17
 
17
- interface DashboardFilterProps extends PConnProps {
18
- // If any, enter additional props that only exist on this component
19
- children?: Array<any>,
20
- name: string,
21
- filterProp: string,
22
- type?: string,
23
- metadata?: any
24
- }
18
+ declare const PCore: typeof PCoreType;
25
19
 
26
20
 
27
- export default function DashboardFilter(props: DashboardFilterProps) {
28
- const { children = [], name, filterProp, type = '', metadata = null, getPConnect } = props;
21
+ export default function DashboardFilter(props) {
22
+ const { children, name, filterProp, type, metadata, getPConnect } = props;
29
23
  const { current: filterId } = useRef(uuidv4());
30
24
 
31
25
  const [startDate, setStartDate] = useState(null);
@@ -108,8 +102,7 @@ export default function DashboardFilter(props: DashboardFilterProps) {
108
102
  metadata.config.onRecordChange = e => {
109
103
  fireFilterChange(e.id);
110
104
  };
111
- return getPConnect().createComponent(metadata,
112
- null, null, {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
105
+ return getPConnect().createComponent(metadata);
113
106
  };
114
107
 
115
108
  const onChange = dates => {
@@ -174,3 +167,18 @@ export default function DashboardFilter(props: DashboardFilterProps) {
174
167
  </Fragment>
175
168
  );
176
169
  }
170
+
171
+ DashboardFilter.defaultProps = {
172
+ children: null,
173
+ type: null,
174
+ metadata: null
175
+ };
176
+
177
+ DashboardFilter.propTypes = {
178
+ getPConnect: PropTypes.func.isRequired,
179
+ children: PropTypes.object,
180
+ name: PropTypes.string.isRequired,
181
+ filterProp: PropTypes.string.isRequired,
182
+ type: PropTypes.string,
183
+ metadata: PropTypes.objectOf(PropTypes.any)
184
+ };
@@ -91,7 +91,7 @@ export const createFilterComponent = (getPConnect, filterMeta, index) => {
91
91
  metadata={filterMeta}
92
92
  type={filterMeta.type}
93
93
  >
94
- {getPConnect().createComponent(filterMeta, '','', {})}
94
+ {getPConnect().createComponent(filterMeta)}
95
95
  </DashboardFilter>
96
96
  );
97
97
  };
@@ -1,18 +1,13 @@
1
1
  import React, { useState, useEffect, createElement } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import { Box, Card, CircularProgress } from '@material-ui/core';
3
4
  import { makeStyles } from '@material-ui/core/styles';
4
5
 
5
6
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
6
7
 
7
- // import type { PConnProps } from '../../../types/PConnProps';
8
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
8
9
 
9
- // Can't use PConnProps until typedefs for showData are fixed
10
- // interface DeferLoadProps extends PConnProps {
11
- // // If any, enter additional props that only exist on this component
12
- // name: string,
13
- // isChildDeferLoad?: boolean,
14
- // isTab: boolean
15
- // }
10
+ declare const PCore: typeof PCoreType;
16
11
 
17
12
 
18
13
  //
@@ -34,7 +29,7 @@ const useStyles = makeStyles(theme => ({
34
29
  }
35
30
  }));
36
31
 
37
- export default function DeferLoad(props /* : DeferLoadProps */) {
32
+ export default function DeferLoad(props) {
38
33
  const { getPConnect, name, deferLoadId, isTab } = props;
39
34
  const [content, setContent] = useState<any>(null);
40
35
  const [isLoading, setLoading] = useState(true);
@@ -45,7 +40,7 @@ export default function DeferLoad(props /* : DeferLoadProps */) {
45
40
  const pConnect = getPConnect();
46
41
  const constants = PCore.getConstants();
47
42
 
48
- const theRequestedAssignment = pConnect.getValue( PCore.getConstants().CASE_INFO.ASSIGNMENT_LABEL, ''); // 2nd arg empty string until typedef allows optional
43
+ const theRequestedAssignment = pConnect.getValue( PCore.getConstants().CASE_INFO.ASSIGNMENT_LABEL);
49
44
  if (theRequestedAssignment !== currentLoadedAssignment) {
50
45
  // console.log(`DeferLoad: currentLoadedAssignment about to change from ${currentLoadedAssignment} to ${theRequestedAssignment}`);
51
46
  setCurrentLoadedAssignment(theRequestedAssignment);
@@ -53,7 +48,7 @@ export default function DeferLoad(props /* : DeferLoadProps */) {
53
48
 
54
49
  const { CASE, PAGE, DATA } = constants.RESOURCE_TYPES;
55
50
  const loadViewCaseID =
56
- pConnect.getValue(constants.PZINSKEY, '') || pConnect.getValue(constants.CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef allows optional
51
+ pConnect.getValue(constants.PZINSKEY) || pConnect.getValue(constants.CASE_INFO.CASE_INFO_ID);
57
52
  let containerName;
58
53
  let containerItemData;
59
54
  const targetName = pConnect.getTarget();
@@ -70,7 +65,7 @@ export default function DeferLoad(props /* : DeferLoadProps */) {
70
65
 
71
66
  const getViewOptions = () => ({
72
67
  viewContext: resourceType,
73
- pageClass: loadViewCaseID ? '' : pConnect.getDataObject(pConnect.getContextName()).pyPortal.classID,
68
+ pageClass: loadViewCaseID ? '' : pConnect.getDataObject().pyPortal.classID,
74
69
  container: isContainerPreview ? 'preview' : null,
75
70
  containerName: isContainerPreview ? 'preview' : null,
76
71
  updateData: isContainerPreview
@@ -118,7 +113,7 @@ export default function DeferLoad(props /* : DeferLoadProps */) {
118
113
 
119
114
  getPConnect()
120
115
  .getActionsApi()
121
- .showData(name, dataContext, dataContextParameters, { // Need to wait for typedefs to be fixed for showData
116
+ .showData(name, dataContext, dataContextParameters, {
122
117
  skipSemanticUrl: true,
123
118
  isDeferLoaded: true
124
119
  })
@@ -140,7 +135,7 @@ export default function DeferLoad(props /* : DeferLoadProps */) {
140
135
  } else {
141
136
  getPConnect()
142
137
  .getActionsApi()
143
- .refreshCaseView(encodeURI(loadViewCaseID), name, '') // 3rd arg empty string until typedef allows optional
138
+ .refreshCaseView(encodeURI(loadViewCaseID), name)
144
139
  .then(data => {
145
140
  onResponse(data.root);
146
141
  });
@@ -170,3 +165,14 @@ export default function DeferLoad(props /* : DeferLoadProps */) {
170
165
 
171
166
  return deferLoadContent;
172
167
  }
168
+
169
+ DeferLoad.defaultProps = {
170
+ isChildDeferLoad: false
171
+ };
172
+
173
+ DeferLoad.propTypes = {
174
+ getPConnect: PropTypes.func.isRequired,
175
+ name: PropTypes.string.isRequired,
176
+ isChildDeferLoad: PropTypes.bool,
177
+ isTab: PropTypes.bool
178
+ };
@@ -1,25 +1,18 @@
1
1
  import React from "react";
2
-
3
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
-
5
- interface ErrorBoundaryProps extends PConnProps {
6
- // If any, enter additional props that only exist on this component
7
- isInternalError?: boolean
8
- }
9
-
2
+ import PropTypes from "prop-types";
10
3
 
11
4
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
12
5
  declare const PCore: any;
13
6
 
14
7
 
15
- export default function ErrorBoundary(props: ErrorBoundaryProps) {
8
+ function ErrorBoundary(props) {
16
9
  const errorMsg = PCore.getErrorHandler().getGenericFailedMessage();
17
10
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
18
11
  const localeCategory = 'Messages';
19
12
  const ERROR_TEXT = localizedVal(errorMsg, localeCategory);
20
13
  const WORK_AREA = "workarea";
21
14
  const ERROR_WHILE_RENDERING = "ERROR_WHILE_RENDERING";
22
- const { getPConnect, isInternalError = false } = props;
15
+ const { getPConnect, isInternalError } = props;
23
16
 
24
17
  const theErrorDiv = <div>{ERROR_TEXT}</div>
25
18
 
@@ -58,3 +51,14 @@ export default function ErrorBoundary(props: ErrorBoundaryProps) {
58
51
  theErrorDiv
59
52
  );
60
53
  }
54
+ ErrorBoundary.propTypes = {
55
+ getPConnect: PropTypes.func,
56
+ isInternalError: PropTypes.bool
57
+ };
58
+
59
+ ErrorBoundary.defaultProps = {
60
+ getPConnect: null,
61
+ isInternalError: false
62
+ };
63
+
64
+ export default ErrorBoundary;
@@ -1,30 +1,14 @@
1
1
  import React from "react";
2
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
- import './MultiStep.css';
4
-
5
- // import { useConstellationContext } from "../../bridge/Context/StoreContext";
6
-
7
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
2
+ import PropTypes from "prop-types";
8
3
 
4
+ import './MultiStep.css';
9
5
 
10
- interface MultiStepProps extends PConnProps {
11
- // If any, enter additional props that only exist on this component
12
- children: Array<any>,
13
- itemKey: string,
14
- actionButtons: Array<any>,
15
- onButtonPress: any,
16
- bIsVertical: boolean,
17
- arNavigationSteps: Array<any>,
18
- // eslint-disable-next-line react/no-unused-prop-types
19
- arCurrentStepIndicies?: Array<any>
20
- }
21
-
6
+ import AssignmentCard from '@pega/react-sdk-components/lib/components/infra/AssignmentCard';
22
7
 
23
- export default function MultiStep(props: MultiStepProps) {
24
- // Get emitted components from map (so we can get any override that may exist)
25
- const AssignmentCard = getComponentFromMap("AssignmentCard");
8
+ // import { useConstellationContext } from "../../bridge/Context/StoreContext";
26
9
 
27
- const { getPConnect, children, itemKey = '', actionButtons, onButtonPress} = props;
10
+ export default function MultiStep(props) {
11
+ const { getPConnect, children, itemKey, actionButtons, onButtonPress} = props;
28
12
  const { bIsVertical, arNavigationSteps } = props;
29
13
 
30
14
  // const svgCurrent = Utils.getImageSrc("circle-solid", Utils.getSDKStaticConentUrl());
@@ -223,3 +207,19 @@ export default function MultiStep(props: MultiStepProps) {
223
207
 
224
208
  )
225
209
  }
210
+
211
+ MultiStep.propTypes = {
212
+ children: PropTypes.node.isRequired,
213
+ getPConnect: PropTypes.func.isRequired,
214
+ itemKey: PropTypes.string,
215
+ actionButtons: PropTypes.object,
216
+ onButtonPress: PropTypes.func,
217
+ bIsVertical: PropTypes.bool,
218
+ // eslint-disable-next-line react/no-unused-prop-types
219
+ arCurrentStepIndicies: PropTypes.array,
220
+ arNavigationSteps: PropTypes.array
221
+ };
222
+
223
+ MultiStep.defaultProps = {
224
+ itemKey: null
225
+ };