@pega/react-sdk-overrides 23.1.10 → 23.1.12

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 (232) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/SECURITY.md +10 -0
  4. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +6 -14
  5. package/lib/designSystemExtension/Banner/Banner.tsx +14 -11
  6. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +27 -22
  8. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +14 -20
  9. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  10. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +44 -19
  11. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +7 -12
  12. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +21 -32
  13. package/lib/designSystemExtension/Operator/Operator.tsx +94 -82
  14. package/lib/designSystemExtension/Pulse/Pulse.tsx +14 -16
  15. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +6 -5
  16. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +14 -14
  17. package/lib/field/AutoComplete/AutoComplete.tsx +24 -26
  18. package/lib/field/AutoComplete/config-ext.json +2 -3
  19. package/lib/field/CancelAlert/CancelAlert.tsx +98 -84
  20. package/lib/field/CancelAlert/index.tsx +1 -1
  21. package/lib/field/Checkbox/Checkbox.tsx +120 -63
  22. package/lib/field/Checkbox/config-ext.json +2 -3
  23. package/lib/field/Currency/Currency.tsx +25 -50
  24. package/lib/field/Currency/config-ext.json +2 -3
  25. package/lib/field/Currency/currency-utils.ts +9 -16
  26. package/lib/field/Date/Date.tsx +15 -11
  27. package/lib/field/Date/config-ext.json +2 -3
  28. package/lib/field/DateTime/DateTime.tsx +9 -9
  29. package/lib/field/DateTime/config-ext.json +1 -2
  30. package/lib/field/Decimal/Decimal.tsx +33 -44
  31. package/lib/field/Decimal/config-ext.json +1 -2
  32. package/lib/field/Decimal/index.tsx +1 -1
  33. package/lib/field/Dropdown/Dropdown.tsx +122 -31
  34. package/lib/field/Dropdown/config-ext.json +1 -2
  35. package/lib/field/Email/Email.tsx +11 -10
  36. package/lib/field/Email/config-ext.json +1 -2
  37. package/lib/field/Email/index.tsx +1 -1
  38. package/lib/field/Group/Group.tsx +39 -0
  39. package/lib/field/Group/config-ext.json +7 -0
  40. package/lib/field/Group/index.tsx +1 -0
  41. package/lib/field/Integer/Integer.tsx +8 -7
  42. package/lib/field/Integer/config-ext.json +1 -2
  43. package/lib/field/MultiSelect/Multiselect.tsx +244 -0
  44. package/lib/field/MultiSelect/index.tsx +1 -0
  45. package/lib/field/MultiSelect/utils.ts +230 -0
  46. package/lib/field/Percentage/Percentage.tsx +46 -41
  47. package/lib/field/Percentage/config-ext.json +1 -2
  48. package/lib/field/Phone/Phone.tsx +13 -12
  49. package/lib/field/Phone/index.tsx +1 -1
  50. package/lib/field/RadioButtons/RadioButtons.tsx +20 -18
  51. package/lib/field/RadioButtons/config-ext.json +1 -2
  52. package/lib/field/RichText/RichText.tsx +8 -7
  53. package/lib/field/ScalarList/ScalarList.tsx +3 -13
  54. package/lib/field/ScalarList/config-ext.json +1 -2
  55. package/lib/field/SemanticLink/SemanticLink.tsx +7 -7
  56. package/lib/field/SemanticLink/config-ext.json +1 -2
  57. package/lib/field/SemanticLink/utils.ts +8 -11
  58. package/lib/field/TextArea/TextArea.tsx +7 -6
  59. package/lib/field/TextArea/config-ext.json +1 -2
  60. package/lib/field/TextContent/TextContent.tsx +4 -6
  61. package/lib/field/TextContent/config-ext.json +1 -2
  62. package/lib/field/TextInput/TextInput.tsx +9 -7
  63. package/lib/field/TextInput/config-ext.json +1 -2
  64. package/lib/field/TextInput/index.tsx +1 -1
  65. package/lib/field/Time/Time.tsx +11 -11
  66. package/lib/field/Time/config-ext.json +1 -2
  67. package/lib/field/URL/URL.tsx +9 -8
  68. package/lib/field/URL/config-ext.json +1 -2
  69. package/lib/field/URL/index.tsx +1 -1
  70. package/lib/field/UserReference/UserReference.tsx +18 -16
  71. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  72. package/lib/field/UserReference/config-ext.json +1 -2
  73. package/lib/helpers/attachmentHelpers.ts +13 -8
  74. package/lib/helpers/case-utils.tsx +4 -8
  75. package/lib/helpers/common-utils.ts +5 -1
  76. package/lib/helpers/data_page.ts +3 -7
  77. package/lib/helpers/date-format-utils.ts +3 -3
  78. package/lib/helpers/event-utils.ts +3 -3
  79. package/lib/helpers/field-group-utils.ts +1 -1
  80. package/lib/helpers/formatters/Boolean.ts +9 -26
  81. package/lib/helpers/formatters/Currency.ts +15 -21
  82. package/lib/helpers/formatters/CurrencyMap.ts +505 -501
  83. package/lib/helpers/formatters/Date.ts +20 -26
  84. package/lib/helpers/formatters/common.ts +1 -2
  85. package/lib/helpers/formatters/index.ts +26 -19
  86. package/lib/helpers/instructions-utils.ts +38 -0
  87. package/lib/helpers/reactContextHelpers.ts +2 -2
  88. package/lib/helpers/simpleTableHelpers.ts +59 -83
  89. package/lib/helpers/state-utils.tsx +5 -9
  90. package/lib/helpers/template-utils.ts +3 -6
  91. package/lib/helpers/utils.ts +5 -5
  92. package/lib/helpers/versionHelpers.ts +1 -4
  93. package/lib/infra/ActionButtons/ActionButtons.tsx +38 -29
  94. package/lib/infra/ActionButtons/index.tsx +1 -1
  95. package/lib/infra/Assignment/Assignment.tsx +99 -79
  96. package/lib/infra/Assignment/index.tsx +1 -1
  97. package/lib/infra/AssignmentCard/AssignmentCard.tsx +13 -16
  98. package/lib/infra/AssignmentCard/index.tsx +1 -1
  99. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -213
  100. package/lib/infra/Containers/FlowContainer/helpers.ts +34 -45
  101. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
  103. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  104. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +227 -218
  105. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  106. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  107. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  108. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  109. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +36 -46
  110. package/lib/infra/Containers/helpers.ts +6 -0
  111. package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -42
  112. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -43
  113. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -28
  114. package/lib/infra/DeferLoad/index.tsx +1 -1
  115. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +16 -30
  116. package/lib/infra/MultiStep/MultiStep.css +11 -15
  117. package/lib/infra/MultiStep/MultiStep.tsx +176 -212
  118. package/lib/infra/MultiStep/index.tsx +1 -1
  119. package/lib/infra/NavBar/NavBar.css +103 -105
  120. package/lib/infra/NavBar/NavBar.tsx +19 -31
  121. package/lib/infra/Reference/Reference.tsx +16 -18
  122. package/lib/infra/Region/Region.tsx +4 -6
  123. package/lib/infra/RootContainer/RootContainer.tsx +75 -111
  124. package/lib/infra/RootContainer/index.tsx +1 -1
  125. package/lib/infra/Stages/Stages.tsx +32 -39
  126. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +11 -11
  127. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +21 -28
  128. package/lib/infra/View/View.tsx +17 -21
  129. package/lib/template/AppShell/AppShell.css +22 -23
  130. package/lib/template/AppShell/AppShell.tsx +39 -74
  131. package/lib/template/BannerPage/BannerPage.tsx +12 -14
  132. package/lib/template/CaseSummary/CaseSummary.tsx +58 -18
  133. package/lib/template/CaseSummary/config-ext.json +1 -2
  134. package/lib/template/CaseView/CaseView.tsx +34 -63
  135. package/lib/template/CaseView/config-ext.json +1 -2
  136. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +63 -19
  137. package/lib/template/Confirmation/Confirmation.tsx +12 -17
  138. package/lib/template/Confirmation/config-ext.json +1 -2
  139. package/lib/template/DataReference/DataReference.tsx +95 -121
  140. package/lib/template/DataReference/config-ext.json +1 -2
  141. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  142. package/lib/template/DefaultForm/DefaultForm.tsx +13 -16
  143. package/lib/template/DefaultForm/config-ext.json +1 -2
  144. package/lib/template/Details/Details/Details.tsx +19 -22
  145. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +9 -13
  146. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  147. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -24
  148. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  149. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +19 -25
  150. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  151. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  152. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +15 -14
  153. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +15 -22
  154. package/lib/template/InlineDashboard/InlineDashboard.tsx +12 -14
  155. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +12 -16
  156. package/lib/template/ListPage/ListPage.tsx +5 -10
  157. package/lib/template/ListPage/config-ext.json +1 -2
  158. package/lib/template/ListView/DefaultViewMeta.ts +1 -3
  159. package/lib/template/ListView/ListView.tsx +185 -175
  160. package/lib/template/ListView/config-ext.json +1 -2
  161. package/lib/template/ListView/hooks.ts +24 -26
  162. package/lib/template/ListView/utils.ts +51 -87
  163. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +20 -20
  164. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  165. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +25 -38
  166. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +20 -25
  167. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  168. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  169. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +14 -24
  170. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  171. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +9 -19
  172. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  173. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +14 -15
  174. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  175. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +3 -10
  176. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  177. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +6 -10
  178. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  179. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  180. package/lib/template/PromotedFilters/PromotedFilters.tsx +32 -28
  181. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +37 -33
  182. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  183. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -121
  184. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +24 -25
  185. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +30 -30
  186. package/lib/template/SubTabs/SubTabs.tsx +22 -40
  187. package/lib/template/SubTabs/config-ext.json +1 -2
  188. package/lib/template/SubTabs/tabUtils.ts +2 -5
  189. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  190. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +30 -28
  191. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  192. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +3 -10
  193. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  194. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +30 -28
  195. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  196. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  197. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +22 -34
  198. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +24 -28
  199. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  200. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  201. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +13 -21
  202. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  203. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +8 -16
  204. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  205. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  206. package/lib/template/WssNavBar/WssNavBar.tsx +18 -21
  207. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +29 -28
  208. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  209. package/lib/widget/Attachment/Attachment.css +60 -1
  210. package/lib/widget/Attachment/Attachment.tsx +378 -405
  211. package/lib/widget/Attachment/index.tsx +1 -1
  212. package/lib/widget/CaseHistory/CaseHistory.tsx +64 -66
  213. package/lib/widget/CaseHistory/config-ext.json +1 -2
  214. package/lib/widget/CaseHistory/index.tsx +1 -1
  215. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +16 -18
  216. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  217. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +310 -246
  218. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  219. package/lib/widget/Followers/Followers.tsx +23 -20
  220. package/lib/widget/Followers/config-ext.json +1 -2
  221. package/lib/widget/QuickCreate/QuickCreate.tsx +68 -42
  222. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  223. package/lib/widget/SummaryItem/SummaryItem.tsx +58 -58
  224. package/lib/widget/SummaryItem/index.tsx +1 -1
  225. package/lib/widget/SummaryList/SummaryList.tsx +7 -10
  226. package/lib/widget/ToDo/ToDo.css +4 -4
  227. package/lib/widget/ToDo/ToDo.tsx +52 -53
  228. package/lib/widget/ToDo/config-ext.json +1 -2
  229. package/package.json +5 -2
  230. package/lib/helpers/auth.js +0 -834
  231. package/lib/helpers/authManager.ts +0 -933
  232. package/lib/helpers/config_access.js +0 -186
@@ -1,8 +1,7 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { makeStyles, useTheme } from '@material-ui/core/styles';
3
3
  import clsx from 'clsx';
4
- import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
5
- import './NavBar.css';
4
+
6
5
  import {
7
6
  Drawer,
8
7
  List,
@@ -17,7 +16,6 @@ import {
17
16
  MenuItem,
18
17
  Typography
19
18
  } from '@material-ui/core';
20
-
21
19
  import PersonOutlineIcon from '@material-ui/icons/PersonOutlineOutlined';
22
20
  import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
23
21
  import ChevronRightIcon from '@material-ui/icons/ChevronRight';
@@ -30,23 +28,23 @@ import WorkOutlineIcon from '@material-ui/icons/WorkOutline';
30
28
  import ClearOutlinedIcon from '@material-ui/icons/ClearOutlined';
31
29
  import ArrowBackIcon from '@material-ui/icons/ArrowBack';
32
30
  import useMediaQuery from '@material-ui/core/useMediaQuery';
31
+ import { logout } from '@pega/auth/lib/sdk-auth-manager';
33
32
 
34
33
  import { useNavBar } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
35
- import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
36
-
37
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
34
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
35
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
38
36
 
37
+ import './NavBar.css';
39
38
 
40
39
  interface NavBarProps extends PConnProps {
41
40
  // If any, enter additional props that only exist on this component
42
41
  // eslint-disable-next-line react/no-unused-prop-types
43
- appName?: string,
44
- pages?: Array<any>,
45
- caseTypes: Array<any>,
46
- pConn?: any
42
+ appName?: string;
43
+ pages?: any[];
44
+ caseTypes: any[];
45
+ pConn?: any;
47
46
  }
48
47
 
49
-
50
48
  const iconMap = {
51
49
  'pi pi-headline': <HomeOutlinedIcon fontSize='large' />,
52
50
  'pi pi-flag-solid': <FlagOutlinedIcon fontSize='large' />,
@@ -118,13 +116,13 @@ export default function NavBar(props: NavBarProps) {
118
116
  const [bShowCaseTypes, setBShowCaseTypes] = useState(true);
119
117
  const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false);
120
118
  const [anchorEl, setAnchorEl] = useState(null);
119
+ const localeUtils = PCore.getLocaleUtils();
120
+ const localeReference = pConn.getValue('.pyLocaleReference');
121
121
 
122
122
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
123
123
  const localeCategory = 'AppShell';
124
124
 
125
- const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat(
126
- 'pzpega-logo-mark.svg'
127
- );
125
+ const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat('pzpega-logo-mark.svg');
128
126
  const portalOperator = PCore.getEnvironmentInfo().getOperatorName();
129
127
  const portalApp = PCore.getEnvironmentInfo().getApplicationLabel();
130
128
 
@@ -213,22 +211,12 @@ export default function NavBar(props: NavBarProps) {
213
211
  </List>
214
212
  ) : (
215
213
  <div className={classes.appListDiv} onClick={handleDrawerOpen}>
216
- <ChevronRightIcon
217
- className={classes.appListIcon}
218
- id='chevron-right-icon'
219
- fontSize='large'
220
- />
214
+ <ChevronRightIcon className={classes.appListIcon} id='chevron-right-icon' fontSize='large' />
221
215
  </div>
222
216
  )}
223
217
  <List>
224
218
  <ListItem button onClick={handleCaseItemClick}>
225
- <ListItemIcon>
226
- {bShowCaseTypes && open ? (
227
- <ClearOutlinedIcon fontSize='large' />
228
- ) : (
229
- <AddIcon fontSize='large' />
230
- )}
231
- </ListItemIcon>
219
+ <ListItemIcon>{bShowCaseTypes && open ? <ClearOutlinedIcon fontSize='large' /> : <AddIcon fontSize='large' />}</ListItemIcon>
232
220
  <ListItemText primary='Create' />
233
221
  {bShowCaseTypes ? <ExpandLess /> : <ExpandMore />}
234
222
  </ListItem>
@@ -245,7 +233,7 @@ export default function NavBar(props: NavBarProps) {
245
233
  <ListItemIcon>
246
234
  <WorkOutlineIcon fontSize='large' />
247
235
  </ListItemIcon>
248
- <ListItemText primary={caseType.pyLabel} />
236
+ <ListItemText primary={localeUtils.getLocaleValue(caseType.pyLabel, '', localeReference)} />
249
237
  </ListItem>
250
238
  ))}
251
239
  </List>
@@ -254,14 +242,14 @@ export default function NavBar(props: NavBarProps) {
254
242
  {navPages.map(page => (
255
243
  <ListItem button onClick={() => navPanelButtonClick(page)} key={page.pyLabel}>
256
244
  <ListItemIcon>{iconMap[page.pxPageViewIcon]}</ListItemIcon>
257
- <ListItemText primary={page.pyLabel} />
245
+ <ListItemText primary={localeUtils.getLocaleValue(page.pyLabel, '', localeReference)} />
258
246
  </ListItem>
259
247
  ))}
260
248
  </List>
261
249
  <Divider />
262
250
  <List className='marginTopAuto'>
263
251
  <>
264
- <ListItem onClick={navPanelOperatorButtonClick}>
252
+ <ListItem onClick={navPanelOperatorButtonClick} style={{ cursor: 'pointer' }}>
265
253
  <ListItemIcon>
266
254
  <PersonOutlineIcon fontSize='large' />
267
255
  </ListItemIcon>
@@ -292,7 +280,7 @@ export default function NavBar(props: NavBarProps) {
292
280
  <ListItemIcon>
293
281
  <ArrowBackIcon fontSize='large' />
294
282
  </ListItemIcon>
295
- <Typography variant='inherit'>{localizedVal('Logout', localeCategory)}</Typography>
283
+ <Typography variant='inherit'>{localizedVal('Log off', localeCategory)}</Typography>
296
284
  </MenuItem>
297
285
  </Menu>
298
286
  </>
@@ -1,28 +1,25 @@
1
- import React from "react";
2
-
3
- // import type { PConnProps } from '../../../types/PConnProps';
4
-
5
- // ReferenceProps can't be used until getComponentConfig() is NOT private
6
- // interface ReferenceProps extends PConnProps {
7
- // // If any, enter additional props that only exist on this component
8
- // visibility?: boolean,
9
- // context?: string,
10
- // readOnly?: boolean,
11
- // displayMode?: string
12
- // }
13
-
1
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
2
+
3
+ interface ReferenceProps extends PConnProps {
4
+ // If any, enter additional props that only exist on this component
5
+ visibility?: boolean;
6
+ context?: string;
7
+ readOnly?: boolean;
8
+ displayMode?: string;
9
+ }
14
10
 
15
- export default function Reference(props /*: ReferenceProps */) {
11
+ export default function Reference(props: ReferenceProps) {
16
12
  const { visibility = true, context = '', getPConnect, readOnly = false, displayMode = '' } = props;
17
13
 
18
14
  const pConnect = getPConnect();
15
+ // @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
19
16
  const referenceConfig = { ...pConnect.getComponentConfig() } || {};
20
17
 
21
18
  delete referenceConfig?.name;
22
19
  delete referenceConfig?.type;
23
20
  delete referenceConfig?.visibility;
24
21
 
25
- const viewMetadata = pConnect.getReferencedView();
22
+ const viewMetadata: any = pConnect.getReferencedView();
26
23
 
27
24
  if (!viewMetadata) {
28
25
  // console.log("View not found ", pConnect.getComponentConfig());
@@ -37,8 +34,9 @@ export default function Reference(props /*: ReferenceProps */) {
37
34
  }
38
35
  };
39
36
 
40
- const viewComponent = pConnect.createComponent(viewObject, null, null, {
41
- pageReference: context
37
+ // @ts-ignore - Argument of type 'null' is not assignable to parameter of type 'string'.
38
+ const viewComponent: any = pConnect.createComponent(viewObject, null, null, {
39
+ pageReference: context && context.startsWith('@CLASS') ? '' : context
42
40
  });
43
41
 
44
42
  viewComponent.props.getPConnect().setInheritedConfig({
@@ -48,7 +46,7 @@ export default function Reference(props /*: ReferenceProps */) {
48
46
  });
49
47
 
50
48
  if (visibility !== false) {
51
- return <React.Fragment>{viewComponent}</React.Fragment>;
49
+ return <>{viewComponent}</>;
52
50
  }
53
51
  return null;
54
52
  }
@@ -1,19 +1,17 @@
1
- import React from "react";
1
+ import { PropsWithChildren } from 'react';
2
2
 
3
3
  // Region does NOT have getPConnect. So, no need to extend from PConnProps
4
4
  interface RegionProps {
5
5
  // If any, enter additional props that only exist on this component
6
- children: Array<any>
7
6
  }
8
7
 
9
-
10
- export default function Region(props: RegionProps) {
8
+ export default function Region(props: PropsWithChildren<RegionProps>) {
11
9
  const { children } = props;
12
10
 
13
- return <React.Fragment>
11
+ return (
14
12
  <>
15
13
  {/* <div>Region</div> */}
16
14
  {children}
17
15
  </>
18
- </React.Fragment>;
16
+ );
19
17
  }
@@ -1,28 +1,20 @@
1
- import React, { useMemo, useRef, useState, useEffect, useContext, createElement } from "react";
2
- // import { Banner, ModalManager } from "@pega/cosmos-react-core";
1
+ import { Children, createElement, PropsWithChildren, useContext, useEffect, useMemo, useRef, useState } from 'react';
3
2
  import isEqual from 'lodash.isequal';
4
- // import ReAuthMessageModal from "../ReAuthenticationModal";
5
- import { Box, CircularProgress } from "@material-ui/core";
6
- import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
7
- import { LazyMap as LazyComponentMap } from "@pega/react-sdk-components/lib/components_map";
8
- import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
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;
3
+ import { Box, CircularProgress } from '@material-ui/core';
25
4
 
5
+ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
6
+ import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
7
+ import { LazyMap as LazyComponentMap } from '@pega/react-sdk-components/lib/components_map';
8
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
9
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
+
11
+ interface RootContainerProps extends PConnProps {
12
+ // If any, enter additional props that only exist on this component
13
+ renderingMode?: string;
14
+ routingInfo: { type: string; accessedOrder: any[]; items: any };
15
+ skeleton: any;
16
+ httpMessages: any[];
17
+ }
26
18
 
27
19
  //
28
20
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -30,8 +22,7 @@ declare const PCore: any;
30
22
  // is totally at your own risk.
31
23
  //
32
24
 
33
-
34
- const renderingModes = ["portal", "view"];
25
+ const renderingModes = ['portal', 'view'];
35
26
 
36
27
  function usePrevious(value) {
37
28
  const ref = useRef(null);
@@ -44,14 +35,10 @@ function usePrevious(value) {
44
35
  function getItemView(routingInfo, renderingMode) {
45
36
  const viewConfigs: any = [];
46
37
  if (routingInfo && renderingModes.includes(renderingMode)) {
47
- const { accessedOrder, items }: {accessedOrder: any, items:any } = routingInfo;
38
+ const { accessedOrder, items }: { accessedOrder: any; items: any } = routingInfo;
48
39
  if (accessedOrder && items) {
49
40
  const key = accessedOrder[accessedOrder.length - 1];
50
- if (
51
- items[key] &&
52
- items[key].view &&
53
- !isEmptyObject(items[key].view)
54
- ) {
41
+ if (items[key] && items[key].view && !isEmptyObject(items[key].view)) {
55
42
  viewConfigs.push(items[key]);
56
43
  }
57
44
  }
@@ -59,29 +46,21 @@ function getItemView(routingInfo, renderingMode) {
59
46
  return viewConfigs;
60
47
  }
61
48
 
62
- export default function RootContainer(props /* : RootContainerProps */) {
63
- const {
64
- getPConnect,
65
- renderingMode = '',
66
- children = [],
67
- skeleton,
68
- httpMessages = [],
69
- routingInfo
70
- } = props;
49
+ export default function RootContainer(props: PropsWithChildren<RootContainerProps>) {
50
+ const { getPConnect, renderingMode = '', children, skeleton, httpMessages = [], routingInfo } = props;
71
51
 
72
52
  const { displayOnlyFA } = useContext<any>(StoreContext);
73
53
 
74
-
75
54
  const pConn = getPConnect();
76
55
 
77
- const options = { "context": "app" };
56
+ const options = { context: 'app' };
78
57
 
79
- const [componentName, setComponentName] = useState("");
58
+ const [componentName, setComponentName] = useState('');
80
59
 
81
- useEffect( () => {
60
+ useEffect(() => {
82
61
  // debugging/investigation help
83
62
  // console.log(`componentName change: ${componentName} triggering a re-render`);
84
- }, [componentName] );
63
+ }, [componentName]);
85
64
 
86
65
  // debugging/investigation help
87
66
  // console.log(`RootContainer props.routingInfo: ${JSON.stringify(routingInfo)}`);
@@ -91,21 +70,19 @@ export default function RootContainer(props /* : RootContainerProps */) {
91
70
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
92
71
  const localeCategory = 'Messages';
93
72
 
94
- const messages = httpMessages
95
- ? httpMessages.map((msg) => localizedVal(msg.message, localeCategory))
96
- : httpMessages;
73
+ const messages = httpMessages ? httpMessages.map(msg => localizedVal(msg.message, localeCategory)) : httpMessages;
97
74
 
98
75
  hasBanner = messages && messages.length > 0;
99
- banners = hasBanner && (<div>{localizedVal(`RootContainer: trying to emit Banner with ${messages}`, localeCategory)}</div>);
76
+ banners = hasBanner && <div>{localizedVal(`RootContainer: trying to emit Banner with ${messages}`, localeCategory)}</div>;
100
77
 
101
78
  const MemoizedModalViewContainer = useMemo(() => {
102
79
  return createElement(
103
80
  createPConnectComponent(),
104
81
  PCore.createPConnect({
105
82
  meta: {
106
- type: "ModalViewContainer",
83
+ type: 'ModalViewContainer',
107
84
  config: {
108
- name: "modal"
85
+ name: 'modal'
109
86
  }
110
87
  },
111
88
  options
@@ -113,15 +90,15 @@ export default function RootContainer(props /* : RootContainerProps */) {
113
90
  );
114
91
  }, []);
115
92
 
116
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
93
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
117
94
  const MemoizedPreviewViewContainer = useMemo(() => {
118
95
  return createElement(
119
96
  createPConnectComponent(),
120
97
  PCore.createPConnect({
121
98
  meta: {
122
- type: "PreviewViewContainer",
99
+ type: 'PreviewViewContainer',
123
100
  config: {
124
- name: "preview"
101
+ name: 'preview'
125
102
  }
126
103
  },
127
104
  options
@@ -129,29 +106,28 @@ export default function RootContainer(props /* : RootContainerProps */) {
129
106
  );
130
107
  }, []);
131
108
 
132
-
133
109
  //
134
110
  function getNoPortalContent() {
135
111
  let noPortalContent: any;
136
112
 
137
113
  switch (componentName) {
138
- case "View":
139
- noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render View in noPortal mode', localeCategory)}</div>
114
+ case 'View':
115
+ noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render View in noPortal mode', localeCategory)}</div>;
140
116
  break;
141
117
 
142
- case "ViewContainer": {
118
+ case 'ViewContainer': {
143
119
  const configProps = pConn.getConfigProps();
144
120
  const viewContConfig = {
145
- "meta": {
146
- "type": "ViewContainer",
147
- "config": configProps
121
+ meta: {
122
+ type: 'ViewContainer',
123
+ config: configProps
148
124
  },
149
- options
125
+ options
150
126
  };
151
- const theViewCont = PCore.createPConnect(viewContConfig);
127
+ const theViewCont: any = PCore.createPConnect(viewContConfig);
152
128
  // Add in displayOnlyFA if prop is on RootContainer
153
129
  if (displayOnlyFA) {
154
- theViewCont["displayOnlyFA"] = true;
130
+ theViewCont.displayOnlyFA = true;
155
131
  }
156
132
 
157
133
  const theViewContainerAsReact = createElement(createPConnectComponent(), theViewCont);
@@ -161,24 +137,22 @@ export default function RootContainer(props /* : RootContainerProps */) {
161
137
  }
162
138
 
163
139
  default:
164
- noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode', localeCategory)}</div>
140
+ noPortalContent = (
141
+ <div>{localizedVal('getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode', localeCategory)}</div>
142
+ );
165
143
  break;
166
-
167
144
  }
168
145
 
169
146
  return noPortalContent;
170
147
  }
171
148
 
172
-
173
- let rootView : any;
149
+ let rootView: any;
174
150
  let rootViewConfig: any = null;
175
151
 
176
152
  useEffect(() => {
177
153
  const { containers } = PCore.getStore().getState();
178
- const items = Object.keys(containers).filter((item) =>
179
- item.includes("root")
180
- );
181
- PCore.getContainerUtils().getContainerAPI().addContainerItems(items);
154
+ const items = Object.keys(containers).filter(item => item.includes('root'));
155
+ (PCore.getContainerUtils().getContainerAPI() as any).addContainerItems(items);
182
156
  }, [routingInfo]);
183
157
 
184
158
  const items: any = getItemView(routingInfo, renderingMode);
@@ -193,13 +167,8 @@ export default function RootContainer(props /* : RootContainerProps */) {
193
167
  }
194
168
  const prevRootConfig = usePrevious(rootViewConfig);
195
169
 
196
- if (
197
- renderingModes.includes(renderingMode) &&
198
- messages &&
199
- routingInfo &&
200
- routingInfo?.accessedOrder.length === 0
201
- ) {
202
- return <div id="root-container">{banners}</div>;
170
+ if (renderingModes.includes(renderingMode) && messages && routingInfo && routingInfo?.accessedOrder.length === 0) {
171
+ return <div id='root-container'>{banners}</div>;
203
172
  }
204
173
 
205
174
  if (items.length > 0) {
@@ -212,66 +181,61 @@ export default function RootContainer(props /* : RootContainerProps */) {
212
181
  };
213
182
 
214
183
  if (!isEqual(currentRootConfig, prevRootConfig)) {
215
- rootView = createElement(
216
- createPConnectComponent(),
217
- PCore.createPConnect(currentRootConfig)
218
- );
184
+ rootView = createElement(createPConnectComponent(), PCore.createPConnect(currentRootConfig));
219
185
  }
220
186
 
221
187
  // debugging/investigation help
222
188
  // console.log(`rootView.props.getPConnect().getComponentName(): ${rootView.props.getPConnect().getComponentName()}`);
223
189
 
224
190
  return (
225
- <div id="ModalManager">
226
- {rootView}
227
- {MemoizedModalViewContainer}
228
- <div id="MemoizedPreviewViewContainer"></div>
229
- <div id="ReAuthMessageModal"></div>
191
+ <div id='ModalManager'>
192
+ {rootView}
193
+ {MemoizedModalViewContainer}
194
+ <div id='MemoizedPreviewViewContainer' />
195
+ <div id='ReAuthMessageModal' />
230
196
  </div>
231
197
  );
232
-
233
198
  }
234
- else if (renderingMode === "noPortal") {
199
+ if (renderingMode === 'noPortal') {
235
200
  // eslint-disable-next-line no-console
236
201
  console.log(`${localizedVal('RootContainer rendering in noPortal mode', localeCategory)}`);
237
202
 
238
- const theChildren = pConn.getChildren();
239
- if (theChildren && (theChildren.length === 1)) {
203
+ const theChildren = pConn.getChildren() as any[];
204
+ if (theChildren && theChildren.length === 1) {
240
205
  const localPConn = theChildren[0].getPConnect();
241
- const localCompName = localPConn.getComponentName()
206
+ const localCompName = localPConn.getComponentName();
242
207
  if (componentName !== localCompName) {
243
208
  setComponentName(localCompName);
244
209
  }
245
210
  }
246
211
 
247
- const noPortalContent = getNoPortalContent();
248
-
249
- return noPortalContent;
212
+ return getNoPortalContent();
250
213
  }
251
- else if (children && children.length > 0) {
214
+ if (children && Children.count(children) > 0) {
252
215
  return (
253
- <React.Fragment>
216
+ <>
254
217
  <div>{localizedVal('RootContainer: Has children. Trying to show ModalManager with children, etc.', localeCategory)}</div>
255
218
  {children}
256
219
  {MemoizedModalViewContainer}
257
- </React.Fragment>
258
-
220
+ </>
259
221
  );
260
- } else if (skeleton) {
261
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
222
+ }
223
+ if (skeleton) {
224
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
262
225
  const LoadingComponent = LazyComponentMap[skeleton];
263
226
 
264
227
  return (
265
- <div id="root-container">
228
+ <div id='root-container'>
266
229
  {/* <div>RootContainer: Trying to show skeleton</div> */}
267
- <Box textAlign="center"><CircularProgress /></Box>
268
- </div>
269
- );
270
- } else {
271
- return (
272
- <div id="root-container">
273
- <div>{localizedVal('RootContainer: Should be ModalManager, etc.', localeCategory)}</div>
230
+ <Box textAlign='center'>
231
+ <CircularProgress />
232
+ </Box>
274
233
  </div>
275
234
  );
276
235
  }
277
- };
236
+ return (
237
+ <div id='root-container'>
238
+ <div>{localizedVal('RootContainer: Should be ModalManager, etc.', localeCategory)}</div>
239
+ </div>
240
+ );
241
+ }
@@ -1 +1 @@
1
- export { default } from './RootContainer';
1
+ export { default } from './RootContainer';