@pega/react-sdk-overrides 0.25.6 → 0.25.7

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.
@@ -199,7 +199,8 @@ export function resolveReferenceFields(
199
199
  ...preset,
200
200
  config: {
201
201
  ...preset.config,
202
- displayMode: 'DISPLAY_ONLY'
202
+ displayMode: 'DISPLAY_ONLY',
203
+ contextName: pConnect.getContextName()
203
204
  }
204
205
  },
205
206
  useCustomContext: item
@@ -9,8 +9,7 @@ export function isEmptyObject(obj: object): boolean {
9
9
  * @returns The localized string or the key itself if no translation is found
10
10
  */
11
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];
12
+ const localeStore = PCore.getLocaleUtils().localeStore;
14
13
 
15
14
  if (!localeStore) return key;
16
15
 
@@ -34,7 +34,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
34
34
  const actionsAPI = thePConn.getActionsApi();
35
35
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
36
36
  const localeCategory = 'Assignment';
37
- const localeReference = `${getPConnect().getCaseInfo().getClassName()}!CASE!${getPConnect().getCaseInfo().getName()}`.toUpperCase();
37
+ const localeReference = getPConnect()?.getCaseLocaleReference();
38
38
 
39
39
  // store off bound functions to above pointers
40
40
  const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
@@ -96,7 +96,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
96
96
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
97
97
  const localeCategory = 'Messages';
98
98
 
99
- const key = `${thePConn.getCaseInfo().getClassName()}!CASE!${thePConn.getCaseInfo().getName()}`.toUpperCase();
99
+ const key = getPConnect()?.getCaseLocaleReference();
100
100
  const classes = useStyles();
101
101
 
102
102
  function getBuildName(): string {
@@ -218,7 +218,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
218
218
  <CardHeader
219
219
  id='assignment-header'
220
220
  title={<Typography variant='h6'>{localizedVal(containerName, undefined, key)}</Typography>}
221
- subheader={`${localizedVal('Task in', 'Todo')} ${caseId} \u2022 ${localizedVal('Priority', 'Todo')} ${urgency}`}
221
+ subheader={`${localizedVal('In', 'Todo')} ${caseId} \u2022 ${localizedVal('Priority', 'Todo')} ${urgency}`}
222
222
  avatar={<Avatar className={`${classes.avatar} psdk-avatar`}>{operatorInitials}</Avatar>}
223
223
  />
224
224
  {displayPageMessages()}
@@ -131,7 +131,7 @@ export default function ModalViewContainer(props: ModalViewContainerProps) {
131
131
  const [cancelAlertProps, setCancelAlertProps] = useState({});
132
132
  const [isMultiRecordData, setMultiRecordData] = useState(false);
133
133
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
134
- const localeCategory = 'Data Object';
134
+ const localeCategory = 'ModalContainer';
135
135
 
136
136
  const ERROR_WHILE_RENDERING = 'ERROR_WHILE_RENDERING';
137
137
 
@@ -255,7 +255,7 @@ export default function ModalViewContainer(props: ModalViewContainerProps) {
255
255
  const headingValue =
256
256
  isDataObject || isMultiRecord
257
257
  ? getModalHeading(dataObjectAction)
258
- : determineModalHeaderByAction(actionName, caseTypeName, ID, `${caseInfo?.getClassName()}!CASE!${caseInfo.getName()}`.toUpperCase());
258
+ : determineModalHeaderByAction(actionName, caseTypeName, ID, pConnect?.getCaseLocaleReference());
259
259
 
260
260
  let arChildrenAsReact: any[] = [];
261
261
 
@@ -126,7 +126,6 @@ export default function NavBar(props: NavBarProps) {
126
126
  const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false);
127
127
  const [anchorEl, setAnchorEl] = useState(null);
128
128
  const localeUtils = PCore.getLocaleUtils();
129
- const localeReference = pConn.getValue('.pyLocaleReference');
130
129
 
131
130
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
132
131
  const localeCategory = 'AppShell';
@@ -241,7 +240,7 @@ export default function NavBar(props: NavBarProps) {
241
240
  <ListItemIcon>
242
241
  <WorkOutlineIcon fontSize='large' />
243
242
  </ListItemIcon>
244
- <ListItemText primary={localeUtils.getLocaleValue(caseType.pyLabel, '', localeReference)} />
243
+ <ListItemText primary={localeUtils.getLocaleValue(caseType.pyLabel, '', localeUtils.getCaseLocaleReference(caseType.pyClassName))} />
245
244
  </ListItemButton>
246
245
  ))}
247
246
  </List>
@@ -250,7 +249,7 @@ export default function NavBar(props: NavBarProps) {
250
249
  {navPages.map(page => (
251
250
  <ListItemButton onClick={() => navPanelButtonClick(page)} key={page.pyLabel}>
252
251
  <ListItemIcon>{iconMap[page.pxPageViewIcon]}</ListItemIcon>
253
- <ListItemText primary={localeUtils.getLocaleValue(page.pyLabel, '', localeReference)} />
252
+ <ListItemText primary={localeUtils.getLocaleValue(page.pyLabel, '', localeUtils.getCaseLocaleReference(page.pyClassName))} />
254
253
  </ListItemButton>
255
254
  ))}
256
255
  </List>
@@ -57,7 +57,7 @@ export default function Stages(props: StagesProps) {
57
57
 
58
58
  const { getPConnect, stages } = props;
59
59
  const pConn = getPConnect();
60
- const key = `${pConn.getCaseInfo().getClassName()}!CASE!${pConn.getCaseInfo().getName()}`.toUpperCase();
60
+ const key = getPConnect()?.getCaseLocaleReference();
61
61
 
62
62
  const filteredStages = getFilteredStages(stages);
63
63
  const currentStageID = pConn.getValue(PCore.getConstants().CASE_INFO.STAGEID, ''); // 2nd arg empty string until typedef allows optional
@@ -9,7 +9,6 @@ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
9
9
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
10
10
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
11
11
  import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
12
- import { prepareCaseSummaryData } from '@pega/react-sdk-components/lib/components/template/utils';
13
12
 
14
13
  interface CaseViewProps extends PConnProps {
15
14
  // If any, enter additional props that only exist on this component
@@ -50,7 +49,6 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
50
49
  const CaseViewActionsMenu = getComponentFromMap('CaseViewActionsMenu');
51
50
  const VerticalTabs = getComponentFromMap('VerticalTabs');
52
51
  const DeferLoad = getComponentFromMap('DeferLoad');
53
- const CaseSummary = getComponentFromMap('CaseSummary');
54
52
 
55
53
  const {
56
54
  getPConnect,
@@ -73,7 +71,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
73
71
 
74
72
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
75
73
  const localeCategory = 'CaseView';
76
- const localeKey = `${caseTypeID}!CASE!${caseTypeName}`.toUpperCase();
74
+ const localeKey = thePConn?.getCaseLocaleReference();
77
75
  /**
78
76
  *
79
77
  * @param inName the metadata <em>name</em> that will cause a region to be returned
@@ -90,12 +88,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
90
88
  return null;
91
89
  }
92
90
 
93
- const theSummaryRegion = children && children[0];
94
-
95
- const data = prepareCaseSummaryData(theSummaryRegion);
96
- const primarySummaryFields = data.primarySummaryFields;
97
- const secondarySummaryFields = data.secondarySummaryFields;
98
-
91
+ const theSummaryRegion = getChildRegionByName('summary');
99
92
  const theStagesRegion = getChildRegionByName('stages');
100
93
  const theTodoRegion = getChildRegionByName('todo');
101
94
  const theUtilitiesRegion = getChildRegionByName('utilities');
@@ -237,7 +230,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
237
230
  />
238
231
  {getActionButtonsHtml()}
239
232
  <Divider />
240
- <CaseSummary arPrimaryFields={primarySummaryFields} arSecondaryFields={secondarySummaryFields}></CaseSummary>
233
+ {theSummaryRegion}
241
234
  <Divider />
242
235
  {vertTabInfo.length > 1 && <VerticalTabs tabconfig={vertTabInfo} />}
243
236
  </Card>
@@ -88,8 +88,7 @@ export default function DataReference(props: PropsWithChildren<DataReferenceProp
88
88
  let firstChildPConnect;
89
89
 
90
90
  const localizedPlaceholderOption = placeholder => {
91
- const { GENERIC_BUNDLE_KEY } = PCore.getLocaleUtils?.() ?? {};
92
- const localizedDefaultPlaceholder = pConn.getLocalizedValue('select_placeholder_default', 'CosmosFields', GENERIC_BUNDLE_KEY);
91
+ const localizedDefaultPlaceholder = pConn.getLocalizedValue('select_placeholder_default', '', 'CosmosFields');
93
92
  // If we have a placeholder, push that option in the list of items
94
93
  if (placeholder === 'Select...' && localizedDefaultPlaceholder !== 'select_placeholder_default') {
95
94
  return localizedDefaultPlaceholder;
@@ -1212,7 +1212,7 @@ export default function ListView(props: ListViewProps) {
1212
1212
  </TableBody>
1213
1213
  </Table>
1214
1214
  {(!arRows || arRows.length === 0) && (
1215
- <div className='no-records'>{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}</div>
1215
+ <div className='no-records'>{getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.')}</div>
1216
1216
  )}
1217
1217
  </TableContainer>
1218
1218
  )}
@@ -715,7 +715,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
715
715
  </Table>
716
716
  {((readOnlyMode && (!rowData || rowData?.length === 0)) || (editableMode && (!referenceList || referenceList?.length === 0))) && (
717
717
  <div className='no-records' id='no-records'>
718
- {getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}
718
+ {getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.')}
719
719
  </div>
720
720
  )}
721
721
  </TableContainer>
@@ -180,7 +180,9 @@ export default function ToDo(props: ToDoProps) {
180
180
  };
181
181
 
182
182
  const getAssignmentName = assignment => {
183
- return type === CONSTS.TODO ? assignment.name : assignment.stepName;
183
+ return type === CONSTS.TODO
184
+ ? localizedVal(assignment.name, '', PCore.getLocaleUtils().getCaseLocaleReference(assignment.classname))
185
+ : localizedVal(assignment.stepName, '', PCore.getLocaleUtils().getCaseLocaleReference(assignment.classname));
184
186
  };
185
187
 
186
188
  function showToast(message: string) {
@@ -263,13 +265,16 @@ export default function ToDo(props: ToDoProps) {
263
265
  };
264
266
 
265
267
  const getListItemComponent = assignment => {
268
+ const caseLocaleRef = PCore.getLocaleUtils().getCaseLocaleReference(assignment.classname);
266
269
  if (isDesktop) {
267
270
  return (
268
271
  <>
269
- {localizedVal('Task in', localeCategory)}
272
+ {localizedVal('In', localeCategory)}
270
273
  {renderTaskId(type, getPConnect, showTodoList, assignment)}
271
274
  {type === CONSTS.WORKLIST && assignment.status ? `\u2022 ` : undefined}
272
- {type === CONSTS.WORKLIST && assignment.status ? <span className='psdk-todo-assignment-status'>{assignment.status}</span> : undefined}
275
+ {type === CONSTS.WORKLIST && assignment.status ? (
276
+ <span className='psdk-todo-assignment-status'>{localizedVal(assignment.status, '', caseLocaleRef)}</span>
277
+ ) : undefined}
273
278
  {` \u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`}
274
279
  </>
275
280
  );
@@ -302,8 +307,8 @@ export default function ToDo(props: ToDoProps) {
302
307
  {currentUserInitials}
303
308
  </Avatar>
304
309
  <div style={{ display: 'block' }}>
305
- <Typography variant='h6'>{assignment?.name}</Typography>
306
- {`${localizedVal('Task in', localeCategory)} ${getID(assignment)} \u2022 ${localizedVal(
310
+ <Typography variant='h6'>{localizedVal(assignment?.name, localeCategory)}</Typography>
311
+ {`${localizedVal('In', localeCategory)} ${getID(assignment)} \u2022 ${localizedVal(
307
312
  'Urgency',
308
313
  localeCategory
309
314
  )} ${getPriority(assignment)}`}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.25.6",
3
+ "version": "0.25.7",
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": [