@pega/react-sdk-overrides 0.25.7 → 0.25.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.
@@ -33,8 +33,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
33
33
 
34
34
  const actionsAPI = thePConn.getActionsApi();
35
35
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
36
+ const localizationService = thePConn.getLocalizationService();
36
37
  const localeCategory = 'Assignment';
37
- const localeReference = getPConnect()?.getCaseLocaleReference();
38
38
 
39
39
  // store off bound functions to above pointers
40
40
  const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
@@ -76,7 +76,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
76
76
  function getStepsInfo(steps, formedSteps: any = []) {
77
77
  steps.forEach(step => {
78
78
  if (step.name) {
79
- step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
79
+ step.name = localizationService.getLocalizedText(step.name);
80
80
  }
81
81
  if (step.steps) {
82
82
  formedSteps = getStepsInfo(step.steps, formedSteps);
@@ -133,9 +133,19 @@ export default function NavBar(props: NavBarProps) {
133
133
  const portalLogoImage = Utils.getIconPath(Utils.getSDKStaticConentUrl()).concat('pzpega-logo-mark.svg');
134
134
  const portalOperator = PCore.getEnvironmentInfo().getOperatorName();
135
135
  const portalApp = PCore.getEnvironmentInfo().getApplicationLabel();
136
-
136
+ // @ts-ignore
137
+ const localeReference = PCore.getLocaleUtils().getPortalLocaleReference() || pConn.getValue('.pyLocaleReference');
137
138
  useEffect(() => {
138
- setNavPages(JSON.parse(JSON.stringify(pages)));
139
+ const updatedPages = pages.map((page: any) => {
140
+ const destinationObject: any = {};
141
+ pConn.resolveConfigProps(
142
+ { defaultHeading: page.pyDefaultHeading || page.pyLabel, localeReference: page.pyLocalizationReference },
143
+ destinationObject
144
+ );
145
+ const name = localeUtils.getLocaleValue(destinationObject.defaultHeading, '', destinationObject.localeReference || localeReference);
146
+ return { ...page, name };
147
+ });
148
+ setNavPages(updatedPages);
139
149
  }, [pages]);
140
150
 
141
151
  function navPanelButtonClick(oPageData: any) {
@@ -249,7 +259,7 @@ export default function NavBar(props: NavBarProps) {
249
259
  {navPages.map(page => (
250
260
  <ListItemButton onClick={() => navPanelButtonClick(page)} key={page.pyLabel}>
251
261
  <ListItemIcon>{iconMap[page.pxPageViewIcon]}</ListItemIcon>
252
- <ListItemText primary={localeUtils.getLocaleValue(page.pyLabel, '', localeUtils.getCaseLocaleReference(page.pyClassName))} />
262
+ <ListItemText primary={page.name} />
253
263
  </ListItemButton>
254
264
  ))}
255
265
  </List>
@@ -57,14 +57,13 @@ export default function Stages(props: StagesProps) {
57
57
 
58
58
  const { getPConnect, stages } = props;
59
59
  const pConn = getPConnect();
60
- const key = getPConnect()?.getCaseLocaleReference();
61
-
60
+ const localizationService = pConn.getLocalizationService();
62
61
  const filteredStages = getFilteredStages(stages);
63
62
  const currentStageID = pConn.getValue(PCore.getConstants().CASE_INFO.STAGEID, ''); // 2nd arg empty string until typedef allows optional
64
63
  const stagesObj = filteredStages.map((stage, index, arr) => {
65
64
  const theID = stage.ID || stage.id;
66
65
  return {
67
- name: PCore.getLocaleUtils().getLocaleValue(stage.name, undefined, key),
66
+ name: localizationService.getLocalizedText(stage.name),
68
67
  id: theID,
69
68
  complete: stage.visited_status === 'completed',
70
69
  current: theID === currentStageID,
@@ -70,8 +70,9 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
70
70
  const editAction = availableActions.find(action => action.ID === 'pyUpdateCaseDetails');
71
71
 
72
72
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
73
+ const localizationService = thePConn.getLocalizationService();
73
74
  const localeCategory = 'CaseView';
74
- const localeKey = thePConn?.getCaseLocaleReference();
75
+
75
76
  /**
76
77
  *
77
78
  * @param inName the metadata <em>name</em> that will cause a region to be returned
@@ -214,7 +215,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
214
215
  className={classes.caseViewHeader}
215
216
  title={
216
217
  <Typography variant='h6' component='div' id='case-name'>
217
- {PCore.getLocaleUtils().getLocaleValue(header, '', localeKey)}
218
+ {localizationService.getLocalizedText(header)}
218
219
  </Typography>
219
220
  }
220
221
  subheader={
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.25.7",
3
+ "version": "0.25.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": [