@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
@@ -11,7 +11,9 @@ import { Button } from '@material-ui/core';
11
11
  import { validateMaxSize } from '@pega/react-sdk-components/lib/components/helpers/attachmentHelpers';
12
12
  import { CircularProgress } from "@material-ui/core";
13
13
 
14
- declare const PCore;
14
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 5 errors)
15
+ declare const PCore: any;
16
+
15
17
 
16
18
  export default function FileUtility(props) {
17
19
  const { getPConnect } = props;
@@ -22,8 +24,8 @@ export default function FileUtility(props) {
22
24
  count: 0
23
25
  };
24
26
  const [list, setList] = useState(listTemp);
25
- const headerSvgIcon$ = Utils.getImageSrc('paper-clip', PCore.getAssetLoader().getStaticServerUrl());
26
- const closeSvgIcon = Utils.getImageSrc("times", PCore.getAssetLoader().getStaticServerUrl());
27
+ const headerSvgIcon$ = Utils.getImageSrc('paper-clip', Utils.getSDKStaticConentUrl());
28
+ const closeSvgIcon = Utils.getImageSrc("times", Utils.getSDKStaticConentUrl());
27
29
  const configProps: any = thePConn.resolveConfigProps(thePConn.getConfigProps());
28
30
 
29
31
  const header = configProps.label;
@@ -31,16 +33,16 @@ export default function FileUtility(props) {
31
33
  showfileModal: false,
32
34
  fileList: [],
33
35
  attachedFiles: [],
34
- fileMainButtons: [{ actionID: "attach", jsAction: "attachFiles", name: "Attach files"}],
35
- fileSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: "Cancel"}]
36
+ fileMainButtons: [{ actionID: "attach", jsAction: "attachFiles", name: thePConn.getLocalizedValue('Attach files')}],
37
+ fileSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: thePConn.getLocalizedValue('Cancel')}]
36
38
  };
37
39
  const [fileData, setFileData] = useState(fileTemp);
38
40
  const linkTemp = {
39
41
  showLinkModal: false,
40
42
  linksList: [],
41
43
  attachedLinks: [],
42
- linkMainButtons: [{ actionID: "attach", jsAction: "attachLinks", name: "Attach links"}],
43
- linkSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: "Cancel"}]
44
+ linkMainButtons: [{ actionID: "attach", jsAction: "attachLinks", name: thePConn.getLocalizedValue('Attach links')}],
45
+ linkSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: thePConn.getLocalizedValue('Cancel')}]
44
46
  };
45
47
  const [linkData, setLinkData] = useState(linkTemp);
46
48
  const [anchorEl, setAnchorEl] = useState(null);
@@ -75,12 +77,11 @@ export default function FileUtility(props) {
75
77
  }) {
76
78
  let actions;
77
79
 
78
-
79
80
  if (att.progress && att.progress !== 100) {
80
81
  actions = [
81
82
  {
82
83
  id: `Cancel-${att.ID}`,
83
- text: "Cancel",
84
+ text: thePConn.getLocalizedValue('Cancel'),
84
85
  icon: "times",
85
86
  onClick: cancelFile
86
87
  }
@@ -93,7 +94,7 @@ export default function FileUtility(props) {
93
94
  "download",
94
95
  {
95
96
  id: `download-${ID}`,
96
- text: isFile ? "Download" : "Open",
97
+ text: isFile ? thePConn.getLocalizedValue('Download') : thePConn.getLocalizedValue('Open'),
97
98
  icon: isFile ? "download" : "open",
98
99
  onClick: downloadFile
99
100
  }
@@ -102,7 +103,7 @@ export default function FileUtility(props) {
102
103
  "delete",
103
104
  {
104
105
  id: `Delete-${ID}`,
105
- text: "Delete",
106
+ text: thePConn.getLocalizedValue('Delete'),
106
107
  icon: "trash",
107
108
  onClick: deleteFile
108
109
  }
@@ -118,7 +119,7 @@ export default function FileUtility(props) {
118
119
  actions = [
119
120
  {
120
121
  id: `Remove-${att.ID}`,
121
- text: "Remove",
122
+ text: thePConn.getLocalizedValue('Remove'),
122
123
  icon: "trash",
123
124
  onClick: removeFile
124
125
  }
@@ -492,8 +493,8 @@ export default function FileUtility(props) {
492
493
  open={Boolean(anchorEl)}
493
494
  onClose={handleClose}
494
495
  >
495
- <MenuItem style={{fontSize: '14px'}} onClick={onAddFilesClick}>Add Files</MenuItem>
496
- <MenuItem style={{fontSize: '14px'}} onClick={onAddLinksClick}>Add Links</MenuItem>
496
+ <MenuItem style={{fontSize: '14px'}} onClick={onAddFilesClick}>{thePConn.getLocalizedValue('Add files')}</MenuItem>
497
+ <MenuItem style={{fontSize: '14px'}} onClick={onAddLinksClick}>{thePConn.getLocalizedValue('Add links')}</MenuItem>
497
498
  </Menu>
498
499
  </div>
499
500
  </div>
@@ -506,12 +507,12 @@ export default function FileUtility(props) {
506
507
  {fileData.showfileModal && (
507
508
  <div className="psdk-dialog-background">
508
509
  <div className="psdk-modal-file-top">
509
- <h3>Add local files</h3>
510
+ <h3>{thePConn.getLocalizedValue('Add local files')}</h3>
510
511
  <div className="psdk-modal-body">
511
512
  <div className="psdk-modal-file-selector">
512
513
  <label htmlFor='upload-files'>
513
514
  <input style={{ display: 'none' }} id='upload-files' name='upload-files' type='file' multiple onChange={uploadMyFiles}/>
514
- <Button variant='outlined' color='primary' component="span">Upload file(s)</Button>
515
+ <Button variant='outlined' color='primary' component="span">{thePConn.getLocalizedValue('Attach files')}</Button>
515
516
  </label>
516
517
  </div>
517
518
  {fileData.fileList.length > 0 && (<div style={{marginTop: '1rem'}}>
@@ -527,7 +528,7 @@ export default function FileUtility(props) {
527
528
  {linkData.showLinkModal && (
528
529
  <div className="psdk-dialog-background">
529
530
  <div className="psdk-modal-file-top">
530
- <h3>Add links</h3>
531
+ <h3>{thePConn.getLocalizedValue('Add links')}</h3>
531
532
  <div className="psdk-modal-body">
532
533
  <div className="psdk-modal-links-row">
533
534
  <div className="psdk-links-two-column">
@@ -539,7 +540,7 @@ export default function FileUtility(props) {
539
540
  </div>
540
541
  </div>
541
542
  <div className="psdk-modal-link-add">
542
- <Button className="psdk-add-link-action" color="primary" variant="contained" component="span" onClick={addLink} disabled={link.disable}>Add Link</Button>
543
+ <Button className="psdk-add-link-action" color="primary" variant="contained" component="span" onClick={addLink} disabled={link.disable}>{thePConn.getLocalizedValue('Add link')}</Button>
543
544
  </div>
544
545
  </div>
545
546
  {linkData.linksList.length > 0 && (<div style={{marginTop: '1rem'}}>
@@ -554,7 +555,7 @@ export default function FileUtility(props) {
554
555
  {showViewAllModal && (<div className="psdk-dialog-background">
555
556
  <div className="psdk-modal-file-top">
556
557
  <div className="psdk-view-all-header">
557
- <h3>Attachments</h3>
558
+ <h3>{thePConn.getLocalizedValue('Attachments')}</h3>
558
559
  {/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
559
560
  <button type="button" className="psdk-close-button" onClick = {() => setViewAll(false)}><img className="psdk-utility-card-actions-svg-icon" src={closeSvgIcon}></img></button>
560
561
  </div>
@@ -2,7 +2,10 @@ import React from "react";
2
2
  import WssQuickCreate from '@pega/react-sdk-components/lib/components/designSystemExtension/WssQuickCreate';
3
3
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
4
4
 
5
- declare const PCore: any;
5
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
6
+
7
+ declare const PCore: typeof PCoreType;
8
+
6
9
 
7
10
  export default function QuickCreate(props) {
8
11
  const { getPConnect, heading, showCaseIcons, classFilter } = props;
@@ -26,11 +29,11 @@ export default function QuickCreate(props) {
26
29
  envInfo.environmentInfoObject.pyCaseTypeList.length > 0
27
30
  ) {
28
31
  classFilter.forEach((item) => {
29
- let icon = Utils.getImageSrc('polaris-solid', PCore.getAssetLoader().getStaticServerUrl());
32
+ let icon = Utils.getImageSrc('polaris-solid', Utils.getSDKStaticConentUrl());
30
33
  let label = '';
31
34
  envInfo.environmentInfoObject.pyCaseTypeList.forEach((casetype) => {
32
35
  if (casetype.pyWorkTypeImplementationClassName === item) {
33
- icon = casetype.pxIcon && Utils.getImageSrc(casetype?.pxIcon, PCore.getAssetLoader().getStaticServerUrl());
36
+ icon = casetype.pxIcon && Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl());
34
37
  label = casetype.pyWorkTypeName ?? '';
35
38
  }
36
39
  });
@@ -4,19 +4,17 @@ import './SummaryItem.css'
4
4
  import { IconButton, Menu, MenuItem } from '@material-ui/core';
5
5
  import MoreVertIcon from '@material-ui/icons/MoreVert';
6
6
 
7
- declare const PCore: any;
8
-
9
7
  export default function SummaryItem(props) {
10
8
  let imagePath$ = "";
11
9
  let menuIconOverride$;
12
10
  menuIconOverride$ = props.menuIconOverride$
13
- imagePath$ = Utils.getIconPath(PCore.getAssetLoader().getStaticServerUrl());
11
+ imagePath$ = Utils.getIconPath(Utils.getSDKStaticConentUrl());
14
12
  const item = props.arItems$;
15
13
  const srcImg = `${imagePath$}${item.visual.icon}.svg`
16
14
  const [anchorEl, setAnchorEl] = useState(null);
17
15
  const open = Boolean(anchorEl);
18
16
  if (menuIconOverride$) {
19
- menuIconOverride$ = Utils.getImageSrc(menuIconOverride$ , PCore.getAssetLoader().getStaticServerUrl());
17
+ menuIconOverride$ = Utils.getImageSrc(menuIconOverride$ , Utils.getSDKStaticConentUrl());
20
18
  }
21
19
 
22
20
  function removeAttachment() {
@@ -26,9 +26,11 @@ import { makeStyles } from '@material-ui/core/styles';
26
26
  import { useTheme } from '@material-ui/core/styles';
27
27
  import useMediaQuery from '@material-ui/core/useMediaQuery';
28
28
 
29
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
30
+
29
31
  import './ToDo.css';
30
32
 
31
- declare const PCore: any;
33
+ declare const PCore: typeof PCoreType;
32
34
 
33
35
  const isChildCase = assignment => {
34
36
  return assignment.isChild;
@@ -90,6 +92,10 @@ export default function ToDo(props) {
90
92
  const classes = useStyles();
91
93
  const theme = useTheme();
92
94
  const isDesktop = useMediaQuery(theme.breakpoints.up('md'));
95
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
96
+ const localeCategory = 'Todo';
97
+ const showlessLocalizedValue = localizedVal('show_less', 'CosmosFields');
98
+ const showMoreLocalizedValue = localizedVal('show_more', 'CosmosFields');
93
99
  // const { setOpen } = useNavBar();
94
100
 
95
101
  function initAssignments(): Array<any> {
@@ -191,20 +197,20 @@ export default function ToDo(props) {
191
197
  if (isDesktop) {
192
198
  return (
193
199
  <>
194
- Task in
200
+ {localizedVal('Task in', localeCategory)}
195
201
  {renderTaskId(type, getPConnect, showTodoList, assignment)}
196
202
  {type === CONSTS.WORKLIST && assignment.status ? `\u2022 ` : undefined}
197
203
  {type === CONSTS.WORKLIST && assignment.status ? (
198
204
  <span className='psdk-todo-assignment-status'>{assignment.status}</span>
199
205
  ) : undefined}
200
- {` \u2022 Urgency ${getPriority(assignment)}`}
206
+ {` \u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`}
201
207
  </>
202
208
  );
203
209
  }
204
210
  return (
205
211
  <>
206
212
  <Button size='small' color='primary'>{`${assignment.name} ${getID(assignment)}`}</Button>
207
- {` \u2022 Urgency ${getPriority(assignment)}`}
213
+ {` \u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`}
208
214
  </>
209
215
  );
210
216
  };
@@ -223,18 +229,18 @@ export default function ToDo(props) {
223
229
  <List>
224
230
  {assignments.map(assignment => (
225
231
  <>
226
- <div className='psdk-todo-avatar-header'>
232
+ <div className='psdk-todo-avatar-header' key={getAssignmentId(assignment)}>
227
233
  <Avatar className={classes.avatar} style={{ marginRight: '16px' }}>
228
234
  {currentUserInitials}
229
235
  </Avatar>
230
236
  <div style={{ display: 'block' }}>
231
237
  <Typography variant='h6'>{assignment?.name}</Typography>
232
- {`Task in ${renderTaskId(
238
+ {`${localizedVal('Task in', localeCategory)} ${renderTaskId(
233
239
  type,
234
240
  getPConnect,
235
241
  showTodoList,
236
242
  assignment
237
- )} \u2022 Urgency ${getPriority(assignment)}`}
243
+ )} \u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`}
238
244
  </div>
239
245
  {!isConfirm && (
240
246
  <div style={{ marginLeft: 'auto' }}>
@@ -298,10 +304,12 @@ export default function ToDo(props) {
298
304
  <Box display='flex' justifyContent='center'>
299
305
  {bShowMore ? (
300
306
  <Button color='primary' onClick={_showMore}>
301
- Show more
307
+ {showMoreLocalizedValue === 'show_more' ? 'Show more': showMoreLocalizedValue}
302
308
  </Button>
303
309
  ) : (
304
- <Button onClick={_showLess}>Show less</Button>
310
+ <Button onClick={_showLess}>
311
+ {showlessLocalizedValue === 'show_less' ? 'Show less': showlessLocalizedValue}
312
+ </Button>
305
313
  )}
306
314
  </Box>
307
315
  )}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "8.23.10",
3
+ "version": "8.23.11-debug",
4
4
  "description": "React SDK - Code for overriding components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [
@@ -1,14 +0,0 @@
1
- export function getLocale(locale) {
2
- // use locale if specified
3
- if (locale) return locale;
4
- // otherwise, use operator locale if it's defined
5
- if (window.PCore.getEnvironmentInfo().getUseLocale()) return window.PCore.getEnvironmentInfo().getUseLocale();
6
- // fallback
7
- return Intl.DateTimeFormat().resolvedOptions().locale;
8
- }
9
-
10
- export function getCurrentTimezone(timezone) {
11
- if (timezone) return timezone;
12
- // eslint-disable-next-line no-undef
13
- return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
14
- }
File without changes
File without changes