@pega/react-sdk-overrides 8.23.10 → 8.23.11-debug

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 (84) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +43 -0
  2. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  3. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +1 -3
  4. package/lib/designSystemExtension/Operator/Operator.tsx +16 -11
  5. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +2 -2
  6. package/lib/field/CancelAlert/CancelAlert.tsx +12 -8
  7. package/lib/field/Checkbox/Checkbox.tsx +3 -2
  8. package/lib/field/Currency/currency-utils.ts +4 -1
  9. package/lib/field/Date/Date.tsx +12 -5
  10. package/lib/field/DateTime/DateTime.tsx +1 -1
  11. package/lib/field/Decimal/Decimal.tsx +66 -14
  12. package/lib/field/Dropdown/Dropdown.tsx +49 -10
  13. package/lib/field/Phone/Phone.tsx +2 -1
  14. package/lib/field/RadioButtons/RadioButtons.tsx +43 -4
  15. package/lib/field/SemanticLink/utils.ts +2 -1
  16. package/lib/field/TextInput/TextInput.tsx +26 -6
  17. package/lib/field/Time/Time.tsx +9 -1
  18. package/lib/field/URL/URL.tsx +8 -0
  19. package/lib/field/UserReference/UserReference.tsx +2 -0
  20. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +2 -2
  21. package/lib/helpers/auth.js +10 -3
  22. package/lib/helpers/authManager.js +16 -13
  23. package/lib/helpers/case-utils.tsx +104 -0
  24. package/lib/helpers/common-utils.ts +4 -0
  25. package/lib/helpers/config_access.js +122 -131
  26. package/lib/helpers/data_page.ts +2 -1
  27. package/lib/helpers/date-format-utils.ts +28 -18
  28. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
  29. package/lib/helpers/formatters/{Currency.js → Currency.ts} +4 -3
  30. package/lib/helpers/formatters/{Date.js → Date.ts} +1 -1
  31. package/lib/helpers/formatters/common.ts +18 -0
  32. package/lib/helpers/simpleTableHelpers.ts +6 -2
  33. package/lib/helpers/state-utils.tsx +50 -0
  34. package/lib/helpers/template-utils.ts +3 -1
  35. package/lib/helpers/utils.ts +12 -4
  36. package/lib/helpers/versionHelpers.ts +3 -1
  37. package/lib/infra/ActionButtons/ActionButtons.tsx +7 -2
  38. package/lib/infra/Assignment/Assignment.tsx +23 -10
  39. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +24 -11
  40. package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +21 -16
  41. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +28 -9
  42. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +7 -5
  43. package/lib/infra/DashboardFilter/DashboardFilter.tsx +5 -1
  44. package/lib/infra/DashboardFilter/filterUtils.tsx +2 -0
  45. package/lib/infra/DeferLoad/DeferLoad.tsx +4 -1
  46. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +10 -5
  47. package/lib/infra/MultiStep/MultiStep.tsx +2 -2
  48. package/lib/infra/NavBar/NavBar.tsx +11 -5
  49. package/lib/infra/RootContainer/RootContainer.tsx +16 -14
  50. package/lib/infra/Stages/Stages.tsx +5 -1
  51. package/lib/infra/View/View.tsx +7 -34
  52. package/lib/template/AppShell/AppShell.tsx +15 -9
  53. package/lib/template/CaseView/CaseView.tsx +116 -78
  54. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +26 -17
  55. package/lib/template/Confirmation/Confirmation.tsx +4 -1
  56. package/lib/template/DataReference/DataReference.tsx +2 -0
  57. package/lib/template/DefaultForm/DefaultForm.tsx +15 -8
  58. package/lib/template/DefaultForm/utils/index.ts +33 -0
  59. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +5 -2
  60. package/lib/template/ListView/ListView.tsx +3 -1
  61. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  62. package/lib/template/ListView/{utils.js → utils.ts} +12 -10
  63. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +5 -1
  64. package/lib/template/PromotedFilters/PromotedFilters.tsx +9 -5
  65. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +4 -1
  66. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +8 -4
  67. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +6 -1
  68. package/lib/template/SubTabs/tabUtils.ts +3 -1
  69. package/lib/template/WssNavBar/WssNavBar.tsx +2 -2
  70. package/lib/widget/Attachment/Attachment.css +15 -3
  71. package/lib/widget/Attachment/Attachment.tsx +32 -25
  72. package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
  73. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +20 -19
  74. package/lib/widget/QuickCreate/QuickCreate.tsx +6 -3
  75. package/lib/widget/SummaryItem/SummaryItem.tsx +2 -4
  76. package/lib/widget/ToDo/ToDo.tsx +17 -9
  77. package/package.json +1 -1
  78. package/lib/helpers/formatters/common.js +0 -14
  79. /package/lib/helpers/{event-utils.js → event-utils.ts} +0 -0
  80. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  81. /package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +0 -0
  82. /package/lib/helpers/formatters/{index.js → index.ts} +0 -0
  83. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  84. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -2,6 +2,7 @@ import dayjs from 'dayjs';
2
2
  import customParseFormat from 'dayjs/plugin/customParseFormat';
3
3
  import localizedFormat from 'dayjs/plugin/localizedFormat';
4
4
  import relativeTime from 'dayjs/plugin/relativeTime';
5
+ import { SdkConfigAccess } from './config_access';
5
6
 
6
7
  dayjs.extend(customParseFormat);
7
8
  dayjs.extend(localizedFormat);
@@ -10,6 +11,17 @@ dayjs.extend(relativeTime);
10
11
  export class Utils {
11
12
  static lastControlID: number = 0;
12
13
 
14
+ static getSDKStaticConentUrl() {
15
+ const sdkConfigServer = SdkConfigAccess.getSdkConfigServer();
16
+
17
+ // NOTE: Needs a trailing slash! So add one if not provided
18
+ if (!sdkConfigServer.sdkContentServerUrl.endsWith('/')) {
19
+ sdkConfigServer.sdkContentServerUrl = `${sdkConfigServer.sdkContentServerUrl}/`;
20
+ }
21
+
22
+ return `${sdkConfigServer.sdkContentServerUrl}constellation/`;
23
+ }
24
+
13
25
  static getUniqueControlID(): string {
14
26
  const sPrefix = 'control-';
15
27
 
@@ -322,10 +334,6 @@ export class Utils {
322
334
  return text.charAt(text.length - 1);
323
335
  }
324
336
 
325
- static isEmptyObject(obj: Object): Boolean {
326
- return Object.keys(obj).length === 0;
327
- }
328
-
329
337
  static isObject(objValue) {
330
338
  return objValue && typeof objValue === 'object' && objValue.constructor === Object;
331
339
  }
@@ -4,8 +4,10 @@
4
4
  * Container helper functions that can identify which version of
5
5
  * PCore/PConnect is being run
6
6
  */
7
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
8
+
9
+ declare const PCore: typeof PCoreType;
7
10
 
8
- declare const PCore;
9
11
 
10
12
  export const sdkVersion = "8.7";
11
13
 
@@ -5,6 +5,9 @@ import { makeStyles } from '@material-ui/core/styles';
5
5
  import Button from '@material-ui/core/Button';
6
6
  import { Grid, Divider } from "@material-ui/core";
7
7
 
8
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
9
+
10
+ declare const PCore: typeof PCoreType;
8
11
 
9
12
 
10
13
  const useStyles = makeStyles((/* theme */) => ({
@@ -21,6 +24,8 @@ const useStyles = makeStyles((/* theme */) => ({
21
24
  export default function ActionButtons(props) {
22
25
  const { arMainButtons, arSecondaryButtons, onButtonPress } = props;
23
26
  const classes = useStyles();
27
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
28
+ const localeCategory = 'Assignment';
24
29
 
25
30
  function _onButtonPress(sAction: string, sButtonType: string) {
26
31
 
@@ -35,7 +40,7 @@ export default function ActionButtons(props) {
35
40
  <Grid container spacing={1}>
36
41
  {arSecondaryButtons.map((sButton) => (
37
42
  <Grid item key={sButton.name}>
38
- <Button variant="contained" color="secondary" onClick={() => { _onButtonPress(sButton.jsAction, "secondary")}} >{sButton.name}</Button>
43
+ <Button variant="contained" color="secondary" onClick={() => { _onButtonPress(sButton.jsAction, "secondary")}} >{localizedVal(sButton.name, localeCategory)}</Button>
39
44
  </Grid>
40
45
  ))}
41
46
  </Grid>
@@ -44,7 +49,7 @@ export default function ActionButtons(props) {
44
49
  <Grid container spacing={1}>
45
50
  {arMainButtons.map((mButton) => (
46
51
  <Grid item key={mButton.name}>
47
- <Button variant="contained" color="primary" onClick={() => { _onButtonPress(mButton.jsAction, "primary")}} >{mButton.name}</Button>
52
+ <Button variant="contained" color="primary" onClick={() => { _onButtonPress(mButton.jsAction, "primary")}} >{localizedVal(mButton.name, localeCategory)}</Button>
48
53
  </Grid>
49
54
  ))}
50
55
  </Grid>
@@ -7,10 +7,13 @@ import Snackbar from '@material-ui/core/Snackbar';
7
7
  import IconButton from '@material-ui/core/IconButton';
8
8
  import CloseIcon from '@material-ui/icons/Close';
9
9
 
10
- declare const PCore: any;
10
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
11
+
12
+ declare const PCore: typeof PCoreType;
13
+
11
14
 
12
15
  export default function Assignment(props) {
13
- const { getPConnect, children, itemKey, isInModal } = props;
16
+ const { getPConnect, children, itemKey, isInModal, banners } = props;
14
17
  const thePConn = getPConnect();
15
18
 
16
19
  const [bHasNavigation, setHasNavigation] = useState(false);
@@ -20,6 +23,9 @@ export default function Assignment(props) {
20
23
  const [arNavigationSteps, setArNavigationSteps] = useState<Array<any>>([]);
21
24
 
22
25
  const actionsAPI = thePConn.getActionsApi();
26
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
27
+ const localeCategory = 'Assignment';
28
+ const localeReference = `${getPConnect().getCaseInfo().getClassName()}!CASE!${getPConnect().getCaseInfo().getName()}`.toUpperCase();
23
29
 
24
30
  // store off bound functions to above pointers
25
31
  const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
@@ -91,8 +97,13 @@ export default function Assignment(props) {
91
97
  } else {
92
98
  setIsVertical(false);
93
99
  }
94
-
95
- setArNavigationSteps(JSON.parse(JSON.stringify(oCaseInfo.navigation.steps)));
100
+ const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
101
+ steps.forEach(step => {
102
+ if (step.name) {
103
+ step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
104
+ }
105
+ });
106
+ setArNavigationSteps(steps);
96
107
  setArCurrentStepIndicies(
97
108
  findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0)
98
109
  );
@@ -134,7 +145,7 @@ export default function Assignment(props) {
134
145
  navigatePromise
135
146
  .then(() => {})
136
147
  .catch(() => {
137
- showToast(`Navigation failed!`);
148
+ showToast(`${localizedVal('Navigation failed!', localeCategory)}`);
138
149
  });
139
150
 
140
151
  break;
@@ -153,7 +164,7 @@ export default function Assignment(props) {
153
164
  onSaveActionSuccess({ caseType, caseID, assignmentID });
154
165
  })
155
166
  .catch(() => {
156
- showToast('Save failed');
167
+ showToast(`${localizedVal('Save failed', localeCategory)}`);
157
168
  });
158
169
 
159
170
  break;
@@ -176,7 +187,7 @@ export default function Assignment(props) {
176
187
  publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
177
188
  })
178
189
  .catch(() => {
179
- showToast(`Cancel failed!`);
190
+ showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
180
191
  });
181
192
  } else {
182
193
  const cancelPromise = cancelAssignment(itemKey);
@@ -186,7 +197,7 @@ export default function Assignment(props) {
186
197
  publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
187
198
  })
188
199
  .catch(() => {
189
- showToast(`Cancel failed!`);
200
+ showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
190
201
  });
191
202
  }
192
203
  break;
@@ -204,7 +215,7 @@ export default function Assignment(props) {
204
215
  finishPromise
205
216
  .then(() => {})
206
217
  .catch(() => {
207
- showToast(`Submit failed!`);
218
+ showToast(`${localizedVal('Submit failed!', localeCategory)}`);
208
219
  });
209
220
 
210
221
  break;
@@ -218,6 +229,7 @@ export default function Assignment(props) {
218
229
 
219
230
  return (
220
231
  <div id='Assignment'>
232
+ {banners}
221
233
  {bHasNavigation ? (
222
234
  <React.Fragment>
223
235
  <MultiStep
@@ -308,7 +320,8 @@ Assignment.propTypes = {
308
320
  children: PropTypes.node.isRequired,
309
321
  getPConnect: PropTypes.func.isRequired,
310
322
  itemKey: PropTypes.string,
311
- isInModal: PropTypes.bool
323
+ isInModal: PropTypes.bool,
324
+ banners: PropTypes.any
312
325
  // actionButtons: PropTypes.object
313
326
  // buildName: PropTypes.string
314
327
  };
@@ -7,17 +7,20 @@ import { Card, CardHeader, Avatar, Typography } from '@material-ui/core';
7
7
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
8
8
  import { Alert } from '@material-ui/lab';
9
9
 
10
- import Assignment from '@pega/react-sdk-components/lib/components/infra/Assignment';
11
- import ToDo from '@pega/react-sdk-components/lib/components/widget/ToDo';
12
-
13
10
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
14
11
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
15
12
  import DayjsUtils from '@date-io/dayjs';
16
13
  import { MuiPickersUtilsProvider } from '@material-ui/pickers';
17
14
 
18
15
  import { addContainerItem, getToDoAssignments, showBanner } from './helpers';
16
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
17
+ // Need to get correct implementation from component map for Assignment and ToDo
18
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
19
+
20
+
21
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 3 errors)
22
+ declare const PCore: any;
19
23
 
20
- declare const PCore;
21
24
 
22
25
  //
23
26
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -47,13 +50,17 @@ const useStyles = makeStyles(theme => ({
47
50
  }));
48
51
 
49
52
  export default function FlowContainer(props) {
53
+ // Get the proper implementation (local or Pega-provided) for these components that are emitted below
54
+ const Assignment = getComponentFromMap("Assignment");
55
+ const ToDo = getComponentFromMap("Todo"); // NOTE: ConstellationJS Engine uses "Todo" and not "ToDo"!!!
56
+
50
57
  const pCoreConstants = PCore.getConstants();
51
58
  const { TODO } = pCoreConstants;
52
59
  const todo_headerText = 'To do';
53
60
 
54
61
  const { getPConnect, routingInfo } = props;
55
62
 
56
- const { displayOnlyFA } = useContext(StoreContext);
63
+ const { displayOnlyFA } = useContext<any>(StoreContext);
57
64
 
58
65
  const thePConn = getPConnect();
59
66
 
@@ -78,9 +85,14 @@ export default function FlowContainer(props) {
78
85
  const [containerName, setContainerName] = useState('');
79
86
  const [buildName, setBuildName] = useState('');
80
87
  const [bShowConfirm, setShowConfirm] = useState(false);
88
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
89
+ const localeCategory = 'Messages';
90
+ const caseInfo = getPConnect().getCaseInfo();
91
+ const localeReference = `${caseInfo?.getClassName()}!CASE!${caseInfo.getName()}`.toUpperCase();
81
92
 
82
93
  const classes = useStyles();
83
94
 
95
+
84
96
  function initContainer() {
85
97
  const ourPConn = getPConnect();
86
98
  const containerMgr = ourPConn.getContainerManager();
@@ -171,7 +183,7 @@ export default function FlowContainer(props) {
171
183
 
172
184
  if (bLoadChildren && oWorkData) {
173
185
  // debugger;
174
- setContainerName(oWorkData.caseInfo.assignments?.[0].name);
186
+ setContainerName(localizedVal(oWorkData.caseInfo.assignments?.[0].name, undefined, localeReference));
175
187
  }
176
188
 
177
189
  // debugger;
@@ -313,13 +325,13 @@ export default function FlowContainer(props) {
313
325
  }
314
326
 
315
327
  // if have caseMessage show message and end
316
- const theCaseMessages = thePConn.getValue('caseMessages');
328
+ const theCaseMessages = localizedVal(thePConn.getValue('caseMessages'), localeCategory);
317
329
 
318
330
  if (theCaseMessages || !hasAssignments()) {
319
331
  // Temp fix for 8.7 change: confirmationNote no longer coming through in caseMessages$.
320
332
  // So, if we get here and caseMessages$ is empty, use default value in DX API response
321
333
  setCaseMessages(
322
- theCaseMessages || 'Thank you! The next step in this case has been routed appropriately.'
334
+ theCaseMessages || localizedVal('Thank you! The next step in this case has been routed appropriately.', localeCategory)
323
335
  );
324
336
  setHasCaseMessages(true);
325
337
  setShowConfirm(true);
@@ -328,7 +340,7 @@ export default function FlowContainer(props) {
328
340
  PCore.getPubSubUtils().publish('assignmentFinished');
329
341
 
330
342
  // debugger;
331
- setCheckSvg(Utils.getImageSrc('check', PCore.getAssetLoader().getStaticServerUrl()));
343
+ setCheckSvg(Utils.getImageSrc('check', Utils.getSDKStaticConentUrl()));
332
344
  } else {
333
345
  // debugger;
334
346
  setHasCaseMessages(false);
@@ -357,7 +369,7 @@ export default function FlowContainer(props) {
357
369
  currentItems[key] &&
358
370
  currentItems[key].view &&
359
371
  type === 'single' &&
360
- !Utils.isEmptyObject(currentItems[key].view)
372
+ !isEmptyObject(currentItems[key].view)
361
373
  ) {
362
374
  const currentItem = currentItems[key];
363
375
  const rootView = currentItem.view;
@@ -395,7 +407,7 @@ export default function FlowContainer(props) {
395
407
  // check if have oWorkData, there are times due to timing of state change, when this
396
408
  // may not be available
397
409
  if (oWorkData) {
398
- setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name);
410
+ setContainerName(localizedVal(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name, undefined, localeReference));
399
411
  }
400
412
  }
401
413
  }
@@ -450,6 +462,7 @@ export default function FlowContainer(props) {
450
462
  ) : (
451
463
  <div>
452
464
  <ToDo
465
+ key={Math.random()}
453
466
  getPConnect={getPConnect}
454
467
  caseInfoID={todo_caseInfoID}
455
468
  datasource={todo_datasource}
@@ -1,4 +1,7 @@
1
- // From CosmosReact DX Components
1
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
2
+
3
+ declare const PCore: typeof PCoreType;
4
+
2
5
 
3
6
  // Moved PCore.getConstants() into each function in which it's used until we can
4
7
  // make sure that this code isn't run until PCore is defined (after onPCoreReady)
@@ -14,8 +17,8 @@ export const addContainerItem = (pConnect) => {
14
17
 
15
18
  if(caseViewMode !== "review") {
16
19
  const target = contextName.substring(0, contextName.lastIndexOf("_"));
17
- const activeContainerItemID = window.PCore.getContainerUtils().getActiveContainerItemName(target);
18
- const containerItemData = window.PCore.getContainerUtils().getContainerItemData(target, activeContainerItemID);
20
+ const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(target);
21
+ const containerItemData = PCore.getContainerUtils().getContainerItemData(target, activeContainerItemID);
19
22
 
20
23
  if(containerItemData) {
21
24
  ({ key, flowName } = containerItemData);
@@ -35,11 +38,11 @@ export const addContainerItem = (pConnect) => {
35
38
  export const hasContainerItems = (pConnect) => {
36
39
  const contextName = pConnect.getContextName();
37
40
  const containerName = pConnect.getContainerName();
38
- return window.PCore.getContainerUtils().hasContainerItems(`${contextName}/${containerName}`);
41
+ return PCore.getContainerUtils().hasContainerItems(`${contextName}/${containerName}`);
39
42
  }
40
43
 
41
44
  export const getActiveCaseActionName = (pConnect) => {
42
- const { CASE_INFO } = window.PCore.getConstants();
45
+ const { CASE_INFO } = PCore.getConstants();
43
46
  const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
44
47
  const activeActionID = pConnect.getValue(CASE_INFO.ACTIVE_ACTION_ID);
45
48
  const activeAction = caseActions.find(
@@ -49,7 +52,7 @@ export const getActiveCaseActionName = (pConnect) => {
49
52
  };
50
53
 
51
54
  export const getFirstCaseActionName = (pConnect) => {
52
- const { CASE_INFO } = window.PCore.getConstants();
55
+ const { CASE_INFO } = PCore.getConstants();
53
56
  const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
54
57
  return caseActions[0]?.name || "";
55
58
  };
@@ -59,7 +62,7 @@ export const hasNotificationMessages = (pConnect) => {
59
62
  };
60
63
 
61
64
  export const isCaseWideLocalAction = (pConnect) => {
62
- const { CASE_INFO } = window.PCore.getConstants();
65
+ const { CASE_INFO } = PCore.getConstants();
63
66
  const actionID = pConnect.getValue(CASE_INFO.ACTIVE_ACTION_ID);
64
67
  const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
65
68
  if (caseActions && actionID) {
@@ -72,23 +75,25 @@ export const isCaseWideLocalAction = (pConnect) => {
72
75
  };
73
76
 
74
77
  export const getChildCaseAssignments = (pConnect) => {
75
- const { CASE_INFO } = window.PCore.getConstants();
78
+ const { CASE_INFO } = PCore.getConstants();
76
79
  const childCases = pConnect.getValue(CASE_INFO.CHILD_ASSIGNMENTS);
77
80
  let allAssignments = [];
78
81
  if (childCases && childCases.length > 0) {
79
- childCases.forEach(({ assignments = [], Name }) => {
80
- const childCaseAssignments = assignments.map((assignment) => ({
81
- ...assignment,
82
- caseName: Name
83
- }));
84
- allAssignments = allAssignments.concat(childCaseAssignments);
82
+ childCases.forEach(({ assignments, Name }) => {
83
+ if (assignments) {
84
+ const childCaseAssignments = assignments.map((assignment) => ({
85
+ ...assignment,
86
+ caseName: Name
87
+ }));
88
+ allAssignments = allAssignments.concat(childCaseAssignments);
89
+ }
85
90
  });
86
91
  }
87
92
  return allAssignments;
88
93
  };
89
94
 
90
95
  export const hasAssignments = (pConnect) => {
91
- const { CASE_INFO } = window.PCore.getConstants();
96
+ const { CASE_INFO } = PCore.getConstants();
92
97
  const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS);
93
98
  const childCasesAssignments = getChildCaseAssignments(pConnect);
94
99
 
@@ -118,7 +123,7 @@ export const isRenderWithToDoWrapper = (getPConnect, options) => {
118
123
  };
119
124
 
120
125
  export const getToDoAssignments = (pConnect) => {
121
- const { CASE_INFO } = window.PCore.getConstants();
126
+ const { CASE_INFO } = PCore.getConstants();
122
127
  const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
123
128
  const assignmentLabel = pConnect.getValue(CASE_INFO.ASSIGNMENT_LABEL);
124
129
  const assignments =
@@ -6,11 +6,14 @@ import DialogContent from '@material-ui/core/DialogContent';
6
6
  import DialogTitle from '@material-ui/core/DialogTitle';
7
7
  import { makeStyles } from '@material-ui/core/styles';
8
8
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
9
- import Assignment from '@pega/react-sdk-components/lib/components/infra/Assignment';
10
- import CancelAlert from '@pega/react-sdk-components/lib/components/field/CancelAlert';
11
- import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
9
+ // Need to get correct implementation from component map for Assignment and CancelAlert
10
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
11
+ import { getBanners } from '@pega/react-sdk-components/lib/components/helpers/case-utils';
12
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
13
+
14
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 8 errors)
15
+ declare const PCore: any;
12
16
 
13
- declare const PCore;
14
17
 
15
18
  function buildName(pConnect, name = '') {
16
19
  const context = pConnect.getContextName();
@@ -68,10 +71,14 @@ const useStyles = makeStyles(theme => ({
68
71
  }));
69
72
 
70
73
  const ModalViewContainer = props => {
74
+ // Get the proper implementation (local or Pega-provided) for these components that are emitted below
75
+ const Assignment = getComponentFromMap("Assignment");
76
+ const CancelAlert = getComponentFromMap("CancelAlert");
77
+
71
78
  const classes = useStyles();
72
79
 
73
80
  const routingInfoRef = useRef({});
74
- const { getPConnect, routingInfo, loadingInfo } = props;
81
+ const { getPConnect, routingInfo, loadingInfo, pageMessages } = props;
75
82
  const pConn = getPConnect();
76
83
  const {
77
84
  CONTAINER_TYPE: { MULTIPLE },
@@ -88,6 +95,10 @@ const ModalViewContainer = props => {
88
95
  const [itemKey, setItemKey] = useState('');
89
96
  const [cancelPConn, setCancelPConn] = useState(null);
90
97
 
98
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
99
+ const localeCategory = 'Data Object';
100
+
101
+
91
102
  function showAlert(payload) {
92
103
  const { latestItem } = getKeyAndLatestItem(routingInfoRef.current, pConn);
93
104
  const { isModalAction } = payload;
@@ -160,7 +171,7 @@ const ModalViewContainer = props => {
160
171
  if (
161
172
  currentItems[key] &&
162
173
  currentItems[key].view &&
163
- !Utils.isEmptyObject(currentItems[key].view)
174
+ !isEmptyObject(currentItems[key].view)
164
175
  ) {
165
176
  const currentItem = currentItems[key];
166
177
  const rootView = currentItem.view;
@@ -218,7 +229,7 @@ const ModalViewContainer = props => {
218
229
  const caseName = theNewCaseInfo.getName();
219
230
  const ID = theNewCaseInfo.getID();
220
231
 
221
- setTitle(actionName || `New ${caseName} (${ID})`);
232
+ setTitle(actionName || `${localizedVal('New', localeCategory)} ${caseName} (${ID})`);
222
233
 
223
234
  let arChildrenAsReact: Array<any> = [];
224
235
 
@@ -255,7 +266,7 @@ const ModalViewContainer = props => {
255
266
  if (bShowModal) {
256
267
  setShowModal(false);
257
268
  }
258
- if (!Utils.isEmptyObject(oCaseInfo)) {
269
+ if (!isEmptyObject(oCaseInfo)) {
259
270
  setOCaseInfo({});
260
271
  }
261
272
  }
@@ -286,7 +297,15 @@ const ModalViewContainer = props => {
286
297
  </DialogTitle>
287
298
  <DialogContent className={classes.dlgContent}>
288
299
  {bShowModal ? (
289
- <Assignment getPConnect={createdView.getPConnect} itemKey={itemKey} isInModal>
300
+ <Assignment
301
+ getPConnect={createdView.getPConnect}
302
+ itemKey={itemKey}
303
+ isInModal
304
+ banners={getBanners({
305
+ target: itemKey,
306
+ pageMessages
307
+ })}
308
+ >
290
309
  {arNewChildrenAsReact}
291
310
  </Assignment>
292
311
  ) : (
@@ -3,13 +3,15 @@ import PropTypes from "prop-types";
3
3
  import { Box, CircularProgress } from "@material-ui/core";
4
4
  import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
5
5
  import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
6
- import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
6
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
7
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
8
+
9
+ declare const PCore: typeof PCoreType;
10
+
7
11
 
8
12
  // ViewContainer can emit View
9
13
  // import View from '../View';
10
14
 
11
- declare const PCore;
12
-
13
15
  //
14
16
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
15
17
  // Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
@@ -21,7 +23,7 @@ export default function ViewContainer(props) {
21
23
  // const { getPConnect, children, routingInfo, name } = props;
22
24
  const { getPConnect, name, mode, limit, loadingInfo, routingInfo } = props;
23
25
 
24
- const { displayOnlyFA } = useContext(StoreContext);
26
+ const { displayOnlyFA } = useContext<any>(StoreContext);
25
27
 
26
28
 
27
29
  const { CONTAINER_TYPE, APP } = PCore.getConstants();
@@ -157,7 +159,7 @@ export default function ViewContainer(props) {
157
159
  if (
158
160
  items[key] &&
159
161
  items[key].view &&
160
- !Utils.isEmptyObject(items[key].view)
162
+ !isEmptyObject(items[key].view)
161
163
  ) {
162
164
  const latestItem = items[key];
163
165
  const rootView = latestItem.view;
@@ -10,9 +10,13 @@ import { getFilterExpression } from './filterUtils';
10
10
  import { TextField } from '@material-ui/core';
11
11
  import React from 'react';
12
12
  import DatePicker from 'react-datepicker';
13
+
13
14
  import 'react-datepicker/dist/react-datepicker.css';
14
15
 
15
- declare const PCore: any;
16
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
17
+
18
+ declare const PCore: typeof PCoreType;
19
+
16
20
 
17
21
  export default function DashboardFilter(props) {
18
22
  const { children, name, filterProp, type, metadata, getPConnect } = props;
@@ -5,8 +5,10 @@ import { Grid, Link } from '@material-ui/core';
5
5
  import React from 'react';
6
6
  import DashboardFilter from './DashboardFilter';
7
7
 
8
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 5 errors)
8
9
  declare const PCore: any;
9
10
 
11
+
10
12
  export const createFilter = (value, fieldId, comparator = 'EQ') => {
11
13
  return {
12
14
  condition: {
@@ -5,7 +5,10 @@ import { makeStyles } from '@material-ui/core/styles';
5
5
 
6
6
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
7
7
 
8
- declare const PCore;
8
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
9
+
10
+ declare const PCore: typeof PCoreType;
11
+
9
12
 
10
13
  //
11
14
  // WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
@@ -1,10 +1,15 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
- declare const PCore;
4
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
5
+ declare const PCore: any;
6
+
5
7
 
6
8
  function ErrorBoundary(props) {
7
- const ERROR_TEXT = PCore.getErrorHandler().getGenericFailedMessage();
9
+ const errorMsg = PCore.getErrorHandler().getGenericFailedMessage();
10
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
11
+ const localeCategory = 'Messages';
12
+ const ERROR_TEXT = localizedVal(errorMsg, localeCategory);
8
13
  const WORK_AREA = "workarea";
9
14
  const ERROR_WHILE_RENDERING = "ERROR_WHILE_RENDERING";
10
15
  const { getPConnect, isInternalError } = props;
@@ -21,9 +26,9 @@ function ErrorBoundary(props) {
21
26
 
22
27
  if (!isInternalError) {
23
28
  // eslint-disable-next-line no-console
24
- console.error(`Unable to load the component ${pConn.getComponentName()}
25
- This might be due to the view meta data getting corrupted or the component file missing.
26
- Raw meta data for the component: ${JSON.stringify(pConn.getRawMetadata())}`);
29
+ console.error(`${localizedVal('Unable to load the component', localeCategory)} ${pConn.getComponentName()}
30
+ ${localizedVal(`This might be due to the view meta data getting corrupted or the component file missing.
31
+ Raw meta data for the component:`, localeCategory)} ${JSON.stringify(pConn.getRawMetadata())}`);
27
32
  }
28
33
 
29
34
  if (pConn.getConfigProps().type === "page") {
@@ -11,8 +11,8 @@ export default function MultiStep(props) {
11
11
  const { getPConnect, children, itemKey, actionButtons, onButtonPress} = props;
12
12
  const { bIsVertical, arNavigationSteps } = props;
13
13
 
14
- // const svgCurrent = Utils.getImageSrc("circle-solid", PCore.getAssetLoader().getStaticServerUrl());
15
- // const svgNotCurrent = Utils.getImageSrc("circle-solid", PCore.getAssetLoader().getStaticServerUrl());
14
+ // const svgCurrent = Utils.getImageSrc("circle-solid", Utils.getSDKStaticConentUrl());
15
+ // const svgNotCurrent = Utils.getImageSrc("circle-solid", Utils.getSDKStaticConentUrl());
16
16
 
17
17
  function _getVIconClass(status): string {
18
18
  if (status === "current") {
@@ -35,7 +35,10 @@ import useMediaQuery from '@material-ui/core/useMediaQuery';
35
35
  import { useNavBar } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
36
36
  import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
37
37
 
38
- declare const PCore;
38
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
39
+
40
+ declare const PCore: typeof PCoreType;
41
+
39
42
 
40
43
  const iconMap = {
41
44
  'pi pi-headline': <HomeOutlinedIcon fontSize='large' />,
@@ -108,7 +111,10 @@ export default function NavBar(props) {
108
111
  const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false);
109
112
  const [anchorEl, setAnchorEl] = useState(null);
110
113
 
111
- const portalLogoImage = Utils.getIconPath(PCore.getAssetLoader().getStaticServerUrl()).concat(
114
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
115
+ const localeCategory = 'AppShell';
116
+
117
+ const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat(
112
118
  'pzpega-logo-mark.svg'
113
119
  );
114
120
  const portalOperator = PCore.getEnvironmentInfo().getOperatorName();
@@ -126,7 +132,7 @@ export default function NavBar(props) {
126
132
  .showPage(pyRuleName, pyClassName)
127
133
  .then(() => {
128
134
  // eslint-disable-next-line no-console
129
- console.log(`showPage completed`);
135
+ console.log(`${localizedVal('showPage completed', localeCategory)}`);
130
136
  });
131
137
  }
132
138
 
@@ -142,7 +148,7 @@ export default function NavBar(props) {
142
148
  .createWork(sCaseType, actionInfo)
143
149
  .then(() => {
144
150
  // eslint-disable-next-line no-console
145
- console.log(`createWork completed`);
151
+ console.log(`${localizedVal('createWork completed', localeCategory)}`);
146
152
  });
147
153
  }
148
154
 
@@ -278,7 +284,7 @@ export default function NavBar(props) {
278
284
  <ListItemIcon>
279
285
  <ArrowBackIcon fontSize='large' />
280
286
  </ListItemIcon>
281
- <Typography variant='inherit'>Logout</Typography>
287
+ <Typography variant='inherit'>{localizedVal('Logout', localeCategory)}</Typography>
282
288
  </MenuItem>
283
289
  </Menu>
284
290
  </>