@pega/react-sdk-overrides 0.23.26 → 0.23.28

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 (238) 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 +39 -0
  5. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  6. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  8. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  9. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  10. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  11. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  12. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
  13. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  14. package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
  15. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  16. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  17. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  18. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  19. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  20. package/lib/field/AutoComplete/config-ext.json +2 -3
  21. package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
  22. package/lib/field/CancelAlert/index.tsx +1 -1
  23. package/lib/field/Checkbox/Checkbox.tsx +29 -19
  24. package/lib/field/Checkbox/config-ext.json +2 -3
  25. package/lib/field/Currency/Currency.tsx +27 -38
  26. package/lib/field/Currency/config-ext.json +2 -3
  27. package/lib/field/Currency/currency-utils.ts +10 -18
  28. package/lib/field/Date/Date.tsx +33 -15
  29. package/lib/field/Date/config-ext.json +2 -3
  30. package/lib/field/DateTime/DateTime.tsx +22 -11
  31. package/lib/field/DateTime/config-ext.json +1 -2
  32. package/lib/field/Decimal/Decimal.tsx +64 -17
  33. package/lib/field/Decimal/config-ext.json +1 -2
  34. package/lib/field/Decimal/index.tsx +1 -1
  35. package/lib/field/Dropdown/Dropdown.tsx +154 -18
  36. package/lib/field/Dropdown/config-ext.json +1 -2
  37. package/lib/field/Email/Email.tsx +16 -7
  38. package/lib/field/Email/config-ext.json +1 -2
  39. package/lib/field/Email/index.tsx +1 -1
  40. package/lib/field/Group/Group.tsx +37 -0
  41. package/lib/field/Group/config-ext.json +7 -0
  42. package/lib/field/Group/index.tsx +1 -0
  43. package/lib/field/Integer/Integer.tsx +15 -6
  44. package/lib/field/Integer/config-ext.json +1 -2
  45. package/lib/field/Percentage/Percentage.tsx +14 -6
  46. package/lib/field/Percentage/config-ext.json +1 -2
  47. package/lib/field/Phone/Phone.tsx +17 -7
  48. package/lib/field/Phone/index.tsx +1 -1
  49. package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
  50. package/lib/field/RadioButtons/config-ext.json +1 -2
  51. package/lib/field/RichText/RichText.tsx +96 -0
  52. package/lib/field/RichText/index.tsx +1 -0
  53. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  54. package/lib/field/ScalarList/config-ext.json +7 -0
  55. package/lib/field/ScalarList/index.tsx +1 -0
  56. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  57. package/lib/field/SemanticLink/config-ext.json +1 -2
  58. package/lib/field/SemanticLink/utils.ts +8 -10
  59. package/lib/field/TextArea/TextArea.tsx +15 -5
  60. package/lib/field/TextArea/config-ext.json +1 -2
  61. package/lib/field/TextContent/TextContent.tsx +9 -2
  62. package/lib/field/TextContent/config-ext.json +1 -2
  63. package/lib/field/TextInput/TextInput.tsx +41 -10
  64. package/lib/field/TextInput/config-ext.json +1 -2
  65. package/lib/field/TextInput/index.tsx +1 -1
  66. package/lib/field/Time/Time.tsx +21 -18
  67. package/lib/field/Time/config-ext.json +1 -2
  68. package/lib/field/URL/URL.tsx +23 -6
  69. package/lib/field/URL/config-ext.json +1 -2
  70. package/lib/field/URL/index.tsx +1 -1
  71. package/lib/field/UserReference/UserReference.tsx +52 -58
  72. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  73. package/lib/field/UserReference/config-ext.json +1 -2
  74. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
  75. package/lib/helpers/case-utils.tsx +99 -0
  76. package/lib/helpers/common-utils.ts +8 -0
  77. package/lib/helpers/data_page.ts +3 -6
  78. package/lib/helpers/date-format-utils.ts +29 -19
  79. package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
  80. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
  81. package/lib/helpers/formatters/Boolean.ts +21 -0
  82. package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
  83. package/lib/helpers/formatters/CurrencyMap.ts +915 -0
  84. package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
  85. package/lib/helpers/formatters/{common.js → common.ts} +3 -4
  86. package/lib/helpers/formatters/{index.js → index.ts} +22 -22
  87. package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
  88. package/lib/helpers/simpleTableHelpers.ts +65 -85
  89. package/lib/helpers/state-utils.tsx +43 -0
  90. package/lib/helpers/template-utils.ts +4 -8
  91. package/lib/helpers/utils.ts +16 -8
  92. package/lib/helpers/versionHelpers.ts +1 -5
  93. package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
  94. package/lib/infra/ActionButtons/index.tsx +1 -1
  95. package/lib/infra/Assignment/Assignment.tsx +99 -84
  96. package/lib/infra/Assignment/index.tsx +1 -1
  97. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  98. package/lib/infra/AssignmentCard/index.tsx +1 -1
  99. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
  100. package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
  101. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
  103. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  104. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
  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 +49 -64
  110. package/lib/infra/Containers/helpers.ts +6 -0
  111. package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
  112. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
  113. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
  114. package/lib/infra/DeferLoad/index.tsx +1 -1
  115. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
  116. package/lib/infra/MultiStep/MultiStep.css +11 -15
  117. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  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 +28 -43
  121. package/lib/infra/Reference/Reference.tsx +16 -22
  122. package/lib/infra/Region/Region.tsx +9 -9
  123. package/lib/infra/RootContainer/RootContainer.tsx +82 -125
  124. package/lib/infra/RootContainer/index.tsx +1 -1
  125. package/lib/infra/Stages/Stages.tsx +38 -39
  126. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  127. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  128. package/lib/infra/View/View.tsx +32 -63
  129. package/lib/template/AppShell/AppShell.css +22 -23
  130. package/lib/template/AppShell/AppShell.tsx +51 -69
  131. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  132. package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
  133. package/lib/template/CaseSummary/config-ext.json +1 -2
  134. package/lib/template/CaseView/CaseView.tsx +122 -114
  135. package/lib/template/CaseView/config-ext.json +1 -2
  136. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
  137. package/lib/template/Confirmation/Confirmation.tsx +25 -53
  138. package/lib/template/Confirmation/config-ext.json +1 -2
  139. package/lib/template/DataReference/DataReference.tsx +112 -140
  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 +26 -20
  143. package/lib/template/DefaultForm/config-ext.json +1 -2
  144. package/lib/template/DefaultForm/utils/index.ts +33 -0
  145. package/lib/template/Details/Details/Details.tsx +24 -28
  146. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  147. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  151. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  152. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  153. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  154. package/lib/template/Details/DynamicTabs/config.json +36 -0
  155. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  156. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
  157. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  158. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  159. package/lib/template/ListPage/ListPage.tsx +12 -16
  160. package/lib/template/ListPage/config-ext.json +1 -2
  161. package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
  162. package/lib/template/ListView/ListView.tsx +245 -306
  163. package/lib/template/ListView/config-ext.json +1 -2
  164. package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
  165. package/lib/template/ListView/{utils.js → utils.ts} +202 -91
  166. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
  167. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  168. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  169. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  170. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  171. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  172. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  173. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  174. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  175. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  177. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  179. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  180. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  181. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  182. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  183. package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
  184. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
  185. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  186. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
  187. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
  188. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  189. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  190. package/lib/template/SubTabs/config-ext.json +1 -2
  191. package/lib/template/SubTabs/tabUtils.ts +2 -7
  192. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  193. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  194. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  196. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  197. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  198. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  199. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  200. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  201. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  202. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  203. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  204. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  205. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  207. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  208. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  209. package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
  210. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  211. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  212. package/lib/widget/Attachment/Attachment.css +75 -4
  213. package/lib/widget/Attachment/Attachment.tsx +370 -388
  214. package/lib/widget/Attachment/index.tsx +1 -1
  215. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  216. package/lib/widget/CaseHistory/config-ext.json +1 -2
  217. package/lib/widget/CaseHistory/index.tsx +1 -1
  218. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  219. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  220. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
  221. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  222. package/lib/widget/Followers/Followers.tsx +27 -25
  223. package/lib/widget/Followers/config-ext.json +1 -2
  224. package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
  225. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  226. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
  227. package/lib/widget/SummaryItem/index.tsx +1 -1
  228. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  229. package/lib/widget/ToDo/ToDo.css +4 -4
  230. package/lib/widget/ToDo/ToDo.tsx +80 -116
  231. package/lib/widget/ToDo/config-ext.json +1 -2
  232. package/package.json +5 -2
  233. package/lib/helpers/auth.js +0 -483
  234. package/lib/helpers/authManager.js +0 -631
  235. package/lib/helpers/config_access.js +0 -268
  236. package/lib/helpers/formatters/Boolean.js +0 -38
  237. package/lib/helpers/formatters/CurrencyMap.js +0 -908
  238. package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
@@ -1,15 +1,20 @@
1
- import React, { useMemo, useRef, useState, useEffect, useContext, createElement } from "react";
2
- // import { Banner, ModalManager } from "@pega/cosmos-react-core";
3
- import PropTypes, { object } from "prop-types";
1
+ import { Children, createElement, PropsWithChildren, useContext, useEffect, useMemo, useRef, useState } from 'react';
4
2
  import isEqual from 'lodash.isequal';
5
- // import ReAuthMessageModal from "../ReAuthenticationModal";
6
- import { Box, CircularProgress } from "@material-ui/core";
7
- import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
8
- import { LazyMap as LazyComponentMap } from "@pega/react-sdk-components/lib/components_map";
9
- import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
10
- import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
11
-
12
- declare const PCore;
3
+ import { Box, CircularProgress } from '@material-ui/core';
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
+ }
13
18
 
14
19
  //
15
20
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -17,8 +22,7 @@ declare const PCore;
17
22
  // is totally at your own risk.
18
23
  //
19
24
 
20
-
21
- const renderingModes = ["portal", "view"];
25
+ const renderingModes = ['portal', 'view'];
22
26
 
23
27
  function usePrevious(value) {
24
28
  const ref = useRef(null);
@@ -31,14 +35,10 @@ function usePrevious(value) {
31
35
  function getItemView(routingInfo, renderingMode) {
32
36
  const viewConfigs: any = [];
33
37
  if (routingInfo && renderingModes.includes(renderingMode)) {
34
- const { accessedOrder, items }: {accessedOrder: any, items:any } = routingInfo;
38
+ const { accessedOrder, items }: { accessedOrder: any; items: any } = routingInfo;
35
39
  if (accessedOrder && items) {
36
40
  const key = accessedOrder[accessedOrder.length - 1];
37
- if (
38
- items[key] &&
39
- items[key].view &&
40
- !Utils.isEmptyObject(items[key].view)
41
- ) {
41
+ if (items[key] && items[key].view && !isEmptyObject(items[key].view)) {
42
42
  viewConfigs.push(items[key]);
43
43
  }
44
44
  }
@@ -46,53 +46,43 @@ function getItemView(routingInfo, renderingMode) {
46
46
  return viewConfigs;
47
47
  }
48
48
 
49
- const RootContainer = (props) => {
50
- const {
51
- getPConnect,
52
- renderingMode,
53
- children,
54
- skeleton,
55
- httpMessages,
56
- routingInfo
57
- } = props;
58
-
59
- const { displayOnlyFA, isMashup } = useContext(StoreContext);
49
+ export default function RootContainer(props: PropsWithChildren<RootContainerProps>) {
50
+ const { getPConnect, renderingMode = '', children, skeleton, httpMessages = [], routingInfo } = props;
60
51
 
52
+ const { displayOnlyFA } = useContext<any>(StoreContext);
61
53
 
62
54
  const pConn = getPConnect();
63
55
 
64
- const options = { "context": "app" };
65
- if (isMashup) {
66
- options["context"] = "root";
67
- }
56
+ const options = { context: 'app' };
68
57
 
69
- const [componentName, setComponentName] = useState("");
58
+ const [componentName, setComponentName] = useState('');
70
59
 
71
- useEffect( () => {
60
+ useEffect(() => {
72
61
  // debugging/investigation help
73
62
  // console.log(`componentName change: ${componentName} triggering a re-render`);
74
- }, [componentName] );
63
+ }, [componentName]);
75
64
 
76
65
  // debugging/investigation help
77
66
  // console.log(`RootContainer props.routingInfo: ${JSON.stringify(routingInfo)}`);
78
67
 
79
68
  let hasBanner = false;
80
69
  let banners: any = null;
81
- const messages = httpMessages
82
- ? httpMessages.map((msg) => msg.message)
83
- : httpMessages;
70
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
71
+ const localeCategory = 'Messages';
72
+
73
+ const messages = httpMessages ? httpMessages.map(msg => localizedVal(msg.message, localeCategory)) : httpMessages;
84
74
 
85
75
  hasBanner = messages && messages.length > 0;
86
- banners = hasBanner && (<div>RootContainer: trying to emit Banner with {messages}</div>);
76
+ banners = hasBanner && <div>{localizedVal(`RootContainer: trying to emit Banner with ${messages}`, localeCategory)}</div>;
87
77
 
88
78
  const MemoizedModalViewContainer = useMemo(() => {
89
79
  return createElement(
90
80
  createPConnectComponent(),
91
81
  PCore.createPConnect({
92
82
  meta: {
93
- type: "ModalViewContainer",
83
+ type: 'ModalViewContainer',
94
84
  config: {
95
- name: "modal"
85
+ name: 'modal'
96
86
  }
97
87
  },
98
88
  options
@@ -100,15 +90,15 @@ const RootContainer = (props) => {
100
90
  );
101
91
  }, []);
102
92
 
103
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
93
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
104
94
  const MemoizedPreviewViewContainer = useMemo(() => {
105
95
  return createElement(
106
96
  createPConnectComponent(),
107
97
  PCore.createPConnect({
108
98
  meta: {
109
- type: "PreviewViewContainer",
99
+ type: 'PreviewViewContainer',
110
100
  config: {
111
- name: "preview"
101
+ name: 'preview'
112
102
  }
113
103
  },
114
104
  options
@@ -116,29 +106,28 @@ const RootContainer = (props) => {
116
106
  );
117
107
  }, []);
118
108
 
119
-
120
109
  //
121
110
  function getNoPortalContent() {
122
111
  let noPortalContent: any;
123
112
 
124
113
  switch (componentName) {
125
- case "View":
126
- noPortalContent = <div>getNoPortalContent: RootContainer wants to render View in noPortal mode</div>
114
+ case 'View':
115
+ noPortalContent = <div>{localizedVal('getNoPortalContent: RootContainer wants to render View in noPortal mode', localeCategory)}</div>;
127
116
  break;
128
117
 
129
- case "ViewContainer": {
118
+ case 'ViewContainer': {
130
119
  const configProps = pConn.getConfigProps();
131
120
  const viewContConfig = {
132
- "meta": {
133
- "type": "ViewContainer",
134
- "config": configProps
121
+ meta: {
122
+ type: 'ViewContainer',
123
+ config: configProps
135
124
  },
136
- options
125
+ options
137
126
  };
138
- const theViewCont = PCore.createPConnect(viewContConfig);
127
+ const theViewCont: any = PCore.createPConnect(viewContConfig);
139
128
  // Add in displayOnlyFA if prop is on RootContainer
140
129
  if (displayOnlyFA) {
141
- theViewCont["displayOnlyFA"] = true;
130
+ theViewCont.displayOnlyFA = true;
142
131
  }
143
132
 
144
133
  const theViewContainerAsReact = createElement(createPConnectComponent(), theViewCont);
@@ -148,24 +137,22 @@ const RootContainer = (props) => {
148
137
  }
149
138
 
150
139
  default:
151
- noPortalContent = <div>getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode</div>
140
+ noPortalContent = (
141
+ <div>{localizedVal('getNoPortalContent: RootContainer wants to render NO componentName in noPortal mode', localeCategory)}</div>
142
+ );
152
143
  break;
153
-
154
144
  }
155
145
 
156
146
  return noPortalContent;
157
147
  }
158
148
 
159
-
160
- let rootView : any;
149
+ let rootView: any;
161
150
  let rootViewConfig: any = null;
162
151
 
163
152
  useEffect(() => {
164
153
  const { containers } = PCore.getStore().getState();
165
- const items = Object.keys(containers).filter((item) =>
166
- item.includes("root")
167
- );
168
- PCore.getContainerUtils().getContainerAPI().addContainerItems(items);
154
+ const items = Object.keys(containers).filter(item => item.includes('root'));
155
+ (PCore.getContainerUtils().getContainerAPI() as any).addContainerItems(items);
169
156
  }, [routingInfo]);
170
157
 
171
158
  const items: any = getItemView(routingInfo, renderingMode);
@@ -180,13 +167,8 @@ const RootContainer = (props) => {
180
167
  }
181
168
  const prevRootConfig = usePrevious(rootViewConfig);
182
169
 
183
- if (
184
- renderingModes.includes(renderingMode) &&
185
- messages &&
186
- routingInfo &&
187
- routingInfo?.accessedOrder.length === 0
188
- ) {
189
- 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>;
190
172
  }
191
173
 
192
174
  if (items.length > 0) {
@@ -199,86 +181,61 @@ const RootContainer = (props) => {
199
181
  };
200
182
 
201
183
  if (!isEqual(currentRootConfig, prevRootConfig)) {
202
- rootView = createElement(
203
- createPConnectComponent(),
204
- PCore.createPConnect(currentRootConfig)
205
- );
184
+ rootView = createElement(createPConnectComponent(), PCore.createPConnect(currentRootConfig));
206
185
  }
207
186
 
208
187
  // debugging/investigation help
209
188
  // console.log(`rootView.props.getPConnect().getComponentName(): ${rootView.props.getPConnect().getComponentName()}`);
210
189
 
211
190
  return (
212
- <div id="ModalManager">
213
- {rootView}
214
- {MemoizedModalViewContainer}
215
- <div id="MemoizedPreviewViewContainer"></div>
216
- <div id="ReAuthMessageModal"></div>
191
+ <div id='ModalManager'>
192
+ {rootView}
193
+ {MemoizedModalViewContainer}
194
+ <div id='MemoizedPreviewViewContainer' />
195
+ <div id='ReAuthMessageModal' />
217
196
  </div>
218
197
  );
219
-
220
198
  }
221
- else if (renderingMode === "noPortal") {
199
+ if (renderingMode === 'noPortal') {
222
200
  // eslint-disable-next-line no-console
223
- console.log(`RootContainer rendering in noPortal mode`);
201
+ console.log(`${localizedVal('RootContainer rendering in noPortal mode', localeCategory)}`);
224
202
 
225
- const theChildren = pConn.getChildren();
226
- if (theChildren && (theChildren.length === 1)) {
203
+ const theChildren = pConn.getChildren() as any[];
204
+ if (theChildren && theChildren.length === 1) {
227
205
  const localPConn = theChildren[0].getPConnect();
228
- const localCompName = localPConn.getComponentName()
206
+ const localCompName = localPConn.getComponentName();
229
207
  if (componentName !== localCompName) {
230
208
  setComponentName(localCompName);
231
209
  }
232
210
  }
233
211
 
234
- const noPortalContent = getNoPortalContent();
235
-
236
- return noPortalContent;
212
+ return getNoPortalContent();
237
213
  }
238
- else if (children && children.length > 0) {
214
+ if (children && Children.count(children) > 0) {
239
215
  return (
240
- <React.Fragment>
241
- <div>RootContainer: Has children. Trying to show ModalManager with children, etc.</div>
216
+ <>
217
+ <div>{localizedVal('RootContainer: Has children. Trying to show ModalManager with children, etc.', localeCategory)}</div>
242
218
  {children}
243
219
  {MemoizedModalViewContainer}
244
- </React.Fragment>
245
-
220
+ </>
246
221
  );
247
- } else if (skeleton) {
248
- // 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
249
225
  const LoadingComponent = LazyComponentMap[skeleton];
250
226
 
251
227
  return (
252
- <div id="root-container">
228
+ <div id='root-container'>
253
229
  {/* <div>RootContainer: Trying to show skeleton</div> */}
254
- <Box textAlign="center"><CircularProgress /></Box>
255
- </div>
256
- );
257
- } else {
258
- return (
259
- <div id="root-container">
260
- <div>RootContainer: Should be ModalManager, etc.</div>
230
+ <Box textAlign='center'>
231
+ <CircularProgress />
232
+ </Box>
261
233
  </div>
262
234
  );
263
235
  }
264
- };
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;
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';
@@ -1,13 +1,16 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import { Breadcrumbs, Card, Typography } from "@material-ui/core";
1
+ import { Breadcrumbs, Card, Typography } from '@material-ui/core';
4
2
  import DoubleArrowIcon from '@material-ui/icons/DoubleArrow';
5
3
  import DoneIcon from '@material-ui/icons/Done';
6
4
  import { makeStyles } from '@material-ui/core/styles';
7
5
 
8
- declare const PCore: any;
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
7
 
10
- const useStyles = makeStyles((theme) => ({
8
+ interface StagesProps extends PConnProps {
9
+ // If any, enter additional props that only exist on this component
10
+ stages: any[];
11
+ }
12
+
13
+ const useStyles = makeStyles(theme => ({
11
14
  root: {
12
15
  paddingRight: theme.spacing(1),
13
16
  paddingLeft: theme.spacing(1),
@@ -16,25 +19,23 @@ const useStyles = makeStyles((theme) => ({
16
19
  marginRight: theme.spacing(1),
17
20
  marginLeft: theme.spacing(1),
18
21
  marginTop: theme.spacing(1),
19
- marginBottom: theme.spacing(1),
22
+ marginBottom: theme.spacing(1)
20
23
  },
21
24
  completedStage: {
22
- color: theme.palette.text.primary,
25
+ color: theme.palette.text.primary
23
26
  },
24
27
  currentStage: {
25
28
  color: theme.palette.info.dark,
26
- fontWeight: 600,
29
+ fontWeight: 600
27
30
  },
28
31
  futureStage: {
29
- color: theme.palette.text.secondary,
32
+ color: theme.palette.text.secondary
30
33
  },
31
34
  separatorIcon: {
32
- color: theme.palette.text.disabled,
35
+ color: theme.palette.text.disabled
33
36
  }
34
-
35
37
  }));
36
38
 
37
-
38
39
  /**
39
40
  * API to filter out the alternate stages which are not in active and return all other stages
40
41
  * @param {Array} stages - Stages of a case type
@@ -46,31 +47,28 @@ function getFilteredStages(stages) {
46
47
  return [];
47
48
  }
48
49
 
49
- return stages.filter(
50
- (stage) =>
51
- stage.type !== "Alternate" ||
52
- (stage.type === "Alternate" && stage.visited_status === "active")
53
- );
50
+ return stages.filter(stage => stage.type !== 'Alternate' || (stage.type === 'Alternate' && stage.visited_status === 'active'));
54
51
  }
55
52
 
56
53
  /* TODO - this component should be refactored and not exposed as top level DX Component -
57
54
  the stages should be created as part of the CaseView */
58
- export default function Stages(props) {
55
+ export default function Stages(props: StagesProps) {
59
56
  const classes = useStyles();
60
57
 
61
58
  const { getPConnect, stages } = props;
62
59
  const pConn = getPConnect();
60
+ const key = `${pConn.getCaseInfo().getClassName()}!CASE!${pConn.getCaseInfo().getName()}`.toUpperCase();
63
61
 
64
62
  const filteredStages = getFilteredStages(stages);
65
- const currentStageID = pConn.getValue(PCore.getConstants().CASE_INFO.STAGEID);
63
+ const currentStageID = pConn.getValue(PCore.getConstants().CASE_INFO.STAGEID, ''); // 2nd arg empty string until typedef allows optional
66
64
  const stagesObj = filteredStages.map((stage, index, arr) => {
67
65
  const theID = stage.ID || stage.id;
68
66
  return {
69
- name: stage.name,
67
+ name: PCore.getLocaleUtils().getLocaleValue(stage.name, undefined, key),
70
68
  id: theID,
71
- complete: stage.visited_status === "completed",
72
- current: (theID === currentStageID),
73
- last: (index === arr.length - 1),
69
+ complete: stage.visited_status === 'completed',
70
+ current: theID === currentStageID,
71
+ last: index === arr.length - 1
74
72
  };
75
73
  });
76
74
 
@@ -89,31 +87,32 @@ export default function Stages(props) {
89
87
  theClass = classes.futureStage;
90
88
  }
91
89
 
92
- return <span key={index}>
93
- {stage.complete ? <DoneIcon color="disabled" fontSize="small" /> : null}
94
- <Typography variant="h5" component="span" display="inline" className={theClass}>{stage.name}</Typography>
95
- </span>;
90
+ return (
91
+ <span key={index}>
92
+ {stage.complete ? <DoneIcon color='disabled' fontSize='small' /> : null}
93
+ <Typography variant='h5' component='span' display='inline' className={theClass}>
94
+ {stage.name}
95
+ </Typography>
96
+ </span>
97
+ );
96
98
  }
97
99
 
98
100
  function getStages(inStages) {
99
- return <Breadcrumbs aria-label="stages" separator={<DoubleArrowIcon className={classes.separatorIcon} />}>
100
- {inStages.map((stage, index) => {
101
- return getStage(stage, index);
102
- })}
103
- </Breadcrumbs>
101
+ return (
102
+ <Breadcrumbs aria-label='stages' separator={<DoubleArrowIcon className={classes.separatorIcon} />}>
103
+ {inStages.map((stage, index) => {
104
+ return getStage(stage, index);
105
+ })}
106
+ </Breadcrumbs>
107
+ );
104
108
  }
105
109
 
106
110
  return (
107
- <Card id="Stages" className={classes.root}>
111
+ <Card id='Stages' className={classes.root}>
108
112
  {/* Stages<br />
109
113
  currentStageID: {currentStageID}<br />
110
114
  {JSON.stringify(stagesObj)}<br /><br /> */}
111
115
  {getStages(stagesObj)}
112
116
  </Card>
113
- )
117
+ );
114
118
  }
115
-
116
- Stages.propTypes = {
117
- getPConnect: PropTypes.func.isRequired,
118
- stages: PropTypes.arrayOf(PropTypes.object).isRequired
119
- };
@@ -1,9 +1,11 @@
1
- import React from "react";
2
- import { withStyles } from '@material-ui/core/styles'
3
- import {
4
- Tab,
5
- Divider,
6
- } from '@material-ui/core';
1
+ import { withStyles } from '@material-ui/core/styles';
2
+ import { Tab, Divider } from '@material-ui/core';
3
+
4
+ // LeftAlignVerticalTabs does NOT have getPConnect. So, no need to extend from PConnProps
5
+
6
+ interface LeftAlignVerticalTabsProps {
7
+ // If any, enter additional props that only exist on this component
8
+ }
7
9
 
8
10
  // LeftAlignVerticalTab is a specialized Tab that has styles to make it
9
11
  // left aligned and full width of the container Tabs
@@ -16,12 +18,17 @@ import {
16
18
  const LeftAlignVerticalTabs: any = withStyles((/* theme */) => ({
17
19
  root: {
18
20
  width: '100%',
19
- maxWidth: '100%',
21
+ maxWidth: '100%'
20
22
  },
21
23
  wrapper: {
22
24
  display: 'block',
23
- textAlign: 'left',
24
- },
25
- }))((props) => <div><Tab {...props} /><Divider /></div>);
25
+ textAlign: 'left'
26
+ }
27
+ }))((props: LeftAlignVerticalTabsProps) => (
28
+ <div>
29
+ <Tab {...props} />
30
+ <Divider />
31
+ </div>
32
+ ));
26
33
 
27
34
  export default LeftAlignVerticalTabs;
@@ -1,26 +1,29 @@
1
- import React, { useState, useEffect } from "react";
2
- import PropTypes from "prop-types";
3
- import { makeStyles } from '@material-ui/core/styles'
4
-
1
+ import React, { useState, useEffect } from 'react';
2
+ import { makeStyles } from '@material-ui/core/styles';
5
3
  import Tabs from '@material-ui/core/Tabs';
6
- import LeftAlignVerticalTab from '@pega/react-sdk-components/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs';
7
4
 
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+
7
+ // VerticalTabs does NOT have getPConnect. So, no need to extend from PConnProps
8
+ interface VerticalTabsProps {
9
+ // If any, enter additional props that only exist on this component
10
+ tabconfig: any[];
11
+ }
8
12
 
9
13
  // The MuiTabs-indicator class is in a span whose parent is div (under the Tabs root component)
10
14
  // So, we're going to make the selected vertical tab indicator use a color from our theme.
11
- const useStyles = makeStyles((theme) => (
12
- {
13
- tabs: {
14
- '& div > span': {
15
- backgroundColor: theme.palette.info.dark,
16
- width: "3px"
17
- },
18
- },
15
+ const useStyles = makeStyles(theme => ({
16
+ tabs: {
17
+ '& div > span': {
18
+ backgroundColor: theme.palette.info.dark,
19
+ width: '3px'
20
+ }
21
+ }
19
22
  }));
20
23
 
21
24
  // Implementation of custom event inspired by:
22
25
  // https://betterprogramming.pub/master-your-react-skills-with-event-listeners-ebc01dde4fad
23
- const createCustomEvent = (eventName: string, additionalData: {[key: string]: string}): CustomEvent | null => {
26
+ const createCustomEvent = (eventName: string, additionalData: { [key: string]: string }): CustomEvent | null => {
24
27
  if (window) {
25
28
  return new CustomEvent(eventName, {
26
29
  detail: { additionalData }
@@ -30,22 +33,22 @@ const createCustomEvent = (eventName: string, additionalData: {[key: string]: st
30
33
  return null;
31
34
  };
32
35
 
36
+ export default function VerticalTabs(props: VerticalTabsProps) {
37
+ // Get emitted components from map (so we can get any override that may exist)
38
+ const LeftAlignVerticalTab = getComponentFromMap('LeftAlignVerticalTabs');
33
39
 
34
- export default function VerticalTabs(props) {
35
40
  // Get a React warning when we use tabConfig as mixed case. So all lowercase tabconfig
36
- const { tabconfig } = props;
41
+ const { tabconfig = [] } = props;
37
42
  const classes = useStyles();
38
43
  const [value, setValue] = useState(0);
39
44
 
40
45
  useEffect(() => {
41
-
42
- const eventData = {"itemClicked": value.toString()};
46
+ const eventData = { itemClicked: value.toString() };
43
47
  const myEvent = createCustomEvent('VerticalTabClick', eventData);
44
48
 
45
49
  if (myEvent !== null) {
46
- document.dispatchEvent( myEvent );
50
+ document.dispatchEvent(myEvent);
47
51
  }
48
-
49
52
  }, [value]);
50
53
 
51
54
  const handleChange = (event: React.ChangeEvent<{}>, newValue: number) => {
@@ -53,23 +56,13 @@ export default function VerticalTabs(props) {
53
56
  };
54
57
 
55
58
  return (
56
- <div id="VerticalTabs">
59
+ <div id='VerticalTabs'>
57
60
  {/* VerticalTabs: {JSON.stringify(tabconfig)} */}
58
- <Tabs
59
- className={classes.tabs}
60
- orientation="vertical"
61
- value={value}
62
- onChange={handleChange}>
63
- {tabconfig.map((tab) => <LeftAlignVerticalTab {...props} label={tab.name} key={tab.name} />)}
61
+ <Tabs className={classes.tabs} orientation='vertical' value={value} onChange={handleChange}>
62
+ {tabconfig.map(tab => (
63
+ <LeftAlignVerticalTab {...props} label={tab.name} key={tab.name} />
64
+ ))}
64
65
  </Tabs>
65
66
  </div>
66
- )
67
+ );
67
68
  }
68
-
69
- VerticalTabs.defaultProps = {
70
- tabconfig: []
71
- };
72
-
73
- VerticalTabs.propTypes = {
74
- tabconfig: PropTypes.arrayOf(PropTypes.object)
75
- };