import type { PropertyInfo } from '../globals';
import type { CascadeSubscribersObj, CascadeResetSubscribersObj } from './types';
/**
* @description
* Exposes APIs to handle Datapage parameters for callback subscriptions.
*/
declare class CascadeManager {
readonly name: string;
cascadeSubscribers: CascadeSubscribersObj;
cascadeResetSubscribers: CascadeResetSubscribersObj;
listChangeSubscribers: Function[];
constructor();
/**
* Registers all the dependencies for the target field when the source field changes.
* @description Registers all the dependencies of the target field to perform cascade resetting.
* Cascade resetting is the process of resetting the value of the target field when the value of the source field changes.
*
* @example
In this example, the API registers the dependencies of the backlogId target field.
* Example usage - CascadeManager.registerResetDependencies('app/primary_1', 'caseInfo.content','.backlogId', ['.productId','release'], 'Text', 'singleRecord')
*
* @param contextName The name of the context containing the fields to be registered.
* @param pageReference The reference to the page that contains the field to be registered.
* @param target The field whose dependencies needs to be registered.
* @param dependentProperties Array of fields on which target field is dependent.
* @param fieldType The type of the target field which needs to be registered. eg. Text
* @param mode The selection mode of the target field, the value of mode can singleRecord or multiRecord.
* @public
* @function
*/
registerResetDependencies(contextName: string, pageReference: string, target: string, dependentProperties: string[], fieldType: string, mode?: string): void;
/**
* De-Registers all the dependencies for the target field when the source field changes.
* @description De-registers all the registered dependencies of the target field that have undergone cascade resetting.
* Cascade resetting is the process of resetting the value of the target field when the value of the source field changes.
*
* @example In this example, the API de-registers the registered dependencies of the backlogId target field..
* Example usage - CascadeManager.deregisterResetDependencies('app/primary_1', 'caseInfo.content','.backlogId', ['.productId','release'], 'Text')
*
* @param contextName The name of the context containing the fields to be de-registered.
* @param pageReference The reference to the page that contains the field to be de-registered.
* @param target The field whose dependencies needs to be de-registered.
* @param dependentProperties Array of fields on which target field is dependent.
* @param fieldType The type of the target field which needs to be de-registered. eg. Text
* @public
* @function
*/
deregisterResetDependencies(contextName: string, pageReference: string, target: string, dependentProperties: string[], fieldType: string): void;
/**
* get all the dependencies associated with the property
* @param contextName name of the context
* @param propertyName name of dependent property inside the context
* @returns dependent properties array which needs to be resetted.
* @example Example for getResetDependencies() depicting how to get resetting dependencies for change in productId.
* Example usage - CascadeManager.getResetDependencies('app/primary_1', 'caseInfo.content.productId')
* @private
*/
getResetDependencies(contextName: string, propertyName: string): PropertyInfo[];
/**
* purge dependency map on given contextName
* @param contextName name of the context
* @example Example for purgeResetDependencies() depicting how to purge dependencies on a context.
* Example usage - CascadeManager.purgeResetDependencies('app/primary_1')
* @private
*/
purgeResetDependencies(contextName: string): void;
/**
* Registers the fields to the CascadeManager Class.
* @description Register the fields to the CascadeManager Class.
*
* @example Example for registerFields() depicting how to register the firstName and lastName
* fields to trigger callback.
* Example usage - CascadeManager.registerFields('app/primary_1', 'caseInfo.content', ['firstName','lastName'], () => { console.log("field changed")}, '001-002-003')
*
* @param context The name of the context containing the fields to be registered.
* @param pageReference The reference to the page that contains the field to be registered.
* @param fields Array of fields to be registered.
* @param callback function to be called when the registered field is updated.
* @param subscriptionId uniqueId for registering the fields. The same subscriptionId should be provided for de-registering th fields.
*
* @function
* @public
*/
registerFields(context: string, pageReference: string, fields: string[] | undefined, callback: Function, subscriptionId: string): void;
/**
* Registers the fields of type PageList to the CascadeManager Class.
* @description Registers the field of type PageList to the CascadeManager Class.
*
* @example Example for registerListField() depicting how to register the phoneNumber
* field to trigger callback.
* Example usage - CascadeManager.registerListField('app/primary_1', 'caseInfo.content', phoneNumber, () => { console.log("field changed")}, '002-002-004')
*
* @param context The name of the context containing the field to be registered.
* @param pageReference The reference to the page that contains the field to be registered.
* @param listField field to be registered.
* @param callback function to be called when the registered field is updated.
* @param subscriptionId uniqueId for registering the field. The same subscriptionId should be provided for de-registering th field.
*
* @function
* @public
*/
registerListField(context: string, pageReference: string, listField: string, callback: Function, subscriptionId: string): void;
/**
* De-Registers the field of type PageList from the CascadeManager Class.
* @description De-Registers the field of type PageList from the CascadeManager Class.
*
* @example Example for unRegisterListField() depicting how to de-register
* field.
* Example usage - CascadeManager.unRegisterListField('app/primary_1', 'caseInfo.content', phoneNumber, '002-002-004')
*
* @param context The name of the context containing the field to be de-registered.
* @param pageReference The reference to the page that contains the field to be de-registered.
* @param listField field to be de-registered.
* @param subscriptionId uniqueId for de-registering the field.
*
* @function
* @public
*/
unRegisterListField(context: string, pageReference: string, listField: string, subscriptionId: string): void;
static _getFieldsForList(context: string, pageReference: string, listField: string): string[];
/**
* De-registers the fields from the CascadeManager Class.
* @description De-register fields from the CascadeManager Class.
*
* @example Example for unRegisterFields() depicting how to unregister the firstName and lastName fields.
* Example usage - CascadeManager.unRegisterFields('app/primary_1', 'caseInfo.content', ['firstName','lastName'], '001-002-003')
*
* @param context The name of the context containing the fields to be de-registered.
* @param pageReference The reference to the page that contains the field to be de-registered.
* @param fields Array of fields to be de-registered.
* @param subscriptionId uniqueId for de-registering the fields.
*
* @function
* @public
*/
unRegisterFields(context: string, pageReference: string, fields: string[] | undefined, subscriptionId: string): void;
/**
* Invokes subscribers registered to the fields.
* @description invokes subscribers registered to the fields.
*
* @example Example for triggerCascade() depicting how to triggerCascade for subscribers
* Example usage - CascadeManager.triggerCascade('app/Primary', 'pgRef0', 'value 0')
*
* @param context name of the context
* @param propertyReference reference path
* @param propertyValue property value
*
* @private
*/
triggerCascade(context: string, propertyReference: string, propertyValue: string, changeSet?: Set): void;
purgeCascadeFields(context: string): void;
/**
* @function handleServerChanges
* @param context app context
* @param {string[]} changedListProperty changed list properties
* @param {string[]} leafProperty all leaf properties
* It trigger cascade for all subscribed leaf property and generate pageinstruction for changed list property after server DT.
* @private
*/
handleServerChanges(context: string, changedListProperty?: string[], leafProperty?: string[]): void;
_updateChangedProperties(previousValue: unknown, serverFields: unknown, isChangedListPropertyExist: boolean, pathPrefix: string, context: string, changedListProperty: string[], changedPropertyWithError: string[], lengthMismatchPageListArr: string[]): void;
isChangedListPropertyExist(pathPrefix: string): boolean;
_getServerProperties(serverFields: any, context: string, pathPrefix: string, changedListProperty: string[], leafProperty: string[], changedPropertyWithError: string[], lengthMismatchPageListArr: string[]): void;
/**
* @function getServerProperties
* @param {object} serverData serverData
* @param {string }context app context
* @param {string} path path from serverData
* @returns {object} {changedListProperty,leafProperty}
* return leafProperty and changedListProperty
* @private
*/
getServerProperties(serverData: object, context: string, path?: string): {
changedListProperty: string[];
leafProperty: string[];
changedPropertyWithError: string[];
};
/**
@private
*/
_handlePageReference(pageReference: string, target: string, fieldType: string): string;
/**
* registers the provided function on every redux update which came from server.
* @param callback a callback function which needs to be called when the redux changes
* @private
*/
registerForListChanges(callback?: Function): void;
/**
* This will unRegister all the existing subscribers
* @private
*/
unRegisterForListChanges(): void;
}
declare const _default: CascadeManager;
export default _default;