@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,26 +1,14 @@
1
1
  import React, { createElement } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import Grid from '@material-ui/core/Grid';
3
4
  import { GridSize } from '@material-ui/core/Grid';
4
5
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
-
7
- // import type { PConnProps } from '../../../../types/PConnProps';
8
-
9
- // Can't use PConnProps until PConnect.getChildren() type is ok
10
- // interface WideNarrowDetailsProps extends PConnProps {
11
- // // If any, enter additional props that only exist on this component
12
- // showLabel?: boolean,
13
- // label?: string,
14
- // showHighlightedData?: boolean
15
- // }
6
+ import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
16
7
 
17
8
  const COLUMN_WIDTHS = [8, 4];
18
9
 
19
- export default function WideNarrowDetails(props /* : WideNarrowDetailsProps */) {
20
- // Get emitted components from map (so we can get any override that may exist)
21
- const FieldGroup = getComponentFromMap('FieldGroup');
22
-
23
- const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
10
+ export default function WideNarrowDetails(props) {
11
+ const { label, showLabel, getPConnect, showHighlightedData } = props;
24
12
 
25
13
  // Get the inherited props from the parent to determine label settings
26
14
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
@@ -31,18 +19,13 @@ export default function WideNarrowDetails(props /* : WideNarrowDetailsProps */)
31
19
  getPConnect().setInheritedProp('readOnly', true);
32
20
  const children = getPConnect()
33
21
  .getChildren()
34
- ?.map((configObject, index) => {
35
- let theConfigObject: object = configObject;
36
- if (!theConfigObject) {
37
- theConfigObject = {}
38
- }
39
-
40
- return createElement(createPConnectComponent(), {
41
- ...theConfigObject,
22
+ .map((configObject, index) =>
23
+ createElement(createPConnectComponent(), {
24
+ ...configObject,
42
25
  // eslint-disable-next-line react/no-array-index-key
43
26
  key: index.toString()
44
- });
45
- });
27
+ })
28
+ );
46
29
 
47
30
  // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
48
31
  let highlightedDataArr = [];
@@ -57,18 +40,12 @@ export default function WideNarrowDetails(props /* : WideNarrowDetailsProps */)
57
40
  field.config.displayAsStatus = true;
58
41
  }
59
42
 
60
- return getPConnect().createComponent(field,
61
- '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
43
+ return getPConnect().createComponent(field);
62
44
  });
63
45
  }
64
46
 
65
- let theName = '';
66
- if (propsToUse?.showLabel && propsToUse.label ) {
67
- theName = propsToUse.label;
68
- }
69
-
70
47
  return (
71
- <FieldGroup name={theName}>
48
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
72
49
  {showHighlightedData && highlightedDataArr.length > 0 && (
73
50
  <Grid container spacing={1} style={{ padding: '0 0 1em' }}>
74
51
  {highlightedDataArr.map((child, i) => (
@@ -79,7 +56,7 @@ export default function WideNarrowDetails(props /* : WideNarrowDetailsProps */)
79
56
  </Grid>
80
57
  )}
81
58
  <Grid container spacing={1}>
82
- {children?.map((child, i) => (
59
+ {children.map((child, i) => (
83
60
  <Grid item xs={COLUMN_WIDTHS[i] as GridSize} key={`r-${i + 1}`}>
84
61
  {child}
85
62
  </Grid>
@@ -88,3 +65,16 @@ export default function WideNarrowDetails(props /* : WideNarrowDetailsProps */)
88
65
  </FieldGroup>
89
66
  );
90
67
  }
68
+
69
+ WideNarrowDetails.defaultProps = {
70
+ label: undefined,
71
+ showLabel: true,
72
+ showHighlightedData: false
73
+ };
74
+
75
+ WideNarrowDetails.propTypes = {
76
+ showLabel: PropTypes.bool,
77
+ label: PropTypes.string,
78
+ getPConnect: PropTypes.func.isRequired,
79
+ showHighlightedData: PropTypes.bool
80
+ };
@@ -2,13 +2,7 @@ import React from "react";
2
2
 
3
3
  import './WideNarrowForm.css';
4
4
 
5
- // WideNarrowForm does NOT have getPConnect. So, no need to extend from PConnProps
6
- interface WideNarrowFormProps {
7
- // If any, enter additional props that only exist on this component
8
- children: Array<any>
9
- }
10
-
11
- export default function WideNarrowForm(props: WideNarrowFormProps) {
5
+ export default function WideNarrowForm(props) {
12
6
  const {children} = props;
13
7
 
14
8
  return (
@@ -1,25 +1,15 @@
1
1
  import React, { Children } from "react";
2
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
-
4
- // WideNarrowPage does NOT have getPConnect. So, no need to extend from PConnProps
5
- interface WideNarrowPageProps {
6
- // If any, enter additional props that only exist on this component
7
- children: Array<any>,
8
- title: string,
9
- templateCol?: string,
10
- icon?: string
11
- }
2
+ import PropTypes from "prop-types";
12
3
 
4
+ // import { TwoColumnPage as TwoColumn } from "@pega/cosmos-react-core";
5
+ import WideNarrow from '@pega/react-sdk-components/lib/components/template/WideNarrow/WideNarrow';
13
6
 
14
7
  /*
15
8
  * The wrapper handles knowing how to take in just children and mapping
16
9
  * to the Cosmos template.
17
10
  */
18
- export default function WideNarrowPage(props: WideNarrowPageProps) {
19
- // Get emitted components from map (so we can get any override that may exist)
20
- const WideNarrow = getComponentFromMap('WideNarrow');
21
-
22
- const { children, title, templateCol = '1fr 1fr', icon = '' } = props;
11
+ export default function WideNarrowPage(props) {
12
+ const { children, title, templateCol, icon } = props;
23
13
  const childArray = Children.toArray(children);
24
14
 
25
15
  return (
@@ -34,3 +24,15 @@ export default function WideNarrowPage(props: WideNarrowPageProps) {
34
24
  </div>
35
25
  );
36
26
  }
27
+
28
+ WideNarrowPage.propTypes = {
29
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
30
+ title: PropTypes.string.isRequired,
31
+ templateCol: PropTypes.string,
32
+ icon: PropTypes.string
33
+ };
34
+
35
+ WideNarrowPage.defaultProps = {
36
+ templateCol: "1fr 1fr",
37
+ icon: ""
38
+ };
@@ -11,23 +11,6 @@ import MenuIcon from '@material-ui/icons/Menu';
11
11
  import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
12
12
  import './WssNavBar.css';
13
13
 
14
- // WssNavBar does NOT have getPConnect. So, no need to extend from PConnProps
15
-
16
- interface WssNavBarProps {
17
- // If any, enter additional props that only exist on this component
18
- appInfo: any,
19
- navLinks: Array<any>
20
- operator: { currentUserInitials: string },
21
- navDisplayOptions: { alignment: string, position: string},
22
- // eslint-disable-next-line react/no-unused-prop-types
23
- portalName: string,
24
- imageSrc: string,
25
- // eslint-disable-next-line react/no-unused-prop-types
26
- fullImageSrc: string,
27
- appName: any
28
- }
29
-
30
-
31
14
  const useStyles = makeStyles(theme => ({
32
15
  root: {
33
16
  display: 'flex'
@@ -49,7 +32,7 @@ const useStyles = makeStyles(theme => ({
49
32
  }
50
33
  }));
51
34
 
52
- export default function WssNavBar(props: WssNavBarProps) {
35
+ export default function WssNavBar(props) {
53
36
  const { appInfo, navLinks, operator, navDisplayOptions } = props;
54
37
  const { alignment, position } = navDisplayOptions;
55
38
  const classes = useStyles();
@@ -1,18 +1,8 @@
1
1
  import React from "react";
2
+ import PropTypes from "prop-types";
2
3
  import { Card, CardContent, CardHeader, Typography, CardActions, Button } from "@material-ui/core";
3
4
  import { makeStyles } from '@material-ui/core/styles';
4
5
 
5
- // AppAnnouncement is one of the few components that does NOT have getPConnect.
6
- // So, no need to extend PConnProps
7
- interface AppAnnouncementProps {
8
- // If any, enter additional props that only exist on this component
9
- header?: string,
10
- description?: string,
11
- datasource?: any,
12
- whatsnewlink?: string
13
- }
14
-
15
-
16
6
  const useStyles = makeStyles((theme) => ({
17
7
  root: {
18
8
  marginTop: theme.spacing(1),
@@ -22,8 +12,8 @@ const useStyles = makeStyles((theme) => ({
22
12
  },
23
13
  }));
24
14
 
25
- export default function AppAnnouncement(props: AppAnnouncementProps) {
26
- const { header = '', description = '', datasource = [], whatsnewlink = '' } = props;
15
+ const AppAnnouncement = (props) => {
16
+ const { header, description, datasource, whatsnewlink } = props;
27
17
  let details = [];
28
18
  if (datasource && datasource.source) {
29
19
  details = datasource.source.map((item) => {
@@ -57,3 +47,21 @@ export default function AppAnnouncement(props: AppAnnouncementProps) {
57
47
  </Card>
58
48
  );
59
49
  };
50
+
51
+ AppAnnouncement.propTypes = {
52
+ header: PropTypes.string,
53
+ description: PropTypes.string,
54
+ datasource: PropTypes.instanceOf(Object),
55
+ whatsnewlink: PropTypes.string,
56
+ // image: PropTypes.string
57
+ };
58
+
59
+ AppAnnouncement.defaultProps = {
60
+ header: "",
61
+ description: "",
62
+ // image: "",
63
+ datasource: [],
64
+ whatsnewlink: ""
65
+ };
66
+
67
+ export default AppAnnouncement;
@@ -4,22 +4,13 @@ import { Button } from '@material-ui/core';
4
4
  import React, { useState, useEffect } from 'react';
5
5
  import { buildFilePropsFromResponse, getIconFromFileType, validateMaxSize, getIconForAttachment } from '@pega/react-sdk-components/lib/components/helpers/attachmentHelpers';
6
6
  import './Attachment.css';
7
+ import SummaryList from '@pega/react-sdk-components/lib/components/widget/SummaryList'
7
8
  import { CircularProgress } from "@material-ui/core";
8
9
  import download from "downloadjs";
9
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
10
-
11
- // import type { PConnProps } from '../../../types/PConnProps';
12
10
 
13
11
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
14
12
  declare const PCore: any;
15
13
 
16
- // NOTE: we can't use PConnProps in this file because the
17
- // PConnect type is missing a number of expected properties
18
- // such as attachmentsInfo and incorrect type for our use of clearMessages,
19
- // interface AttachmentProps extends PConnProps {
20
- // // If any, enter additional props that only exist on this component
21
- // }
22
-
23
14
 
24
15
  const getAttachmentKey = (name='') => name ? `attachmentsList.${name}` : 'attachmentsList';
25
16
 
@@ -27,10 +18,7 @@ function getCurrentAttachmentsList(key, context) {
27
18
  return PCore.getStoreValue(`.${key}`, 'context_data', context) || [];
28
19
  }
29
20
 
30
- export default function Attachment(props /* :AttachmentProps */) {
31
- // Get emitted components from map (so we can get any override that may exist)
32
- const SummaryList = getComponentFromMap('SummaryList');
33
-
21
+ export default function Attachment(props) {
34
22
  const PCoreVersion = PCore.getPCoreVersion();
35
23
  const {value, getPConnect, label, validatemessage} = props;
36
24
  /* this is a temporary fix because required is supposed to be passed as a boolean and NOT as a string */
@@ -48,7 +36,7 @@ export default function Attachment(props /* :AttachmentProps */) {
48
36
  categoryName = value.pyCategoryName;
49
37
  }
50
38
 
51
- let valueRef = pConn.getStateProps()["value"];
39
+ let valueRef = pConn.getStateProps().value;
52
40
  valueRef = valueRef.indexOf('.') === 0 ? valueRef.substring(1) : valueRef;
53
41
  const [file, setFile] = useState(fileTemp);
54
42
 
@@ -78,9 +66,9 @@ export default function Attachment(props /* :AttachmentProps */) {
78
66
  let index = 0;
79
67
  const maxAttachmentSize = 5;
80
68
  for (const item of arFiles) {
81
- if (!validateMaxSize(item, maxAttachmentSize.toString())) {
69
+ if (!validateMaxSize(item, maxAttachmentSize)) {
82
70
  item.error = true;
83
- item.meta = pConn.getLocalizedValue(`File is too big. Max allowed size is ${maxAttachmentSize}MB.`, '', ''); // 2nd and 3rd args empty string until typedef marked correctly
71
+ item.meta = pConn.getLocalizedValue(`File is too big. Max allowed size is ${maxAttachmentSize}MB.`);
84
72
  }
85
73
  item.mimeType = item.type;
86
74
  item.icon = getIconFromFileType(item.type);
@@ -106,7 +94,7 @@ export default function Attachment(props /* :AttachmentProps */) {
106
94
  actions = [
107
95
  {
108
96
  id: `Cancel-${att.ID}`,
109
- text: pConn.getLocalizedValue('Cancel', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
97
+ text: pConn.getLocalizedValue('Cancel'),
110
98
  icon: "times",
111
99
  onClick: cancelFile
112
100
  }
@@ -119,7 +107,7 @@ export default function Attachment(props /* :AttachmentProps */) {
119
107
  "download",
120
108
  {
121
109
  id: `download-${ID}`,
122
- text: isFile ? pConn.getLocalizedValue('Download', '', '') : pConn.getLocalizedValue('Open', '', ''),
110
+ text: isFile ? pConn.getLocalizedValue('Download') : pConn.getLocalizedValue('Open'),
123
111
  icon: isFile ? "download" : "open",
124
112
  onClick: downloadFile
125
113
  }
@@ -128,7 +116,7 @@ export default function Attachment(props /* :AttachmentProps */) {
128
116
  "delete",
129
117
  {
130
118
  id: `Delete-${ID}`,
131
- text: pConn.getLocalizedValue('Delete', '', ''),
119
+ text: pConn.getLocalizedValue('Delete'),
132
120
  icon: "trash",
133
121
  onClick: deleteFile
134
122
  }
@@ -144,7 +132,7 @@ export default function Attachment(props /* :AttachmentProps */) {
144
132
  actions = [
145
133
  {
146
134
  id: `Remove-${att.ID}`,
147
- text: pConn.getLocalizedValue('Remove', '', ''),
135
+ text: pConn.getLocalizedValue('Remove'),
148
136
  icon: "trash",
149
137
  onClick: removeFile
150
138
  }
@@ -187,13 +175,13 @@ export default function Attachment(props /* :AttachmentProps */) {
187
175
  const errorHandler = (isFetchCanceled) => {
188
176
  return (error) => {
189
177
  if (!isFetchCanceled(error)) {
190
- let uploadFailMsg = pConn.getLocalizedValue('Something went wrong', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
178
+ let uploadFailMsg = pConn.getLocalizedValue('Something went wrong');
191
179
  if (error.response && error.response.data && error.response.data.errorDetails) {
192
- uploadFailMsg = pConn.getLocalizedValue(error.response.data.errorDetails[0].localizedValue, '', ''); // 2nd and 3rd args empty string until typedef marked correctly
180
+ uploadFailMsg = pConn.getLocalizedValue(error.response.data.errorDetails[0].localizedValue);
193
181
  }
194
182
  myFiles[0].meta = uploadFailMsg;
195
183
  myFiles[0].error = true;
196
- myFiles[0].fileName = pConn.getLocalizedValue('Unable to upload file', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
184
+ myFiles[0].fileName = pConn.getLocalizedValue('Unable to upload file');
197
185
  arFileList$ = myFiles.map((att) => {
198
186
  return getNewListUtilityItemProps({
199
187
  att,
@@ -258,7 +246,7 @@ export default function Attachment(props /* :AttachmentProps */) {
258
246
  }
259
247
  );
260
248
  }
261
- const fieldName = pConn.getStateProps()["value"];
249
+ const fieldName = pConn.getStateProps().value;
262
250
  const context = pConn.getContextName();
263
251
 
264
252
  PCore.getMessageManager().clearMessages({
@@ -267,7 +255,7 @@ export default function Attachment(props /* :AttachmentProps */) {
267
255
  pageReference: pConn.getPageReference(),
268
256
  context
269
257
  });
270
- myFiles[0].meta = pConn.getLocalizedValue('Uploaded successfully', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
258
+ myFiles[0].meta = pConn.getLocalizedValue('Uploaded successfully');
271
259
 
272
260
  arFileList$ = myFiles.map((att) => {
273
261
  return getNewListUtilityItemProps({
@@ -390,12 +378,12 @@ export default function Attachment(props /* :AttachmentProps */) {
390
378
  let oMenu: any = {};
391
379
 
392
380
  oMenu.icon = "download";
393
- oMenu.text = pConn.getLocalizedValue('Download', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
381
+ oMenu.text = pConn.getLocalizedValue('Download');
394
382
  oMenu.onClick = () => { _downloadFileFromList(value.pxResults[0])}
395
383
  arMenuList.push(oMenu);
396
384
  oMenu = {};
397
385
  oMenu.icon = "trash";
398
- oMenu.text = pConn.getLocalizedValue('Delete', '', ''); // 2nd and 3rd args empty string until typedef marked correctly
386
+ oMenu.text = pConn.getLocalizedValue('Delete');
399
387
  oMenu.onClick = () => { _removeFileFromList(arFileList$[0], arFileList$)}
400
388
  arMenuList.push(oMenu);
401
389
 
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useRef, useEffect } from "react";
2
+ import PropTypes from "prop-types";
2
3
  import { withStyles, Theme, createStyles } from '@material-ui/core/styles';
3
4
  import Table from '@material-ui/core/Table';
4
5
  import TableBody from '@material-ui/core/TableBody';
@@ -8,13 +9,6 @@ import TableHead from '@material-ui/core/TableHead';
8
9
  import TableRow from '@material-ui/core/TableRow';
9
10
  import isDeepEqual from 'fast-deep-equal/react';
10
11
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
11
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
12
-
13
-
14
- interface CaseHistoryProps extends PConnProps {
15
- // If any, enter additional props that only exist on this component
16
- }
17
-
18
12
 
19
13
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 2 errors)
20
14
  declare const PCore: any;
@@ -38,15 +32,15 @@ const StyledTableCell = withStyles((theme: Theme) =>
38
32
  )(TableCell);
39
33
 
40
34
 
41
- export default function CaseHistory(props:CaseHistoryProps) {
35
+ export default function CaseHistory(props) {
42
36
  const { getPConnect } = props;
43
37
  const thePConn = getPConnect();
44
38
  // let waitingForData = true;
45
39
 
46
40
  const displayedColumns = [
47
- { label: thePConn.getLocalizedValue('Date', '', ''), type: "DateTime", fieldName: "pxTimeCreated" }, // 2nd and 3rd args empty string until typedef marked correctly
48
- { label: thePConn.getLocalizedValue('Description', '', ''), type: "TextInput", fieldName: "pyMessageKey" }, // 2nd and 3rd args empty string until typedef marked correctly
49
- { label: thePConn.getLocalizedValue('Performed by', '', ''), type: "TextInput", fieldName: "pyPerformer" } // 2nd and 3rd args empty string until typedef marked correctly
41
+ { label: thePConn.getLocalizedValue('Date'), type: "DateTime", fieldName: "pxTimeCreated" },
42
+ { label: thePConn.getLocalizedValue('Description'), type: "TextInput", fieldName: "pyMessageKey" },
43
+ { label: thePConn.getLocalizedValue('Performed by'), type: "TextInput", fieldName: "pyPerformer" }
50
44
  ];
51
45
 
52
46
  const rowData: any = useRef([]);
@@ -54,7 +48,7 @@ export default function CaseHistory(props:CaseHistoryProps) {
54
48
  const [waitingForData, setWaitingForData] = useState<boolean>(true);
55
49
 
56
50
 
57
- const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
51
+ const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
58
52
  const dataViewName = "D_pyWorkHistory";
59
53
  const context = thePConn.getContextName();
60
54
 
@@ -169,3 +163,7 @@ export default function CaseHistory(props:CaseHistoryProps) {
169
163
  </div>
170
164
  )
171
165
  }
166
+
167
+ CaseHistory.propTypes = {
168
+ getPConnect: PropTypes.func.isRequired
169
+ };
@@ -2,19 +2,7 @@ import React from "react";
2
2
  import { Button } from '@material-ui/core';
3
3
  import './ActionButtonsForFileUtil.css';
4
4
 
5
- // ActionButtonsForFileUtil does NOT have getPConnect.
6
- // So, no need to extend PConnProps
7
-
8
- interface ActionButtonsForFileUtilProps {
9
- // If any, enter additional props that only exist on this component
10
- arMainButtons: Array<any>,
11
- arSecondaryButtons: Array<any>,
12
- primaryAction: any,
13
- secondaryAction: any
14
- }
15
-
16
-
17
- export default function ActionButtonsForFileUtil(props: ActionButtonsForFileUtilProps) {
5
+ export default function ActionButtonsForFileUtil(props) {
18
6
 
19
7
  return (
20
8
  <div className="psdk-actions">
@@ -2,33 +2,20 @@ import React, { useEffect, useState } from "react";
2
2
  import TextField from '@material-ui/core/TextField';
3
3
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
4
4
  import download from "downloadjs";
5
- // import SummaryList from '../../SummaryList';
6
- // import ActionButtonsForFileUtil from '../ActionButtonsForFileUtil';
5
+ import SummaryList from '@pega/react-sdk-components/lib/components/widget/SummaryList';
6
+ import ActionButtonsForFileUtil from '@pega/react-sdk-components/lib/components/widget/FileUtility/ActionButtonsForFileUtil';
7
7
  import './FileUtility.css';
8
8
  import { IconButton, Menu, MenuItem } from '@material-ui/core';
9
9
  import MoreVertIcon from '@material-ui/icons/MoreVert';
10
10
  import { Button } from '@material-ui/core';
11
11
  import { validateMaxSize } from '@pega/react-sdk-components/lib/components/helpers/attachmentHelpers';
12
12
  import { CircularProgress } from "@material-ui/core";
13
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
14
-
15
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
16
-
17
-
18
- interface FileUtilityProps extends PConnProps {
19
- // If any, enter additional props that only exist on this component
20
- }
21
-
22
13
 
23
14
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 5 errors)
24
15
  declare const PCore: any;
25
16
 
26
17
 
27
- export default function FileUtility(props:FileUtilityProps) {
28
- // Get emitted components from map (so we can get any override that may exist)
29
- const SummaryList = getComponentFromMap('SummaryList');
30
- const ActionButtonsForFileUtil = getComponentFromMap('ActionButtonsForFileUtil');
31
-
18
+ export default function FileUtility(props) {
32
19
  const { getPConnect } = props;
33
20
  const thePConn = getPConnect();
34
21
  const required = true;
@@ -46,16 +33,16 @@ export default function FileUtility(props:FileUtilityProps) {
46
33
  showfileModal: false,
47
34
  fileList: [],
48
35
  attachedFiles: [],
49
- fileMainButtons: [{ actionID: "attach", jsAction: "attachFiles", name: thePConn.getLocalizedValue('Attach files', '', '')}], // 2nd and 3rd args empty string until typedef marked correctly
50
- fileSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: thePConn.getLocalizedValue('Cancel', '', '')}] // 2nd and 3rd args empty string until typedef marked correctly
36
+ fileMainButtons: [{ actionID: "attach", jsAction: "attachFiles", name: thePConn.getLocalizedValue('Attach files')}],
37
+ fileSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: thePConn.getLocalizedValue('Cancel')}]
51
38
  };
52
39
  const [fileData, setFileData] = useState(fileTemp);
53
40
  const linkTemp = {
54
41
  showLinkModal: false,
55
42
  linksList: [],
56
43
  attachedLinks: [],
57
- linkMainButtons: [{ actionID: "attach", jsAction: "attachLinks", name: thePConn.getLocalizedValue('Attach links', '', '')}], // 2nd and 3rd args empty string until typedef marked correctly
58
- linkSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: thePConn.getLocalizedValue('Cancel', '', '')}] // 2nd and 3rd args empty string until typedef marked correctly
44
+ linkMainButtons: [{ actionID: "attach", jsAction: "attachLinks", name: thePConn.getLocalizedValue('Attach links')}],
45
+ linkSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: thePConn.getLocalizedValue('Cancel')}]
59
46
  };
60
47
  const [linkData, setLinkData] = useState(linkTemp);
61
48
  const [anchorEl, setAnchorEl] = useState(null);
@@ -94,7 +81,7 @@ export default function FileUtility(props:FileUtilityProps) {
94
81
  actions = [
95
82
  {
96
83
  id: `Cancel-${att.ID}`,
97
- text: thePConn.getLocalizedValue('Cancel', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
84
+ text: thePConn.getLocalizedValue('Cancel'),
98
85
  icon: "times",
99
86
  onClick: cancelFile
100
87
  }
@@ -107,7 +94,7 @@ export default function FileUtility(props:FileUtilityProps) {
107
94
  "download",
108
95
  {
109
96
  id: `download-${ID}`,
110
- text: isFile ? thePConn.getLocalizedValue('Download', '', '') : thePConn.getLocalizedValue('Open', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
97
+ text: isFile ? thePConn.getLocalizedValue('Download') : thePConn.getLocalizedValue('Open'),
111
98
  icon: isFile ? "download" : "open",
112
99
  onClick: downloadFile
113
100
  }
@@ -116,7 +103,7 @@ export default function FileUtility(props:FileUtilityProps) {
116
103
  "delete",
117
104
  {
118
105
  id: `Delete-${ID}`,
119
- text: thePConn.getLocalizedValue('Delete', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
106
+ text: thePConn.getLocalizedValue('Delete'),
120
107
  icon: "trash",
121
108
  onClick: deleteFile
122
109
  }
@@ -132,7 +119,7 @@ export default function FileUtility(props:FileUtilityProps) {
132
119
  actions = [
133
120
  {
134
121
  id: `Remove-${att.ID}`,
135
- text: thePConn.getLocalizedValue('Remove', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
122
+ text: thePConn.getLocalizedValue('Remove'),
136
123
  icon: "trash",
137
124
  onClick: removeFile
138
125
  }
@@ -200,7 +187,7 @@ export default function FileUtility(props:FileUtilityProps) {
200
187
  const getAttachments = () => {
201
188
 
202
189
  const attachmentUtils = PCore.getAttachmentUtils();
203
- const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
190
+ const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
204
191
 
205
192
  if (caseID && caseID !== "") {
206
193
  const attPromise = attachmentUtils.getCaseAttachments(caseID, thePConn.getContextName());
@@ -259,7 +246,7 @@ export default function FileUtility(props:FileUtilityProps) {
259
246
  function setNewFiles(arFiles) {
260
247
  let index = 0;
261
248
  for (const file of arFiles) {
262
- if (!validateMaxSize(file, '5')) {
249
+ if (!validateMaxSize(file, 5)) {
263
250
  file.error = true;
264
251
  file.meta = "File is too big. Max allowed size is 5MB.";
265
252
  }
@@ -332,7 +319,7 @@ export default function FileUtility(props:FileUtilityProps) {
332
319
 
333
320
  function onAttachFiles() {
334
321
  const attachmentUtils = PCore.getAttachmentUtils();
335
- const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
322
+ const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
336
323
  const onUploadProgress = () => {};
337
324
  const errorHandler = () => {};
338
325
  closeFilePopup()
@@ -457,7 +444,7 @@ export default function FileUtility(props:FileUtilityProps) {
457
444
 
458
445
  function onAttachLinks() {
459
446
  const attachmentUtils = PCore.getAttachmentUtils();
460
- const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
447
+ const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
461
448
  const links = linkData.attachedLinks;
462
449
  closeAddLinksPopup();
463
450
  const linksToAttach = links.map((item: any) => ({
@@ -506,8 +493,8 @@ export default function FileUtility(props:FileUtilityProps) {
506
493
  open={Boolean(anchorEl)}
507
494
  onClose={handleClose}
508
495
  >
509
- <MenuItem style={{fontSize: '14px'}} onClick={onAddFilesClick}>{thePConn.getLocalizedValue('Add files', '', '')}</MenuItem> {/* 2nd and 3rd args empty string until typedef marked correctly */}
510
- <MenuItem style={{fontSize: '14px'}} onClick={onAddLinksClick}>{thePConn.getLocalizedValue('Add links', '', '')}</MenuItem> {/* 2nd and 3rd args empty string until typedef marked correctly */}
496
+ <MenuItem style={{fontSize: '14px'}} onClick={onAddFilesClick}>{thePConn.getLocalizedValue('Add files')}</MenuItem>
497
+ <MenuItem style={{fontSize: '14px'}} onClick={onAddLinksClick}>{thePConn.getLocalizedValue('Add links')}</MenuItem>
511
498
  </Menu>
512
499
  </div>
513
500
  </div>
@@ -520,12 +507,12 @@ export default function FileUtility(props:FileUtilityProps) {
520
507
  {fileData.showfileModal && (
521
508
  <div className="psdk-dialog-background">
522
509
  <div className="psdk-modal-file-top">
523
- <h3>{thePConn.getLocalizedValue('Add local files', '', '')}</h3>
510
+ <h3>{thePConn.getLocalizedValue('Add local files')}</h3>
524
511
  <div className="psdk-modal-body">
525
512
  <div className="psdk-modal-file-selector">
526
513
  <label htmlFor='upload-files'>
527
514
  <input style={{ display: 'none' }} id='upload-files' name='upload-files' type='file' multiple onChange={uploadMyFiles}/>
528
- <Button variant='outlined' color='primary' component="span">{thePConn.getLocalizedValue('Attach files', '', '')}</Button> {/* 2nd and 3rd args empty string until typedef marked correctly */}
515
+ <Button variant='outlined' color='primary' component="span">{thePConn.getLocalizedValue('Attach files')}</Button>
529
516
  </label>
530
517
  </div>
531
518
  {fileData.fileList.length > 0 && (<div style={{marginTop: '1rem'}}>
@@ -541,7 +528,7 @@ export default function FileUtility(props:FileUtilityProps) {
541
528
  {linkData.showLinkModal && (
542
529
  <div className="psdk-dialog-background">
543
530
  <div className="psdk-modal-file-top">
544
- <h3>{thePConn.getLocalizedValue('Add links', '', '')}</h3> {/* 2nd and 3rd args empty string until typedef marked correctly */}
531
+ <h3>{thePConn.getLocalizedValue('Add links')}</h3>
545
532
  <div className="psdk-modal-body">
546
533
  <div className="psdk-modal-links-row">
547
534
  <div className="psdk-links-two-column">
@@ -553,7 +540,7 @@ export default function FileUtility(props:FileUtilityProps) {
553
540
  </div>
554
541
  </div>
555
542
  <div className="psdk-modal-link-add">
556
- <Button className="psdk-add-link-action" color="primary" variant="contained" component="span" onClick={addLink} disabled={link.disable}>{thePConn.getLocalizedValue('Add link', '', '')}</Button> {/* 2nd and 3rd args empty string until typedef marked correctly */}
543
+ <Button className="psdk-add-link-action" color="primary" variant="contained" component="span" onClick={addLink} disabled={link.disable}>{thePConn.getLocalizedValue('Add link')}</Button>
557
544
  </div>
558
545
  </div>
559
546
  {linkData.linksList.length > 0 && (<div style={{marginTop: '1rem'}}>
@@ -568,7 +555,7 @@ export default function FileUtility(props:FileUtilityProps) {
568
555
  {showViewAllModal && (<div className="psdk-dialog-background">
569
556
  <div className="psdk-modal-file-top">
570
557
  <div className="psdk-view-all-header">
571
- <h3>{thePConn.getLocalizedValue('Attachments', '', '')}</h3> {/* 2nd and 3rd args empty string until typedef marked correctly */}
558
+ <h3>{thePConn.getLocalizedValue('Attachments')}</h3>
572
559
  {/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
573
560
  <button type="button" className="psdk-close-button" onClick = {() => setViewAll(false)}><img className="psdk-utility-card-actions-svg-icon" src={closeSvgIcon}></img></button>
574
561
  </div>