@pega/react-sdk-overrides 8.23.10 → 23.1.10

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 (142) 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 +38 -19
  15. package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
  16. package/lib/field/Checkbox/Checkbox.tsx +42 -9
  17. package/lib/field/Currency/Currency.tsx +24 -16
  18. package/lib/field/Currency/currency-utils.ts +1 -2
  19. package/lib/field/Date/Date.tsx +32 -18
  20. package/lib/field/DateTime/DateTime.tsx +27 -16
  21. package/lib/field/Decimal/Decimal.tsx +82 -19
  22. package/lib/field/Dropdown/Dropdown.tsx +60 -15
  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 +57 -28
  28. package/lib/field/RichText/RichText.tsx +95 -0
  29. package/lib/field/RichText/index.tsx +1 -0
  30. package/lib/field/ScalarList/ScalarList.tsx +73 -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 +752 -401
  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} +10 -11
  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 +44 -35
  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 -25
  67. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +25 -30
  68. package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
  69. package/lib/infra/DashboardFilter/filterUtils.tsx +4 -1
  70. package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
  71. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -20
  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 +14 -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 +30 -57
  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 +51 -53
  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/Details/DynamicTabs/DynamicTabs.tsx +78 -0
  95. package/lib/template/Details/DynamicTabs/config.json +36 -0
  96. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  97. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
  98. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  99. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +20 -18
  100. package/lib/template/ListPage/ListPage.tsx +14 -13
  101. package/lib/template/ListView/ListView.tsx +244 -314
  102. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  103. package/lib/template/ListView/{utils.js → utils.ts} +172 -23
  104. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
  105. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  106. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  107. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  108. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  109. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  110. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  111. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  112. package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
  113. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
  114. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +29 -8
  115. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
  116. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +33 -36
  117. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  118. package/lib/template/SubTabs/tabUtils.ts +0 -2
  119. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  120. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  121. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  122. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  123. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  124. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  125. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  126. package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
  127. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  128. package/lib/widget/Attachment/Attachment.css +15 -3
  129. package/lib/widget/Attachment/Attachment.tsx +51 -32
  130. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  131. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  132. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
  133. package/lib/widget/Followers/Followers.tsx +10 -11
  134. package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
  135. package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
  136. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  137. package/lib/widget/ToDo/ToDo.tsx +69 -104
  138. package/package.json +1 -1
  139. package/lib/helpers/authManager.js +0 -631
  140. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  141. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  142. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { Alert } from '@material-ui/lab';
3
+
4
+
5
+ // AlertBanner is one of the few components that does NOT have getPConnect.
6
+ // So, no need to extend PConnProps
7
+ interface AlertBannerProps {
8
+ // If any, enter additional props that only exist on Date here
9
+ id: string,
10
+ variant: string,
11
+ messages: Array<string>,
12
+ onDismiss?: any
13
+ }
14
+
15
+
16
+ const SEVERITY_MAP = {
17
+ urgent: 'error',
18
+ warning: 'warning',
19
+ success: 'success',
20
+ info: 'info'
21
+ };
22
+
23
+ export default function AlertBanner(props:AlertBannerProps) {
24
+ const { id, variant, messages, onDismiss } = props;
25
+ let additionalProps = {};
26
+
27
+ if (onDismiss) {
28
+ additionalProps = {
29
+ onClose: onDismiss
30
+ };
31
+ }
32
+
33
+ return (
34
+ <div id={id}>
35
+ {messages.map(message => (
36
+ <Alert
37
+ key={message}
38
+ variant='outlined'
39
+ severity={SEVERITY_MAP[variant]}
40
+ {...additionalProps}
41
+ >
42
+ {message}
43
+ </Alert>
44
+ ))}
45
+ </div>
46
+ );
47
+ }
@@ -0,0 +1 @@
1
+ export { default } from './AlertBanner';
@@ -2,7 +2,18 @@ import React from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import './Banner.css';
4
4
 
5
- export default function Banner(props) {
5
+ // AlertBanner is one of the few components that does NOT have getPConnect.
6
+ // So, no need to extend PConnProps
7
+
8
+ interface BannerProps {
9
+ // If any, enter additional props that only exist on this component
10
+ a: any,
11
+ b: any,
12
+ banner: { variant: any, backgroundColor: any, title: any, message: any, backgroundImage: any, tintImage: any },
13
+ variant: any
14
+ }
15
+
16
+ export default function Banner(props:BannerProps) {
6
17
  const { a, b, banner, variant} = props;
7
18
  const { title, message, backgroundImage } = banner;
8
19
  const variantMap = {
@@ -1,18 +1,29 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import isDeepEqual from 'fast-deep-equal/react';
4
-
5
3
  import Grid from '@material-ui/core/Grid';
6
4
  import TextField from '@material-ui/core/TextField';
7
- import Operator from '@pega/react-sdk-components/lib/components/designSystemExtension/Operator';
8
5
  import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
9
6
  import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
7
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
10
8
 
11
9
  import './CaseSummaryFields.css';
12
10
 
13
11
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
14
12
 
15
- export default function CaseSummaryFields(props) {
13
+ // CaseSummaryFields is one of the few components that does NOT have getPConnect.
14
+ // So, no need to extend PConnProps
15
+ interface CaseSummaryFieldsProps{
16
+ // If any, enter additional props that only exist on this component
17
+ status?: string,
18
+ showStatus?: boolean,
19
+ theFields: Array<any> | any | never
20
+ }
21
+
22
+
23
+ export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
24
+ // Get emitted components from map (so we can get any override that may exist)
25
+ const Operator = getComponentFromMap("Operator");
26
+
16
27
  const { status, showStatus, theFields } = props;
17
28
 
18
29
  const [theFieldsToRender, setFieldsToRender] = useState([]);
@@ -227,9 +238,3 @@ export default function CaseSummaryFields(props) {
227
238
  </React.Fragment>
228
239
  );
229
240
  }
230
-
231
- CaseSummaryFields.propTypes = {
232
- status: PropTypes.string,
233
- showStatus: PropTypes.bool,
234
- theFields: PropTypes.arrayOf(PropTypes.object)
235
- };
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
2
  import React, { createElement, isValidElement } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import Grid from '@material-ui/core/Grid';
5
4
  import Typography from '@material-ui/core/Typography';
6
5
  import { makeStyles } from '@material-ui/core/styles';
@@ -9,6 +8,14 @@ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react
9
8
 
10
9
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
11
10
 
11
+ // DetailsFields is one of the few components that does NOT have getPConnect.
12
+ // So, no need to extend PConnProps
13
+ interface DetailsFieldsProps{
14
+ // If any, enter additional props that only exist on this component
15
+ fields: Array<any>
16
+ }
17
+
18
+
12
19
  const useStyles = makeStyles(theme => ({
13
20
  root: {
14
21
  paddingRight: theme.spacing(1),
@@ -31,9 +38,9 @@ const useStyles = makeStyles(theme => ({
31
38
  }
32
39
  }));
33
40
 
34
- export default function DetailsFields(props) {
41
+ export default function DetailsFields(props: DetailsFieldsProps) {
35
42
  // const componentName = "DetailsFields";
36
- const { fields } = props;
43
+ const { fields = [] } = props;
37
44
  const classes = useStyles();
38
45
  const fieldComponents: Array<any> = [];
39
46
 
@@ -138,11 +145,3 @@ export default function DetailsFields(props) {
138
145
 
139
146
  return <React.Fragment>{getGridItems()}</React.Fragment>;
140
147
  }
141
-
142
- DetailsFields.defaultProps = {
143
- fields: []
144
- };
145
-
146
- DetailsFields.propTypes = {
147
- fields: PropTypes.arrayOf(PropTypes.any)
148
- };
@@ -2,6 +2,15 @@ import React from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import { makeStyles } from '@material-ui/core/styles';
4
4
 
5
+ // FieldGroupProps is one of the few components that does NOT have getPConnect.
6
+ // So, no need to extend PConnProps
7
+ interface FieldGroupProps {
8
+ // If any, enter additional props that only exist on this component
9
+ children: Array<any> | any,
10
+ name: string | object,
11
+ }
12
+
13
+
5
14
  const useStyles = makeStyles(theme => ({
6
15
  root: {
7
16
  marginRight: theme.spacing(1),
@@ -19,7 +28,7 @@ const useStyles = makeStyles(theme => ({
19
28
  }
20
29
  }));
21
30
 
22
- const FieldGroup = props => {
31
+ export default function FieldGroup(props: FieldGroupProps) {
23
32
  const { children, name } = props;
24
33
  const classes = useStyles();
25
34
 
@@ -44,5 +53,3 @@ const FieldGroup = props => {
44
53
  </React.Fragment>
45
54
  );
46
55
  };
47
-
48
- export default FieldGroup;
@@ -6,14 +6,22 @@ import Link from '@material-ui/core/Link';
6
6
 
7
7
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
8
8
 
9
- declare const PCore: any;
9
+ // FieldGroupList is one of the few components that does NOT have getPConnect.
10
+ // So, no need to extend PConnProps
11
+ interface FieldGroupListProps {
12
+ // If any, enter additional props that only exist on this component
13
+ items: Array<any> | any,
14
+ onDelete: any,
15
+ onAdd: any
16
+ }
10
17
 
11
- const FieldGroupList = props => {
18
+
19
+ export default function FieldGroupList(props: FieldGroupListProps) {
12
20
  let menuIconOverride$ = 'trash';
13
21
  if (menuIconOverride$) {
14
22
  menuIconOverride$ = Utils.getImageSrc(
15
23
  menuIconOverride$,
16
- PCore.getAssetLoader().getStaticServerUrl()
24
+ Utils.getSDKStaticConentUrl()
17
25
  );
18
26
  }
19
27
 
@@ -53,5 +61,3 @@ const FieldGroupList = props => {
53
61
  </Grid>
54
62
  );
55
63
  };
56
-
57
- export default FieldGroupList;
@@ -4,6 +4,16 @@ import Grid from '@material-ui/core/Grid';
4
4
  import Typography from '@material-ui/core/Typography';
5
5
  import { makeStyles } from '@material-ui/core/styles';
6
6
 
7
+ // FieldValueList is one of the few components that does NOT have getPConnect.
8
+ // So, no need to extend PConnProps
9
+ interface FieldValueListProps{
10
+ // If any, enter additional props that only exist on this component
11
+ name?: string,
12
+ value: any,
13
+ variant?: string
14
+ }
15
+
16
+
7
17
  const useStyles = makeStyles(theme => ({
8
18
  root: {
9
19
  marginRight: theme.spacing(1),
@@ -37,7 +47,7 @@ function formatItemValue(value) {
37
47
  return formattedVal;
38
48
  }
39
49
 
40
- const FieldValueList = props => {
50
+ export default function FieldValueList(props: FieldValueListProps) {
41
51
  const { name, value, variant = 'inline' } = props;
42
52
  const classes = useStyles();
43
53
 
@@ -84,5 +94,3 @@ const FieldValueList = props => {
84
94
  </React.Fragment>
85
95
  );
86
96
  };
87
-
88
- export default FieldValueList;
@@ -1,5 +1,4 @@
1
1
  import React, {useState} from "react";
2
- import PropTypes from "prop-types";
3
2
  import TextField from '@material-ui/core/TextField';
4
3
  import Popover from '@material-ui/core/Popover';
5
4
  import Grid from '@material-ui/core/Grid';
@@ -9,7 +8,22 @@ import { makeStyles } from '@material-ui/core/styles';
9
8
 
10
9
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
11
10
 
12
- declare const PCore: any;
11
+ // Operator is one of the few components that does NOT have getPConnect.
12
+ // So, no need to extend PConnProps
13
+ interface OperatorProps{
14
+ // If any, enter additional props that only exist on this component
15
+ caseOpConfig: {
16
+ label: string,
17
+ createDateTime: string,
18
+ createLabel: string,
19
+ createOperator: { userName: string, userId: string },
20
+ updateDateTime: string,
21
+ updateLabel: string,
22
+ updateOperator: { userName: string, userId: string }
23
+ }
24
+ }
25
+
26
+
13
27
 
14
28
  const useStyles = makeStyles((theme) => ({
15
29
  root: {
@@ -22,7 +36,7 @@ const useStyles = makeStyles((theme) => ({
22
36
  }
23
37
  }));
24
38
 
25
- export default function Operator(props) {
39
+ export default function Operator(props: OperatorProps) {
26
40
  // const componentName = "Operator";
27
41
  const { caseOpConfig } = props;
28
42
  const classes = useStyles();
@@ -31,7 +45,7 @@ export default function Operator(props) {
31
45
  let caseOpLabel = "---";
32
46
  let caseOpName = "---";
33
47
  let caseOpId = "";
34
- let caseTime = null;
48
+ let caseTime = "";
35
49
 
36
50
  if (fieldLabel === "create operator") {
37
51
  caseOpLabel = caseOpConfig.createLabel;
@@ -59,6 +73,8 @@ export default function Operator(props) {
59
73
  function showOperatorDetails(event) {
60
74
 
61
75
  const operatorPreviewPromise = PCore.getUserApi().getOperatorDetails(caseOpId);
76
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
77
+ const localeCategory = 'Operator';
62
78
 
63
79
  operatorPreviewPromise.then((res) => {
64
80
  const fillerString = "---";
@@ -71,27 +87,27 @@ export default function Operator(props) {
71
87
  fields = [
72
88
  {
73
89
  id: "pyPosition",
74
- name: "Position",
90
+ name: localizedVal("Position", localeCategory),
75
91
  value: res.data.pyOperatorInfo.pyPosition ? res.data.pyOperatorInfo.pyPosition : fillerString
76
92
  },
77
93
  {
78
94
  id: "pyOrganization",
79
- name: "Organization",
95
+ name: localizedVal("Organization", localeCategory),
80
96
  value: res.data.pyOperatorInfo.pyOrganization ? res.data.pyOperatorInfo.pyOrganization : fillerString
81
97
  },
82
98
  {
83
99
  id: "ReportToUserName",
84
- name: "Reports to",
100
+ name: localizedVal('Reports to', localeCategory),
85
101
  value: res.data.pyOperatorInfo.pyReportToUserName ? res.data.pyOperatorInfo.pyReportToUserName : fillerString
86
102
  },
87
103
  {
88
104
  id: "pyTelephone",
89
- name: "Telephone",
105
+ name: localizedVal('Telephone', localeCategory),
90
106
  value: res.data.pyOperatorInfo.pyTelephone ? <a href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>{res.data.pyOperatorInfo.pyTelephone}</a> : fillerString
91
107
  },
92
108
  {
93
109
  id: "pyEmailAddress",
94
- name: "Email address",
110
+ name: localizedVal('Email address', localeCategory),
95
111
  value: res.data.pyOperatorInfo.pyEmailAddress ? <a href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>{res.data.pyOperatorInfo.pyEmailAddress}</a> : fillerString
96
112
  }
97
113
  ];
@@ -101,27 +117,27 @@ export default function Operator(props) {
101
117
  fields = [
102
118
  {
103
119
  id: "pyPosition",
104
- name: "Position",
120
+ name: localizedVal("Position", localeCategory),
105
121
  value: fillerString
106
122
  },
107
123
  {
108
124
  id: "pyOrganization",
109
- name: "Organization",
125
+ name: localizedVal("Organization", localeCategory),
110
126
  value: fillerString
111
127
  },
112
128
  {
113
129
  id: "ReportToUserName",
114
- name: "Reports to",
130
+ name: localizedVal('Reports to', localeCategory),
115
131
  value: fillerString
116
132
  },
117
133
  {
118
134
  id: "pyTelephone",
119
- name: "Telephone",
135
+ name: localizedVal('Telephone', localeCategory),
120
136
  value: fillerString
121
137
  },
122
138
  {
123
139
  id: "pyEmailAddress",
124
- name: "Email address",
140
+ name: localizedVal('Email address', localeCategory),
125
141
  value: fillerString
126
142
  }
127
143
  ];
@@ -187,10 +203,3 @@ export default function Operator(props) {
187
203
  </React.Fragment>;
188
204
 
189
205
  }
190
-
191
- Operator.defaultProps = {
192
- }
193
-
194
- Operator.propTypes = {
195
- caseOpConfig: PropTypes.object.isRequired,
196
- };
@@ -1,8 +1,15 @@
1
1
  import React from "react";
2
- // import PropTypes from "prop-types";
3
2
  import { Card, CardContent, CardHeader, Typography } from "@material-ui/core";
4
3
  import { makeStyles } from '@material-ui/core/styles';
5
4
 
5
+ // Pulse is one of the few components that does NOT have getPConnect.
6
+ // So, no need to extend PConnProps
7
+ interface PulseProps {
8
+ // If any, enter additional props that only exist on this component
9
+ children?: Array<any>
10
+ }
11
+
12
+
6
13
  const useStyles = makeStyles((theme) => ({
7
14
  root: {
8
15
  marginTop: theme.spacing(1),
@@ -12,8 +19,9 @@ const useStyles = makeStyles((theme) => ({
12
19
  },
13
20
  }));
14
21
 
15
- export default function Pulse(/* props */) {
16
- // const { children } = props;
22
+ export default function Pulse(props: PulseProps) {
23
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
24
+ const { children } = props;
17
25
  const classes = useStyles();
18
26
 
19
27
  return (
@@ -25,7 +33,3 @@ export default function Pulse(/* props */) {
25
33
  </Card>
26
34
  );
27
35
  }
28
-
29
- // Pulse.propTypes = {
30
- // children: PropTypes.arrayOf(PropTypes.node).isRequired
31
- // };
@@ -0,0 +1,121 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Editor } from '@tinymce/tinymce-react';
3
+ import { FormControl, FormHelperText, InputLabel, makeStyles } from '@material-ui/core';
4
+ import { useAfterInitialEffect, useConsolidatedRef, useUID } from '@pega/react-sdk-components/lib/hooks';
5
+
6
+ const useStyles = makeStyles((theme) => ({
7
+ fieldLabel: {
8
+ position: 'relative',
9
+ transform: 'translate(0, 0px) scale(1)',
10
+ marginBottom: '5px',
11
+ color: theme.palette.text.secondary
12
+ }
13
+ }));
14
+
15
+ interface RichTextEditorProps {
16
+ id?: string;
17
+ defaultValue: string;
18
+ label: string;
19
+ labelHidden: boolean;
20
+ info: string;
21
+ testId: string;
22
+ placeholder: string;
23
+ disabled: boolean;
24
+ required: boolean;
25
+ readOnly: boolean;
26
+ error: boolean;
27
+ onBlur: React.EventHandler<any>;
28
+ onChange: React.EventHandler<any>;
29
+ }
30
+
31
+ const RichTextEditor = forwardRef(function RichTextEditor(props: RichTextEditorProps, ref) {
32
+ const classes = useStyles();
33
+ const uid = useUID();
34
+ const { id = uid, defaultValue, label, labelHidden, info, testId, placeholder, disabled, required, readOnly, error, onBlur, onChange } = props;
35
+
36
+ const editorRef: any = useConsolidatedRef(ref);
37
+ let richTextComponent: any = null;
38
+
39
+ useAfterInitialEffect(() => {
40
+ editorRef?.current.mode.set(readOnly || disabled ? 'readonly' : 'design');
41
+ }, [readOnly, disabled]);
42
+
43
+ const filePickerCallback = (cb) => {
44
+ const input = document.createElement('input');
45
+ input.setAttribute('type', 'file');
46
+ input.setAttribute('accept', 'image/*');
47
+
48
+ input.addEventListener('change', (e: any) => {
49
+ const file = e.target.files[0];
50
+
51
+ const reader: any = new FileReader();
52
+ reader.addEventListener('load', () => {
53
+ /*
54
+ Note: Now we need to register the blob in TinyMCEs image blob
55
+ registry. In the next release this part hopefully won't be
56
+ necessary, as we are looking to handle it internally.
57
+ */
58
+ const blobId = `blobid${new Date().getTime()}`;
59
+ const blobCache = editorRef.current.editorUpload.blobCache;
60
+ const base64 = reader.result.split(',')[1];
61
+ const blobInfo = blobCache.create(blobId, file, base64);
62
+ blobCache.add(blobInfo);
63
+
64
+ /* call the callback and populate the Title field with the file name */
65
+ cb(blobInfo.blobUri(), { title: file.name });
66
+ });
67
+ reader.readAsDataURL(file);
68
+ });
69
+
70
+ input.click();
71
+ };
72
+
73
+ if (readOnly) {
74
+ const value = defaultValue || '--';
75
+ // eslint-disable-next-line react/no-danger
76
+ richTextComponent = <div key={id} id={id} className="readonly-richtext-editor" dangerouslySetInnerHTML={{ __html: value }} />;
77
+ } else {
78
+ richTextComponent = (
79
+ <Editor
80
+ tinymceScriptSrc="tinymce/tinymce.min.js"
81
+ onInit={(_evt, editor) => {
82
+ editorRef.current = editor;
83
+ }}
84
+ id={id}
85
+ initialValue={defaultValue}
86
+ disabled={disabled}
87
+ init={{
88
+ placeholder,
89
+ menubar: false,
90
+ statusbar: false,
91
+ min_height: 130,
92
+ plugins: ['lists', 'advlist', 'autolink', 'image', 'link', 'autoresize'],
93
+ autoresize_bottom_margin: 0,
94
+ toolbar: disabled ? false : 'blocks | bold italic strikethrough | bullist numlist outdent indent | link image',
95
+ toolbar_location: 'bottom',
96
+ content_style: 'body { font-family:Helvetica, Arial,sans-serif; font-size:14px }',
97
+ branding: false,
98
+ paste_data_images: true,
99
+ file_picker_types: 'image',
100
+ file_picker_callback: filePickerCallback
101
+ }}
102
+ onBlur={onBlur}
103
+ onEditorChange={onChange}
104
+ />
105
+ );
106
+ }
107
+
108
+ return (
109
+ <FormControl data-test-id={testId} error={error} required={required}>
110
+ {!labelHidden && (
111
+ <InputLabel id="demo-simple-select-error-label" className={classes.fieldLabel}>
112
+ {label}
113
+ </InputLabel>
114
+ )}
115
+ {richTextComponent}
116
+ {info && <FormHelperText>{info}</FormHelperText>}
117
+ </FormControl>
118
+ );
119
+ });
120
+
121
+ export default RichTextEditor;
@@ -0,0 +1 @@
1
+ export { default } from './RichTextEditor';
@@ -2,13 +2,22 @@ import React from 'react';
2
2
  import { Button } from '@material-ui/core';
3
3
  import './WssQuickCreate.css';
4
4
 
5
- export default function WssQuickCreate(props) {
5
+ // WssQuickCreate is one of the few components that does NOT have getPConnect.
6
+ // So, no need to extend PConnProps
7
+ interface WssQuickCreateProps {
8
+ // If any, enter additional props that only exist on this component
9
+ heading: string,
10
+ actions?: Array<any>
11
+ }
12
+
13
+
14
+ export default function WssQuickCreate(props: WssQuickCreateProps) {
6
15
  const { heading, actions } = props;
7
16
 
8
17
  return (
9
18
  <div>
10
- <h1 className='quick-link-heading'>{heading}</h1>
11
- <ul className='quick-link-ul-list'>
19
+ <h1 id="quick-links-heading" className='quick-link-heading'>{heading}</h1>
20
+ <ul id="quick-links" className='quick-link-ul-list'>
12
21
  {actions &&
13
22
  actions.map(element => {
14
23
  return (