Skip to content

Commit b477dca

Browse files
committed
US-706078: Namespace changes for Gallery Components.
1 parent 103e508 commit b477dca

File tree

33 files changed

+178
-95
lines changed

33 files changed

+178
-95
lines changed

src/components/Pega_Extensions_Banner/demo.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const setPCore = () => {
2121
CASE_INFO: {},
2222
};
2323
},
24+
getNameSpaceUtils: () => {
25+
return {
26+
getDefaultQualifiedName: (name: string) => name,
27+
};
28+
},
2429
getMessagingServiceManager: () => {
2530
return {
2631
subscribe: () => {

src/components/Pega_Extensions_Banner/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const PegaExtensionsBanner = (props: BannerProps) => {
4747
queryPayload: {
4848
caseClassName: className,
4949
caseID: caseInstanceKey,
50-
viewID: 'pyCaseSummary',
50+
viewID: (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyCaseSummary'),
5151
},
5252
})
5353
.then((response: any) => {
@@ -122,14 +122,16 @@ export const PegaExtensionsBanner = (props: BannerProps) => {
122122
if (dataPage) {
123123
const pConn = getPConnect();
124124
const CaseInstanceKey = pConn.getValue((window as any).PCore.getConstants().CASE_INFO.CASE_INFO_ID);
125+
const pyID = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyID');
125126
const payload = {
126-
dataViewParameters: [{ pyID: CaseInstanceKey, ...(dismissed ? { dismissed: true } : null) }],
127+
dataViewParameters: [{ [pyID]: CaseInstanceKey, ...(dismissed ? { dismissed: true } : null) }],
127128
};
128129
(window as any).PCore.getDataApiUtils()
129130
.getData(dataPage, payload, pConn.getContextName())
130131
.then((response: any) => {
131132
if (response.data.data !== null) {
132-
setMessages(response.data.data.map((message: any) => message.pyDescription));
133+
const pyDescription = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyDescription');
134+
setMessages(response.data.data.map((message: any) => message[pyDescription]));
133135
if (dismissed) {
134136
refreshForm();
135137
}

src/components/Pega_Extensions_Calendar/demo.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ const setPCore = () => {
4646
getLazyComponent: (f: string) => f,
4747
};
4848
},
49+
getNameSpaceUtils: () => {
50+
return {
51+
getDefaultQualifiedName: (name: string) => name,
52+
};
53+
},
4954
getEnvironmentInfo: () => {
5055
return {
5156
getTimeZone: () => 'local',

src/components/Pega_Extensions_Calendar/index.tsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,14 @@ export const PegaExtensionsCalendar = (props: CalendarProps) => {
140140
isdayGrid = false;
141141
}
142142
const eventDateStr = `${obj[startTimeProperty].substring(0, 5)} - ${obj[endTimeProperty].substring(0, 5)}`;
143+
const pyID = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyID');
144+
const pxObjClass = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pxObjClass');
145+
const pzInsKey = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pzInsKey');
146+
const pyStatusWork = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyStatusWork');
143147
const linkURL = (window as any).PCore.getSemanticUrlUtils().getResolvedSemanticURL(
144148
(window as any).PCore.getSemanticUrlUtils().getActions().ACTION_OPENWORKBYHANDLE,
145-
{ caseClassName: obj.pxObjClass },
146-
{ workID: obj.pyID },
149+
{ caseClassName: obj[pxObjClass] },
150+
{ workID: obj[pyID] },
147151
);
148152
const linkEl = (
149153
<Link
@@ -161,18 +165,18 @@ export const PegaExtensionsCalendar = (props: CalendarProps) => {
161165
}
162166
onPreview={() => {
163167
getPConnect().getActionsApi().showCasePreview(encodeURI(eventInfo.event.id), {
164-
caseClassName: obj.pxObjClass,
168+
caseClassName: obj[pxObjClass],
165169
});
166170
}}
167171
onClick={(e: MouseEvent<HTMLButtonElement>) => {
168172
/* for links - need to set onClick for spa to avoid full reload - (cmd | ctrl) + click for opening in new tab */
169173
if (!e.metaKey && !e.ctrlKey) {
170174
e.preventDefault();
171-
getPConnect().getActionsApi().openWorkByHandle(obj.pzInsKey, obj.pxObjClass);
175+
getPConnect().getActionsApi().openWorkByHandle(obj[pzInsKey], obj[pxObjClass]);
172176
}
173177
}}
174178
>
175-
{isdayGrid ? obj.pyID : `${eventInfo.event.title} - ${eventDateStr}`}
179+
{isdayGrid ? obj[pyID] : `${eventInfo.event.title} - ${eventDateStr}`}
176180
</Link>
177181
);
178182
if (!isdayGrid) {
@@ -200,7 +204,7 @@ export const PegaExtensionsCalendar = (props: CalendarProps) => {
200204
{
201205
id: 'status',
202206
name: 'Status',
203-
value: <Status variant='success'>{obj.pyStatusWork}</Status>,
207+
value: <Status variant='success'>{obj[pyStatusWork]}</Status>,
204208
},
205209
]}
206210
/>
@@ -209,6 +213,9 @@ export const PegaExtensionsCalendar = (props: CalendarProps) => {
209213
};
210214

211215
const loadEvents = () => {
216+
const pzInsKey = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pzInsKey');
217+
const pyLabel = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyLabel');
218+
212219
(window as any).PCore.getDataApiUtils()
213220
.getData(dataPage, {})
214221
.then((response: any) => {
@@ -220,8 +227,8 @@ export const PegaExtensionsCalendar = (props: CalendarProps) => {
220227
const endTime = item[endTimeProperty];
221228
if (sessionDate && startTime && endTime) {
222229
tmpevents.push({
223-
id: item.pzInsKey,
224-
title: item.pyLabel,
230+
id: item[pzInsKey],
231+
title: item[pyLabel],
225232
start: new Date(`${sessionDate}T${startTime}`),
226233
end: new Date(`${sessionDate}T${endTime}`),
227234
item,
@@ -234,8 +241,10 @@ export const PegaExtensionsCalendar = (props: CalendarProps) => {
234241
};
235242

236243
const handleEventClick = (eventClickInfo: EventClickArg) => {
244+
const pzInsKey = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pzInsKey');
245+
const pxObjClass = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pxObjClass');
237246
const eventDetails = eventClickInfo.event.extendedProps;
238-
getPConnect().getActionsApi().openWorkByHandle(eventDetails.item.pzInsKey, eventDetails.item.pxObjClass);
247+
getPConnect().getActionsApi().openWorkByHandle(eventDetails.item[pzInsKey], eventDetails.item[pxObjClass]);
239248
};
240249

241250
const handleDateChange = (objInfo: any) => {

src/components/Pega_Extensions_CardGallery/demo.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ const setPCore = (args: any) => {
202202
},
203203
};
204204
},
205+
getNameSpaceUtils: () => {
206+
return {
207+
getDefaultQualifiedName: (name: string) => name,
208+
};
209+
},
205210
createPConnect: () => ({
206211
getPConnect: () => ({
207212
createComponent: (meta: any) => {

src/components/Pega_Extensions_CardGallery/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const PegaExtensionsCardGallery = (props: CardGalleryProps) => {
5656
const editTask = (id: string) => {
5757
getPConnect()
5858
.getActionsApi()
59-
.openLocalAction('pyUpdateCaseDetails', {
59+
.openLocalAction((window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyUpdateCaseDetails'), {
6060
caseID: id,
6161
containerName: 'modal',
6262
actionTitle: getPConnect().getLocalizedValue('Edit task'),
@@ -92,11 +92,11 @@ export const PegaExtensionsCardGallery = (props: CardGalleryProps) => {
9292
query: {
9393
...(filterExpr ? { filter: filterExpr } : null),
9494
select: [
95-
{ field: 'pyID' },
96-
{ field: 'pyLabel' },
97-
{ field: 'pyStatusWork' },
98-
{ field: 'pzInsKey' },
99-
{ field: 'pxObjClass' },
95+
{ field: (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyID') },
96+
{ field: (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyLabel') },
97+
{ field: (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyStatusWork') },
98+
{ field: (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pzInsKey') },
99+
{ field: (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pxObjClass') },
100100
],
101101
},
102102
};
@@ -110,11 +110,11 @@ export const PegaExtensionsCardGallery = (props: CardGalleryProps) => {
110110
const tmpTasks: any = [];
111111
response.data.data.forEach((item: any) => {
112112
tmpTasks.push({
113-
id: item.pyID,
114-
title: item.pyLabel,
115-
status: item.pyStatusWork,
116-
classname: item.pxObjClass,
117-
insKey: item.pzInsKey,
113+
id: item[(window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyID')],
114+
title: item[(window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyLabel')],
115+
status: item[(window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyStatusWork')],
116+
classname: item[(window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pxObjClass')],
117+
insKey: item[(window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pzInsKey')],
118118
isVisible: true,
119119
getDetails,
120120
editTask,
@@ -149,7 +149,7 @@ export const PegaExtensionsCardGallery = (props: CardGalleryProps) => {
149149
prevTasks?.forEach((tmpTask: any) => {
150150
let isVisible = false;
151151
response?.data?.data?.forEach((item: any) => {
152-
if (item.pyID === tmpTask.id) {
152+
if (item[(window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyID')] === tmpTask.id) {
153153
isVisible = true;
154154
tmpIsEmpty = false;
155155
}

src/components/Pega_Extensions_CardGallery/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const loadDetails = async (props: LoadDetailsProps) => {
1616
const { id, classname, detailsDataPage, detailsViewName, getPConnect } = props;
1717
let myElem;
1818
await (window as any).PCore.getDataApiUtils()
19-
.getDataObjectView(detailsDataPage, detailsViewName, { pyID: id })
19+
.getDataObjectView(detailsDataPage, detailsViewName, { [(window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyID')]: id })
2020
.then(async (res: any) => {
2121
const { fetchViewResources, updateViewResources } = (window as any).PCore.getViewResources();
2222
await updateViewResources(res.data);
@@ -39,7 +39,7 @@ export const loadDetails = async (props: LoadDetailsProps) => {
3939
},
4040
};
4141
messageConfig.meta.config.showLabel = false;
42-
messageConfig.meta.config.pyID = id;
42+
messageConfig.meta.config[(window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyID')] = id;
4343
const c11nEnv = (window as any).PCore.createPConnect(messageConfig);
4444

4545
myElem = c11nEnv.getPConnect().createComponent(messageConfig.meta);

src/components/Pega_Extensions_CaseLauncher/demo.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ const setPCore = () => {
2323
getEnvironmentInfo: () => {
2424
return {};
2525
},
26+
getNameSpaceUtils: () => {
27+
return {
28+
getDefaultQualifiedName: (name: string) => name,
29+
};
30+
},
2631
};
2732
};
2833

src/components/Pega_Extensions_CaseLauncher/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const PegaExtensionsCaseLauncher = (props: CaseLauncherProps) => {
2222
/* Create a new case on click of the selected button */
2323
const createCase = (className: string) => {
2424
const options = {
25-
flowType: 'pyStartCase',
25+
flowType: (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pyStartCase'),
2626
containerName: 'primary',
2727
openCaseViewAfterCreate: true,
2828
};

src/components/Pega_Extensions_CheckboxTrigger/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ export const PegaExtensionsCheckboxTrigger = (props: CheckboxTriggerProps) => {
101101
.then((resp: any) => {
102102
const respData = resp?.data?.responseData;
103103
const updateObj = { ...respData };
104-
delete updateObj?.pzInsKey;
104+
const keyToDelete = (window as any).PCore.getNameSpaceUtils().getDefaultQualifiedName('pzInsKey');
105+
if (updateObj && keyToDelete in updateObj) {
106+
delete updateObj[keyToDelete];
107+
}
105108
(window as any).PCore.getStore().dispatch({
106109
type: 'SET_PROPERTY',
107110
payload: {

0 commit comments

Comments
 (0)