@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,5 +1,6 @@
1
1
  // Helper singleton class to assist with loading and accessing
2
2
  // the SDK Config JSON
3
+ import { sdkGetAuthHeader } from './authManager';
3
4
  import { isEmptyObject } from './common-utils';
4
5
 
5
6
  // Create a singleton for this class (with async loading of config file) and export it
@@ -121,6 +122,78 @@ class ConfigAccess {
121
122
  this.sdkConfig.serverConfig[key] = value;
122
123
  };
123
124
 
125
+ /**
126
+ * Get available portals which supports SDK
127
+ * @returns list of available portals (portals other than excludingPortals list)
128
+ */
129
+ async getAvailablePortals() {
130
+ return new Promise(async (resolve, reject) => {
131
+ if (isEmptyObject(this.sdkConfig)) {
132
+ await getSdkConfig();
133
+ }
134
+
135
+ const serverConfig = this.sdkConfig.serverConfig;
136
+
137
+ const userAccessGroup = PCore.getEnvironmentInfo().getAccessGroup();
138
+ const dataPageName = 'D_OperatorAccessGroups';
139
+ const serverUrl = serverConfig.infinityRestServerUrl;
140
+ const appAlias = serverConfig.appAlias;
141
+ const appAliasPath = appAlias ? `/app/${appAlias}` : '';
142
+ const arExcludedPortals = serverConfig['excludePortals'];
143
+ let headers = {
144
+ Authorization: sdkGetAuthHeader(),
145
+ 'Content-Type': 'application/json'
146
+ };
147
+
148
+ // Using v1 API here as v2 data_views is not able to access same data page currently. Should move to avoid having this logic to find
149
+ // a default portal or constellation portal and rather have Constellation JS Engine API just load the default portal
150
+ fetch(`${serverUrl}${appAliasPath}/api/v1/data/${dataPageName}`, {
151
+ method: 'GET',
152
+ headers
153
+ })
154
+ .then(response => {
155
+ if (response.ok && response.status === 200) {
156
+ return response.json();
157
+ } else {
158
+ if (response.status === 401) {
159
+ // Might be either a real token expiration or revoke, but more likely that the "api" service package is misconfigured
160
+ throw new Error(
161
+ `Attempt to access ${dataPageName} failed. The "api" service package is likely not configured to use "OAuth 2.0"`
162
+ );
163
+ }
164
+ throw new Error(`HTTP Error: ${response.status}`);
165
+ }
166
+ })
167
+ .then(async agData => {
168
+ const arAccessGroups = agData.pxResults;
169
+ const availablePortals = [];
170
+
171
+ for (let ag of arAccessGroups) {
172
+ if (ag.pyAccessGroup === userAccessGroup) {
173
+ console.error(
174
+ `Default portal for current operator (${ag.pyPortal}) is not compatible with SDK.\nConsider using a different operator, adjusting the default portal for this operator, or using "appPortal" setting within sdk-config.json to specify a specific portal to load.`
175
+ );
176
+ for (let portal of ag.pyUserPortals) {
177
+ if (!arExcludedPortals.includes(portal.pyPortalLayout)) {
178
+ availablePortals.push(portal.pyPortalLayout);
179
+ }
180
+ }
181
+ break;
182
+ }
183
+ }
184
+
185
+ // Found operator's current access group. Use its portal
186
+ console.log(`Available portals: ${availablePortals}`);
187
+
188
+ resolve(availablePortals);
189
+ })
190
+ .catch(e => {
191
+ console.error(e.message);
192
+ // check specific error if 401, and wiped out if so stored token is stale. Fetch new tokens.
193
+ });
194
+ });
195
+ }
196
+
124
197
  /**
125
198
  * Path to the BootstrapCSS
126
199
  * @returns the locBootstrapCSS from the serverConfig block of the sdk-config.json file
@@ -7,7 +7,7 @@ export const dateFormatInfoDefault = {
7
7
  dateFormatMask: '__/__/____'
8
8
  };
9
9
 
10
- export const getDateFormatInfo = (): typeof dateFormatInfoDefault => {
10
+ export const getDateFormatInfo = () => {
11
11
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
12
12
  const localeCategory = 'CosmosFields';
13
13
  const theDateFormatInfo = dateFormatInfoDefault;
@@ -1,6 +1,6 @@
1
1
  // From DX Components src/utils/event-utils.js
2
2
 
3
- const handleEvent = (actions: any, eventType: string, propName: string, value: string) => {
3
+ const handleEvent = (actions, eventType, propName, value) => {
4
4
  switch (eventType) {
5
5
  case "change":
6
6
  actions.updateFieldValue(propName, value);
@@ -2,8 +2,8 @@ import { getLocale } from "./common";
2
2
  import CurrencyMap from "./CurrencyMap";
3
3
 
4
4
  // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
5
- function NumberFormatter(value, { locale = "en-US", decPlaces = 2, style="", currency="USD" } = {}): string {
6
- const currentLocale: string | undefined = getLocale(locale);
5
+ function NumberFormatter(value, { locale = "en-US", decPlaces = 2, style="", currency="USD" } = {}) {
6
+ const currentLocale = getLocale(locale);
7
7
  if (value !== null && value !== undefined) {
8
8
  return Number(value).toLocaleString(currentLocale, {
9
9
  minimumFractionDigits: decPlaces,
@@ -14,11 +14,11 @@ function NumberFormatter(value, { locale = "en-US", decPlaces = 2, style="", cur
14
14
  }
15
15
 
16
16
  function CurrencyFormatter(
17
- value: string,
17
+ value,
18
18
  { symbol = true, position="before", locale="en-US", decPlaces = 2, style = "currency", currency = "USD" } = {}
19
- ): string {
20
- const currentLocale: string | undefined = getLocale(locale);
21
- let formattedValue: string = value;
19
+ ) {
20
+ const currentLocale = getLocale(locale);
21
+ let formattedValue = value;
22
22
  if (value !== null && value !== undefined && value !== '') {
23
23
  formattedValue = NumberFormatter(value, {
24
24
  locale: currentLocale,
@@ -27,14 +27,14 @@ function CurrencyFormatter(
27
27
  currency
28
28
  });
29
29
 
30
- let countryCode: string | undefined = currentLocale?.split("-")[1].toUpperCase();
30
+ let countryCode = currentLocale.split("-")[1].toUpperCase();
31
31
 
32
32
  // If countryCode is still undefined, setting it as US
33
33
  if( !countryCode ){
34
34
  countryCode = 'US';
35
35
  }
36
36
 
37
- let code: string;
37
+ let code;
38
38
  if (symbol) {
39
39
  code = CurrencyMap[countryCode]?.symbolFormat;
40
40
  } else {
@@ -43,7 +43,7 @@ function CurrencyFormatter(
43
43
 
44
44
  // if position is provided, change placeholder accordingly.
45
45
  if (position && code) {
46
- if (position.toLowerCase() === "before" && code.startsWith("{#}")) {
46
+ if (position.toLowerCase() === "before" && code.indexOf("{#}") === 0) {
47
47
  code = code.slice(3) + code.slice(0, 3);
48
48
  } else if (
49
49
  position.toLowerCase() === "after" &&
@@ -57,8 +57,8 @@ function CurrencyFormatter(
57
57
  return formattedValue;
58
58
  }
59
59
 
60
- function SymbolFormatter(value, { symbol="$", suffix = true, locale="en-US" } = {}): string {
61
- let formattedValue: string = value;
60
+ function SymbolFormatter(value, { symbol="$", suffix = true, locale="en-US" } = {}) {
61
+ let formattedValue = value;
62
62
  if (value !== null && value !== undefined) {
63
63
  formattedValue = NumberFormatter(value, { locale });
64
64
  return suffix ? `${formattedValue}${symbol}` : `${symbol}${formattedValue}`;
@@ -1,32 +1,29 @@
1
1
  /* eslint-disable no-template-curly-in-string */
2
-
3
- type CurrencyMapType = { name: string, symbolFormat: string, currencyCode: string}
4
-
5
- const EURO: CurrencyMapType = {
2
+ const EURO = {
6
3
  name: "Euro (EUR)",
7
4
  symbolFormat: "\u20AC{#}",
8
5
  currencyCode: "EUR {#}"
9
6
  };
10
7
 
11
- const USD: CurrencyMapType = {
8
+ const USD = {
12
9
  name: "U.S. Dollar (USD)",
13
10
  symbolFormat: "${#}",
14
11
  currencyCode: "USD {#}"
15
12
  };
16
13
 
17
- const XAF: CurrencyMapType = {
14
+ const XAF = {
18
15
  name: "CFA Franc (BEAC) (XAF)",
19
16
  symbolFormat: "XAF {#}",
20
17
  currencyCode: "XAF {#}"
21
18
  };
22
19
 
23
- const XCD: CurrencyMapType = {
20
+ const XCD = {
24
21
  name: "East Caribbean Dollar (XCD)",
25
22
  symbolFormat: "${#}",
26
23
  currencyCode: "XCD {#}"
27
24
  };
28
25
 
29
- const XPF: CurrencyMapType = {
26
+ const XPF = {
30
27
  name: "Pacific Franc (XPF)",
31
28
  symbolFormat: "₣{#}",
32
29
  currencyCode: "XPF {#}"
@@ -13,7 +13,7 @@ const types = ["fromNow", "customFormat"];
13
13
 
14
14
  // value should be in ISO 8601 format.
15
15
  function DateFormatter(
16
- value: string,
16
+ value,
17
17
  { type = types[1], format = "DD/MM/YYYY", timezone = "America/New_York" } = {}
18
18
  ) {
19
19
  if (!value) return value;
@@ -1,5 +1,9 @@
1
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
1
2
 
2
- export function getLocale(locale: string = '') {
3
+ declare const PCore: typeof PCoreType;
4
+
5
+
6
+ export function getLocale(locale='') {
3
7
  // use locale if specified
4
8
  if (locale) return locale;
5
9
  // otherwise, use operator locale if it's defined
@@ -8,7 +12,7 @@ export function getLocale(locale: string = '') {
8
12
  return Intl.DateTimeFormat().resolvedOptions().locale;
9
13
  }
10
14
 
11
- export function getCurrentTimezone(timezone: string = "America/New_York" ) {
15
+ export function getCurrentTimezone(timezone="America/New_York") {
12
16
  if (timezone) return timezone;
13
17
  return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
14
18
  }
@@ -9,7 +9,7 @@ export default {
9
9
  ...DateFormatter
10
10
  };
11
11
 
12
- function getDateObject(text): Date {
12
+ function getDateObject(text) {
13
13
  // TODO - cleanup formatters util functions as DX APIs are returning values per ISO std now.
14
14
  const timeStamp = text.replace(/-/g, "");
15
15
  const isDateTime = timeStamp.indexOf("GMT") !== -1;
@@ -58,8 +58,8 @@ function parseDateInISO(value) {
58
58
  return value ? getDateObject(value).toISOString() : value;
59
59
  }
60
60
 
61
- export function format(value, type, options = {}): string {
62
- let formattedValue: string;
61
+ export function format(value, type, options = {}) {
62
+ let formattedValue;
63
63
 
64
64
  switch (type?.toLowerCase()) {
65
65
  case "currency": {
@@ -1,4 +1,7 @@
1
1
  import { Utils } from './utils';
2
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
3
+
4
+ declare const PCore: typeof PCoreType;
2
5
 
3
6
 
4
7
  export const TABLE_CELL = "SdkRenderer";
@@ -7,7 +10,7 @@ export const DELETE_ICON = "DeleteIcon";
7
10
  // BUG-615253: Workaround for autosize in table with lazy loading components
8
11
  /* istanbul ignore next */
9
12
  function getFieldWidth(field, label) {
10
- let width: number;
13
+ let width;
11
14
  switch (field.type) {
12
15
  case "Time":
13
16
  width = 150;
@@ -45,7 +48,7 @@ function getFieldWidth(field, label) {
45
48
  export const getContext = (thePConn) => {
46
49
  const contextName = thePConn.getContextName();
47
50
  const pageReference = thePConn.getPageReference();
48
- let { referenceList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
51
+ let { referenceList } = thePConn.getStateProps().config;
49
52
  const pageReferenceForRows = referenceList.startsWith(".")
50
53
  ? `${pageReference}.${referenceList.substring(1)}`
51
54
  : referenceList;
@@ -64,7 +67,7 @@ export const getContext = (thePConn) => {
64
67
  };
65
68
 
66
69
  export const populateRowKey = (rawData) => {
67
- return rawData.map((row: any, index: number) => {
70
+ return rawData.map((row, index) => {
68
71
  return { ...row, index };
69
72
  });
70
73
  };
@@ -102,7 +105,6 @@ export const buildMetaForListView = (
102
105
  ruleClass,
103
106
  name,
104
107
  propertyLabel,
105
- isDataObject,
106
108
  parameters
107
109
  ) => {
108
110
  return {
@@ -112,12 +114,10 @@ export const buildMetaForListView = (
112
114
  referenceList: fieldMetadata.datasource.name,
113
115
  parameters: parameters ?? fieldMetadata.datasource.parameters,
114
116
  personalization: false,
115
- isDataObject,
116
117
  grouping: true,
117
118
  globalSearch: true,
118
119
  reorderFields: true,
119
120
  toggleFieldVisibility: true,
120
- title: propertyLabel,
121
121
  personalizationId: "" /* TODO */,
122
122
  template: "ListView",
123
123
  presets: [
@@ -209,7 +209,7 @@ export const createMetaForTable = (fields, renderMode) => {
209
209
  * @param {number} index - index of the page list to add
210
210
  */
211
211
  export const getAddRowCallback = (pConnect, index) => {
212
- return () => pConnect.getListActions().insert({}, index, ''); // 3rd arg null until typedef marked correctly as optional
212
+ return () => pConnect.getListActions().insert({}, index);
213
213
  };
214
214
 
215
215
  /**
@@ -1,6 +1,9 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { connect, Provider, shallowEqual } from 'react-redux';
3
3
  import ReactReduxContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
4
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
5
+
6
+ declare const PCore: typeof PCoreType;
4
7
 
5
8
 
6
9
  const connectToState = (mapStateToProps = () => {}) => {
@@ -1,9 +1,12 @@
1
1
  // This file is adapted from React DX components/template/utils.js
2
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
3
+
4
+ declare const PCore: typeof PCoreType;
2
5
 
3
6
 
4
7
  export function getAllFields(pConnect: any) {
5
8
  const metadata = pConnect.getRawMetadata();
6
- let allFields: Array<any> = [];
9
+ let allFields = [];
7
10
  if (metadata.children && metadata.children.map) {
8
11
  allFields = metadata.children.map(fields => {
9
12
  const children = fields.children instanceof Array ? fields.children : [];
@@ -13,7 +16,7 @@ export function getAllFields(pConnect: any) {
13
16
  return allFields;
14
17
  }
15
18
 
16
- export function filterForFieldValueList(fields: Array<any>) {
19
+ export function filterForFieldValueList(fields: any) {
17
20
  return fields
18
21
  .filter(({ visibility }) => visibility !== false)
19
22
  .map(({ value, label }) => ({
@@ -46,7 +49,7 @@ export function getIsAssignmentView(pConnect) {
46
49
  * @param {Function} pConnect PConnect object for the component
47
50
  * @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler)
48
51
  */
49
- export function getInstructions(pConnect, instructions: string = 'casestep'): string | undefined {
52
+ export function getInstructions(pConnect, instructions = 'casestep') {
50
53
  const caseStepInstructions =
51
54
  PCore.getConstants().CASE_INFO.INSTRUCTIONS &&
52
55
  pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
@@ -4,6 +4,9 @@
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
11
 
9
12
  export const sdkVersion = "8.7";
@@ -1,16 +1,13 @@
1
1
  import React from "react";
2
+ import PropTypes from "prop-types";
2
3
  import { makeStyles } from '@material-ui/core/styles';
3
4
 
4
5
  import Button from '@material-ui/core/Button';
5
6
  import { Grid, Divider } from "@material-ui/core";
6
7
 
7
- // ActionButtons does NOT have getPConnect. So, no need to extend from PConnProps
8
- interface ActionButtonsProps {
9
- // If any, enter additional props that only exist on this component
10
- arMainButtons?: Array<any>,
11
- arSecondaryButtons?: Array<any>,
12
- onButtonPress: any
13
- }
8
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
9
+
10
+ declare const PCore: typeof PCoreType;
14
11
 
15
12
 
16
13
  const useStyles = makeStyles((/* theme */) => ({
@@ -24,8 +21,8 @@ const useStyles = makeStyles((/* theme */) => ({
24
21
  }));
25
22
 
26
23
 
27
- export default function ActionButtons(props: ActionButtonsProps) {
28
- const { arMainButtons = [], arSecondaryButtons = [], onButtonPress } = props;
24
+ export default function ActionButtons(props) {
25
+ const { arMainButtons, arSecondaryButtons, onButtonPress } = props;
29
26
  const classes = useStyles();
30
27
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
31
28
  const localeCategory = 'Assignment';
@@ -63,3 +60,16 @@ export default function ActionButtons(props: ActionButtonsProps) {
63
60
 
64
61
  )
65
62
  }
63
+
64
+ ActionButtons.propTypes = {
65
+ arMainButtons: PropTypes.array,
66
+ arSecondaryButtons: PropTypes.array,
67
+ onButtonPress: PropTypes.func
68
+ // buildName: PropTypes.string
69
+ };
70
+
71
+ ActionButtons.defaultProps = {
72
+ arMainButtons: [],
73
+ arSecondaryButtons: []
74
+ // buildName: null
75
+ };
@@ -1,32 +1,23 @@
1
1
  import React, { useState, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import AssignmentCard from '@pega/react-sdk-components/lib/components/infra/AssignmentCard';
5
+ import MultiStep from '@pega/react-sdk-components/lib/components/infra/MultiStep';
2
6
  import Snackbar from '@material-ui/core/Snackbar';
3
7
  import IconButton from '@material-ui/core/IconButton';
4
8
  import CloseIcon from '@material-ui/icons/Close';
5
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
-
7
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
-
9
- interface AssignmentProps extends PConnProps {
10
- // If any, enter additional props that only exist on this component
11
- children: Array<any>,
12
- itemKey: string,
13
- isInModal: boolean,
14
- banners: Array<any>
15
- // eslint-disable-next-line react/no-unused-prop-types
16
- actionButtons: Array<any>,
17
- }
18
9
 
10
+ import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
19
11
 
20
- export default function Assignment(props: AssignmentProps) {
21
- // Get emitted components from map (so we can get any override that may exist)
22
- const AssignmentCard = getComponentFromMap("AssignmentCard");
23
- const MultiStep = getComponentFromMap("MultiStep");
12
+ declare const PCore: typeof PCoreType;
24
13
 
25
- const { getPConnect, children, itemKey = '', isInModal = false, banners = [] } = props;
14
+
15
+ export default function Assignment(props) {
16
+ const { getPConnect, children, itemKey, isInModal, banners } = props;
26
17
  const thePConn = getPConnect();
27
18
 
28
19
  const [bHasNavigation, setHasNavigation] = useState(false);
29
- const [actionButtons, setActionButtons] = useState([]);
20
+ const [actionButtons, setActionButtons] = useState({});
30
21
  const [bIsVertical, setIsVertical] = useState(false);
31
22
  const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<Array<any>>([]);
32
23
  const [arNavigationSteps, setArNavigationSteps] = useState<Array<any>>([]);
@@ -81,7 +72,7 @@ export default function Assignment(props: AssignmentProps) {
81
72
 
82
73
  const oWorkItem = children[0].props.getPConnect();
83
74
  const oWorkData = oWorkItem.getDataObject();
84
- const oData = thePConn.getDataObject(thePConn.getContextName());
75
+ const oData = thePConn.getDataObject();
85
76
 
86
77
  if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
87
78
  const oCaseInfo = oData.caseInfo;
@@ -187,7 +178,7 @@ export default function Assignment(props: AssignmentProps) {
187
178
  const isLocalAction =
188
179
  thePConn.getCaseInfo().isLocalAction() ||
189
180
  (PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION &&
190
- getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION, ''));// 2nd arg empty string until typedefs allow it to be optional
181
+ getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
191
182
  if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
192
183
  const cancelPromise = cancelCreateStageAssignment(itemKey);
193
184
 
@@ -324,3 +315,19 @@ export default function Assignment(props: AssignmentProps) {
324
315
  // <lit-toast></lit-toast>
325
316
  // </div>`}
326
317
  // `;
318
+
319
+ Assignment.propTypes = {
320
+ children: PropTypes.node.isRequired,
321
+ getPConnect: PropTypes.func.isRequired,
322
+ itemKey: PropTypes.string,
323
+ isInModal: PropTypes.bool,
324
+ banners: PropTypes.any
325
+ // actionButtons: PropTypes.object
326
+ // buildName: PropTypes.string
327
+ };
328
+
329
+ Assignment.defaultProps = {
330
+ itemKey: null,
331
+ isInModal: false
332
+ // buildName: null
333
+ };
@@ -1,21 +1,9 @@
1
1
  import React, { useState, useEffect } from "react";
2
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
-
5
- interface AssignmentCardProps extends PConnProps {
6
- // If any, enter additional props that only exist on this component
7
- children: Array<any>,
8
- actionButtons: any,
9
- onButtonPress: any,
10
- // eslint-disable-next-line react/no-unused-prop-types
11
- itemKey?: string
12
- }
13
-
2
+ import PropTypes from "prop-types";
14
3
 
15
- export default function AssignmentCard(props: AssignmentCardProps) {
16
- // Get emitted components from map (so we can get any override that may exist)
17
- const ActionButtons = getComponentFromMap("ActionButtons");
4
+ import ActionButtons from "@pega/react-sdk-components/lib/components/infra/ActionButtons";
18
5
 
6
+ export default function AssignmentCard(props) {
19
7
  const { children, actionButtons, onButtonPress} = props;
20
8
 
21
9
  const [arMainButtons, setArMainButtons] = useState([]);
@@ -41,3 +29,19 @@ export default function AssignmentCard(props: AssignmentCardProps) {
41
29
  </>
42
30
  )
43
31
  }
32
+
33
+ AssignmentCard.propTypes = {
34
+ children: PropTypes.node.isRequired,
35
+ // eslint-disable-next-line react/no-unused-prop-types
36
+ getPConnect: PropTypes.func.isRequired,
37
+ // eslint-disable-next-line react/no-unused-prop-types
38
+ itemKey: PropTypes.string,
39
+ actionButtons: PropTypes.object,
40
+ onButtonPress: PropTypes.func
41
+ // buildName: PropTypes.string
42
+ };
43
+
44
+ AssignmentCard.defaultProps = {
45
+ itemKey: null,
46
+ // buildName: null
47
+ };