@pega/react-sdk-overrides 8.23.11 → 23.1.11

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 (233) 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 +12 -16
  5. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  6. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  8. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  9. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  10. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  11. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +14 -11
  12. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  13. package/lib/designSystemExtension/Operator/Operator.tsx +100 -84
  14. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  15. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  16. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  17. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  18. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  19. package/lib/field/AutoComplete/config-ext.json +2 -3
  20. package/lib/field/CancelAlert/CancelAlert.tsx +100 -81
  21. package/lib/field/CancelAlert/index.tsx +1 -1
  22. package/lib/field/Checkbox/Checkbox.tsx +27 -16
  23. package/lib/field/Checkbox/config-ext.json +2 -3
  24. package/lib/field/Currency/Currency.tsx +30 -47
  25. package/lib/field/Currency/config-ext.json +2 -3
  26. package/lib/field/Currency/currency-utils.ts +10 -21
  27. package/lib/field/Date/Date.tsx +24 -13
  28. package/lib/field/Date/config-ext.json +2 -3
  29. package/lib/field/DateTime/DateTime.tsx +21 -10
  30. package/lib/field/DateTime/config-ext.json +1 -2
  31. package/lib/field/Decimal/Decimal.tsx +31 -40
  32. package/lib/field/Decimal/config-ext.json +1 -2
  33. package/lib/field/Decimal/index.tsx +1 -1
  34. package/lib/field/Dropdown/Dropdown.tsx +128 -31
  35. package/lib/field/Dropdown/config-ext.json +1 -2
  36. package/lib/field/Email/Email.tsx +16 -7
  37. package/lib/field/Email/config-ext.json +1 -2
  38. package/lib/field/Email/index.tsx +1 -1
  39. package/lib/field/Group/Group.tsx +39 -0
  40. package/lib/field/Group/config-ext.json +7 -0
  41. package/lib/field/Group/index.tsx +1 -0
  42. package/lib/field/Integer/Integer.tsx +15 -6
  43. package/lib/field/Integer/config-ext.json +1 -2
  44. package/lib/field/Percentage/Percentage.tsx +52 -39
  45. package/lib/field/Percentage/config-ext.json +1 -2
  46. package/lib/field/Phone/Phone.tsx +15 -6
  47. package/lib/field/Phone/index.tsx +1 -1
  48. package/lib/field/RadioButtons/RadioButtons.tsx +26 -34
  49. package/lib/field/RadioButtons/config-ext.json +1 -2
  50. package/lib/field/RichText/RichText.tsx +96 -0
  51. package/lib/field/RichText/index.tsx +1 -0
  52. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  53. package/lib/field/ScalarList/config-ext.json +7 -0
  54. package/lib/field/ScalarList/index.tsx +1 -0
  55. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  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 +15 -5
  59. package/lib/field/TextArea/config-ext.json +1 -2
  60. package/lib/field/TextContent/TextContent.tsx +9 -2
  61. package/lib/field/TextContent/config-ext.json +1 -2
  62. package/lib/field/TextInput/TextInput.tsx +18 -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 +14 -19
  66. package/lib/field/Time/config-ext.json +1 -2
  67. package/lib/field/URL/URL.tsx +15 -6
  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 +52 -60
  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 +15 -10
  74. package/lib/helpers/case-utils.tsx +5 -10
  75. package/lib/helpers/common-utils.ts +6 -2
  76. package/lib/helpers/data_page.ts +3 -7
  77. package/lib/helpers/date-format-utils.ts +4 -4
  78. package/lib/helpers/event-utils.ts +4 -4
  79. package/lib/helpers/field-group-utils.ts +6 -8
  80. package/lib/helpers/formatters/Boolean.ts +9 -26
  81. package/lib/helpers/formatters/Currency.ts +22 -28
  82. package/lib/helpers/formatters/CurrencyMap.ts +512 -505
  83. package/lib/helpers/formatters/Date.ts +20 -26
  84. package/lib/helpers/formatters/common.ts +2 -7
  85. package/lib/helpers/formatters/index.ts +29 -22
  86. package/lib/helpers/reactContextHelpers.ts +2 -2
  87. package/lib/helpers/simpleTableHelpers.ts +63 -87
  88. package/lib/helpers/state-utils.tsx +5 -12
  89. package/lib/helpers/template-utils.ts +4 -10
  90. package/lib/helpers/utils.ts +5 -5
  91. package/lib/helpers/versionHelpers.ts +1 -7
  92. package/lib/infra/ActionButtons/ActionButtons.tsx +44 -45
  93. package/lib/infra/ActionButtons/index.tsx +1 -1
  94. package/lib/infra/Assignment/Assignment.tsx +102 -86
  95. package/lib/infra/Assignment/index.tsx +1 -1
  96. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  97. package/lib/infra/AssignmentCard/index.tsx +1 -1
  98. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +93 -240
  99. package/lib/infra/Containers/FlowContainer/helpers.ts +34 -48
  100. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  101. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  103. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +229 -223
  104. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  105. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  106. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  107. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  108. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +47 -64
  109. package/lib/infra/Containers/helpers.ts +6 -0
  110. package/lib/infra/DashboardFilter/DashboardFilter.tsx +25 -54
  111. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -42
  112. package/lib/infra/DeferLoad/DeferLoad.tsx +21 -33
  113. package/lib/infra/DeferLoad/index.tsx +1 -1
  114. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -39
  115. package/lib/infra/MultiStep/MultiStep.css +11 -15
  116. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  117. package/lib/infra/MultiStep/index.tsx +1 -1
  118. package/lib/infra/NavBar/NavBar.css +103 -105
  119. package/lib/infra/NavBar/NavBar.tsx +26 -45
  120. package/lib/infra/Reference/Reference.tsx +16 -22
  121. package/lib/infra/Region/Region.tsx +9 -9
  122. package/lib/infra/RootContainer/RootContainer.tsx +75 -120
  123. package/lib/infra/RootContainer/index.tsx +1 -1
  124. package/lib/infra/Stages/Stages.tsx +36 -41
  125. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  126. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  127. package/lib/infra/View/View.tsx +25 -29
  128. package/lib/template/AppShell/AppShell.css +22 -23
  129. package/lib/template/AppShell/AppShell.tsx +47 -71
  130. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  131. package/lib/template/CaseSummary/CaseSummary.tsx +66 -19
  132. package/lib/template/CaseSummary/config-ext.json +1 -2
  133. package/lib/template/CaseView/CaseView.tsx +44 -74
  134. package/lib/template/CaseView/config-ext.json +1 -2
  135. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +66 -31
  136. package/lib/template/Confirmation/Confirmation.tsx +24 -55
  137. package/lib/template/Confirmation/config-ext.json +1 -2
  138. package/lib/template/DataReference/DataReference.tsx +112 -142
  139. package/lib/template/DataReference/config-ext.json +1 -2
  140. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  141. package/lib/template/DefaultForm/DefaultForm.tsx +15 -16
  142. package/lib/template/DefaultForm/config-ext.json +1 -2
  143. package/lib/template/Details/Details/Details.tsx +24 -28
  144. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  145. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  146. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  147. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  151. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  152. package/lib/template/Details/DynamicTabs/config.json +36 -0
  153. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  154. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +22 -35
  155. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  156. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  157. package/lib/template/ListPage/ListPage.tsx +12 -16
  158. package/lib/template/ListPage/config-ext.json +1 -2
  159. package/lib/template/ListView/DefaultViewMeta.ts +1 -3
  160. package/lib/template/ListView/ListView.tsx +247 -309
  161. package/lib/template/ListView/config-ext.json +1 -2
  162. package/lib/template/ListView/hooks.ts +24 -26
  163. package/lib/template/ListView/utils.ts +205 -94
  164. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -34
  165. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  166. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  167. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  168. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  169. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  170. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  171. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  172. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  173. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  174. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  175. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  177. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  179. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  180. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  181. package/lib/template/PromotedFilters/PromotedFilters.tsx +39 -33
  182. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +113 -15
  183. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  184. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -104
  185. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -44
  186. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  187. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  188. package/lib/template/SubTabs/config-ext.json +1 -2
  189. package/lib/template/SubTabs/tabUtils.ts +2 -9
  190. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  191. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  192. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  193. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  194. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  196. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  197. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  198. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  199. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  200. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  201. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  202. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  203. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  204. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  205. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  207. package/lib/template/WssNavBar/WssNavBar.tsx +24 -10
  208. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  209. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  210. package/lib/widget/Attachment/Attachment.css +60 -1
  211. package/lib/widget/Attachment/Attachment.tsx +379 -394
  212. package/lib/widget/Attachment/index.tsx +1 -1
  213. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  214. package/lib/widget/CaseHistory/config-ext.json +1 -2
  215. package/lib/widget/CaseHistory/index.tsx +1 -1
  216. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  217. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  218. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +322 -245
  219. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  220. package/lib/widget/Followers/Followers.tsx +27 -25
  221. package/lib/widget/Followers/config-ext.json +1 -2
  222. package/lib/widget/QuickCreate/QuickCreate.tsx +71 -39
  223. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  224. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -52
  225. package/lib/widget/SummaryItem/index.tsx +1 -1
  226. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  227. package/lib/widget/ToDo/ToDo.css +4 -4
  228. package/lib/widget/ToDo/ToDo.tsx +72 -116
  229. package/lib/widget/ToDo/config-ext.json +1 -2
  230. package/package.json +5 -2
  231. package/lib/helpers/auth.js +0 -483
  232. package/lib/helpers/authManager.js +0 -634
  233. package/lib/helpers/config_access.js +0 -259
@@ -1,15 +1,25 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- // import { FieldGroup } from "@pega/cosmos-react-core";
4
- // import { LazyMap as LazyComponentMap } from "../../components_map";
1
+ import { PropsWithChildren } from 'react';
5
2
 
6
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
-
8
4
  import { getAllFields } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
5
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
6
 
10
7
  // Need to import any templates that we might render
11
8
 
12
9
  import './View.css';
10
+
11
+ interface ViewProps extends PConnProps {
12
+ // If any, enter additional props that only exist on this component
13
+ template?: string;
14
+ label?: string;
15
+ showLabel: boolean;
16
+ mode?: string;
17
+ title?: string;
18
+ visibility?: boolean;
19
+ name?: string;
20
+ bInForm?: boolean;
21
+ }
22
+
13
23
  //
14
24
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
15
25
  // Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
@@ -25,17 +35,18 @@ const NO_HEADER_TEMPLATES = [
25
35
  'DetailsThreeColumn',
26
36
  'NarrowWideDetails',
27
37
  'WideNarrowDetails',
28
- 'Confirmation'
38
+ 'Confirmation',
39
+ 'DynamicTabs'
29
40
  ];
30
41
 
31
- export default function View(props) {
42
+ export default function View(props: PropsWithChildren<ViewProps>) {
32
43
  const { children, template, getPConnect, mode, visibility, name: pageName } = props;
33
- let { label, showLabel = false } = props;
44
+ let { label = '', showLabel = false } = props;
34
45
 
35
46
  // Get the inherited props from the parent to determine label settings. For 8.6, this is only for embedded data form views
36
47
  // Putting this logic here instead of copy/paste in every Form template index.js
37
48
 
38
- const inheritedProps = getPConnect().getInheritedProps();
49
+ const inheritedProps: any = getPConnect().getInheritedProps(); // try to remove any when getInheritedProps typedefs are fixed
39
50
  label = inheritedProps.label || label;
40
51
  showLabel = inheritedProps.showLabel || showLabel;
41
52
 
@@ -68,7 +79,11 @@ export default function View(props) {
68
79
  // console.log(`View rendering template: ${template}`);
69
80
 
70
81
  // spreading because all props should go to the template
71
- let RenderedTemplate = <ViewTemplate key={key} {...props}>{children}</ViewTemplate>;
82
+ let RenderedTemplate = (
83
+ <ViewTemplate key={key} {...props}>
84
+ {children}
85
+ </ViewTemplate>
86
+ );
72
87
 
73
88
  if (FORMTEMPLATES.includes(template) && showLabel) {
74
89
  // Original:
@@ -112,25 +127,6 @@ export default function View(props) {
112
127
  return null;
113
128
  }
114
129
 
115
- View.defaultProps = {
116
- label: undefined,
117
- showLabel: undefined,
118
- mode: undefined
119
- };
120
-
121
- View.propTypes = {
122
- children: PropTypes.oneOfType([
123
- PropTypes.arrayOf(PropTypes.node),
124
- PropTypes.array
125
- ]) /* array might be empty */,
126
- template: PropTypes.string /* .isRequired */,
127
- getPConnect: PropTypes.func.isRequired,
128
- label: PropTypes.string,
129
- showLabel: PropTypes.bool,
130
- mode: PropTypes.string,
131
- title: PropTypes.string
132
- };
133
-
134
130
  // Adapted from Constellation DX Component to add in additional props for some templates
135
131
  View.additionalProps = (state, getPConnect) => {
136
132
  const thePConn = getPConnect();
@@ -1,40 +1,39 @@
1
1
  .appshell-top {
2
- display: flex;
3
- background-color: var(--app-background-color);
2
+ display: flex;
3
+ background-color: var(--app-background-color);
4
4
  }
5
5
 
6
-
7
6
  .appshell-main {
8
- position: relative;
9
- min-height: 100vh;
10
- display: block;
11
- width: 100%;
7
+ position: relative;
8
+ min-height: 100vh;
9
+ display: block;
10
+ width: 100%;
12
11
  }
13
12
 
14
13
  .psdk-icon {
15
- padding: 0rem 0.125rem;
16
- min-width: unset;
14
+ padding: 0rem 0.125rem;
15
+ min-width: unset;
17
16
  }
18
17
 
19
18
  .progress-box {
20
- display: flex;
21
- flex-direction: column;
22
- justify-content: center;
23
- align-items: center;
24
- height: 100%;
25
- width: 100%;
26
- background-color: whitesmoke;
27
- position: fixed;
28
- z-index: 999;
29
- top: 0rem;
30
- left: 0rem;
31
- opacity: 0.5;
19
+ display: flex;
20
+ flex-direction: column;
21
+ justify-content: center;
22
+ align-items: center;
23
+ height: 100%;
24
+ width: 100%;
25
+ background-color: whitesmoke;
26
+ position: fixed;
27
+ z-index: 999;
28
+ top: 0rem;
29
+ left: 0rem;
30
+ opacity: 0.5;
32
31
  }
33
32
 
34
33
  .progress-spinner {
35
- text-align: center;
34
+ text-align: center;
36
35
  }
37
36
 
38
37
  ::ng-deep snack-bar-container.snackbar-newline {
39
- white-space: pre-line;
38
+ white-space: pre-line;
40
39
  }
@@ -1,14 +1,30 @@
1
- import React, { useEffect, useState } from 'react';
2
- import PropTypes from 'prop-types';
1
+ import { PropsWithChildren, useEffect, useState } from 'react';
3
2
  import { makeStyles } from '@material-ui/core/styles';
4
- import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
5
3
  import Avatar from '@material-ui/core/Avatar';
4
+
5
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
6
6
  import { NavContext } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
7
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+
7
10
  import './AppShell.css';
8
11
 
9
- // AppShell can emit NavBar or WssNavBar
10
- import NavBar from '@pega/react-sdk-components/lib/components/infra/NavBar';
11
- import WssNavBar from '@pega/react-sdk-components/lib/components/template/WssNavBar';
12
+ interface AppShellProps extends PConnProps {
13
+ // If any, enter additional props that only exist on this component
14
+ showAppName: boolean;
15
+ pages: {
16
+ pxPageViewIcon: string;
17
+ pyClassName: string;
18
+ pyLabel: string;
19
+ pyRuleName: string;
20
+ pyURLContent: string;
21
+ }[];
22
+ caseTypes?: object[];
23
+ portalTemplate: string;
24
+ portalName: string;
25
+ portalLogo: string;
26
+ navDisplayOptions: { alignment: string; position: string };
27
+ }
12
28
 
13
29
  const useStyles = makeStyles(theme => ({
14
30
  root: {
@@ -29,24 +45,15 @@ const useStyles = makeStyles(theme => ({
29
45
  }
30
46
  }));
31
47
 
32
- // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
33
- declare const PCore: any;
34
-
35
-
36
- export default function AppShell(props) {
37
- const {
38
- pages,
39
- caseTypes,
40
- showAppName,
41
- children,
42
- getPConnect,
43
- portalTemplate,
44
- portalName,
45
- portalLogo,
46
- navDisplayOptions
47
- } = props;
48
+ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
49
+ // Get emitted components from map (so we can get any override that may exist)
50
+ const NavBar = getComponentFromMap('NavBar');
51
+ const WssNavBar = getComponentFromMap('WssNavBar');
52
+
53
+ const { pages = [], caseTypes = [], showAppName, children = [], getPConnect, portalTemplate, portalName, portalLogo, navDisplayOptions } = props;
54
+
48
55
  const [open, setOpen] = useState(true);
49
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
56
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
50
57
  const [activeTab, setActiveTab] = useState(!pages ? null : pages[0]?.pyRuleName);
51
58
  const pConn = getPConnect();
52
59
  const envInfo = PCore.getEnvironmentInfo();
@@ -54,25 +61,25 @@ export default function AppShell(props) {
54
61
  const userName = envInfo.getOperatorName();
55
62
  const currentUserInitials = Utils.getInitials(userName);
56
63
  const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
57
- const portalClass = pConn.getValue('.classID');
64
+ const portalClass = pConn.getValue('.classID', ''); // 2nd arg empty string until typedef marked correctly
58
65
  const envPortalName = envInfo.getPortalName();
59
66
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
60
67
 
61
68
  const classes = useStyles();
62
69
  const actionsAPI = pConn.getActionsApi();
63
- const localeReference = pConn.getValue('.pyLocaleReference');
64
- const [imageBlobUrl, setImageBlobUrl] = useState(null);
70
+ const localeReference = pConn.getValue('.pyLocaleReference', ''); // 2nd arg empty string until typedef marked correctly
71
+ const [imageBlobUrl, setImageBlobUrl] = useState<string | null>(null);
65
72
  // useState for appName and mapChildren - note these are ONLY updated once (on component mount!)
66
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
73
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
67
74
  const [appName, setAppName] = useState('');
68
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
75
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
69
76
  const [mapChildren, setMapChildren] = useState([]);
70
77
 
71
78
  // Initial setting of appName and mapChildren
72
79
  useEffect(() => {
73
80
  setAppName(PCore.getEnvironmentInfo().getApplicationName());
74
81
 
75
- const tempMap = pConn.getChildren().map((child, index) => {
82
+ const tempMap: any = (pConn.getChildren() as any)?.map((child: any, index) => {
76
83
  const theChildComp = child.getPConnect().getComponentName();
77
84
  const theKey = `.${index}`;
78
85
  return (
@@ -95,9 +102,7 @@ export default function AppShell(props) {
95
102
  portalLogo.toLowerCase().includes('py-logo') ||
96
103
  portalLogo.toLowerCase().includes('py-full-logo')
97
104
  ) {
98
- const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat(
99
- 'pzpega-logo-mark.svg'
100
- );
105
+ const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat('pzpega-logo-mark.svg');
101
106
  setIconURL(portalLogoImage);
102
107
  setFullIconURL(`${Utils.getSDKStaticConentUrl()}static/py-full-logo.svg`);
103
108
  }
@@ -111,10 +116,8 @@ export default function AppShell(props) {
111
116
  setFullIconURL(data);
112
117
  })
113
118
  .catch(() => {
114
- // eslint-disable-next-line no-console
115
- console.error(
116
- `${localizedVal('Unable to load the image for the portal logo/icon with the insName', 'AppShell')}:${portalLogo}`
117
- );
119
+ // eslint-disable-next-line no-console
120
+ console.error(`${localizedVal('Unable to load the image for the portal logo/icon with the insName', 'AppShell')}:${portalLogo}`);
118
121
  });
119
122
  }
120
123
  }, [portalLogo]);
@@ -153,10 +156,7 @@ export default function AppShell(props) {
153
156
  name,
154
157
  icon: page.pxPageViewIcon.replace('pi pi-', ''),
155
158
  active: page.pyRuleName === activeTab,
156
- onClick: () =>
157
- !page.pyURLContent || page.pyURLContent === ''
158
- ? showPage(page.pyRuleName, page.pyClassName)
159
- : openURL(page.pyURLContent)
159
+ onClick: () => (!page.pyURLContent || page.pyURLContent === '' ? showPage(page.pyRuleName, page.pyClassName) : openURL(page.pyURLContent))
160
160
  };
161
161
  });
162
162
 
@@ -175,19 +175,11 @@ export default function AppShell(props) {
175
175
  portalName={portalName}
176
176
  imageSrc={iconURL}
177
177
  fullImageSrc={fullIconURL}
178
- appName={localizedVal(
179
- appNameToDisplay,
180
- '',
181
- `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
182
- )}
178
+ appName={localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
183
179
  appInfo={{
184
180
  imageSrc: iconURL,
185
- appName: localizedVal(
186
- appNameToDisplay,
187
- '',
188
- `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
189
- ),
190
- onClick: links[0] && links[0].onClick ? links[0].onClick : undefined
181
+ appName: localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()),
182
+ onClick: links[0] && /* links[0].onClick ? */ links[0].onClick /* : undefined */
191
183
  }}
192
184
  navLinks={links.filter((link, index) => {
193
185
  return index !== 0;
@@ -197,38 +189,22 @@ export default function AppShell(props) {
197
189
  />
198
190
  <div className={classes.wsscontent}>{children}</div>
199
191
  </div>
200
-
201
192
  );
202
193
  }
203
194
 
204
195
  return (
196
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
205
197
  <NavContext.Provider value={{ open, setOpen }}>
206
198
  <div id='AppShell' className={classes.root}>
207
199
  <NavBar
200
+ getPConnect={getPConnect}
208
201
  pConn={getPConnect()}
209
- appName={localizedVal(
210
- appNameToDisplay,
211
- '',
212
- `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
213
- )}
202
+ appName={localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
214
203
  pages={pages}
215
204
  caseTypes={caseTypes}
216
- ></NavBar>
205
+ />
217
206
  <div className={classes.content}>{children}</div>
218
207
  </div>
219
208
  </NavContext.Provider>
220
209
  );
221
210
  }
222
-
223
- AppShell.defaultProps = {
224
- pages: [],
225
- caseTypes: [],
226
- children: []
227
- };
228
- AppShell.propTypes = {
229
- showAppName: PropTypes.bool /* .isRequired */,
230
- pages: PropTypes.arrayOf(PropTypes.object),
231
- caseTypes: PropTypes.arrayOf(PropTypes.object),
232
- children: PropTypes.arrayOf(PropTypes.node),
233
- getPConnect: PropTypes.func.isRequired
234
- };
@@ -1,21 +1,35 @@
1
- import { useMemo, Children } from 'react';
2
- import PropTypes from 'prop-types';
3
- import Banner from '@pega/react-sdk-components/lib/components/designSystemExtension/Banner';
4
- import React from 'react';
1
+ import { Children, PropsWithChildren, useMemo } from 'react';
2
+
3
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+
6
+ interface BannerPageProps extends PConnProps {
7
+ // If any, enter additional props that only exist on this component
8
+ layout?: string;
9
+ heading?: string;
10
+ message?: string;
11
+ imageTheme?: string;
12
+ backgroundImage?: string;
13
+ backgroundColor?: string;
14
+ tintImage?: boolean;
15
+ }
5
16
 
6
17
  /*
7
18
  * BannerPage template.
8
19
  */
9
- export default function BannerPage(props) {
20
+ export default function BannerPage(props: PropsWithChildren<BannerPageProps>) {
21
+ // Get emitted components from map (so we can get any override that may exist)
22
+ const Banner = getComponentFromMap('Banner');
23
+
10
24
  const {
11
25
  children,
12
- layout,
13
- heading,
14
- message,
15
- imageTheme,
16
- backgroundImage,
17
- backgroundColor,
18
- tintImage
26
+ layout = 'two-column',
27
+ heading = '',
28
+ message = '',
29
+ imageTheme = 'light',
30
+ backgroundImage = '',
31
+ backgroundColor = '',
32
+ tintImage = false
19
33
  } = props;
20
34
 
21
35
  const childArray = useMemo(() => {
@@ -38,24 +52,3 @@ export default function BannerPage(props) {
38
52
  />
39
53
  );
40
54
  }
41
-
42
- BannerPage.propTypes = {
43
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
44
- layout: PropTypes.string,
45
- heading: PropTypes.string,
46
- message: PropTypes.string,
47
- imageTheme: PropTypes.string,
48
- backgroundImage: PropTypes.string,
49
- backgroundColor: PropTypes.string,
50
- tintImage: PropTypes.bool
51
- };
52
-
53
- BannerPage.defaultProps = {
54
- layout: 'two-column',
55
- heading: '',
56
- message: '',
57
- imageTheme: 'light',
58
- backgroundImage: '',
59
- backgroundColor: '',
60
- tintImage: false
61
- };
@@ -1,14 +1,24 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
1
+ import { PropsWithChildren, ReactElement } from 'react';
2
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
4
 
4
- import CaseSummaryFields from '@pega/react-sdk-components/lib/components/designSystemExtension/CaseSummaryFields';
5
+ interface CaseSummaryProps extends PConnProps {
6
+ // If any, enter additional props that only exist on this component
7
+ }
8
+
9
+ export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>) {
10
+ // Get emitted components from map (so we can get any override that may exist)
11
+ const CaseSummaryFields = getComponentFromMap('CaseSummaryFields');
5
12
 
6
- export default function CaseSummary(props) {
7
13
  const { getPConnect, children } = props;
8
- const thePConn = getPConnect();
9
- const theConfigProps = thePConn.getConfigProps();
10
- const { status, showStatus } = theConfigProps;
11
14
 
15
+ const thePConn = getPConnect();
16
+ const theConfigProps: any = thePConn.getConfigProps();
17
+ // const { status, showStatus } = theConfigProps;
18
+ const status = theConfigProps.status;
19
+ const showStatus = theConfigProps.showStatus;
20
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
21
+ const localeCategory = 'ModalContainer';
12
22
  // from Constellation DX Components
13
23
  // get the primary and secondary fields with the raw data (which has the non-resolved property values)
14
24
  // const regionsRaw = getPConnect().getRawMetadata().children;
@@ -17,16 +27,57 @@ export default function CaseSummary(props) {
17
27
 
18
28
  // From other SDKs
19
29
  // may want to move these into useEffect/useState combo
20
- let arPrimaryFields:Array<any> = [];
21
- let arSecondaryFields:Array<any> = [];
30
+ let arPrimaryFields: any[] = [];
31
+ let arSecondaryFields: any[] = [];
32
+
33
+ /* eslint-disable @typescript-eslint/no-shadow */
34
+ function prepareComponentInCaseSummary(pConnectMeta, getPConnect) {
35
+ const { config, children } = pConnectMeta;
36
+ const pConnect = getPConnect();
37
+
38
+ const caseSummaryComponentObject: any = {};
22
39
 
23
- for (const child of children) {
24
- const childPConn = child.props.getPConnect();
40
+ const { type } = pConnectMeta;
41
+ const createdComponent = pConnect.createComponent({
42
+ type,
43
+ children: children ? [...children] : [],
44
+ config: {
45
+ ...config
46
+ }
47
+ });
48
+
49
+ caseSummaryComponentObject.value = createdComponent;
50
+ return caseSummaryComponentObject;
51
+ }
52
+
53
+ function prepareCaseSummaryData(summaryFieldChildren) {
54
+ const convertChildrenToSummaryData = kid => {
55
+ return kid?.map((childItem, index) => {
56
+ const childMeta = childItem.getPConnect().meta;
57
+ const caseSummaryComponentObject = prepareComponentInCaseSummary(childMeta, childItem.getPConnect);
58
+ caseSummaryComponentObject.id = index + 1;
59
+ return caseSummaryComponentObject;
60
+ });
61
+ };
62
+ return summaryFieldChildren ? convertChildrenToSummaryData(summaryFieldChildren?.getChildren()) : undefined;
63
+ }
64
+
65
+ for (const child of children as ReactElement[]) {
66
+ const childPConn = (child as ReactElement).props.getPConnect();
25
67
  const childPConnData = childPConn.resolveConfigProps(childPConn.getRawMetadata());
26
- if (childPConnData.name.toLowerCase() === "primary fields") {
68
+ if (childPConnData.name.toLowerCase() === 'primary fields') {
27
69
  arPrimaryFields = childPConnData.children;
28
- } else if (childPConnData.name.toLowerCase() === "secondary fields") {
70
+ arPrimaryFields.forEach(field => {
71
+ if (field.config?.value && typeof field.config?.value === 'string') {
72
+ field.config.value = localizedVal(field.config.value, localeCategory);
73
+ }
74
+ });
75
+ } else if (childPConnData.name.toLowerCase() === 'secondary fields') {
76
+ const secondarySummaryFields = prepareCaseSummaryData(childPConn);
29
77
  arSecondaryFields = childPConnData.children;
78
+ arSecondaryFields.forEach((field, index) => {
79
+ field.config.displayLabel = secondarySummaryFields[index]?.value?.props?.label;
80
+ });
30
81
  }
31
82
  }
32
83
 
@@ -38,13 +89,9 @@ export default function CaseSummary(props) {
38
89
  // console.log(`CaseSummary: arSecondaryFields: ${JSON.stringify(arSecondaryFields)}`);
39
90
 
40
91
  return (
41
- <div id="CaseSummary">
92
+ <div id='CaseSummary'>
42
93
  <CaseSummaryFields status={status} showStatus={showStatus} theFields={arPrimaryFields} />
43
94
  <CaseSummaryFields theFields={arSecondaryFields} />
44
95
  </div>
45
- )
96
+ );
46
97
  }
47
-
48
- CaseSummary.propTypes = {
49
- getPConnect: PropTypes.func.isRequired
50
- };
@@ -4,6 +4,5 @@
4
4
  "description": "Case summary template",
5
5
  "type": "Template",
6
6
  "subtype": "SUMMARY",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }