@pega/react-sdk-overrides 8.8.21 → 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 (128) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +9 -13
  2. package/lib/designSystemExtension/Banner/Banner.tsx +1 -12
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +10 -15
  4. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -10
  5. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +3 -10
  6. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +3 -11
  7. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +3 -11
  8. package/lib/designSystemExtension/Operator/Operator.tsx +12 -16
  9. package/lib/designSystemExtension/Pulse/Pulse.tsx +7 -11
  10. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -10
  11. package/lib/field/AutoComplete/AutoComplete.tsx +18 -37
  12. package/lib/field/CancelAlert/CancelAlert.tsx +4 -9
  13. package/lib/field/Checkbox/Checkbox.tsx +16 -39
  14. package/lib/field/Currency/Currency.tsx +15 -23
  15. package/lib/field/Currency/currency-utils.ts +5 -1
  16. package/lib/field/Date/Date.tsx +15 -22
  17. package/lib/field/DateTime/DateTime.tsx +14 -25
  18. package/lib/field/Decimal/Decimal.tsx +14 -25
  19. package/lib/field/Dropdown/Dropdown.tsx +26 -30
  20. package/lib/field/Email/Email.tsx +9 -17
  21. package/lib/field/Integer/Integer.tsx +7 -15
  22. package/lib/field/Percentage/Percentage.tsx +7 -15
  23. package/lib/field/Phone/Phone.tsx +11 -19
  24. package/lib/field/RadioButtons/RadioButtons.tsx +37 -25
  25. package/lib/field/SemanticLink/SemanticLink.tsx +25 -26
  26. package/lib/field/TextArea/TextArea.tsx +5 -14
  27. package/lib/field/TextContent/TextContent.tsx +1 -10
  28. package/lib/field/TextInput/TextInput.tsx +6 -15
  29. package/lib/field/Time/Time.tsx +27 -22
  30. package/lib/field/URL/URL.tsx +8 -16
  31. package/lib/field/UserReference/UserReference.tsx +60 -50
  32. package/lib/helpers/attachmentHelpers.ts +4 -4
  33. package/lib/helpers/auth.js +397 -741
  34. package/lib/helpers/authManager.js +634 -0
  35. package/lib/helpers/case-utils.tsx +9 -8
  36. package/lib/helpers/common-utils.ts +1 -1
  37. package/lib/helpers/config_access.js +73 -0
  38. package/lib/helpers/date-format-utils.ts +1 -1
  39. package/lib/helpers/event-utils.ts +1 -1
  40. package/lib/helpers/formatters/Currency.ts +11 -11
  41. package/lib/helpers/formatters/CurrencyMap.ts +5 -8
  42. package/lib/helpers/formatters/Date.ts +1 -1
  43. package/lib/helpers/formatters/common.ts +6 -2
  44. package/lib/helpers/formatters/index.ts +3 -3
  45. package/lib/helpers/simpleTableHelpers.ts +7 -7
  46. package/lib/helpers/state-utils.tsx +3 -0
  47. package/lib/helpers/template-utils.ts +6 -3
  48. package/lib/helpers/versionHelpers.ts +3 -0
  49. package/lib/infra/ActionButtons/ActionButtons.tsx +19 -9
  50. package/lib/infra/Assignment/Assignment.tsx +28 -21
  51. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -15
  52. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +58 -57
  53. package/lib/infra/Containers/FlowContainer/helpers.ts +3 -0
  54. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +19 -14
  55. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +25 -14
  56. package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -13
  57. package/lib/infra/DashboardFilter/filterUtils.tsx +1 -1
  58. package/lib/infra/DeferLoad/DeferLoad.tsx +20 -14
  59. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +14 -10
  60. package/lib/infra/MultiStep/MultiStep.tsx +22 -22
  61. package/lib/infra/NavBar/NavBar.tsx +21 -14
  62. package/lib/infra/Reference/Reference.tsx +18 -13
  63. package/lib/infra/Region/Region.tsx +6 -8
  64. package/lib/infra/RootContainer/RootContainer.tsx +25 -16
  65. package/lib/infra/Stages/Stages.tsx +8 -10
  66. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +1 -8
  67. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  68. package/lib/infra/View/View.tsx +22 -21
  69. package/lib/template/AppShell/AppShell.tsx +25 -36
  70. package/lib/template/BannerPage/BannerPage.tsx +31 -26
  71. package/lib/template/CaseSummary/CaseSummary.tsx +8 -15
  72. package/lib/template/CaseView/CaseView.tsx +25 -24
  73. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +19 -10
  74. package/lib/template/Confirmation/Confirmation.tsx +53 -27
  75. package/lib/template/DataReference/DataReference.tsx +52 -48
  76. package/lib/template/DefaultForm/DefaultForm.tsx +12 -14
  77. package/lib/template/Details/Details/Details.tsx +17 -16
  78. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +16 -13
  79. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +18 -19
  80. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +18 -20
  81. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +28 -22
  82. package/lib/template/InlineDashboard/InlineDashboard.tsx +7 -11
  83. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +17 -19
  84. package/lib/template/ListPage/ListPage.tsx +13 -14
  85. package/lib/template/ListView/ListView.tsx +186 -189
  86. package/lib/template/ListView/utils.ts +23 -170
  87. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +19 -10
  88. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +1 -16
  89. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +18 -19
  90. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +1 -9
  91. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  92. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -8
  93. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  94. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +7 -5
  95. package/lib/template/PromotedFilters/PromotedFilters.tsx +14 -16
  96. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +8 -102
  97. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +7 -24
  98. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -23
  99. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +36 -34
  100. package/lib/template/SubTabs/SubTabs.tsx +11 -10
  101. package/lib/template/SubTabs/tabUtils.ts +4 -0
  102. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +15 -10
  103. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  104. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +12 -10
  105. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +3 -17
  106. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +25 -35
  107. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +1 -7
  108. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +17 -15
  109. package/lib/template/WssNavBar/WssNavBar.tsx +1 -18
  110. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +21 -13
  111. package/lib/widget/Attachment/Attachment.tsx +16 -28
  112. package/lib/widget/CaseHistory/CaseHistory.tsx +10 -12
  113. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -13
  114. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +22 -35
  115. package/lib/widget/Followers/Followers.tsx +11 -10
  116. package/lib/widget/QuickCreate/QuickCreate.tsx +5 -11
  117. package/lib/widget/SummaryItem/SummaryItem.tsx +1 -11
  118. package/lib/widget/SummaryList/SummaryList.tsx +3 -17
  119. package/lib/widget/ToDo/ToDo.tsx +105 -62
  120. package/package.json +1 -1
  121. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +0 -121
  122. package/lib/designSystemExtension/RichTextEditor/index.tsx +0 -1
  123. package/lib/field/RichText/RichText.tsx +0 -93
  124. package/lib/field/RichText/index.tsx +0 -1
  125. package/lib/field/ScalarList/ScalarList.tsx +0 -64
  126. package/lib/field/ScalarList/config-ext.json +0 -8
  127. package/lib/field/ScalarList/index.tsx +0 -1
  128. package/lib/helpers/authManager.ts +0 -933
@@ -1,8 +1,9 @@
1
1
  import React, { Fragment, memo, useEffect, useState } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import { Typography } from '@material-ui/core';
4
+ import AutoComplete from '@pega/react-sdk-components/lib/components/field/AutoComplete';
5
+ import Dropdown from '@pega/react-sdk-components/lib/components/field/Dropdown';
3
6
  import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
4
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
7
 
7
8
  // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 errors)
8
9
  declare const PCore: any;
@@ -10,48 +11,23 @@ declare const PCore: any;
10
11
  const DROPDOWN_LIST = 'Drop-down list';
11
12
  const SEARCH_BOX = 'Search box';
12
13
 
13
- interface UserReferenceProps extends PConnProps {
14
- // If any, enter additional props that only exist on URLComponent here
15
- displayAs?: string;
16
- label?: string;
17
- value?: any;
18
- testId?: string;
19
- placeholder?: string;
20
- helperText?: string;
21
- disabled?: boolean;
22
- readOnly?: boolean;
23
- required?: boolean;
24
- validatemessage?: string;
25
- showAsFormattedText?: boolean;
26
- additionalProps?: object;
27
- hideLabel?: boolean;
28
- variant?: string;
29
- onChange?: any;
30
- }
31
-
32
- const UserReference = (props: UserReferenceProps) => {
33
- // Get emitted components from map (so we can get any override that may exist)
34
- const AutoComplete = getComponentFromMap('AutoComplete');
35
- const Dropdown = getComponentFromMap('Dropdown');
36
-
14
+ const UserReference = props => {
37
15
  const {
38
- label = '',
39
- displayAs = '',
16
+ label,
17
+ displayAs,
40
18
  getPConnect,
41
- value = '',
42
- testId = '',
43
- helperText = '',
44
- validatemessage = '',
45
- placeholder = '',
46
- showAsFormattedText = false,
47
- additionalProps = {},
48
- hideLabel = false,
49
- readOnly = false,
50
- required = false,
51
- disabled = false,
52
- onChange,
53
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
54
- variant = 'inline'
19
+ value,
20
+ testId,
21
+ helperText,
22
+ validatemessage,
23
+ placeholder,
24
+ showAsFormattedText,
25
+ additionalProps,
26
+ hideLabel,
27
+ readOnly,
28
+ required,
29
+ disabled,
30
+ onChange
55
31
  } = props;
56
32
  const [dropDownDataSource, setDropDownDataSource] = useState([]);
57
33
  const [userName, setUserName] = useState('');
@@ -66,7 +42,7 @@ const UserReference = (props: UserReferenceProps) => {
66
42
  // if same user ref field is referred in view as editable & readonly formatted text
67
43
  // referenced users won't be available, so get user details from dx api
68
44
  const { getOperatorDetails } = PCore.getUserApi();
69
- getOperatorDetails(userId).then((res) => {
45
+ getOperatorDetails(userId).then(res => {
70
46
  if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
71
47
  setUserName(res.data.pyOperatorInfo.pyUserName);
72
48
  }
@@ -78,14 +54,14 @@ const UserReference = (props: UserReferenceProps) => {
78
54
  };
79
55
  PCore.getRestClient()
80
56
  .invokeRestApi('getListData', { queryPayload })
81
- .then((res) => {
82
- const ddDataSource = res.data.data.map((listItem) => ({
57
+ .then(res => {
58
+ const ddDataSource = res.data.data.map(listItem => ({
83
59
  key: listItem.pyUserIdentifier,
84
60
  value: listItem.pyUserName
85
61
  }));
86
62
  setDropDownDataSource(ddDataSource);
87
63
  })
88
- .catch((err) => {
64
+ .catch(err => {
89
65
  // eslint-disable-next-line no-console
90
66
  console.error(err);
91
67
  });
@@ -102,8 +78,8 @@ const UserReference = (props: UserReferenceProps) => {
102
78
  TODO: This has to be replaced with Operator Component
103
79
  */}
104
80
  <div>
105
- <Typography variant="caption">{label}</Typography>
106
- <Typography variant="body1">{userName}</Typography>
81
+ <Typography variant='caption'>{label}</Typography>
82
+ <Typography variant='body1'>{userName}</Typography>
107
83
  </div>
108
84
  </Fragment>
109
85
  );
@@ -133,7 +109,7 @@ const UserReference = (props: UserReferenceProps) => {
133
109
  label={label}
134
110
  getPConnect={getPConnect}
135
111
  datasource={OPERATORS_DP}
136
- listType="datapage"
112
+ listType='datapage'
137
113
  columns={columns}
138
114
  testId={testId}
139
115
  placeholder={placeholder}
@@ -153,7 +129,7 @@ const UserReference = (props: UserReferenceProps) => {
153
129
  <Dropdown
154
130
  additionalProps={additionalProps}
155
131
  datasource={dropDownDataSource}
156
- listType="associated"
132
+ listType='associated'
157
133
  getPConnect={getPConnect}
158
134
  label={label}
159
135
  value={userId}
@@ -174,6 +150,40 @@ const UserReference = (props: UserReferenceProps) => {
174
150
  return userReferenceComponent;
175
151
  };
176
152
 
153
+ UserReference.propTypes = {
154
+ getPConnect: PropTypes.func.isRequired,
155
+ displayAs: PropTypes.string,
156
+ label: PropTypes.string,
157
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.objectOf(PropTypes.any)]),
158
+ testId: PropTypes.string,
159
+ placeholder: PropTypes.string,
160
+ helperText: PropTypes.string,
161
+ disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
162
+ readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
163
+ required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
164
+ validatemessage: PropTypes.string,
165
+ showAsFormattedText: PropTypes.bool,
166
+ additionalProps: PropTypes.objectOf(PropTypes.any),
167
+ hideLabel: PropTypes.bool
168
+ };
169
+
170
+ UserReference.defaultProps = {
171
+ displayAs: null,
172
+ label: null,
173
+ value: null,
174
+ readOnly: false,
175
+ testId: null,
176
+ placeholder: null,
177
+ helperText: null,
178
+ disabled: false,
179
+ required: false,
180
+ validatemessage: null,
181
+ showAsFormattedText: false,
182
+ additionalProps: {},
183
+ variant: 'inline',
184
+ hideLabel: false
185
+ };
186
+
177
187
  // as objects are there in props, shallow comparision fails & re-rendering of comp happens even with
178
188
  // same key value pairs in obj. hence using custom comparison function on when to re-render
179
189
  const comparisonFn = (prevProps, nextProps) => {
@@ -1,6 +1,6 @@
1
1
  import download from 'downloadjs';
2
2
 
3
- export const validateMaxSize = (fileObj: any, maxSizeInMB: string): boolean => {
3
+ export const validateMaxSize = (fileObj, maxSizeInMB) => {
4
4
  const fileSize = (fileObj.size / 1048576).toFixed(2);
5
5
  return parseFloat(fileSize) < parseFloat(maxSizeInMB);
6
6
  };
@@ -15,7 +15,7 @@ export const fileDownload = (data, fileName, ext) => {
15
15
  }
16
16
  };
17
17
 
18
- export const getIconFromFileType = (fileType): string => {
18
+ export const getIconFromFileType = (fileType) => {
19
19
  let icon = 'document-doc';
20
20
  if (!fileType) return icon;
21
21
  if (fileType.startsWith('audio')) {
@@ -42,7 +42,7 @@ export const getIconFromFileType = (fileType): string => {
42
42
  return icon;
43
43
  };
44
44
 
45
- export const getIconForAttachment = (inThis:any , attachment:any): string => {
45
+ export const getIconForAttachment = (inThis:any , attachment:any) => {
46
46
  let icon;
47
47
  switch (attachment.type) {
48
48
  case "FILE":
@@ -57,7 +57,7 @@ export const getIconForAttachment = (inThis:any , attachment:any): string => {
57
57
  return icon;
58
58
  };
59
59
 
60
- export const buildFilePropsFromResponse = (respObj): { props: { meta: string, name: string, icon: string}, responseProps: any} => {
60
+ export const buildFilePropsFromResponse = (respObj) => {
61
61
  return {
62
62
  props: {
63
63
  meta: `${respObj.pyCategoryName}, ${respObj.pxCreateOperator}`,