@pega/react-sdk-overrides 0.23.6

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 (220) hide show
  1. package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.css +19 -0
  2. package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.tsx +156 -0
  3. package/lib/designSystemExtensions/CaseSummaryFields/index.tsx +1 -0
  4. package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +154 -0
  5. package/lib/designSystemExtensions/DetailsFields/index.tsx +1 -0
  6. package/lib/designSystemExtensions/FieldGroup/FieldGroup.tsx +113 -0
  7. package/lib/designSystemExtensions/FieldGroup/index.tsx +1 -0
  8. package/lib/designSystemExtensions/FieldGroupList/FieldGroupList.tsx +53 -0
  9. package/lib/designSystemExtensions/FieldGroupList/index.tsx +1 -0
  10. package/lib/designSystemExtensions/FieldValueList/FieldValueList.tsx +106 -0
  11. package/lib/designSystemExtensions/FieldValueList/index.tsx +1 -0
  12. package/lib/designSystemExtensions/Operator/Operator.tsx +195 -0
  13. package/lib/designSystemExtensions/Operator/index.tsx +1 -0
  14. package/lib/designSystemExtensions/Pulse/Pulse.tsx +31 -0
  15. package/lib/designSystemExtensions/Pulse/index.tsx +1 -0
  16. package/lib/forms/AutoComplete/AutoComplete.tsx +183 -0
  17. package/lib/forms/AutoComplete/index.tsx +1 -0
  18. package/lib/forms/CancelAlert/CancelAlert.css +24 -0
  19. package/lib/forms/CancelAlert/CancelAlert.tsx +126 -0
  20. package/lib/forms/CancelAlert/index.tsx +1 -0
  21. package/lib/forms/Checkbox/Checkbox.tsx +68 -0
  22. package/lib/forms/Checkbox/index.tsx +1 -0
  23. package/lib/forms/Currency/Currency.tsx +89 -0
  24. package/lib/forms/Currency/index.tsx +1 -0
  25. package/lib/forms/Date/Date.tsx +79 -0
  26. package/lib/forms/Date/index.tsx +1 -0
  27. package/lib/forms/DateTime/DateTime.tsx +75 -0
  28. package/lib/forms/DateTime/index.tsx +1 -0
  29. package/lib/forms/Decimal/Decimal.tsx +51 -0
  30. package/lib/forms/Decimal/index.tsx +1 -0
  31. package/lib/forms/Dropdown/Dropdown.tsx +82 -0
  32. package/lib/forms/Dropdown/index.tsx +1 -0
  33. package/lib/forms/Email/Email.tsx +68 -0
  34. package/lib/forms/Email/index.tsx +1 -0
  35. package/lib/forms/Integer/Integer.tsx +77 -0
  36. package/lib/forms/Integer/index.tsx +1 -0
  37. package/lib/forms/Percentage/Percentage.tsx +82 -0
  38. package/lib/forms/Percentage/index.tsx +1 -0
  39. package/lib/forms/Phone/Phone.tsx +90 -0
  40. package/lib/forms/Phone/index.tsx +1 -0
  41. package/lib/forms/RadioButtons/RadioButtons.tsx +73 -0
  42. package/lib/forms/RadioButtons/index.tsx +1 -0
  43. package/lib/forms/SemanticLink/SemanticLink.tsx +69 -0
  44. package/lib/forms/SemanticLink/index.tsx +1 -0
  45. package/lib/forms/SemanticLink/utils.ts +51 -0
  46. package/lib/forms/TextArea/TextArea.tsx +66 -0
  47. package/lib/forms/TextArea/index.tsx +1 -0
  48. package/lib/forms/TextContent/TextContent.tsx +40 -0
  49. package/lib/forms/TextContent/index.tsx +1 -0
  50. package/lib/forms/TextInput/TextInput.tsx +61 -0
  51. package/lib/forms/TextInput/index.tsx +1 -0
  52. package/lib/forms/Time/Time.tsx +71 -0
  53. package/lib/forms/Time/index.tsx +1 -0
  54. package/lib/forms/URL/URL.tsx +53 -0
  55. package/lib/forms/URL/index.tsx +1 -0
  56. package/lib/forms/UserReference/UserReference.tsx +197 -0
  57. package/lib/forms/UserReference/UserReferenceUtils.ts +13 -0
  58. package/lib/forms/UserReference/index.tsx +1 -0
  59. package/lib/helpers/auth.js +483 -0
  60. package/lib/helpers/authManager.js +630 -0
  61. package/lib/helpers/config_access.js +268 -0
  62. package/lib/helpers/data_page.ts +24 -0
  63. package/lib/helpers/event-utils.js +20 -0
  64. package/lib/helpers/field-group-utils.js +61 -0
  65. package/lib/helpers/formatters/Boolean.js +38 -0
  66. package/lib/helpers/formatters/Currency.js +74 -0
  67. package/lib/helpers/formatters/CurrencyMap.js +908 -0
  68. package/lib/helpers/formatters/Date.js +77 -0
  69. package/lib/helpers/formatters/common.js +10 -0
  70. package/lib/helpers/formatters/index.js +120 -0
  71. package/lib/helpers/utils.ts +334 -0
  72. package/lib/helpers/versionHelpers.ts +50 -0
  73. package/lib/infra/ActionButtons/ActionButtons.tsx +70 -0
  74. package/lib/infra/ActionButtons/index.tsx +1 -0
  75. package/lib/infra/Assignment/Assignment.tsx +301 -0
  76. package/lib/infra/Assignment/index.tsx +1 -0
  77. package/lib/infra/AssignmentCard/AssignmentCard.tsx +47 -0
  78. package/lib/infra/AssignmentCard/index.tsx +1 -0
  79. package/lib/infra/Attachment/Attachment.css +18 -0
  80. package/lib/infra/Attachment/Attachment.tsx +404 -0
  81. package/lib/infra/Attachment/AttachmentUtils.js +71 -0
  82. package/lib/infra/Attachment/index.tsx +1 -0
  83. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +511 -0
  84. package/lib/infra/Containers/FlowContainer/helpers.js +147 -0
  85. package/lib/infra/Containers/FlowContainer/index.tsx +1 -0
  86. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +320 -0
  87. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -0
  88. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +216 -0
  89. package/lib/infra/Containers/ViewContainer/index.tsx +1 -0
  90. package/lib/infra/DashboardFilter/DashboardFilter.tsx +180 -0
  91. package/lib/infra/DashboardFilter/filterUtils.tsx +188 -0
  92. package/lib/infra/DashboardFilter/index.tsx +1 -0
  93. package/lib/infra/DeferLoad/DeferLoad.tsx +175 -0
  94. package/lib/infra/DeferLoad/index.tsx +1 -0
  95. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +103 -0
  96. package/lib/infra/ErrorBoundary/index.tsx +1 -0
  97. package/lib/infra/MultiStep/MultiStep.css +261 -0
  98. package/lib/infra/MultiStep/MultiStep.tsx +225 -0
  99. package/lib/infra/MultiStep/index.tsx +1 -0
  100. package/lib/infra/NavBar/NavBar.css +170 -0
  101. package/lib/infra/NavBar/NavBar.tsx +393 -0
  102. package/lib/infra/NavBar/index.tsx +1 -0
  103. package/lib/infra/Reference/Reference.tsx +58 -0
  104. package/lib/infra/Reference/index.tsx +1 -0
  105. package/lib/infra/Region/Region.tsx +17 -0
  106. package/lib/infra/Region/index.tsx +1 -0
  107. package/lib/infra/RootContainer/RootContainer.tsx +336 -0
  108. package/lib/infra/RootContainer/index.tsx +1 -0
  109. package/lib/infra/Stages/Stages.tsx +120 -0
  110. package/lib/infra/Stages/index.tsx +1 -0
  111. package/lib/infra/ToDo/ToDo.css +87 -0
  112. package/lib/infra/ToDo/ToDo.tsx +285 -0
  113. package/lib/infra/ToDo/index.tsx +1 -0
  114. package/lib/infra/VerticalTabs/LeftAlignVerticalTab.tsx +27 -0
  115. package/lib/infra/VerticalTabs/VerticalTabs.tsx +75 -0
  116. package/lib/infra/VerticalTabs/index.tsx +1 -0
  117. package/lib/infra/View/View.css +8 -0
  118. package/lib/infra/View/View.tsx +175 -0
  119. package/lib/infra/View/index.tsx +1 -0
  120. package/lib/templates/AppShell/AppShell.css +40 -0
  121. package/lib/templates/AppShell/AppShell.tsx +439 -0
  122. package/lib/templates/AppShell/index.tsx +1 -0
  123. package/lib/templates/CaseSummary/CaseSummary.tsx +50 -0
  124. package/lib/templates/CaseSummary/index.tsx +1 -0
  125. package/lib/templates/CaseView/CaseView.tsx +261 -0
  126. package/lib/templates/CaseView/CaseViewActionsMenu.tsx +73 -0
  127. package/lib/templates/CaseView/index.tsx +1 -0
  128. package/lib/templates/DataReference/DataReference.tsx +290 -0
  129. package/lib/templates/DataReference/index.tsx +1 -0
  130. package/lib/templates/DefaultForm/DefaultForm.css +25 -0
  131. package/lib/templates/DefaultForm/DefaultForm.tsx +52 -0
  132. package/lib/templates/DefaultForm/index.tsx +1 -0
  133. package/lib/templates/Details/Details/Details.tsx +35 -0
  134. package/lib/templates/Details/Details/index.tsx +1 -0
  135. package/lib/templates/Details/DetailsSubTabs/DetailsSubTabs.tsx +65 -0
  136. package/lib/templates/Details/DetailsSubTabs/index.tsx +1 -0
  137. package/lib/templates/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +45 -0
  138. package/lib/templates/Details/DetailsThreeColumn/index.tsx +1 -0
  139. package/lib/templates/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +43 -0
  140. package/lib/templates/Details/DetailsTwoColumn/index.tsx +1 -0
  141. package/lib/templates/FieldGroupTemplate/FieldGroupTemplate.tsx +94 -0
  142. package/lib/templates/FieldGroupTemplate/index.tsx +1 -0
  143. package/lib/templates/InlineDashboard/InlineDashboard.tsx +72 -0
  144. package/lib/templates/InlineDashboard/index.tsx +1 -0
  145. package/lib/templates/InlineDashboardPage/InlineDashboardPage.tsx +41 -0
  146. package/lib/templates/InlineDashboardPage/index.tsx +1 -0
  147. package/lib/templates/ListPage/ListPage.tsx +20 -0
  148. package/lib/templates/ListPage/index.tsx +1 -0
  149. package/lib/templates/ListView/ListView.css +10 -0
  150. package/lib/templates/ListView/ListView.tsx +1230 -0
  151. package/lib/templates/ListView/index.tsx +1 -0
  152. package/lib/templates/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +42 -0
  153. package/lib/templates/MultiReferenceReadOnly/index.tsx +1 -0
  154. package/lib/templates/NarrowWide/NarrowWide/NarrowWide.css +21 -0
  155. package/lib/templates/NarrowWide/NarrowWide/NarrowWide.tsx +35 -0
  156. package/lib/templates/NarrowWide/NarrowWide/index.tsx +1 -0
  157. package/lib/templates/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +53 -0
  158. package/lib/templates/NarrowWide/NarrowWideDetails/index.tsx +1 -0
  159. package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.css +21 -0
  160. package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +24 -0
  161. package/lib/templates/NarrowWide/NarrowWideForm/index.tsx +1 -0
  162. package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +38 -0
  163. package/lib/templates/NarrowWide/NarrowWidePage/index.tsx +1 -0
  164. package/lib/templates/OneColumn/OneColumn/OneColumn.tsx +32 -0
  165. package/lib/templates/OneColumn/OneColumn/index.tsx +1 -0
  166. package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +24 -0
  167. package/lib/templates/OneColumn/OneColumnPage/index.tsx +1 -0
  168. package/lib/templates/OneColumn/OneColumnTab/OneColumnTab.tsx +17 -0
  169. package/lib/templates/OneColumn/OneColumnTab/index.tsx +1 -0
  170. package/lib/templates/PromotedFilters/PromotedFilters.css +7 -0
  171. package/lib/templates/PromotedFilters/PromotedFilters.tsx +160 -0
  172. package/lib/templates/PromotedFilters/index.tsx +1 -0
  173. package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +28 -0
  174. package/lib/templates/SimpleTable/SimpleTable/index.tsx +1 -0
  175. package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +719 -0
  176. package/lib/templates/SimpleTable/SimpleTableManual/index.tsx +1 -0
  177. package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +129 -0
  178. package/lib/templates/SimpleTable/SimpleTableSelect/index.tsx +1 -0
  179. package/lib/templates/SimpleTable/helpers.ts +360 -0
  180. package/lib/templates/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +66 -0
  181. package/lib/templates/SingleReferenceReadOnly/index.tsx +1 -0
  182. package/lib/templates/SubTabs/SubTabs.tsx +65 -0
  183. package/lib/templates/SubTabs/index.tsx +1 -0
  184. package/lib/templates/SubTabs/tabUtils.ts +73 -0
  185. package/lib/templates/TwoColumn/TwoColumn/TwoColumn.css +13 -0
  186. package/lib/templates/TwoColumn/TwoColumn/TwoColumn.tsx +58 -0
  187. package/lib/templates/TwoColumn/TwoColumn/index.tsx +1 -0
  188. package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +25 -0
  189. package/lib/templates/TwoColumn/TwoColumnPage/index.tsx +1 -0
  190. package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
  191. package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +55 -0
  192. package/lib/templates/TwoColumn/TwoColumnTab/index.tsx +1 -0
  193. package/lib/templates/WideNarrow/WideNarrow/WideNarrow.css +21 -0
  194. package/lib/templates/WideNarrow/WideNarrow/WideNarrow.tsx +35 -0
  195. package/lib/templates/WideNarrow/WideNarrow/index.tsx +1 -0
  196. package/lib/templates/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +54 -0
  197. package/lib/templates/WideNarrow/WideNarrowDetails/index.tsx +1 -0
  198. package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.css +21 -0
  199. package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +24 -0
  200. package/lib/templates/WideNarrow/WideNarrowForm/index.tsx +1 -0
  201. package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +38 -0
  202. package/lib/templates/WideNarrow/WideNarrowPage/index.tsx +1 -0
  203. package/lib/templates/utils.ts +23 -0
  204. package/lib/widgets/AppAnnouncement/AppAnnouncement.tsx +67 -0
  205. package/lib/widgets/AppAnnouncement/index.tsx +1 -0
  206. package/lib/widgets/CaseHistory/CaseHistory.tsx +169 -0
  207. package/lib/widgets/CaseHistory/index.tsx +1 -0
  208. package/lib/widgets/FileUtility/ActionButtonsForFileUtil.css +27 -0
  209. package/lib/widgets/FileUtility/ActionButtonsForFileUtil.tsx +22 -0
  210. package/lib/widgets/FileUtility/FileUtility.css +117 -0
  211. package/lib/widgets/FileUtility/FileUtility.tsx +567 -0
  212. package/lib/widgets/FileUtility/index.tsx +0 -0
  213. package/lib/widgets/Followers/Followers.tsx +43 -0
  214. package/lib/widgets/Followers/index.tsx +1 -0
  215. package/lib/widgets/SummaryItem/SummaryItem.css +78 -0
  216. package/lib/widgets/SummaryItem/SummaryItem.tsx +80 -0
  217. package/lib/widgets/SummaryItem/index.tsx +1 -0
  218. package/lib/widgets/SummaryList/SummaryList.tsx +12 -0
  219. package/lib/widgets/SummaryList/index.tsx +1 -0
  220. package/package.json +14 -0
@@ -0,0 +1,439 @@
1
+ import React, { useEffect, useState, createContext, useContext } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { makeStyles } from '@material-ui/core/styles';
4
+
5
+ // import {
6
+ // Avatar,
7
+ // Toaster,
8
+ // Banner,
9
+ // AppShell as CosmosAppShell
10
+ // } from "@pega/cosmos-react-core";
11
+
12
+ // import createPConnectComponent from "../../../bridge/react_pconnect";
13
+ // import { buildRecentList, onRecentClickHandler } from "./Recents/utils";
14
+
15
+ import './AppShell.css';
16
+
17
+ // AppShell can emit NavBar and ViewContainer
18
+ import NavBar from '@pega/react-sdk-components/lib/components/infra/NavBar';
19
+
20
+ const useStyles = makeStyles((theme) => ({
21
+ root: {
22
+ display: 'flex',
23
+ },
24
+ content: {
25
+ flexGrow: 1,
26
+ height: '100vh',
27
+ overflow: 'auto',
28
+ marginLeft: theme.spacing(2),
29
+ marginRight: theme.spacing(2),
30
+ },
31
+ }));
32
+
33
+ declare const PCore;
34
+
35
+
36
+ const NavContext = createContext({open: false, setOpen: f => f});
37
+ export const useNavBar = () => useContext(NavContext);
38
+
39
+ /*
40
+ * The wrapper handles knowing how to take in just children and mapping
41
+ * to the Cosmos template. This could be a combination of things but it knows...
42
+ */
43
+ export default function AppShell(props) {
44
+ const {
45
+ pages,
46
+ caseTypes,
47
+ showAppName,
48
+ children,
49
+ getPConnect,
50
+ } = props;
51
+ const [open, setOpen] = useState(true);
52
+
53
+ const pConn = getPConnect();
54
+ // const actionsAPI = pConn.getActionsApi();
55
+ const envInfo = PCore.getEnvironmentInfo();
56
+
57
+ // const bannerRef = useRef(null);
58
+ // const hasBanner = httpMessages && httpMessages.length ? httpMessages.length > 0 : false;
59
+
60
+ const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : "";
61
+
62
+ const classes = useStyles();
63
+ // let banners = null;
64
+ // banners = hasBanner && (
65
+ // <Banner
66
+ // ref={bannerRef}
67
+ // id="appShellBanner"
68
+ // variant="urgent"
69
+ // heading="Error"
70
+ // onDismiss={() =>
71
+ // pConn.clearErrorMessages({
72
+ // category: "HTTP",
73
+ // context: null
74
+ // })
75
+ // }
76
+ // messages={httpMessages}
77
+ // />
78
+ // );
79
+
80
+ // useEffect(() => {
81
+ // if (hasBanner && bannerRef.current) {
82
+ // bannerRef.current.focus();
83
+ // window.scrollTo(0, bannerRef.current.offsetTop);
84
+ // }
85
+ // }, [hasBanner]);
86
+
87
+ /**
88
+ *
89
+ * Function to dispatch a show page action for the page links in
90
+ * the left nav of the app shell
91
+ *
92
+ * @param {string} searchString Name of view to show
93
+ */
94
+ // function showSearchResults(searchString) {
95
+ // if (searchString === "") {
96
+ // actionsAPI.showPage("pySearchPage", "Data-Portal");
97
+ // return;
98
+ // }
99
+ // const searchTerm = searchString.replace(/['"]+/g, "");
100
+ // PCore.getDataApiUtils()
101
+ // .getData(
102
+ // "D_pySearch",
103
+ // `{"dataViewParameters": {"SearchString": "${encodeURIComponent(
104
+ // searchTerm
105
+ // )}"}}`
106
+ // )
107
+ // .then((response) => {
108
+ // if (
109
+ // response.data.data !== null &&
110
+ // response.data.resultCount === 1 &&
111
+ // response.data.data[0].pyID === searchTerm
112
+ // ) {
113
+ // /* This is a match for a work item - then we will open it */
114
+ // pConn
115
+ // .getActionsApi()
116
+ // .openWorkByHandle(
117
+ // response.data.data[0].pzInsKey,
118
+ // response.data.data[0].pzCategoryActionKeys
119
+ // );
120
+ // return;
121
+ // }
122
+ // // window.searchResults = {
123
+ // // searchString: searchTerm,
124
+ // // results: response.data
125
+ // // };
126
+ // actionsAPI.showPage("pySearchPage", "Data-Portal");
127
+ // });
128
+ // }
129
+
130
+ /**
131
+ *
132
+ * Function to dispatch a show page action for the page links in
133
+ * the left nav of the app shell
134
+ *
135
+ * @param {string} viewName Name of view to show
136
+ * @param {string} className Pega Applies to class of the page
137
+ */
138
+ // function showPage(viewName, className) {
139
+ // actionsAPI.showPage(viewName, className);
140
+ // }
141
+
142
+ /**
143
+ *
144
+ * Function to dispatch a create work action
145
+ * @param {string} className - placeholder string of case type being created
146
+ */
147
+ // function createWork(className) {
148
+ // actionsAPI
149
+ // .createWork(className)
150
+ // .catch((error) =>
151
+ // // eslint-disable-next-line no-console
152
+ // console.log("Error in case creation: ", error?.message)
153
+ // );
154
+ // }
155
+
156
+ /**
157
+ * Returns the Custome Component for each active case
158
+ */
159
+ // const VisualComponent = useCallback(
160
+ // (context) => {
161
+ // if (activeCases && activeCases.length > 0) {
162
+ // const meta = PCore.getViewResources().fetchViewResources(
163
+ // "pyCaseVisual",
164
+ // getPConnect(),
165
+ // PCore.getStoreValue(".caseTypeID", "caseInfo", context)
166
+ // );
167
+ // if (meta?.config && !meta.config.defaultVisual) {
168
+ // const config = {
169
+ // meta,
170
+ // options: {
171
+ // context,
172
+ // pageReference: "caseInfo.content"
173
+ // }
174
+ // };
175
+ // const visualConfig = PCore.createPConnect(config);
176
+ // return React.createElement(createPConnectComponent(), visualConfig);
177
+ // }
178
+ // }
179
+ // return undefined;
180
+ // },
181
+ // [getPConnect, activeCases]
182
+ // );
183
+
184
+ /**
185
+ * Transforms the active cases information into the model that cosmos expect.
186
+ */
187
+ // function getActiveCases() {
188
+ // if (activeCases) {
189
+ // const activeCaseLinks = [];
190
+ // activeCases.forEach((activeCase) => {
191
+ // const { caseID, className, workID, active, context } = activeCase;
192
+ // // activeCaseLinks.push({
193
+ // // onDismiss: () => {
194
+ // // PCore.getContainerUtils().closeContainerItem(
195
+ // // activeCase.containerItemID
196
+ // // );
197
+ // // },
198
+ // // key: caseID,
199
+ // // name: caseID,
200
+ // // onClick: () => {
201
+ // // actionsAPI.openWorkByHandle(workID, className);
202
+ // // },
203
+ // // active,
204
+ // // visual: VisualComponent(context)
205
+ // // });
206
+ // });
207
+ // return activeCaseLinks;
208
+ // }
209
+ // return activeCases;
210
+ // }
211
+
212
+ /**
213
+ * Translate Pega Data Page into the model that Cosmos expects
214
+ *
215
+ * Example:
216
+ * pxPageViewIcon: "pi pi-home-solid"
217
+ * pxURLPath: "Home"
218
+ * pyClassName: "Data-Portal"
219
+ * pyLabel: "Home"
220
+ * pyRuleName: "pyHome"
221
+ */
222
+ // const links = !pages
223
+ // ? []
224
+ // : pages.map((page) => {
225
+ // return {
226
+ // name: page.pyLabel,
227
+ // icon: page.pxPageViewIcon.replace("pi pi-", ""),
228
+ // onClick: () => showPage(page.pyRuleName, page.pyClassName)
229
+ // };
230
+ // });
231
+
232
+ // const userName = envInfo.getOperatorName();
233
+ // const imageKey = envInfo.getOperatorImageInsKey();
234
+
235
+ // const logOffAction = () => {
236
+ // actionsAPI.logout().then(() => window?.top?.location?.reload());
237
+ // };
238
+
239
+ // const getOperator = () => {
240
+ // const operatorActions = [
241
+ // [{ text: "Logoff", id: "1", onClick: logOffAction }]
242
+ // ];
243
+ // if (imageKey) {
244
+ // return {
245
+ // avatar: (
246
+ // <div id="AvatarWithImageKey">Avatar with image key</div>
247
+ // // <Avatar
248
+ // // name={userName}
249
+ // // imageSrc={getPConnect().getImagePath(imageKey)}
250
+ // // />
251
+ // ),
252
+ // actions: operatorActions,
253
+ // name: userName
254
+ // };
255
+ // }
256
+ // return {
257
+ // avatar: (
258
+ // <div id="Avatar">Avatar</div>
259
+ // // <Avatar name={userName}>
260
+ // // {userName
261
+ // // .split(" ")
262
+ // // .map((i) => i.charAt(0))
263
+ // // .join("")
264
+ // // .toUpperCase()}
265
+ // // </Avatar>
266
+ // ),
267
+ // actions: operatorActions,
268
+ // name: userName
269
+ // };
270
+ // };
271
+
272
+ /**
273
+ * Translate Case Types page into what is expected by Cosmos
274
+ *
275
+ * Example:
276
+ * pyClassName: ""
277
+ * pyFlowType: ""
278
+ * pyLabel: "No case types defined"
279
+ */
280
+ // const cases = !caseTypes
281
+ // ? []
282
+ // : caseTypes.map((caseType) => {
283
+ // let action = {};
284
+ // // Only add actions to entries with a class name to create so in case of empty message no action is added
285
+ // if (caseType.pyClassName) {
286
+ // action = { onClick: () => createWork(caseType.pyClassName) };
287
+ // }
288
+ // return {
289
+ // name: caseType.pyLabel,
290
+ // ...action
291
+ // };
292
+ // });
293
+
294
+ // const [recents, setRecents] = useState([]);
295
+
296
+ // const [searchVal, setSearchVal] = useState("");
297
+
298
+ // // default the icon to be empty. This will cause the image to be initially broken.
299
+ // const [iconURL, setIconURL] = useState("");
300
+ // useEffect(() => {
301
+ // // using the default icon then fetch it from the static folder (not auth involved)
302
+ // if (
303
+ // !portalLogo ||
304
+ // portalLogo.toLowerCase().includes("pzpega-logo-mark") ||
305
+ // portalLogo.toLowerCase().includes("py-logo")
306
+ // ) {
307
+ // setIconURL(
308
+ // `${PCore.getAssetLoader().getStaticServerUrl()}static/py-logo.svg`
309
+ // );
310
+ // }
311
+ // // not using default icon to fetch it using the way which uses authentication
312
+ // else {
313
+ // PCore.getAssetLoader()
314
+ // .getSvcImage(portalLogo)
315
+ // .then((data) => {
316
+ // setIconURL(window.URL.createObjectURL(data));
317
+ // })
318
+ // .catch(() => {
319
+ // console.error(
320
+ // `Unable to load the image for the portal logo/icon with the insName:${portalLogo}`
321
+ // );
322
+ // });
323
+ // }
324
+ // }, [portalLogo]);
325
+
326
+ /**
327
+ * To fetch recents and translate items into what Cosmos expects
328
+ */
329
+ // const fetchRecents = () => {
330
+ // actionsAPI.getRecents(15).then((response) => {
331
+ // const recentsitems = response.data.recents;
332
+ // // setRecents(buildRecentList(recentsitems));
333
+ // });
334
+ // };
335
+
336
+ /**
337
+ * To handle on click of any recent item after the drawer is open
338
+ *
339
+ * @param {*} id : Recent item unique id
340
+ */
341
+
342
+ // const onItemClick = (id, e) => {
343
+ // e.preventDefault();
344
+ // // onRecentClickHandler(id, actionsAPI);
345
+ // };
346
+
347
+ // useState for appName and mapChildren - note these are ONLY updated once (on component mount!)
348
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
349
+ const [appName, setAppName] = useState("");
350
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
351
+ const [mapChildren, setMapChildren] = useState([]);
352
+
353
+ // Initial setting of appName and mapChildren
354
+ useEffect( () => {
355
+ setAppName(PCore.getEnvironmentInfo().getApplicationName());
356
+
357
+ const tempMap = pConn.getChildren().map((child, index) => {
358
+ const theChildComp = child.getPConnect().getComponentName();
359
+ const theKey = `.${index}`;
360
+ return <div id={theChildComp} key={theKey} style={{border: "solid 1px silver", margin: "1px"}}>{theChildComp} will be here</div>
361
+ });
362
+
363
+ setMapChildren(tempMap)
364
+
365
+ }, []);
366
+
367
+ if (pConn.hasChildren()) {
368
+ // const theChildren = pConn.getChildren();
369
+ // const mapChildCompNames = theChildren.map((child) => { return child.getPConnect().getComponentName()});
370
+
371
+ // debugging/investigation help
372
+ // console.log(`AppShell has children: ${theChildren.length}`);
373
+ // console.log(`--> ${mapChildCompNames.map((name) => {return name;})}`);
374
+ }
375
+
376
+ return (
377
+
378
+ <NavContext.Provider value={{open, setOpen}}>
379
+ <div id="AppShell" className={classes.root}>
380
+ <NavBar pConn={getPConnect()} appName={appNameToDisplay} pages={pages} caseTypes={caseTypes}></NavBar>
381
+ <div className={classes.content}>
382
+ {children}
383
+ </div>
384
+ </div>
385
+ </NavContext.Provider>
386
+
387
+ // <Toaster dismissAfter={3000}>
388
+ // <CosmosAppShell
389
+ // {...{
390
+ // appInfo: {
391
+ // imageSrc: `${iconURL}`,
392
+ // appName: `${appNameToDisplay}`,
393
+ // portalName
394
+ // },
395
+ // recents: {
396
+ // items: recents,
397
+ // onDrawerOpen: fetchRecents,
398
+ // onItemClick
399
+ // },
400
+ // searchInput: {
401
+ // onSearchChange: (value) => {
402
+ // setSearchVal(value);
403
+ // },
404
+ // onSearchSubmit: (value) => {
405
+ // showSearchResults(value.trim());
406
+ // setSearchVal("");
407
+ // },
408
+ // value: searchVal
409
+ // },
410
+ // caseTypes: cases,
411
+ // links,
412
+ // cases: getActiveCases(),
413
+ // operator: getOperator()
414
+ // }}
415
+ // main={[children]}
416
+ // banners={banners}
417
+ // className="app-shell"
418
+ // />
419
+ // </Toaster>
420
+ );
421
+ }
422
+ AppShell.defaultProps = {
423
+ pages: [],
424
+ caseTypes: [],
425
+ children: [],
426
+ // httpMessages: [],
427
+ // activeCases: null
428
+ };
429
+ AppShell.propTypes = {
430
+ // portalName: PropTypes.string/* .isRequired */,
431
+ // portalLogo: PropTypes.string/* .isRequired */,
432
+ showAppName: PropTypes.bool/* .isRequired */,
433
+ pages: PropTypes.arrayOf(PropTypes.object),
434
+ caseTypes: PropTypes.arrayOf(PropTypes.object),
435
+ children: PropTypes.arrayOf(PropTypes.node),
436
+ getPConnect: PropTypes.func.isRequired,
437
+ // httpMessages: PropTypes.arrayOf(PropTypes.string),
438
+ // activeCases: PropTypes.arrayOf(PropTypes.object)
439
+ };
@@ -0,0 +1 @@
1
+ export { default } from './AppShell';
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ import CaseSummaryFields from '@pega/react-sdk-components/lib/components/designSystemExtensions/CaseSummaryFields';
5
+
6
+ export default function CaseSummary(props) {
7
+ const { getPConnect, children } = props;
8
+ const thePConn = getPConnect();
9
+ const theConfigProps = thePConn.getConfigProps();
10
+ const { status, showStatus } = theConfigProps;
11
+
12
+ // from Nebula
13
+ // get the primary and secondary fields with the raw data (which has the non-resolved property values)
14
+ // const regionsRaw = getPConnect().getRawMetadata().children;
15
+ // const primaryFieldsRaw = regionsRaw[0].children;
16
+ // const secondaryFieldsRaw = regionsRaw[1].children;
17
+
18
+ // From other SDKs
19
+ // may want to move these into useEffect/useState combo
20
+ let arPrimaryFields:Array<any> = [];
21
+ let arSecondaryFields:Array<any> = [];
22
+
23
+ for (const child of children) {
24
+ const childPConn = child.props.getPConnect();
25
+ const childPConnData = childPConn.resolveConfigProps(childPConn.getRawMetadata());
26
+ if (childPConnData.name.toLowerCase() === "primary fields") {
27
+ arPrimaryFields = childPConnData.children;
28
+ } else if (childPConnData.name.toLowerCase() === "secondary fields") {
29
+ arSecondaryFields = childPConnData.children;
30
+ }
31
+ }
32
+
33
+ // At this point, should hand off to another component for layout and rendering
34
+ // of primary and secondary fields in the Case Summary
35
+
36
+ // debugging/investigation help
37
+ // console.log(`CaseSummary: arPrimaryFields: ${JSON.stringify(arPrimaryFields)}`);
38
+ // console.log(`CaseSummary: arSecondaryFields: ${JSON.stringify(arSecondaryFields)}`);
39
+
40
+ return (
41
+ <div id="CaseSummary">
42
+ <CaseSummaryFields status={status} showStatus={showStatus} theFields={arPrimaryFields} />
43
+ <CaseSummaryFields theFields={arSecondaryFields} />
44
+ </div>
45
+ )
46
+ }
47
+
48
+ CaseSummary.propTypes = {
49
+ getPConnect: PropTypes.func.isRequired
50
+ };
@@ -0,0 +1 @@
1
+ export { default } from './CaseSummary';