@pega/react-sdk-overrides 0.23.26 → 8.8.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
  2. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  3. package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
  9. package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
  12. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  13. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
  14. package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
  15. package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
  16. package/lib/field/Checkbox/Checkbox.tsx +41 -17
  17. package/lib/field/Currency/Currency.tsx +23 -15
  18. package/lib/field/Currency/currency-utils.ts +1 -2
  19. package/lib/field/Date/Date.tsx +31 -17
  20. package/lib/field/DateTime/DateTime.tsx +26 -15
  21. package/lib/field/Decimal/Decimal.tsx +82 -19
  22. package/lib/field/Dropdown/Dropdown.tsx +57 -14
  23. package/lib/field/Email/Email.tsx +17 -9
  24. package/lib/field/Integer/Integer.tsx +15 -7
  25. package/lib/field/Percentage/Percentage.tsx +15 -7
  26. package/lib/field/Phone/Phone.tsx +21 -12
  27. package/lib/field/RadioButtons/RadioButtons.tsx +54 -27
  28. package/lib/field/RichText/RichText.tsx +93 -0
  29. package/lib/field/RichText/index.tsx +1 -0
  30. package/lib/field/ScalarList/ScalarList.tsx +64 -0
  31. package/lib/field/ScalarList/config-ext.json +8 -0
  32. package/lib/field/ScalarList/index.tsx +1 -0
  33. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  34. package/lib/field/SemanticLink/utils.ts +2 -1
  35. package/lib/field/TextArea/TextArea.tsx +14 -5
  36. package/lib/field/TextContent/TextContent.tsx +10 -1
  37. package/lib/field/TextInput/TextInput.tsx +40 -11
  38. package/lib/field/Time/Time.tsx +29 -26
  39. package/lib/field/URL/URL.tsx +24 -8
  40. package/lib/field/UserReference/UserReference.tsx +52 -60
  41. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
  42. package/lib/helpers/auth.js +741 -390
  43. package/lib/helpers/authManager.ts +933 -0
  44. package/lib/helpers/case-utils.tsx +103 -0
  45. package/lib/helpers/common-utils.ts +4 -0
  46. package/lib/helpers/config_access.js +63 -145
  47. package/lib/helpers/data_page.ts +2 -1
  48. package/lib/helpers/date-format-utils.ts +29 -19
  49. package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
  50. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
  51. package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
  52. package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
  53. package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
  54. package/lib/helpers/formatters/{common.js → common.ts} +4 -4
  55. package/lib/helpers/formatters/{index.js → index.ts} +3 -3
  56. package/lib/helpers/simpleTableHelpers.ts +10 -6
  57. package/lib/helpers/state-utils.tsx +47 -0
  58. package/lib/helpers/template-utils.ts +3 -4
  59. package/lib/helpers/utils.ts +12 -4
  60. package/lib/helpers/versionHelpers.ts +0 -1
  61. package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
  62. package/lib/infra/Assignment/Assignment.tsx +38 -32
  63. package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
  64. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
  65. package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
  66. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -27
  67. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
  68. package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
  69. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
  70. package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
  71. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
  72. package/lib/infra/MultiStep/MultiStep.tsx +24 -24
  73. package/lib/infra/NavBar/NavBar.tsx +23 -24
  74. package/lib/infra/Reference/Reference.tsx +13 -18
  75. package/lib/infra/Region/Region.tsx +8 -6
  76. package/lib/infra/RootContainer/RootContainer.tsx +32 -39
  77. package/lib/infra/Stages/Stages.tsx +15 -9
  78. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
  79. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  80. package/lib/infra/View/View.tsx +28 -56
  81. package/lib/template/AppShell/AppShell.tsx +51 -34
  82. package/lib/template/BannerPage/BannerPage.tsx +26 -31
  83. package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
  84. package/lib/template/CaseView/CaseView.tsx +137 -100
  85. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
  86. package/lib/template/Confirmation/Confirmation.tsx +29 -52
  87. package/lib/template/DataReference/DataReference.tsx +50 -52
  88. package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
  89. package/lib/template/DefaultForm/utils/index.ts +33 -0
  90. package/lib/template/Details/Details/Details.tsx +16 -17
  91. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
  92. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
  93. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
  94. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
  95. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  96. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
  97. package/lib/template/ListPage/ListPage.tsx +14 -13
  98. package/lib/template/ListView/ListView.tsx +191 -186
  99. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  100. package/lib/template/ListView/{utils.js → utils.ts} +172 -23
  101. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
  102. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  103. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  104. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  105. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  106. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  107. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  108. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  109. package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
  110. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
  111. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +28 -7
  112. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
  113. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -36
  114. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  115. package/lib/template/SubTabs/tabUtils.ts +0 -2
  116. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  117. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  118. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  119. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  120. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  121. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  122. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  123. package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
  124. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  125. package/lib/widget/Attachment/Attachment.css +15 -3
  126. package/lib/widget/Attachment/Attachment.tsx +51 -32
  127. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  128. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  129. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
  130. package/lib/widget/Followers/Followers.tsx +10 -11
  131. package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
  132. package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
  133. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  134. package/lib/widget/ToDo/ToDo.tsx +69 -104
  135. package/package.json +1 -1
  136. package/lib/helpers/authManager.js +0 -631
  137. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  138. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  139. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -2,7 +2,6 @@
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';
6
5
  import { v4 as uuidv4 } from 'uuid';
7
6
  import { debounce } from 'throttle-debounce';
8
7
  import { createFilter, combineFilters, getFormattedDate } from './filterUtils';
@@ -10,12 +9,23 @@ import { getFilterExpression } from './filterUtils';
10
9
  import { TextField } from '@material-ui/core';
11
10
  import React from 'react';
12
11
  import DatePicker from 'react-datepicker';
12
+
13
13
  import 'react-datepicker/dist/react-datepicker.css';
14
14
 
15
- declare const PCore: any;
15
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
16
+
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
+ }
16
25
 
17
- export default function DashboardFilter(props) {
18
- const { children, name, filterProp, type, metadata, getPConnect } = props;
26
+
27
+ export default function DashboardFilter(props: DashboardFilterProps) {
28
+ const { children = [], name, filterProp, type = '', metadata = null, getPConnect } = props;
19
29
  const { current: filterId } = useRef(uuidv4());
20
30
 
21
31
  const [startDate, setStartDate] = useState(null);
@@ -98,7 +108,8 @@ export default function DashboardFilter(props) {
98
108
  metadata.config.onRecordChange = e => {
99
109
  fireFilterChange(e.id);
100
110
  };
101
- return getPConnect().createComponent(metadata);
111
+ return getPConnect().createComponent(metadata,
112
+ null, null, {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
102
113
  };
103
114
 
104
115
  const onChange = dates => {
@@ -163,18 +174,3 @@ export default function DashboardFilter(props) {
163
174
  </Fragment>
164
175
  );
165
176
  }
166
-
167
- DashboardFilter.defaultProps = {
168
- children: null,
169
- type: null,
170
- metadata: null
171
- };
172
-
173
- DashboardFilter.propTypes = {
174
- getPConnect: PropTypes.func.isRequired,
175
- children: PropTypes.object,
176
- name: PropTypes.string.isRequired,
177
- filterProp: PropTypes.string.isRequired,
178
- type: PropTypes.string,
179
- metadata: PropTypes.objectOf(PropTypes.any)
180
- };
@@ -5,8 +5,10 @@ import { Grid, Link } from '@material-ui/core';
5
5
  import React from 'react';
6
6
  import DashboardFilter from './DashboardFilter';
7
7
 
8
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 5 errors)
8
9
  declare const PCore: any;
9
10
 
11
+
10
12
  export const createFilter = (value, fieldId, comparator = 'EQ') => {
11
13
  return {
12
14
  condition: {
@@ -89,7 +91,7 @@ export const createFilterComponent = (getPConnect, filterMeta, index) => {
89
91
  metadata={filterMeta}
90
92
  type={filterMeta.type}
91
93
  >
92
- {getPConnect().createComponent(filterMeta)}
94
+ {getPConnect().createComponent(filterMeta, '','', {})}
93
95
  </DashboardFilter>
94
96
  );
95
97
  };
@@ -1,11 +1,19 @@
1
1
  import React, { useState, useEffect, createElement } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { Box, Card, CircularProgress } from '@material-ui/core';
4
3
  import { makeStyles } from '@material-ui/core/styles';
5
4
 
6
5
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
7
6
 
8
- declare const PCore;
7
+ // import type { PConnProps } from '../../../types/PConnProps';
8
+
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
+ // }
16
+
9
17
 
10
18
  //
11
19
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -26,7 +34,7 @@ const useStyles = makeStyles(theme => ({
26
34
  }
27
35
  }));
28
36
 
29
- export default function DeferLoad(props) {
37
+ export default function DeferLoad(props /* : DeferLoadProps */) {
30
38
  const { getPConnect, name, deferLoadId, isTab } = props;
31
39
  const [content, setContent] = useState<any>(null);
32
40
  const [isLoading, setLoading] = useState(true);
@@ -37,7 +45,7 @@ export default function DeferLoad(props) {
37
45
  const pConnect = getPConnect();
38
46
  const constants = PCore.getConstants();
39
47
 
40
- const theRequestedAssignment = pConnect.getValue( PCore.getConstants().CASE_INFO.ASSIGNMENT_LABEL);
48
+ const theRequestedAssignment = pConnect.getValue( PCore.getConstants().CASE_INFO.ASSIGNMENT_LABEL, ''); // 2nd arg empty string until typedef allows optional
41
49
  if (theRequestedAssignment !== currentLoadedAssignment) {
42
50
  // console.log(`DeferLoad: currentLoadedAssignment about to change from ${currentLoadedAssignment} to ${theRequestedAssignment}`);
43
51
  setCurrentLoadedAssignment(theRequestedAssignment);
@@ -45,7 +53,7 @@ export default function DeferLoad(props) {
45
53
 
46
54
  const { CASE, PAGE, DATA } = constants.RESOURCE_TYPES;
47
55
  const loadViewCaseID =
48
- pConnect.getValue(constants.PZINSKEY) || pConnect.getValue(constants.CASE_INFO.CASE_INFO_ID);
56
+ pConnect.getValue(constants.PZINSKEY, '') || pConnect.getValue(constants.CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef allows optional
49
57
  let containerName;
50
58
  let containerItemData;
51
59
  const targetName = pConnect.getTarget();
@@ -62,7 +70,7 @@ export default function DeferLoad(props) {
62
70
 
63
71
  const getViewOptions = () => ({
64
72
  viewContext: resourceType,
65
- pageClass: loadViewCaseID ? '' : pConnect.getDataObject().pyPortal.classID,
73
+ pageClass: loadViewCaseID ? '' : pConnect.getDataObject(pConnect.getContextName()).pyPortal.classID,
66
74
  container: isContainerPreview ? 'preview' : null,
67
75
  containerName: isContainerPreview ? 'preview' : null,
68
76
  updateData: isContainerPreview
@@ -110,7 +118,7 @@ export default function DeferLoad(props) {
110
118
 
111
119
  getPConnect()
112
120
  .getActionsApi()
113
- .showData(name, dataContext, dataContextParameters, {
121
+ .showData(name, dataContext, dataContextParameters, { // Need to wait for typedefs to be fixed for showData
114
122
  skipSemanticUrl: true,
115
123
  isDeferLoaded: true
116
124
  })
@@ -132,7 +140,7 @@ export default function DeferLoad(props) {
132
140
  } else {
133
141
  getPConnect()
134
142
  .getActionsApi()
135
- .refreshCaseView(encodeURI(loadViewCaseID), name)
143
+ .refreshCaseView(encodeURI(loadViewCaseID), name, '') // 3rd arg empty string until typedef allows optional
136
144
  .then(data => {
137
145
  onResponse(data.root);
138
146
  });
@@ -162,14 +170,3 @@ export default function DeferLoad(props) {
162
170
 
163
171
  return deferLoadContent;
164
172
  }
165
-
166
- DeferLoad.defaultProps = {
167
- isChildDeferLoad: false
168
- };
169
-
170
- DeferLoad.propTypes = {
171
- getPConnect: PropTypes.func.isRequired,
172
- name: PropTypes.string.isRequired,
173
- isChildDeferLoad: PropTypes.bool,
174
- isTab: PropTypes.bool
175
- };
@@ -1,13 +1,25 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
 
4
- declare const PCore;
3
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
4
 
6
- function ErrorBoundary(props) {
7
- const ERROR_TEXT = PCore.getErrorHandler().getGenericFailedMessage();
5
+ interface ErrorBoundaryProps extends PConnProps {
6
+ // If any, enter additional props that only exist on this component
7
+ isInternalError?: boolean
8
+ }
9
+
10
+
11
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
12
+ declare const PCore: any;
13
+
14
+
15
+ export default function ErrorBoundary(props: ErrorBoundaryProps) {
16
+ const errorMsg = PCore.getErrorHandler().getGenericFailedMessage();
17
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
18
+ const localeCategory = 'Messages';
19
+ const ERROR_TEXT = localizedVal(errorMsg, localeCategory);
8
20
  const WORK_AREA = "workarea";
9
21
  const ERROR_WHILE_RENDERING = "ERROR_WHILE_RENDERING";
10
- const { getPConnect, isInternalError } = props;
22
+ const { getPConnect, isInternalError = false } = props;
11
23
 
12
24
  const theErrorDiv = <div>{ERROR_TEXT}</div>
13
25
 
@@ -21,9 +33,9 @@ function ErrorBoundary(props) {
21
33
 
22
34
  if (!isInternalError) {
23
35
  // eslint-disable-next-line no-console
24
- console.error(`Unable to load the component ${pConn.getComponentName()}
25
- This might be due to the view meta data getting corrupted or the component file missing.
26
- Raw meta data for the component: ${JSON.stringify(pConn.getRawMetadata())}`);
36
+ console.error(`${localizedVal('Unable to load the component', localeCategory)} ${pConn.getComponentName()}
37
+ ${localizedVal(`This might be due to the view meta data getting corrupted or the component file missing.
38
+ Raw meta data for the component:`, localeCategory)} ${JSON.stringify(pConn.getRawMetadata())}`);
27
39
  }
28
40
 
29
41
  if (pConn.getConfigProps().type === "page") {
@@ -46,14 +58,3 @@ function ErrorBoundary(props) {
46
58
  theErrorDiv
47
59
  );
48
60
  }
49
- ErrorBoundary.propTypes = {
50
- getPConnect: PropTypes.func,
51
- isInternalError: PropTypes.bool
52
- };
53
-
54
- ErrorBoundary.defaultProps = {
55
- getPConnect: null,
56
- isInternalError: false
57
- };
58
-
59
- export default ErrorBoundary;
@@ -1,18 +1,34 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
-
2
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
3
  import './MultiStep.css';
5
4
 
6
- import AssignmentCard from '@pega/react-sdk-components/lib/components/infra/AssignmentCard';
7
-
8
5
  // import { useConstellationContext } from "../../bridge/Context/StoreContext";
9
6
 
10
- export default function MultiStep(props) {
11
- const { getPConnect, children, itemKey, actionButtons, onButtonPress} = props;
7
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+
9
+
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
+
22
+
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");
26
+
27
+ const { getPConnect, children, itemKey = '', actionButtons, onButtonPress} = props;
12
28
  const { bIsVertical, arNavigationSteps } = props;
13
29
 
14
- // const svgCurrent = Utils.getImageSrc("circle-solid", PCore.getAssetLoader().getStaticServerUrl());
15
- // const svgNotCurrent = Utils.getImageSrc("circle-solid", PCore.getAssetLoader().getStaticServerUrl());
30
+ // const svgCurrent = Utils.getImageSrc("circle-solid", Utils.getSDKStaticConentUrl());
31
+ // const svgNotCurrent = Utils.getImageSrc("circle-solid", Utils.getSDKStaticConentUrl());
16
32
 
17
33
  function _getVIconClass(status): string {
18
34
  if (status === "current") {
@@ -207,19 +223,3 @@ export default function MultiStep(props) {
207
223
 
208
224
  )
209
225
  }
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
- };
@@ -1,7 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { makeStyles, useTheme } from '@material-ui/core/styles';
3
3
  import clsx from 'clsx';
4
- import PropTypes from 'prop-types';
5
4
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
6
5
  import './NavBar.css';
7
6
  import {
@@ -35,11 +34,23 @@ import useMediaQuery from '@material-ui/core/useMediaQuery';
35
34
  import { useNavBar } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
36
35
  import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
37
36
 
38
- declare const PCore;
37
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
38
+
39
+
40
+ interface NavBarProps extends PConnProps {
41
+ // If any, enter additional props that only exist on this component
42
+ // eslint-disable-next-line react/no-unused-prop-types
43
+ appName?: string,
44
+ pages?: Array<any>,
45
+ caseTypes: Array<any>,
46
+ pConn?: any
47
+ }
48
+
39
49
 
40
50
  const iconMap = {
41
51
  'pi pi-headline': <HomeOutlinedIcon fontSize='large' />,
42
- 'pi pi-flag-solid': <FlagOutlinedIcon fontSize='large' />
52
+ 'pi pi-flag-solid': <FlagOutlinedIcon fontSize='large' />,
53
+ 'pi pi-home-solid': <HomeOutlinedIcon fontSize='large' />
43
54
  };
44
55
 
45
56
  const drawerWidth = 300;
@@ -95,8 +106,8 @@ const useStyles = makeStyles(theme => ({
95
106
  }
96
107
  }));
97
108
 
98
- export default function NavBar(props) {
99
- const { pConn, pages, caseTypes } = props;
109
+ export default function NavBar(props: NavBarProps) {
110
+ const { pConn, pages = [], caseTypes = [] } = props;
100
111
 
101
112
  const classes = useStyles();
102
113
  const theme = useTheme();
@@ -108,7 +119,10 @@ export default function NavBar(props) {
108
119
  const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false);
109
120
  const [anchorEl, setAnchorEl] = useState(null);
110
121
 
111
- const portalLogoImage = Utils.getIconPath(PCore.getAssetLoader().getStaticServerUrl()).concat(
122
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
123
+ const localeCategory = 'AppShell';
124
+
125
+ const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat(
112
126
  'pzpega-logo-mark.svg'
113
127
  );
114
128
  const portalOperator = PCore.getEnvironmentInfo().getOperatorName();
@@ -126,7 +140,7 @@ export default function NavBar(props) {
126
140
  .showPage(pyRuleName, pyClassName)
127
141
  .then(() => {
128
142
  // eslint-disable-next-line no-console
129
- console.log(`showPage completed`);
143
+ console.log(`${localizedVal('showPage completed', localeCategory)}`);
130
144
  });
131
145
  }
132
146
 
@@ -142,7 +156,7 @@ export default function NavBar(props) {
142
156
  .createWork(sCaseType, actionInfo)
143
157
  .then(() => {
144
158
  // eslint-disable-next-line no-console
145
- console.log(`createWork completed`);
159
+ console.log(`${localizedVal('createWork completed', localeCategory)}`);
146
160
  });
147
161
  }
148
162
 
@@ -278,7 +292,7 @@ export default function NavBar(props) {
278
292
  <ListItemIcon>
279
293
  <ArrowBackIcon fontSize='large' />
280
294
  </ListItemIcon>
281
- <Typography variant='inherit'>Logout</Typography>
295
+ <Typography variant='inherit'>{localizedVal('Logout', localeCategory)}</Typography>
282
296
  </MenuItem>
283
297
  </Menu>
284
298
  </>
@@ -286,18 +300,3 @@ export default function NavBar(props) {
286
300
  </Drawer>
287
301
  );
288
302
  }
289
-
290
- NavBar.defaultProps = {
291
- pConn: null,
292
- appName: '',
293
- pages: [],
294
- caseTypes: []
295
- };
296
-
297
- NavBar.propTypes = {
298
- pConn: PropTypes.object,
299
- // eslint-disable-next-line react/no-unused-prop-types
300
- appName: PropTypes.string,
301
- pages: PropTypes.arrayOf(PropTypes.object),
302
- caseTypes: PropTypes.arrayOf(PropTypes.object)
303
- };
@@ -1,8 +1,18 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
 
4
- export default function Reference(props) {
5
- const { visibility, context, getPConnect, readOnly, displayMode } = props;
3
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+
5
+ interface ReferenceProps extends PConnProps {
6
+ // If any, enter additional props that only exist on this component
7
+ visibility?: boolean,
8
+ context?: string,
9
+ readOnly?: boolean,
10
+ displayMode?: string
11
+ }
12
+
13
+
14
+ export default function Reference(props: ReferenceProps) {
15
+ const { visibility = true, context = '', getPConnect, readOnly = false, displayMode = '' } = props;
6
16
 
7
17
  const pConnect = getPConnect();
8
18
  const referenceConfig = { ...pConnect.getComponentConfig() } || {};
@@ -41,18 +51,3 @@ export default function Reference(props) {
41
51
  }
42
52
  return null;
43
53
  }
44
-
45
- Reference.defaultProps = {
46
- visibility: true,
47
- context: null,
48
- readOnly: false,
49
- displayMode: null
50
- };
51
-
52
- Reference.propTypes = {
53
- getPConnect: PropTypes.func.isRequired,
54
- visibility: PropTypes.bool,
55
- context: PropTypes.string,
56
- readOnly: PropTypes.bool,
57
- displayMode: PropTypes.string
58
- };
@@ -1,7 +1,13 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
 
4
- export default function Region(props) {
3
+ // Region does NOT have getPConnect. So, no need to extend from PConnProps
4
+ interface RegionProps {
5
+ // If any, enter additional props that only exist on this component
6
+ children: Array<any>
7
+ }
8
+
9
+
10
+ export default function Region(props: RegionProps) {
5
11
  const { children } = props;
6
12
 
7
13
  return <React.Fragment>
@@ -11,7 +17,3 @@ export default function Region(props) {
11
17
  </>
12
18
  </React.Fragment>;
13
19
  }
14
-
15
- Region.propTypes = {
16
- children: PropTypes.arrayOf(PropTypes.node).isRequired
17
- };
@@ -1,15 +1,28 @@
1
1
  import React, { useMemo, useRef, useState, useEffect, useContext, createElement } from "react";
2
2
  // import { Banner, ModalManager } from "@pega/cosmos-react-core";
3
- import PropTypes, { object } from "prop-types";
4
3
  import isEqual from 'lodash.isequal';
5
4
  // import ReAuthMessageModal from "../ReAuthenticationModal";
6
5
  import { Box, CircularProgress } from "@material-ui/core";
7
6
  import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
8
7
  import { LazyMap as LazyComponentMap } from "@pega/react-sdk-components/lib/components_map";
9
8
  import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
10
- import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
9
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
10
+
11
+ // import type { PConnProps } from '../../../types/PConnProps';
12
+
13
+ // Can't use RootContainerProps until getChildren() typedef is fixes to not return an array of 'never'
14
+ // interface RootContainerProps extends PConnProps {
15
+ // // If any, enter additional props that only exist on this component
16
+ // renderingMode?: string,
17
+ // routingInfo: { type: string, accessedOrder: Array<any>, items: any },
18
+ // children: Array<any>,
19
+ // skeleton: any,
20
+ // httpMessages: Array<any>
21
+ // }
22
+
23
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
24
+ declare const PCore: any;
11
25
 
12
- declare const PCore;
13
26
 
14
27
  //
15
28
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -37,7 +50,7 @@ function getItemView(routingInfo, renderingMode) {
37
50
  if (
38
51
  items[key] &&
39
52
  items[key].view &&
40
- !Utils.isEmptyObject(items[key].view)
53
+ !isEmptyObject(items[key].view)
41
54
  ) {
42
55
  viewConfigs.push(items[key]);
43
56
  }
@@ -46,25 +59,22 @@ function getItemView(routingInfo, renderingMode) {
46
59
  return viewConfigs;
47
60
  }
48
61
 
49
- const RootContainer = (props) => {
62
+ export default function RootContainer(props /* : RootContainerProps */) {
50
63
  const {
51
64
  getPConnect,
52
- renderingMode,
53
- children,
65
+ renderingMode = '',
66
+ children = [],
54
67
  skeleton,
55
- httpMessages,
68
+ httpMessages = [],
56
69
  routingInfo
57
70
  } = props;
58
71
 
59
- const { displayOnlyFA, isMashup } = useContext(StoreContext);
72
+ const { displayOnlyFA } = useContext<any>(StoreContext);
60
73
 
61
74
 
62
75
  const pConn = getPConnect();
63
76
 
64
77
  const options = { "context": "app" };
65
- if (isMashup) {
66
- options["context"] = "root";
67
- }
68
78
 
69
79
  const [componentName, setComponentName] = useState("");
70
80
 
@@ -78,12 +88,15 @@ const RootContainer = (props) => {
78
88
 
79
89
  let hasBanner = false;
80
90
  let banners: any = null;
91
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
92
+ const localeCategory = 'Messages';
93
+
81
94
  const messages = httpMessages
82
- ? httpMessages.map((msg) => msg.message)
95
+ ? httpMessages.map((msg) => localizedVal(msg.message, localeCategory))
83
96
  : httpMessages;
84
97
 
85
98
  hasBanner = messages && messages.length > 0;
86
- banners = hasBanner && (<div>RootContainer: trying to emit Banner with {messages}</div>);
99
+ banners = hasBanner && (<div>{localizedVal(`RootContainer: trying to emit Banner with ${messages}`, localeCategory)}</div>);
87
100
 
88
101
  const MemoizedModalViewContainer = useMemo(() => {
89
102
  return createElement(
@@ -123,7 +136,7 @@ const RootContainer = (props) => {
123
136
 
124
137
  switch (componentName) {
125
138
  case "View":
126
- noPortalContent = <div>getNoPortalContent: RootContainer wants to render View in noPortal mode</div>
139
+ noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render View in noPortal mode', localeCategory)}</div>
127
140
  break;
128
141
 
129
142
  case "ViewContainer": {
@@ -148,7 +161,7 @@ const RootContainer = (props) => {
148
161
  }
149
162
 
150
163
  default:
151
- noPortalContent = <div>getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode</div>
164
+ noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode', localeCategory)}</div>
152
165
  break;
153
166
 
154
167
  }
@@ -220,7 +233,7 @@ const RootContainer = (props) => {
220
233
  }
221
234
  else if (renderingMode === "noPortal") {
222
235
  // eslint-disable-next-line no-console
223
- console.log(`RootContainer rendering in noPortal mode`);
236
+ console.log(`${localizedVal('RootContainer rendering in noPortal mode', localeCategory)}`);
224
237
 
225
238
  const theChildren = pConn.getChildren();
226
239
  if (theChildren && (theChildren.length === 1)) {
@@ -238,7 +251,7 @@ const RootContainer = (props) => {
238
251
  else if (children && children.length > 0) {
239
252
  return (
240
253
  <React.Fragment>
241
- <div>RootContainer: Has children. Trying to show ModalManager with children, etc.</div>
254
+ <div>{localizedVal('RootContainer: Has children. Trying to show ModalManager with children, etc.', localeCategory)}</div>
242
255
  {children}
243
256
  {MemoizedModalViewContainer}
244
257
  </React.Fragment>
@@ -257,28 +270,8 @@ const RootContainer = (props) => {
257
270
  } else {
258
271
  return (
259
272
  <div id="root-container">
260
- <div>RootContainer: Should be ModalManager, etc.</div>
273
+ <div>{localizedVal('RootContainer: Should be ModalManager, etc.', localeCategory)}</div>
261
274
  </div>
262
275
  );
263
276
  }
264
277
  };
265
-
266
- RootContainer.defaultProps = {
267
- getPConnect: null,
268
- renderingMode: null,
269
- children: null,
270
- routingInfo: object
271
- };
272
-
273
- RootContainer.propTypes = {
274
- getPConnect: PropTypes.func,
275
- renderingMode: PropTypes.string,
276
- routingInfo: PropTypes.shape({
277
- type: PropTypes.string,
278
- accessedOrder: PropTypes.array,
279
- items: PropTypes.object
280
- }),
281
- children: PropTypes.arrayOf(PropTypes.oneOfType( [PropTypes.object, PropTypes.string ]))
282
- };
283
-
284
- export default RootContainer;
@@ -1,12 +1,21 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
  import { Breadcrumbs, Card, Typography } from "@material-ui/core";
4
3
  import DoubleArrowIcon from '@material-ui/icons/DoubleArrow';
5
4
  import DoneIcon from '@material-ui/icons/Done';
6
5
  import { makeStyles } from '@material-ui/core/styles';
6
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
+
9
+ interface StagesProps extends PConnProps {
10
+ // If any, enter additional props that only exist on this component
11
+ stages: Array<any>
12
+ }
13
+
14
+
15
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
8
16
  declare const PCore: any;
9
17
 
18
+
10
19
  const useStyles = makeStyles((theme) => ({
11
20
  root: {
12
21
  paddingRight: theme.spacing(1),
@@ -55,18 +64,20 @@ function getFilteredStages(stages) {
55
64
 
56
65
  /* TODO - this component should be refactored and not exposed as top level DX Component -
57
66
  the stages should be created as part of the CaseView */
58
- export default function Stages(props) {
67
+ export default function Stages(props: StagesProps) {
59
68
  const classes = useStyles();
60
69
 
61
70
  const { getPConnect, stages } = props;
62
71
  const pConn = getPConnect();
72
+ const key = `${pConn.getCaseInfo().getClassName()}!CASE!${pConn.getCaseInfo().getName()}`.toUpperCase();
73
+
63
74
 
64
75
  const filteredStages = getFilteredStages(stages);
65
- const currentStageID = pConn.getValue(PCore.getConstants().CASE_INFO.STAGEID);
76
+ const currentStageID = pConn.getValue(PCore.getConstants().CASE_INFO.STAGEID, ''); // 2nd arg empty string until typedef allows optional
66
77
  const stagesObj = filteredStages.map((stage, index, arr) => {
67
78
  const theID = stage.ID || stage.id;
68
79
  return {
69
- name: stage.name,
80
+ name: PCore.getLocaleUtils().getLocaleValue(stage.name, null, key),
70
81
  id: theID,
71
82
  complete: stage.visited_status === "completed",
72
83
  current: (theID === currentStageID),
@@ -112,8 +123,3 @@ export default function Stages(props) {
112
123
  </Card>
113
124
  )
114
125
  }
115
-
116
- Stages.propTypes = {
117
- getPConnect: PropTypes.func.isRequired,
118
- stages: PropTypes.arrayOf(PropTypes.object).isRequired
119
- };