Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typedef changes #410

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@pega/configs": "^0.7.1",
"@pega/constellationjs": "~0.242.5",
"@pega/eslint-config": "^0.7.2",
"@pega/pcore-pconnect-typedefs": "~3.0.0",
"@pega/pcore-pconnect-typedefs": "^3.2.0-alpha.2",
"@pega/tsconfig": "^0.6.0",
"@playwright/test": "^1.40.1",
"@testing-library/jest-dom": "^5.17.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ export default function CancelAlert(props: CancelAlertProps) {
function cancelHandler() {
if (isReverseCoexistence) {
dismiss(true);
// @ts-ignore - An argument for 'payload' was not provided.
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);
} else if (!isDataObject && !isLocalAction && !isBulkAction) {
disableButton(btnIds.DELETE);
actionsAPI
.deleteCaseInCreateStage(containerItemID, hideDelete)
.then(() => {
// @ts-ignore - An argument for 'payload' was not provided.
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
})
.catch(() => {
Expand All @@ -78,13 +76,12 @@ export default function CancelAlert(props: CancelAlertProps) {
});
} else if (isLocalAction) {
dismiss(true);
actionsAPI.cancelAssignment(containerItemID);
actionsAPI.cancelAssignment(containerItemID, false);
} else if (isBulkAction) {
dismiss(true);
actionsAPI.cancelBulkAction(containerItemID);
} else {
dismiss(true);
// @ts-ignore - Argument of type '{ containerItemID: string; skipReleaseLockRequest: any; }' is not assignable to parameter of type 'ContainerInfo'.
containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function Currency(props: CurrrencyProps) {
const theCurrSep = theSymbols.theDigitGroupSeparator;

const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);

let readOnlyProp = {}; // Note: empty if NOT ReadOnly

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function Decimal(props: DecimalProps) {
if (formatter === 'Currency') {
formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
} else {
formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
}

if (displayMode === 'DISPLAY_ONLY') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export default function Dropdown(props: DropdownProps) {
return (
<FieldValueList
name={hideLabel ? '' : label}
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
/>
);
Expand All @@ -179,7 +178,6 @@ export default function Dropdown(props: DropdownProps) {
return (
<FieldValueList
name={hideLabel ? '' : label}
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
variant='stacked'
/>
Expand Down Expand Up @@ -224,7 +222,6 @@ export default function Dropdown(props: DropdownProps) {
>
{options.map((option: any) => (
<MenuItem key={option.key} value={option.key}>
{/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
{thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
</MenuItem>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function Percentage(props: PercentageProps) {
const helperTextToDisplay = validatemessage || helperText;

const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);

let readOnlyProp = {}; // Note: empty if NOT ReadOnly

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
return (
<FieldValueList
name={hideLabel ? '' : label}
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
/>
);
Expand All @@ -75,7 +74,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
return (
<FieldValueList
name={hideLabel ? '' : label}
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
variant='stacked'
/>
Expand All @@ -102,7 +100,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
label={thePConn.getLocalizedValue(
theOption.value,
localePath,
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
)}
control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ export default function ScalarList(props: ScalarListProps) {
{
type: componentType,
config: {
// @ts-ignore - Type '{ readOnly: true; displayInModal: boolean; value: any; displayMode: string; label: string; }' is not assignable to type 'ComponentMetadataConfig'.
value: scalarValue,
displayMode: 'DISPLAY_ONLY',
label,
...restProps,
// @ts-ignore - Type 'string' is not assignable to type 'boolean | undefined'.
readOnly: 'true'
}
},
'',
'',
0,
{}
); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ const UserReference = (props: UserReferenceProps) => {
};

PCore.getRestClient()
// @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
// @ts-ignore - Expected 3 arguments, but got 2
.invokeRestApi('getListData', { queryPayload })
.then((res: any) => {
const ddDataSource = res.data.data.map(listItem => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class Utils {
return arReturn;
}

static getInitials(userName: string): string {
static getInitials(userName: string | undefined): string {
let userInitials = userName;

if (userName && userName !== '') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
}

function onSaveActionSuccess(data) {
actionsAPI.cancelAssignment(itemKey).then(() => {
actionsAPI.cancelAssignment(itemKey, false).then(() => {
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
});
}
Expand All @@ -174,7 +174,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {

savePromise
.then(() => {
// @ts-ignore - Property 'c11nEnv' is private and only accessible within class 'CaseInfo'.
const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
onSaveActionSuccess({ caseType, caseID, assignmentID });
})
Expand All @@ -189,10 +188,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
// check if create stage (modal)
const { PUB_SUB_EVENTS } = PCore.getConstants();
const { publish } = PCore.getPubSubUtils();
// @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
const isLocalAction =
// @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
thePConn.getCaseInfo().isLocalAction() ||
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
Expand All @@ -206,7 +203,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
});
} else {
const cancelPromise = cancelAssignment(itemKey);
const cancelPromise = cancelAssignment(itemKey, false);

cancelPromise
.then(data => {
Expand Down Expand Up @@ -275,7 +272,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
}

// expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
// @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
const context = thePConn.getContextName();
const pageReference = thePConn.getPageReference();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
}, []);

useEffect(() => {
// @ts-ignore - Property 'getMetadata' is private and only accessible within class 'C11nEnv'
if (isInitialized && pConnectOfFlowContainer.getMetadata().children && !hasItems) {
if (isInitialized && pConnectOfFlowContainer.getMetadata()?.children && !hasItems) {
// ensuring not to add container items, if container already has items
// because during multi doc mode, we will have container items already in store
addContainerItem(pConnectOfFlowContainer);
Expand Down Expand Up @@ -274,7 +273,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
setShowConfirm(true);

// publish this "assignmentFinished" for mashup, need to get approved as a standard
// @ts-ignore - second parameter “payload” for publish method should be optional
PCore.getPubSubUtils().publish('assignmentFinished');

// debugger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const createFilterComponent = (getPConnect, filterMeta, index) => {
}
let propInfo: any = PCore.getMetadataUtils().getPropertyMetadata(cleanedName, filterMeta.config.ruleClass);
if (!propInfo) {
// @ts-ignore - PCore.getMetadataUtils().getPropertyMetadata - An argument for 'currentClassID' was not provided.
propInfo = PCore.getMetadataUtils().getPropertyMetadata(cleanedName);
}
const { type: propertyType } = propInfo || { type: 'Text' };
Expand Down Expand Up @@ -82,7 +81,6 @@ export const buildFilterComponents = (getPConnect, allFilters) => {
<Link
style={{ cursor: 'pointer' }}
onClick={() => {
// @ts-ignore - second parameter “payload” for publish method should be optional
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL);
}}
underline='hover'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export default function DeferLoad(props: DeferLoadProps) {
getPConnect()
.getActionsApi()
.showData(name, dataContext, dataContextParameters, {
// @ts-ignore - Type 'boolean' is not assignable to type 'string'
skipSemanticUrl: true,
// @ts-ignore
isDeferLoaded: true
Expand All @@ -129,7 +128,7 @@ export default function DeferLoad(props: DeferLoadProps) {
// Rendering defer loaded tabs in case/ page context
getPConnect()
.getActionsApi()
.loadView(encodeURI(loadViewCaseID), name, getViewOptions())
.loadView(encodeURI(loadViewCaseID), name, getViewOptions() as any)
.then(data => {
onResponse(data);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default function ErrorBoundary(props: ErrorBoundaryProps) {

if (pConn.getContainerName() === WORK_AREA || pConn.isInsideList() === true || pConn.getContainerName() === 'modal') {
const { publish } = PCore.getPubSubUtils();
// @ts-ignore - second parameter “payload” for publish method should be optional
publish(ERROR_WHILE_RENDERING);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default function Reference(props: ReferenceProps) {
const { visibility = true, context = '', getPConnect, readOnly = false, displayMode = '' } = props;

const pConnect = getPConnect();
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
const referenceConfig = { ...pConnect.getComponentConfig() } || {};

delete referenceConfig?.name;
Expand All @@ -34,8 +33,7 @@ export default function Reference(props: ReferenceProps) {
}
};

// @ts-ignore - Argument of type 'null' is not assignable to parameter of type 'string'.
const viewComponent: any = pConnect.createComponent(viewObject, null, null, {
const viewComponent: any = pConnect.createComponent(viewObject, '', 0, {
pageReference: context && context.startsWith('@CLASS') ? '' : context
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default function RootContainer(props: PropsWithChildren<RootContainerProp
}
};
}
const prevRootConfig = usePrevious(rootViewConfig);
const prevRootConfig: any = usePrevious(rootViewConfig);

if (renderingModes.includes(renderingMode) && messages && routingInfo && routingInfo?.accessedOrder.length === 0) {
return <div id='root-container'>{banners}</div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
const imageKey = envInfo.getOperatorImageInsKey();
const userName = envInfo.getOperatorName();
const currentUserInitials = Utils.getInitials(userName);
const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
const appNameToDisplay: any = showAppName ? envInfo.getApplicationLabel() : '';
const portalClass = pConn.getValue('.classID', ''); // 2nd arg empty string until typedef marked correctly
const envPortalName = envInfo.getPortalName();
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
Expand All @@ -86,7 +86,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
const [imageBlobUrl, setImageBlobUrl] = useState<string | null>(null);
// useState for appName and mapChildren - note these are ONLY updated once (on component mount!)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [appName, setAppName] = useState('');
const [appName, setAppName] = useState<string | undefined>('');
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [mapChildren, setMapChildren] = useState([]);

Expand Down Expand Up @@ -117,7 +117,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
}, []);

useEffect(() => {
// @ts-ignore
// @ts-ignore Property 'pyCaseTypesAvailableToCreateDP' does not exist on type ...
const caseTypesAvailableToCreateDP = PCore.getEnvironmentInfo().environmentInfoObject?.pxApplication?.pyCaseTypesAvailableToCreateDP;
if (caseTypesAvailableToCreateDP) {
const portalID = pConn.getValue('.pyOwner');
Expand All @@ -126,8 +126,8 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
PortalName: portalID
})
.then(response => {
if (response?.pyCaseTypesAvailableToCreate) {
pConn.replaceState('.pyCaseTypesAvailableToCreate', response.pyCaseTypesAvailableToCreate, {
if ((response as any)?.pyCaseTypesAvailableToCreate) {
pConn.replaceState('.pyCaseTypesAvailableToCreate', (response as any).pyCaseTypesAvailableToCreate, {
skipDirtyValidation: true
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {

useEffect(() => {
if (hasNewAttachments) {
// @ts-ignore - Argument of type 'boolean' is not assignable to parameter of type 'object'
PCore.getPubSubUtils().publish((PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, true);
}
}, [hasNewAttachments]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function Confirmation(props: PropsWithChildren<ConfirmationProps>
// Not using whatsNext at the moment, need to figure out the use of it
// const whatsNext = datasource?.source;
// const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget());
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget() as any);
const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), activeContainerItemID);
const onConfirmViewClose = () => {
setShowConfirmView(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function DynamicTabs(props: DynamicTabsProps) {
// Get the inherited props from the parent to determine label settings
const propsToUse = { label, showLabel, ...pConnect.getInheritedProps() };
const defaultTabIndex = 0;
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
const { tablabel } = pConnect.getComponentConfig();
const tablabelProp = PCore.getAnnotationUtils().getPropertyName(tablabel);
const referenceListData: any = pConnect.getValue(`${referenceList}.pxResults`, ''); // 2nd arg empty string until typedefs properly allow optional
Expand Down
Loading
Loading