@pega/react-sdk-overrides 24.2.10 → 24.2.11

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 (45) hide show
  1. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +2 -2
  2. package/lib/field/CancelAlert/CancelAlert.tsx +1 -4
  3. package/lib/field/Currency/Currency.tsx +8 -5
  4. package/lib/field/Date/Date.tsx +5 -1
  5. package/lib/field/DateTime/DateTime.tsx +13 -5
  6. package/lib/field/Decimal/Decimal.tsx +7 -2
  7. package/lib/field/Dropdown/Dropdown.tsx +27 -20
  8. package/lib/field/Percentage/Percentage.tsx +6 -2
  9. package/lib/field/RadioButtons/RadioButtons.tsx +0 -3
  10. package/lib/field/ScalarList/ScalarList.tsx +1 -2
  11. package/lib/field/Time/Time.tsx +1 -1
  12. package/lib/field/UserReference/UserReference.tsx +1 -3
  13. package/lib/helpers/common-utils.ts +24 -1
  14. package/lib/helpers/formatters/Currency.ts +11 -16
  15. package/lib/helpers/formatters/common.ts +2 -1
  16. package/lib/helpers/formatters/index.ts +2 -4
  17. package/lib/infra/Assignment/Assignment.tsx +2 -6
  18. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +5 -18
  19. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  20. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +3 -1
  21. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  22. package/lib/infra/DashboardFilter/DashboardFilter.tsx +2 -3
  23. package/lib/infra/DashboardFilter/filterUtils.tsx +1 -3
  24. package/lib/infra/DeferLoad/DeferLoad.tsx +5 -5
  25. package/lib/infra/MultiStep/MultiStep.tsx +1 -6
  26. package/lib/infra/RootContainer/RootContainer.tsx +1 -1
  27. package/lib/template/AppShell/AppShell.tsx +6 -6
  28. package/lib/template/CaseView/CaseView.tsx +5 -4
  29. package/lib/template/Confirmation/Confirmation.tsx +1 -1
  30. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +0 -1
  31. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +0 -2
  32. package/lib/template/ListView/ListView.tsx +10 -9
  33. package/lib/template/ListView/utils.ts +0 -1
  34. package/lib/template/PromotedFilters/PromotedFilters.tsx +0 -1
  35. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
  36. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +68 -56
  37. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
  38. package/lib/widget/Attachment/Attachment.css +1 -0
  39. package/lib/widget/Attachment/Attachment.tsx +2 -7
  40. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +1 -1
  41. package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
  42. package/lib/widget/SummaryItem/SummaryItem.tsx +1 -1
  43. package/lib/widget/ToDo/ToDo.tsx +1 -1
  44. package/package.json +1 -1
  45. /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
@@ -63,7 +63,7 @@ export default function FieldValueList(props: FieldValueListProps) {
63
63
  const formattedValue = formatItemValue(value);
64
64
 
65
65
  return (
66
- <Grid item xs={variant === 'stacked' ? 12 : 8} className={variant === 'stacked' ? classes.noPaddingTop : ''}>
66
+ <Grid item xs={variant === 'stacked' || !name ? 12 : 8} className={variant === 'stacked' ? classes.noPaddingTop : ''}>
67
67
  {isHtml ? (
68
68
  // eslint-disable-next-line react/no-danger
69
69
  <div dangerouslySetInnerHTML={{ __html: formattedValue }} />
@@ -78,7 +78,7 @@ export default function FieldValueList(props: FieldValueListProps) {
78
78
 
79
79
  return (
80
80
  <Grid container spacing={4} justifyContent='space-between'>
81
- {getGridItemLabel()}
81
+ {name ? getGridItemLabel() : null}
82
82
  {getGridItemValue()}
83
83
  </Grid>
84
84
  );
@@ -58,14 +58,12 @@ export default function CancelAlert(props: CancelAlertProps) {
58
58
  function cancelHandler() {
59
59
  if (isReverseCoexistence) {
60
60
  dismiss(true);
61
- // @ts-ignore - An argument for 'payload' was not provided.
62
61
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);
63
62
  } else if (!isDataObject && !isLocalAction && !isBulkAction) {
64
63
  disableButton(btnIds.DELETE);
65
64
  actionsAPI
66
65
  .deleteCaseInCreateStage(containerItemID, hideDelete)
67
66
  .then(() => {
68
- // @ts-ignore - An argument for 'payload' was not provided.
69
67
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
70
68
  })
71
69
  .catch(() => {
@@ -78,13 +76,12 @@ export default function CancelAlert(props: CancelAlertProps) {
78
76
  });
79
77
  } else if (isLocalAction) {
80
78
  dismiss(true);
81
- actionsAPI.cancelAssignment(containerItemID);
79
+ actionsAPI.cancelAssignment(containerItemID, false);
82
80
  } else if (isBulkAction) {
83
81
  dismiss(true);
84
82
  actionsAPI.cancelBulkAction(containerItemID);
85
83
  } else {
86
84
  dismiss(true);
87
- // @ts-ignore - Argument of type '{ containerItemID: string; skipReleaseLockRequest: any; }' is not assignable to parameter of type 'ContainerInfo'.
88
85
  containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });
89
86
  }
90
87
  }
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { NumericFormat } from 'react-number-format';
3
3
  import { TextField } from '@mui/material';
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
@@ -45,9 +45,11 @@ export default function Currency(props: CurrrencyProps) {
45
45
  const helperTextToDisplay = validatemessage || helperText;
46
46
  const [values, setValues] = useState(value.toString());
47
47
 
48
- const testProp = {
49
- 'data-test-id': testId
50
- };
48
+ const testProp = { 'data-test-id': testId };
49
+
50
+ useEffect(() => {
51
+ setValues(value.toString());
52
+ }, [value]);
51
53
 
52
54
  // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
53
55
  const theSymbols = getCurrencyCharacters(currencyISOCode);
@@ -56,7 +58,7 @@ export default function Currency(props: CurrrencyProps) {
56
58
  const theCurrSep = theSymbols.theDigitGroupSeparator;
57
59
 
58
60
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
59
- const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
61
+ const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
60
62
 
61
63
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
62
64
 
@@ -86,6 +88,7 @@ export default function Currency(props: CurrrencyProps) {
86
88
  return (
87
89
  <NumericFormat
88
90
  valueIsNumericString
91
+ variant={readOnly ? 'standard' : 'outlined'}
89
92
  label={label}
90
93
  helperText={helperTextToDisplay}
91
94
  placeholder={placeholder ?? ''}
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { DatePicker } from '@mui/x-date-pickers/DatePicker';
3
3
  import dayjs, { Dayjs } from 'dayjs';
4
4
 
@@ -39,6 +39,10 @@ export default function Date(props: DateProps) {
39
39
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
40
40
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
41
41
 
42
+ useEffect(() => {
43
+ setDateValue(dayjs(value));
44
+ }, [value]);
45
+
42
46
  if (displayMode === 'DISPLAY_ONLY') {
43
47
  const formattedDate = format(props.value, 'date', {
44
48
  format: dateFormatInfo.dateFormatString
@@ -1,7 +1,7 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
3
3
  import dayjs, { Dayjs } from 'dayjs';
4
-
4
+ import DateFormatter from '@pega/react-sdk-components/lib/components/helpers/formatters/Date';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
7
  import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
@@ -19,7 +19,10 @@ export default function DateTime(props: DateTimeProps) {
19
19
 
20
20
  const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;
21
21
 
22
- const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(value) : null);
22
+ const environmentInfo = PCore.getEnvironmentInfo();
23
+ const timezone = environmentInfo && environmentInfo.getTimeZone();
24
+
25
+ const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(DateFormatter.convertToTimezone(value, { timezone })) : null);
23
26
 
24
27
  const pConn = getPConnect();
25
28
  const actions = pConn.getActionsApi();
@@ -34,6 +37,10 @@ export default function DateTime(props: DateTimeProps) {
34
37
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
35
38
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
36
39
 
40
+ useEffect(() => {
41
+ setDateValue(dayjs(DateFormatter.convertToTimezone(value, { timezone })));
42
+ }, [value]);
43
+
37
44
  if (displayMode === 'DISPLAY_ONLY') {
38
45
  const formattedDateTime = format(props.value, 'datetime', {
39
46
  format: `${dateFormatInfo.dateFormatString} hh:mm a`
@@ -60,8 +67,9 @@ export default function DateTime(props: DateTimeProps) {
60
67
  };
61
68
 
62
69
  const handleChange = date => {
63
- setDateValue(date);
64
- const changeValue = date && date.isValid() ? date.toISOString() : null;
70
+ const timeZoneDateTime = (dayjs as any).tz(date.format('YYYY-MM-DDTHH:mm:ss'), timezone);
71
+ const changeValue = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
72
+ setDateValue(timeZoneDateTime);
65
73
  handleEvent(actions, 'changeNblur', propName, changeValue);
66
74
  };
67
75
 
@@ -1,6 +1,6 @@
1
1
  import { NumericFormat } from 'react-number-format';
2
2
  import { TextField } from '@mui/material';
3
- import { useState } from 'react';
3
+ import { useEffect, useState } from 'react';
4
4
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
@@ -58,6 +58,10 @@ export default function Decimal(props: DecimalProps) {
58
58
 
59
59
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
60
60
 
61
+ useEffect(() => {
62
+ setValues(value.toString());
63
+ }, [value]);
64
+
61
65
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
62
66
 
63
67
  if (readOnly) {
@@ -68,7 +72,7 @@ export default function Decimal(props: DecimalProps) {
68
72
  if (formatter === 'Currency') {
69
73
  formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
70
74
  } else {
71
- formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
75
+ formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
72
76
  }
73
77
 
74
78
  if (displayMode === 'DISPLAY_ONLY') {
@@ -109,6 +113,7 @@ export default function Decimal(props: DecimalProps) {
109
113
  }}
110
114
  onBlur={!readOnly ? decimalOnBlur : undefined}
111
115
  prefix={readOnly && formatter === 'Currency' ? theCurrSym : ''}
116
+ suffix={readOnly && formatter === 'Percentage' ? '%' : ''}
112
117
  decimalSeparator={theCurrDec}
113
118
  thousandSeparator={showGroupSeparators ? theCurrSep : ''}
114
119
  decimalScale={readOnly && formatter === 'Currency' ? undefined : decimalPrecision}
@@ -137,7 +137,7 @@ export default function Dropdown(props: DropdownProps) {
137
137
  }, [theDatasource]);
138
138
 
139
139
  useEffect(() => {
140
- if (!displayMode && listType !== 'associated' && typeof datasource === 'string') {
140
+ if (listType !== 'associated' && typeof datasource === 'string') {
141
141
  getDataPage(datasource, parameters, context).then((results: any) => {
142
142
  const optionsData: any[] = [];
143
143
  const displayColumn = getDisplayFieldsMetaData(columns);
@@ -165,25 +165,33 @@ export default function Dropdown(props: DropdownProps) {
165
165
 
166
166
  let readOnlyProp = {};
167
167
 
168
- if (displayMode === 'DISPLAY_ONLY') {
169
- return (
170
- <FieldValueList
171
- name={hideLabel ? '' : label}
172
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
173
- value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
174
- />
175
- );
176
- }
168
+ const displayFn = (displayM, val) => {
169
+ if (displayM === 'DISPLAY_ONLY') {
170
+ return (
171
+ <FieldValueList
172
+ name={hideLabel ? '' : label}
173
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
174
+ value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
175
+ />
176
+ );
177
+ }
178
+
179
+ if (displayM === 'STACKED_LARGE_VAL') {
180
+ return (
181
+ <FieldValueList
182
+ name={hideLabel ? '' : label}
183
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
184
+ value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
185
+ variant='stacked'
186
+ />
187
+ );
188
+ }
189
+
190
+ return null;
191
+ };
177
192
 
178
- if (displayMode === 'STACKED_LARGE_VAL') {
179
- return (
180
- <FieldValueList
181
- name={hideLabel ? '' : label}
182
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
183
- value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
184
- variant='stacked'
185
- />
186
- );
193
+ if (displayMode) {
194
+ return displayFn(displayMode, options.find(option => option.key === value)?.value || value);
187
195
  }
188
196
 
189
197
  if (readOnly) {
@@ -224,7 +232,6 @@ export default function Dropdown(props: DropdownProps) {
224
232
  >
225
233
  {options.map((option: any) => (
226
234
  <MenuItem key={option.key} value={option.key}>
227
- {/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
228
235
  {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
229
236
  </MenuItem>
230
237
  ))}
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { NumericFormat } from 'react-number-format';
3
3
  import { TextField } from '@mui/material';
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
@@ -50,7 +50,11 @@ export default function Percentage(props: PercentageProps) {
50
50
  const helperTextToDisplay = validatemessage || helperText;
51
51
 
52
52
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
53
- const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
53
+ const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
54
+
55
+ useEffect(() => {
56
+ setValues(value.toString());
57
+ }, [value]);
54
58
 
55
59
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
56
60
 
@@ -65,7 +65,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
65
65
  return (
66
66
  <FieldValueList
67
67
  name={hideLabel ? '' : label}
68
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
69
68
  value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
70
69
  />
71
70
  );
@@ -75,7 +74,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
75
74
  return (
76
75
  <FieldValueList
77
76
  name={hideLabel ? '' : label}
78
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
79
77
  value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
80
78
  variant='stacked'
81
79
  />
@@ -102,7 +100,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
102
100
  label={thePConn.getLocalizedValue(
103
101
  theOption.value,
104
102
  localePath,
105
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
106
103
  thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
107
104
  )}
108
105
  control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
@@ -36,16 +36,15 @@ export default function ScalarList(props: ScalarListProps) {
36
36
  {
37
37
  type: componentType,
38
38
  config: {
39
- // @ts-ignore - Type '{ readOnly: true; displayInModal: boolean; value: any; displayMode: string; label: string; }' is not assignable to type 'ComponentMetadataConfig'.
40
39
  value: scalarValue,
41
40
  displayMode: 'DISPLAY_ONLY',
42
41
  label,
43
42
  ...restProps,
44
- // @ts-ignore - Type 'string' is not assignable to type 'boolean | undefined'.
45
43
  readOnly: 'true'
46
44
  }
47
45
  },
48
46
  '',
47
+ // @ts-ignore
49
48
  '',
50
49
  {}
51
50
  ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
@@ -39,7 +39,7 @@ export default function Time(props: TimeProps) {
39
39
  };
40
40
 
41
41
  const handleChange = date => {
42
- const theValue = date && date.isValid() ? date.format('HH:mm') : null;
42
+ const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;
43
43
  handleEvent(actions, 'changeNblur', propName, theValue);
44
44
  };
45
45
 
@@ -80,10 +80,8 @@ const UserReference = (props: UserReferenceProps) => {
80
80
  };
81
81
 
82
82
  PCore.getRestClient()
83
- // @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
84
- // @ts-ignore - Expected 3 arguments, but got 2
85
83
  .invokeRestApi('getListData', { queryPayload })
86
- .then((res: any) => {
84
+ .then(res => {
87
85
  const ddDataSource = res.data.data.map(listItem => ({
88
86
  key: listItem.pyUserIdentifier,
89
87
  value: listItem.pyUserName
@@ -1,4 +1,27 @@
1
- /* eslint-disable import/prefer-default-export */
2
1
  export function isEmptyObject(obj: Object): boolean {
3
2
  return Object.keys(obj).length === 0;
4
3
  }
4
+
5
+ /**
6
+ * Get a localized value from the Generic Fields
7
+ * @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')
8
+ * @param key - The key of the string to localize
9
+ * @returns The localized string or the key itself if no translation is found
10
+ */
11
+ export function getGenericFieldsLocalizedValue(path: string, key: string): string {
12
+ const GENERIC_BUNDLE_KEY = PCore.getLocaleUtils().GENERIC_BUNDLE_KEY;
13
+ const localeStore = PCore.getLocaleUtils().localeStore[GENERIC_BUNDLE_KEY];
14
+
15
+ if (!localeStore) return key;
16
+
17
+ // Split the path and traverse the object
18
+ const pathParts = path.split('.');
19
+ let currentObj = localeStore;
20
+
21
+ for (const part of pathParts) {
22
+ if (!currentObj[part]) return key;
23
+ currentObj = currentObj[part];
24
+ }
25
+
26
+ return currentObj[key] || key;
27
+ }
@@ -5,10 +5,7 @@ import CurrencyMap from './CurrencyMap';
5
5
  function NumberFormatter(value, { locale = 'en-US', decPlaces = 2, style = '', currency = 'USD' } = {}): string {
6
6
  const currentLocale: string | undefined = getLocale(locale);
7
7
  if (value !== null && value !== undefined) {
8
- return Number(value).toLocaleString(currentLocale, {
9
- minimumFractionDigits: decPlaces,
10
- maximumFractionDigits: decPlaces
11
- });
8
+ return Number(value).toLocaleString(currentLocale, { minimumFractionDigits: decPlaces, maximumFractionDigits: decPlaces });
12
9
  }
13
10
  return value;
14
11
  }
@@ -20,14 +17,16 @@ function CurrencyFormatter(
20
17
  const currentLocale: string | undefined = getLocale(locale);
21
18
  let formattedValue: string = value;
22
19
  if (value !== null && value !== undefined && value !== '') {
23
- formattedValue = NumberFormatter(value, {
24
- locale: currentLocale,
25
- decPlaces,
26
- style,
27
- currency
28
- });
20
+ formattedValue = NumberFormatter(value, { locale: currentLocale, decPlaces, style, currency });
29
21
 
30
- let countryCode: string | undefined = currentLocale?.split('-')[1].toUpperCase();
22
+ // For currency other than EUR, we need to determine the country code from currency code
23
+ // If currency is EUR, we use the locale to determine the country code
24
+ let countryCode: string | undefined;
25
+ if (currency !== 'EUR') {
26
+ countryCode = currency.substring(0, 2);
27
+ } else {
28
+ countryCode = currentLocale?.split('-')[1].toUpperCase();
29
+ }
31
30
 
32
31
  // If countryCode is still undefined, setting it as US
33
32
  if (!countryCode) {
@@ -67,11 +66,7 @@ export default {
67
66
  Currency: (value, options) => CurrencyFormatter(value, options),
68
67
  'Currency-Code': (value, options) => CurrencyFormatter(value, { ...options, symbol: false }),
69
68
  Decimal: (value, options) => NumberFormatter(value, options),
70
- 'Decimal-Auto': (value, options) =>
71
- NumberFormatter(value, {
72
- ...options,
73
- decPlaces: Number.isInteger(value) ? 0 : 2
74
- }),
69
+ 'Decimal-Auto': (value, options) => NumberFormatter(value, { ...options, decPlaces: Number.isInteger(value) ? 0 : 2 }),
75
70
  Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),
76
71
  Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })
77
72
  };
@@ -7,7 +7,8 @@ export function getLocale(locale: string = '') {
7
7
  return Intl.DateTimeFormat().resolvedOptions().locale;
8
8
  }
9
9
 
10
- export function getCurrentTimezone(timezone: string = 'America/New_York') {
10
+ export function getCurrentTimezone(timezone?: string) {
11
+ // use timezone if specified
11
12
  if (timezone) return timezone;
12
13
  return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
13
14
  }
@@ -18,10 +18,8 @@ function getDateObject(text): Date {
18
18
  const day = parseInt(timeStamp.substr(6, 2), 10);
19
19
 
20
20
  const date = new Date();
21
-
22
- date.setDate(day);
23
- date.setMonth(month);
24
- date.setFullYear(year);
21
+ // Fix to handle all the dates, raised via https://github.com/pegasystems/react-sdk-components/issues/442
22
+ date.setFullYear(year, month, day);
25
23
 
26
24
  if (isDateTime) {
27
25
  const hours = parseInt(timeStamp.substr(9, 2), 10);
@@ -147,7 +147,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
147
147
  }
148
148
 
149
149
  function onSaveActionSuccess(data) {
150
- actionsAPI.cancelAssignment(itemKey).then(() => {
150
+ actionsAPI.cancelAssignment(itemKey, false).then(() => {
151
151
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
152
152
  });
153
153
  }
@@ -174,7 +174,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
174
174
 
175
175
  savePromise
176
176
  .then(() => {
177
- // @ts-ignore - Property 'c11nEnv' is private and only accessible within class 'CaseInfo'.
178
177
  const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
179
178
  onSaveActionSuccess({ caseType, caseID, assignmentID });
180
179
  })
@@ -189,10 +188,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
189
188
  // check if create stage (modal)
190
189
  const { PUB_SUB_EVENTS } = PCore.getConstants();
191
190
  const { publish } = PCore.getPubSubUtils();
192
- // @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
193
191
  const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
194
192
  const isLocalAction =
195
- // @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
196
193
  thePConn.getCaseInfo().isLocalAction() ||
197
194
  (PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
198
195
  if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
@@ -206,7 +203,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
206
203
  showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
207
204
  });
208
205
  } else {
209
- const cancelPromise = cancelAssignment(itemKey);
206
+ const cancelPromise = cancelAssignment(itemKey, false);
210
207
 
211
208
  cancelPromise
212
209
  .then(data => {
@@ -275,7 +272,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
275
272
  }
276
273
 
277
274
  // expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
278
- // @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
279
275
  const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
280
276
  const context = thePConn.getContextName();
281
277
  const pageReference = thePConn.getPageReference();
@@ -6,9 +6,9 @@ import { Alert, Card, CardHeader, Avatar, Typography } from '@mui/material';
6
6
 
7
7
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
8
8
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
9
- import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
9
+ import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/infra/Containers/container-helpers';
10
10
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
11
- import { withSimpleViewContainerRenderer } from '../SimpleView/SimpleView';
11
+ import { withSimpleViewContainerRenderer } from '@pega/react-sdk-components/lib/components/infra/Containers/SimpleView/SimpleView';
12
12
 
13
13
  import { addContainerItem, getToDoAssignments, showBanner, hasContainerItems } from './helpers';
14
14
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
@@ -117,12 +117,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
117
117
  if (caseViewMode && caseViewMode === 'review') {
118
118
  return true;
119
119
  }
120
- // eslint-disable-next-line sonarjs/prefer-single-boolean-return
121
- if (caseViewMode && caseViewMode === 'perform') {
122
- return false;
123
- }
124
-
125
- return true;
120
+ return !(caseViewMode && caseViewMode === 'perform');
126
121
  }
127
122
 
128
123
  function initComponent() {
@@ -181,11 +176,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
181
176
 
182
177
  const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
183
178
  // const allAssignments = [];
184
- // eslint-disable-next-line sonarjs/prefer-single-boolean-return
185
- if (childCases && childCases.length > 0) {
186
- return true;
187
- }
188
- return false;
179
+ return !!(childCases && childCases.length > 0);
189
180
  }
190
181
 
191
182
  function hasAssignments() {
@@ -275,10 +266,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
275
266
  setHasCaseMessages(true);
276
267
  setShowConfirm(true);
277
268
 
278
- // publish this "assignmentFinished" for mashup, need to get approved as a standard
279
- // @ts-ignore - second parameter “payload” for publish method should be optional
280
- PCore.getPubSubUtils().publish('assignmentFinished');
281
-
282
269
  // debugger;
283
270
  setCheckSvg(Utils.getImageSrc('check', Utils.getSDKStaticConentUrl()));
284
271
  } else {
@@ -290,7 +277,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
290
277
 
291
278
  const caseId = thePConn.getCaseSummary().content.pyID;
292
279
  const urgency = getPConnect().getCaseSummary().assignments ? getPConnect().getCaseSummary().assignments?.[0].urgency : '';
293
- const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName());
280
+ const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName() || '');
294
281
 
295
282
  const bShowBanner = showBanner(getPConnect);
296
283
 
@@ -88,11 +88,7 @@ export const hasAssignments = pConnect => {
88
88
  const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS);
89
89
  const childCasesAssignments = getChildCaseAssignments(pConnect);
90
90
 
91
- // eslint-disable-next-line sonarjs/prefer-single-boolean-return
92
- if (assignments || childCasesAssignments || isCaseWideLocalAction(pConnect)) {
93
- return true;
94
- }
95
- return false;
91
+ return !!(assignments || childCasesAssignments || isCaseWideLocalAction(pConnect));
96
92
  };
97
93
 
98
94
  export const showBanner = getPConnect => {
@@ -50,12 +50,14 @@ function ListViewActionButtons(props: ListViewActionButtonsProps) {
50
50
  .getActionsApi()
51
51
  .submitEmbeddedDataModal(context)
52
52
  .then(() => {
53
- setIsDisabled(false);
54
53
  closeActionsDialog();
55
54
  })
56
55
  .catch(err => {
57
56
  // eslint-disable-next-line no-console
58
57
  console.log(err);
58
+ })
59
+ .finally(() => {
60
+ setIsDisabled(false);
59
61
  });
60
62
  }}
61
63
  >
@@ -1,7 +1,7 @@
1
1
  import { useEffect, createElement } from 'react';
2
2
 
3
3
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
- import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
4
+ import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/infra/Containers/container-helpers';
5
5
 
6
6
  const processRootViewDetails = (rootView, containerItem, options) => {
7
7
  const {
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @typescript-eslint/no-shadow */
2
- /* eslint-disable operator-assignment */
3
2
  import { forwardRef, PropsWithChildren, useEffect, useRef, useState } from 'react';
4
3
  import { TextField } from '@mui/material';
5
4
  import { v4 as uuidv4 } from 'uuid';
@@ -20,7 +19,7 @@ interface DashboardFilterProps extends PConnProps {
20
19
  }
21
20
 
22
21
  export default function DashboardFilter(props: PropsWithChildren<DashboardFilterProps>) {
23
- const { children = [], name, filterProp, type = '', metadata = null, getPConnect } = props;
22
+ const { children, name, filterProp, type = '', metadata = null, getPConnect } = props;
24
23
  const { current: filterId } = useRef(uuidv4());
25
24
 
26
25
  const [startDate, setStartDate] = useState(null);
@@ -35,7 +34,7 @@ export default function DashboardFilter(props: PropsWithChildren<DashboardFilter
35
34
  } else if (type === 'RadioButtons') {
36
35
  const reference = getPConnect().getFullReference() + filterProp;
37
36
  const radList = document.getElementsByName(reference);
38
- for (let i = 0; i < radList.length; i = i + 1) {
37
+ for (let i = 0; i < radList.length; i += 1) {
39
38
  if ((radList[i] as HTMLInputElement).value === '') {
40
39
  (radList[i] as HTMLInputElement).checked = true;
41
40
  } else {
@@ -46,7 +46,6 @@ export const createFilterComponent = (getPConnect, filterMeta, index) => {
46
46
  }
47
47
  let propInfo: any = PCore.getMetadataUtils().getPropertyMetadata(cleanedName, filterMeta.config.ruleClass);
48
48
  if (!propInfo) {
49
- // @ts-ignore - PCore.getMetadataUtils().getPropertyMetadata - An argument for 'currentClassID' was not provided.
50
49
  propInfo = PCore.getMetadataUtils().getPropertyMetadata(cleanedName);
51
50
  }
52
51
  const { type: propertyType } = propInfo || { type: 'Text' };
@@ -78,11 +77,10 @@ export const buildFilterComponents = (getPConnect, allFilters) => {
78
77
  const filterComponents = allFilters.children.map((filter, index) => createFilterComponent(getPConnect, filter, index));
79
78
  if (filterComponents && filterComponents.length > 0) {
80
79
  filterComponents.push(
81
- <Grid>
80
+ <Grid style={{ display: 'flex', alignItems: 'center' }}>
82
81
  <Link
83
82
  style={{ cursor: 'pointer' }}
84
83
  onClick={() => {
85
- // @ts-ignore - second parameter “payload” for publish method should be optional
86
84
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL);
87
85
  }}
88
86
  underline='hover'