@pega/react-sdk-overrides 0.242.6 → 0.242.8

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.
@@ -78,7 +78,7 @@ export default function CancelAlert(props: CancelAlertProps) {
78
78
  });
79
79
  } else if (isLocalAction) {
80
80
  dismiss(true);
81
- actionsAPI.cancelAssignment(containerItemID);
81
+ actionsAPI.cancelAssignment(containerItemID, false);
82
82
  } else if (isBulkAction) {
83
83
  dismiss(true);
84
84
  actionsAPI.cancelBulkAction(containerItemID);
@@ -56,7 +56,7 @@ export default function Currency(props: CurrrencyProps) {
56
56
  const theCurrSep = theSymbols.theDigitGroupSeparator;
57
57
 
58
58
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
59
- const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
59
+ const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
60
60
 
61
61
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
62
62
 
@@ -68,7 +68,7 @@ export default function Decimal(props: DecimalProps) {
68
68
  if (formatter === 'Currency') {
69
69
  formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
70
70
  } else {
71
- formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
71
+ formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
72
72
  }
73
73
 
74
74
  if (displayMode === 'DISPLAY_ONLY') {
@@ -50,7 +50,7 @@ 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
54
 
55
55
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
56
56
 
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from 'react';
2
- import MuiPhoneNumber from 'material-ui-phone-number';
2
+ import { MuiTelInput } from 'mui-tel-input';
3
3
 
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
5
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
@@ -57,12 +57,12 @@ export default function Phone(props: PhoneProps) {
57
57
  const disableDropdown = true;
58
58
  return (
59
59
  <div>
60
- <MuiPhoneNumber
60
+ <MuiTelInput
61
61
  fullWidth
62
62
  helperText={helperTextToDisplay}
63
63
  placeholder={placeholder ?? ''}
64
64
  size='small'
65
- defaultCountry='us'
65
+ defaultCountry='US'
66
66
  required={required}
67
67
  disabled={disabled}
68
68
  onChange={onChange}
@@ -91,13 +91,13 @@ export default function Phone(props: PhoneProps) {
91
91
  };
92
92
 
93
93
  return (
94
- <MuiPhoneNumber
94
+ <MuiTelInput
95
95
  fullWidth
96
96
  variant='outlined'
97
97
  helperText={helperTextToDisplay}
98
98
  placeholder={placeholder ?? ''}
99
99
  size='small'
100
- defaultCountry='us'
100
+ defaultCountry='US'
101
101
  required={required}
102
102
  disabled={disabled}
103
103
  onChange={handleChange}
@@ -46,6 +46,7 @@ export default function ScalarList(props: ScalarListProps) {
46
46
  }
47
47
  },
48
48
  '',
49
+ // @ts-ignore
49
50
  '',
50
51
  {}
51
52
  ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
@@ -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
  }
@@ -206,7 +206,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
206
206
  showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
207
207
  });
208
208
  } else {
209
- const cancelPromise = cancelAssignment(itemKey);
209
+ const cancelPromise = cancelAssignment(itemKey, false);
210
210
 
211
211
  cancelPromise
212
212
  .then(data => {
@@ -266,7 +266,9 @@ export const FlowContainer = (props: FlowContainerProps) => {
266
266
  // if have caseMessage show message and end
267
267
  const theCaseMessages = localizedVal(thePConn.getValue('caseMessages', ''), localeCategory); // 2nd arg empty string until typedefs properly allow optional
268
268
 
269
- if (theCaseMessages || !hasAssignments()) {
269
+ // caseMessages's behavior has changed in 24.2, and hence it doesn't let Optional Action work.
270
+ // Changing the below condition for now. Was: (theCaseMessages || !hasAssignments())
271
+ if (!hasAssignments()) {
270
272
  // Temp fix for 8.7 change: confirmationNote no longer coming through in caseMessages$.
271
273
  // So, if we get here and caseMessages$ is empty, use default value in DX API response
272
274
  setCaseMessages(theCaseMessages || localizedVal('Thank you! The next step in this case has been routed appropriately.', localeCategory));
@@ -288,7 +290,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
288
290
 
289
291
  const caseId = thePConn.getCaseSummary().content.pyID;
290
292
  const urgency = getPConnect().getCaseSummary().assignments ? getPConnect().getCaseSummary().assignments?.[0].urgency : '';
291
- const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName());
293
+ const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName() || '');
292
294
 
293
295
  const bShowBanner = showBanner(getPConnect);
294
296
 
@@ -49,10 +49,15 @@ function ListViewActionButtons(props: ListViewActionButtonsProps) {
49
49
  getPConnect()
50
50
  .getActionsApi()
51
51
  .submitEmbeddedDataModal(context)
52
- .then(() => {})
52
+ .then(() => {
53
+ closeActionsDialog();
54
+ })
55
+ .catch(err => {
56
+ // eslint-disable-next-line no-console
57
+ console.log(err);
58
+ })
53
59
  .finally(() => {
54
60
  setIsDisabled(false);
55
- closeActionsDialog();
56
61
  });
57
62
  }}
58
63
  >
@@ -69,8 +69,8 @@ export default function DeferLoad(props: DeferLoadProps) {
69
69
  const getViewOptions = () => ({
70
70
  viewContext: resourceType,
71
71
  pageClass: loadViewCaseID ? '' : (pConnect.getDataObject('') as any).pyPortal.classID, // 2nd arg empty string until typedef allows optional
72
- container: isContainerPreview ? 'preview' : null,
73
- containerName: isContainerPreview ? 'preview' : null,
72
+ container: isContainerPreview ? 'preview' : undefined,
73
+ containerName: isContainerPreview ? 'preview' : undefined,
74
74
  updateData: isContainerPreview
75
75
  });
76
76
 
@@ -165,4 +165,5 @@
165
165
 
166
166
  .scrollable {
167
167
  overflow-y: scroll !important;
168
+ min-height: 200px !important;
168
169
  }
@@ -179,7 +179,7 @@ export default function RootContainer(props: PropsWithChildren<RootContainerProp
179
179
  }
180
180
  };
181
181
 
182
- if (!PCore.isDeepEqual(currentRootConfig, prevRootConfig)) {
182
+ if (prevRootConfig && !PCore.isDeepEqual(currentRootConfig, prevRootConfig)) {
183
183
  rootView.current = createElement(createPConnectComponent(), PCore.createPConnect(currentRootConfig)) as any;
184
184
  }
185
185
 
@@ -73,7 +73,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
73
73
  const pConn = getPConnect();
74
74
  const envInfo = PCore.getEnvironmentInfo();
75
75
  const imageKey = envInfo.getOperatorImageInsKey();
76
- const userName = envInfo.getOperatorName();
76
+ const userName = envInfo.getOperatorName() || '';
77
77
  const currentUserInitials = Utils.getInitials(userName);
78
78
  const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
79
79
  const portalClass = pConn.getValue('.classID', ''); // 2nd arg empty string until typedef marked correctly
@@ -101,7 +101,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
101
101
  );
102
102
  // Initial setting of appName and mapChildren
103
103
  useEffect(() => {
104
- setAppName(PCore.getEnvironmentInfo().getApplicationName());
104
+ setAppName(PCore.getEnvironmentInfo().getApplicationName() || '');
105
105
 
106
106
  const tempMap: any = (pConn.getChildren() as any)?.map((child: any, index) => {
107
107
  const theChildComp = child.getPConnect().getComponentName();
@@ -125,7 +125,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
125
125
  .getPageDataAsync(caseTypesAvailableToCreateDP, pConn.getContextName(), {
126
126
  PortalName: portalID
127
127
  })
128
- .then(response => {
128
+ .then((response: { pyCaseTypesAvailableToCreate?: any }) => {
129
129
  if (response?.pyCaseTypesAvailableToCreate) {
130
130
  pConn.replaceState('.pyCaseTypesAvailableToCreate', response.pyCaseTypesAvailableToCreate, {
131
131
  skipDirtyValidation: true
@@ -218,10 +218,10 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
218
218
  portalName={portalName}
219
219
  imageSrc={iconURL}
220
220
  fullImageSrc={fullIconURL}
221
- appName={localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
221
+ appName={localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
222
222
  appInfo={{
223
223
  imageSrc: iconURL,
224
- appName: localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()),
224
+ appName: localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()),
225
225
  onClick: links[0] && /* links[0].onClick ? */ links[0].onClick /* : undefined */
226
226
  }}
227
227
  navLinks={links.filter((link, index) => {
@@ -245,7 +245,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
245
245
  <NavBar
246
246
  getPConnect={getPConnect}
247
247
  pConn={getPConnect()}
248
- appName={localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
248
+ appName={localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
249
249
  pages={pages}
250
250
  caseTypes={caseTypes}
251
251
  />
@@ -41,7 +41,7 @@ export default function Confirmation(props: PropsWithChildren<ConfirmationProps>
41
41
  // Not using whatsNext at the moment, need to figure out the use of it
42
42
  // const whatsNext = datasource?.source;
43
43
  // const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
44
- const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget());
44
+ const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget() || '');
45
45
  const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), activeContainerItemID);
46
46
  const onConfirmViewClose = () => {
47
47
  setShowConfirmView(false);
@@ -52,12 +52,27 @@ interface SimpleTableManualProps extends PConnProps {
52
52
  displayMode?: string;
53
53
  useSeparateViewForEdit: any;
54
54
  viewForEditModal: any;
55
+ validatemessage?: string;
56
+ required?: boolean;
55
57
  }
56
58
 
57
59
  const useStyles = makeStyles((/* theme */) => ({
58
60
  label: {
59
61
  margin: '8px'
60
62
  },
63
+ tableLabel: {
64
+ '&::after': {
65
+ display: 'inline',
66
+ content: '" *"',
67
+ verticalAlign: 'top',
68
+ color: 'var(--app-error-color)'
69
+ }
70
+ },
71
+ message: {
72
+ margin: '8px',
73
+ color: 'var(--app-error-color)',
74
+ fontSize: '14px'
75
+ },
61
76
  header: {
62
77
  background: '#f5f5f5'
63
78
  },
@@ -110,7 +125,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
110
125
  editModeConfig,
111
126
  displayMode,
112
127
  useSeparateViewForEdit,
113
- viewForEditModal
128
+ viewForEditModal,
129
+ required,
130
+ validatemessage
114
131
  } = props;
115
132
  const pConn = getPConnect();
116
133
  const [rowData, setRowData] = useState([]);
@@ -258,11 +275,16 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
258
275
  function generateRowsData() {
259
276
  // if referenceList is empty and dataPageName property value exists then make a datapage fetch call and get the list of data.
260
277
  if (!referenceList.length && dataPageName) {
261
- getDataPage(dataPageName, parameters, context).then(listData => {
262
- const data = formatRowsData(listData);
263
- myRows = data;
264
- setRowData(data);
265
- });
278
+ getDataPage(dataPageName, parameters, context)
279
+ .then(listData => {
280
+ const data = formatRowsData(listData);
281
+ myRows = data;
282
+ setRowData(data);
283
+ })
284
+ .catch(e => {
285
+ // eslint-disable-next-line no-console
286
+ console.log(e);
287
+ });
266
288
  } else {
267
289
  // The referenceList prop has the JSON data for each row to be displayed
268
290
  // in the table. So, iterate over referenceList to create the dataRows that
@@ -301,6 +323,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
301
323
  if (allowEditingInModal && defaultView) {
302
324
  pConn
303
325
  .getActionsApi()
326
+ // @ts-ignore
304
327
  .openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
305
328
  } else {
306
329
  // @ts-ignore - An argument for 'pageRef' was not provided.
@@ -317,6 +340,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
317
340
  if (typeof selectedRowIndex.current === 'number') {
318
341
  pConn
319
342
  .getActionsApi()
343
+ // @ts-ignore
320
344
  .openEmbeddedDataModal(
321
345
  bUseSeparateViewForEdit ? editView : defaultView,
322
346
  pConn,
@@ -378,6 +402,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
378
402
  };
379
403
 
380
404
  function descendingComparator<T>(a: T, b: T, orderedBy: keyof T) {
405
+ if (!orderedBy || (!a[orderedBy] && !b[orderedBy])) {
406
+ return 0;
407
+ }
381
408
  if (!b[orderedBy] || b[orderedBy] < a[orderedBy]) {
382
409
  return -1;
383
410
  }
@@ -575,10 +602,11 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
575
602
  <>
576
603
  <TableContainer component={Paper} style={{ margin: '4px 0px' }} id='simple-table-manual'>
577
604
  {propsToUse.label && (
578
- <h3 className={classes.label}>
605
+ <h3 className={`${classes.label} ${required ? classes.tableLabel : ''}`}>
579
606
  {propsToUse.label} {results()}
580
607
  </h3>
581
608
  )}
609
+ {validatemessage && <div className={classes.message}>{validatemessage}</div>}
582
610
  <Table>
583
611
  <TableHead className={classes.header}>
584
612
  <TableRow>
@@ -34,6 +34,7 @@
34
34
 
35
35
  .file-error {
36
36
  color: var(--app-error-color);
37
+ font-size: 14px;
37
38
  }
38
39
 
39
40
  .psdk-utility-card {
@@ -33,7 +33,7 @@ const updateAttachmentState = (pConn, key, attachments) => {
33
33
  };
34
34
 
35
35
  export default function Attachment(props: AttachmentProps) {
36
- const { value, getPConnect, label, validatemessage, allowMultiple, extensions, displayMode } = props;
36
+ const { value, getPConnect, label, validatemessage, allowMultiple, extensions, displayMode, helperText } = props;
37
37
  /* this is a temporary fix because required is supposed to be passed as a boolean and NOT as a string */
38
38
  let { required, disabled } = props;
39
39
  [required, disabled] = [required, disabled].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
@@ -461,7 +461,7 @@ export default function Attachment(props: AttachmentProps) {
461
461
  <div className='file-upload-container'>
462
462
  <span className={`label ${required ? 'file-label' : ''}`}>{label}</span>
463
463
  {((files.length === 0 && allowMultiple !== 'true') || allowMultiple === 'true') && <section>{content}</section>}
464
- {validatemessage !== '' ? <span className='file-error'>{validatemessage}</span> : ''}
464
+ {validatemessage !== '' ? <span className='file-error'>{validatemessage}</span> : <span style={{ fontSize: '14px' }}>{helperText}</span>}
465
465
  {files && files.length > 0 && <section>{fileDisplay}</section>}
466
466
  </div>
467
467
  );
@@ -129,7 +129,7 @@ export default function ToDo(props: ToDoProps) {
129
129
  const CONSTS = PCore.getConstants();
130
130
 
131
131
  const bLogging = true;
132
- const currentUser = PCore.getEnvironmentInfo().getOperatorName();
132
+ const currentUser = PCore.getEnvironmentInfo().getOperatorName() ?? '';
133
133
  const currentUserInitials = Utils.getInitials(currentUser);
134
134
  const assignmentsSource = datasource?.source || myWorkList?.source;
135
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.242.6",
3
+ "version": "0.242.8",
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": [