/**
* @module PConnect
*/
import ValidationApi from '../validation/validation-api';
import ActionsApi from '../actions/api';
import ContainerManager from '../container/container-manager';
import CaseInfo from '../case/case-info';
import type { PropertyModel } from '../rules/types';
import { LocalizationService } from '../locale/LocalizationService';
import type { Meta, Config, ComponentMetadataConfig, CreateC11nEnv } from './types';
/**
* The errorMsgConfig types defines a JSON configuration object used to specify error messages in the store.
* It is used as a parameter to {@link C11nEnv.clearErrorMessages} to indicate which messages should be cleared.
* @example
errorConfig to clear messages on a context
* {category: "HTTP", context: "app/primary"}
* This will clear the error messages at the "app/primary" level which belong to category of type HTTP (like 4XX errors).
*
* @example
errorConfig to clear messages on AppShell
* {category: "HTTP"}
* This will clear the error messages at the App level which belongs to category HTTP.
*
* @example
errorConfig to clearing messages on FirstName property
* {property: ".firstName"}
* This will clear the error messages related to the property: firstName.
*/
type ErrorMsgConfig = {
/** type of message that needs to be deleted (category types - HTTP (App or top level), PAGE (use this category for messages above the assignment)) */
category?: string;
/** on which messages needs to be cleared. Can be empty in which case error messages on app container are cleared. */
context?: string;
/** name on which messages needs to be cleared. */
property: string;
};
/**
*
*/
export declare class C11nEnv {
#private;
useCustomContext?: boolean;
_rawConfig?: ComponentMetadataConfig;
_classID: string | null;
index?: number;
_ruleClass: string | undefined;
private readonly meta?;
private readonly _isRoot;
private readonly options;
private readonly _isExpressionExist;
private readonly _isWhenExist;
private readonly _isValidatorExist;
private readonly _pageReference;
private readonly _referenceContext;
private readonly _contextName;
private readonly _stateProps;
private _actions;
private readonly _children;
private readonly _additionalRegisteredProps;
private _caseInfo;
private readonly viewName;
private readonly parentViewName;
private _referenceList;
private readonly _isInsideList;
private _inheritedConfig;
private readonly _localeRuleName;
private readonly _containerTarget;
private readonly _readOnly;
private _hasSuggestions;
private readonly _isState;
private readonly _type;
private _actionsApi;
private readonly categoryName;
constructor(config: Config);
/**
* This function returns if the paragraph is decision based and if it is then adds it to state props
* @private
*/
_checkAndSetDecisionParagraph(propName: string, propValue: string | undefined): boolean;
/**
* This function returns if the field is configured with declarative target or not
* @private
*/
isDeclarativeTarget(): boolean;
_getPropertyName(): string;
addFieldNode(): void;
removeNode(): void;
addViewNode(): void;
addWhenNode(): void;
updateContextTree(): void;
/**
* Returns the properties which are bound to state, in sense these properties
* are reactive.
* @function getStateProps
*
* @example
* Sample:
* {
* "FirstName": "test value"
* }
* @example
getPConnect().getStateProps()
* const props = getPConnect().getStateProps();
*
* @returns the properties that are bound to the Redux state
*/
getStateProps(): any;
/**
* Set the properties which are bound to state, in sense these properties
* are reactive.
* @example
* @param propsObj object containing each prop name and its value
* @private
*/
setStateProps(propsObj: any): void;
/**
* Returns the metadata, this is raw, unresolved metadata
* @returns - metadata
* @private
*/
getMetadata(): ComponentMetadataConfig | undefined;
/**
* Returns shared datapage record, reads data page name from referenceList in view metadata along with parameters
* @returns - data page records or undefined if no data page found
* @private
*/
getSharedDataPageForReferenceList(): any;
/**
* Returns instance of CaseInfo class bound to redux store current container context
* @function getCaseInfo
* @returns Returns instance of the CaseInfo class
*/
getCaseInfo(): CaseInfo;
/**
* Returns returns case reference string as per current case context.
* @function getCaseLocaleReference
* @returns {String} Returns locale reference for the case type.
* @example
In the example below
* getPconnect().getCaseLocaleReference() returns CASE!SERVICEREQUEST
* @private
*/
getCaseLocaleReference(): string | null;
/**
* Obtains an entry point to the ListActions class that contains APIs that handle list related actions for
* components that display page list data and allow modifications on the list.
* @function getListActions
* @example
In the example
* getPConnect().getListActions();
*/
getListActions(): import("../page-instructions/types").ListActions;
getReferenceList(): string;
isInsideList(): boolean;
/**
* For Advanced Use Only
* Returns the component's complete metadata in its raw and unresolved format.
* This API should only
* be used in advanced use cases where a component needs the complete,
* unresolved metadata. In most situations, the component should
* only require getConfigProps() to get the resolved configuration metadata of
* the component.
* NOTE: the format and content of the metadata returned
* may change as the DX API changes.
*
* @function getRawMetadata
* @returns The raw, unresolved metadata for the component
* @public
*
* @example
In the example below, we see the raw, unresolved metadata for a simple "Table" component.
* const config = getPConnect().getComponentConfig();
* the value of config gets the configuration of the component.
*
* @returns component configuration information
* @private
*/
getComponentConfig(): any;
/**
* Checks whether component has expression configured
* or not.
*
* @function isExpressionExist
* @returns true or false
* @private
*/
isExpressionExist(): boolean;
/**
* Checks whether component has when configured
* or not.
* @function isWhenExist
* @returns true or false
* @private
*/
isWhenExist(): boolean;
/**
* This APIchecks if the component is associated with a condition (such as an expression or when condition) and returns true if anyone of them exists.
* @function isConditionExist
* @example
Usage of isConditionExist - getPConnect().isConditionExist()
* Usage: const isConditionConfigured = getPConnect().isConditionExist();
* value of isConditionConfigured will be true or false based on current component configuration.
*
* @returns true or false
* @public
*/
isConditionExist(): boolean;
/**
* Checks whether current component is bound to state or not.
* If component has any property reference, it will be treated
* as bound to state.
*
* @function isBoundToState
*
* @example
getPConnect().isBoundToState()
* const isStateBound = getPConnect().isBoundToState();
* In this example, the API returns a Boolean value which denotes if the current component is bound to a Redux State.
*
* @returns True if bound to state
*/
isBoundToState(): boolean;
/**
* Returns the data reference path of the store,
* where the data value has been stored for current component.
* @function getPageReference
*
* @example
* For example:
* @example
While loading a portal(App level)
* pageReference value is: "pyPortal"
* @example
Single component
* For components like 'FirstName, LastName', pageReference value is: "caseInfo.content"
* @example
Embedded components which are under embedded view
* For components like 'ZipCode, StreetName' which are under Address view, pageReference value is :"caseInfo.content.Address"
*
* @returns pageReference path
* @public
*/
getPageReference(): string;
getPropertyName(): string;
getFullReference(): string;
/**
* this function returns the context name under which the component has rendered.
*
* @public
* @function getContextName
* @returns context name
*
* @example
Example for getContextName()
* const context = getPConnect().getContextName();
* //example output : returns => 'app/primary_1'
*
*/
getContextName(): string;
/**
* this function returns the Container name with which the component is associated
*
* @public
* @function getContainerName
* @returns container name
*
* @example
Example for getContainerName()
* const { containerName = "primary" } = getPConnect().getContainerName();
* //example output : returns => 'primary'
*
*/
getContainerName(): string;
/**
* this function returns the fully qualified target container name with which the component is associated
*
* @public
* @function getTarget
* @returns target name
*
* @example
Example for getTarget()
* const target = getPConnect().getTarget();
* // example output : returns => 'app/primary'
*/
getTarget(): string | undefined;
/**
* This API obtains the name of the view under which the current component was rendered.This API returns the name of the views a string.
* @public
* @function getCurrentView
* @returns view name
* @example
Example for getCurrentView()
* In this example, the API returns the name of the view under which the current component was rendered.
* const viewName = getPConnect().getCurrentView();
*/
getCurrentView(): string | undefined;
/**
* Populates suggestion props if config has value prop and redux store has field in suggestion context.
*
* @param configObj configObj to which hasSuggestion props gets added
* @function populateSuggestionProps
* @example
* Example Usage:
* const configProps = { label: 'label-name' }
* getPConnect().populateSuggestionProps(configProps);
*
* After the above populateAdditionalProps function call, the configProps object value gets updated by suggestionProps
* all the possible keys added to the configObject are:
* configObject.hasSuggestions (string) - hasSuggestion value.
*
* @private
*/
populateSuggestionProps(configObj: {
[key: string]: any;
}): void;
/**
* Returns the object with resolved component
* configuration of the component.
* @function getConfigProps
*
* @example
* Example:
* {
* label: "@P .FirstName"
* }
* output:
* {
* label: "Hello Name"
* }
*
* @example
getPConnect().getConfigProps()
* @param destinationObject the object to which config props gets added.
* const props = getPConnect().getConfigProps();
*
*
* @returns resolved component props.
*/
getConfigProps(destinationObject?: {
[key: string]: any;
}): any;
/**
*
* @param localeReference default value is set to Component's type,
* @param path nested lookup for the given localeReference object
* @returns LocalizationService instance for the combination of localeReference, path
* @example
getPConnect().getLocalizationService()
* const localizationService = getPConnect().getLocalizationService();
* localizationService.getLocalizedText('label');
*/
getLocalizationService(localeReference?: string): LocalizationService;
/**
* Returns the object with raw configuration of the
* component along with inherited configuration and
* additional registered props.
*
* @example
getPConnect().getRawConfigProps()
* const rawProps = getPConnect().getRawConfigProps();
*
* @returns Raw component props.
*
* @private
*/
getRawConfigProps(): any;
/**
* Returns the resolved props from the provided input props.
* @function resolveConfigProps
* @example
* Example:
* {
* label: "@P .FirstName"
* }
* output:
* {
* label: "Hello Name"
* }
* @param configProps Props meant to be resolved.
* @param destinationObject the object to which config props gets added.
* @example
getPConnect().resolveConfigProps()
* const props = getPConnect().resolveConfigProps({ label: `@P .FirstName` });
*
* @returns resolved props.
* @public
*/
resolveConfigProps(configProps: any, destinationObject?: {
[key: string]: any;
}): {
[key: string]: any;
};
/**
* Returns the resolved props from the provided input props and registers them to configuration object which are used for component rendering.
* When you call the getConfigProps API, the resolved properties are returned.
*
* @function registerAdditionalProps
* @example
* Example:
* additionalMeta = {
* label: "@P .FirstName"
* }
* output:
* {
* label: "Hello Name"
* }
* @param additionalMeta Props meant to be resolved.
* @example
getPConnect().registerAdditionalProps()
* const props = getPConnect().registerAdditionalProps({ label: `@P .FirstName` });
* the props variable will be an object with 'label' value is field value entered for FirstName field.
* Also this prop ('label') is registered in component configuration for further usage in re-renders.
* In this example, the API resolves the FirstName property, obtains the first name value, and registers it to label.
*
* @returns resolved props.
* @public
*/
registerAdditionalProps(additionalMeta?: {}): any;
/**
* This API deregisters the input properties passed from metaConfig.
* When you call the getConfigProps API, the deregistered properties are not obtained.
*
* @param deRegisterKeys The props that needs to be deregistered.
* @function deRegisterAdditionalProps
* @example
getPConnect().deRegisterAdditionalProps()
* getPConnect().deRegisterAdditionalProps(['label']);
* @returns Returns True after unregistering
* @public
*
*/
deRegisterAdditionalProps(deRegisterKeys?: any[]): boolean;
/**
* Populates any additional properties which are specific to component which are not part of component configuration.
*
* @function populateAdditionalProps
* @param configData an object which has props from configuration props data, this objects get populated with new additional properties.
* @example
* Example Usage:
* const configProps = { label: 'label-name' }
* getPConnect().populateAdditionalProps(configProps);
*
* After the above populateAdditionalProps function call, the configProps object value gets updated based on type of the component
* all the possible keys added to the configObject are:
* configObject.pageMessages (string) - page messages are added for case_view template.
* configObject.validatemessage (string) - this key is added for components which are editable and when there is any validation message to be shown.
* configObject.infoMessage (string) - same as above for editable component which has a warning message to be shown.
* configObject.status (string) - "error" or "warning" string values.
* configObject.httpMessages (string) - If there are any top (app) level HTTP messages to be displayed
* configObject.caseMessages (string) - If there are any cases level messages to be shown.
* configObject.stages (object) - contains a particular stage info.
* configObject.fieldMetadata (object) - this object contains the information about the extra configuration which is configured in PRPC.
*
* @public
*/
populateAdditionalProps(configData: any): void;
populateFieldMetadata(configData: any): void;
/**
* @private
* @param propertyMetadata
*/
resolvePropertyMetadata(propertyMetadata: PropertyModel | PropertyModel[] | null, propName?: string): PropertyModel | PropertyModel[] | null;
/**
* Resolves the parent page class for a nested property path.
* Used internally to traverse property segments and determine the classID for the last prop.
* @private
* @param propName - The property path (e.g. "Employee.Address.Street").
* @returns The resolved pageClass string, or undefined if not found.
*/
private resolvePageClass;
/**
* Returns the field model (single model object (or) Array of model objects) (or) null.
* field model is the information like class it belongs to, editValidate, useValidate, maxLength, etc which are configured on the field.
* Model becomes an array if the field belongs to more than one class, otherwise we get only one object.
*
* @param propertyName property (field) name without dot.
* @returns - { classID: 'class-1', type: "text"} | {{ classID: 'class-1', type: "text"}, { classID: 'class-1', type: "text", editValidate: 'funcName'}}
* @example
Usage of getFieldMetadata
* Ex: const firstNameMetaData = getPConnect().getFieldMetadata('FirstName');
*
* firstNameMetaData will receive the configured information on the field while configuring it.
*
* @private
*/
getFieldMetadata(propertyName: string): any;
/**
* Returns the current page meta data.
*
* @param contextPageReference context page reference.
* @returns - { classID: 'class-1', type: "text"} | {{ classID: 'class-1', type: "text"}, { classID: 'class-1', type: "text", editValidate: 'funcName'}}
* @example
Usage of getCurrentPageFieldMetadata
* Ex: const firstNameMetaData = getPConnect().getCurrentPageFieldMetadata();
*
* firstNameMetaData will receive the configured information on the page while configuring it.
*
* @private
*/
getCurrentPageFieldMetadata(contextPageReference?: string | null): any;
/**
* Returns the current field classId
* @returns - "class-name"
* @function getCurrentClassID
* @example
Usage of getCurrentClassID
* Ex: const firstNameClassId = getPConnect().getCurrentClassID();
*
* firstNameClassId will receive the class id corresponding to the field.
*
* @public
*/
getCurrentClassID(): string;
/**
* Returns case summary and isCaseWideAction function consist of below structure
* @function getCaseSummary
* @example
* {
* routedTo:"user@constellation.com"
* urgency:"10"
* caseID:"OPB1HW-SPACE-WORK RA-219"
* name:"Request approval"
* caseClass:"OPB1HW-SpaceTra-Work-RequestApproval"
* ID:"ASSIGN-WORKLIST OPB1HW-SPACE-WORK RA-219!REQUEST_FLOW_0"
* isCaseWideAction
* }
*
* isCaseWideAction() function returns true is the action is a case action else false
*/
getCaseSummary(): any;
/**
* Returns referencedUsers in view with the below structure
*
* @function getReferencedUser
* @param userId is userIdentifier of a user.
* {
* "operatorName": {
* "UserName": "Chandra"
* }
* }
*/
getReferencedUser(userId: string): any;
/**
* Returns case stages consist of below structure
* @function getCaseStages
* @example
* {
* ID: "PRIM1"
* entryTime: "20200520T093921.867 GMT"
* links: {,…}
* name: "Collect Info"
* type: "Primary"
* visited_status: "active"
* }
*/
getCaseStages(): any;
getStageID(): any;
/**
* Gets the actions object that is used to configure a component’s event actions.
* @function getActions
* @example
Example for getActions()
* Example usage - const actions = getPConnect().getActions(); return ;
* // the API provides the currency component’s action-set.
*
* @returns actions configured
*/
getActions(): any;
/**
* Returns true if this C11nEnv is the root
* @returns True is this is the root
* @private
*/
isRoot(): boolean | undefined;
/**
* Checks and resolves any context related info.
* like, any errors for properties and any validation
* info for this component.
* @param target target object to update the context.
* @private
*/
resolveContextProps(target: {
error: string;
validatemessage: string;
}): void;
/**
* Checks whether validators configured for this
* component or not.
* @returns true or false
* @private
*/
isValidatorExist(): boolean;
/**
* Obtains an entry point to the {@link ValidationApi} object that contains APIs that handle validations on the field.
* @function getValidationApi
* @returns entry point to the {@link ValidationApi}
*
* @example
Example for getValidationApi()
* const validationApi = pConn.getValidationApi();
* @public
*/
getValidationApi(): ValidationApi;
/**
* Checks whether a component is editable, relies on value attribute
*
* @function isEditable
* @example
Example for isEditable()
* const isEditable = pConn.isEditable();
* where isEditable is the boolean that contains true/false
* In this example, the API checks if a component can be edited and returns the resulting boolean value.
*
* @returns true or false
*/
isEditable(): boolean;
isVisible(): boolean;
isReadOnly(): boolean;
/**
* This API checks if the current component has children.
*
* @function hasChildren
* @example
Example for hasChildren - getPConnect().hasChildren()
* Usage: const componentHasChildren = getPConnect().hasChildren();
* componentHasChildren will be true or false indicating whether current component has children in the component configuration.
*
* @returns true or false
* @public
*/
hasChildren(): boolean;
/**
* Returns whether the node is visible && has some visible children
* (if it is of a type which require children).
* @returns whether the node should be visible.
* @private
*/
getComputedVisibility(resolvedViews?: string[]): boolean;
/**
* Returns the children iterator
* @returns iterator
* @private
*/
getChildrenIterator(): any;
/**
* This API assigns a new action(based on the event type and handler)to the list of the actions
* associated with the current component.
*
* @function setAction
* @example
Example for setAction()
* Example usage - setAction("onChange", changeHandler);
* // this API associates the change handler to the onChange event type, and assigns the new action to the list of the actions associated with the current component.
*
* @param eventType The type of the event that determines the new action to be added to the list of actions.
* @param handler The function that must be associated with the event type.
*
* @public
*/
setAction(eventType: string, handler: Function): void;
/**
* Returns the component name example Button.
*
* @function getComponentName
* @example
getPConnect().getComponentName()
* const component = getPConnect().getComponentName();
*
* @returns current component name.
*/
getComponentName(): string | undefined;
/**
* Checks whether current component is refreshable
* or not.
* Example:
* If section is configured with refresh this section
* then section will be treated as refreshable.
* @returns true or false
* @private
*/
isComponentRefreshable(): boolean;
/**
* this function helps to obtain the data of the current context from store.
* Here `data` may contain below information
*
*
caseInfo
*
pulse
*
pxRequestor
*
Data Pages
*
...
*
*
* @public
* @function getDataObject
* @param contextName qualified context name e.g. app/primary_1
* @returns data object
*
* @example
Example for getDataObject()
* const data = pConn.getDataObject();
* const { caseInfo, pulse } = data;
*
*/
getDataObject(contextName?: string): any;
/**
* Returns the resolved image path, it resolves the image with current
* static service.
*
* @function getImagePath
* @example
getPConnect().getImagePath(imageName)
* const imagePath = getPConnect().getImagePath("launcher.png");
* // output: imagePath -> https://service/image/launcher.png
* @param imageName image name
* @returns image path
*/
getImagePath(imageName: string): string;
skipRequiredValidation(): boolean | undefined;
isBulkAction(): boolean | undefined;
/**
* Returns list of children for the current component.
* And also resets the iterator to start-index.
*
* @function getChildren
* @example
Example usage of getPConnect().getChildren()
* const children = getPConnect().getChildren()
* the children variable will be receiving the list of children components of the current component.
*
* @returns returns the list of children
* @public
*/
getChildren(): {
getPConnect: () => C11nEnv;
}[];
/**
* This API set inherited prop and propagates the prop to all its children.
*
* @function setInheritedProp
* @example
*
* @param propName name of the prop eq., displayMode
* @param value value to be set ew., LEFT
*
*/
setInheritedProp(propName: string, value: any): void;
/**
* This API returns locale reference rule name this environment object is referencing for the field values.
*
* @function getLocaleRuleName
* @example
getPConnect().getLocaleRuleName()
* const localeRuleName = getPConnect().getLocaleRuleName();
* //Returns "VEHICLE-!VIEW!VEHICLEDETAILS", if the current environment object corresponds to a view named VehicleDetails in Work- class.
* //The above is the name of localization rule which is 1-1 mapped to a View named VehicleDetails
*
* @returns Returns the locale reference rule name.
*/
getLocaleRuleName(): string | undefined;
/**
* Returns the localized value for a string.
*
* @function getLocalizedValue
* @example
* Here the ruleKey will be "Work-!View!CandidateInfo"
*
* @param localeClass Localization rule class
* @param localeContext Localization rule context
* @param localeName Localization rule name
* @returns - localeRuleKey
* @private
*/
getLocaleRuleNameFromKeys(localeClass: string, localeContext: string, localeName: string): string;
/**
* this function helps to resolve the property value from the state (Redux store).
* @function getValue
* @param prop property whose data value is returned
* @param pageReference pageReference of parent view
* @returns property value from the state (Redux store).
*
* @example
Example for .firstName property
* const firstName = getPConnect().getValue('.firstName');
* // here firstName variable contains the value retrieved from redux store.
*/
getValue(prop: string, pageReference?: string): any;
setInheritedConfig(rawConfig: any): void;
/**
* This function is used to retrieve props that are set on the parent metadata node within
* the inheritedProps metadata structure. The purpose of inheritedProps is to allow cascading
* of values in view metadata.
*
* In the following example, a label can be given to a view reference node in order to give a
* unique label each place a view is included, allowing for better reuse.
*
* @function getInheritedProps
* @returns props object that was inherited from the parent
* @public
*
* @example
Getting a label from parent reference
* // Parent reference metadata
* {
* "type": "reference",
* "config": {
* "name": "Address",
* "inheritedProps": [
* {
* "prop": "label",
* "value": "@L Shipping address"
* }
* ]
* }
* }
*
* // Child reusable Address view
* {
* "name": "Address",
* "type": "View",
* "config": {
* "template": "OneColumn",
* "ruleClass": "Data-Address"
* "label": "Generic address"
* },
* "children": [
* {
* "name": "A",
* "type": "Region",
* "children": []
* }
* ]
* }
*
* // During render of the child view called Address, one would retrieve the inherited label as follows
*
* const propsToUse = { label, ...getPConnect().getInheritedProps() };
*
* // This would result in propsToUse.label = “Shipping address”. This inherits the value that was set on the
* // parent (if the parent had a “label” property) and would override any “label” property that was set on the child view.
*/
getInheritedProps(): {
[key: string]: any;
};
/**
* this function helps to assign the value to property name (or key) in state (Redux store).
* @function setValue
* @param prop property name whose data value need to set
* @param value property value which need to get assigned to the property name.
* @param initialValue property initialValue which need to get assigned to the property name.
* @param isImplicit boolean check if it is implicit setValue action
* @param options object containing extra infomation like isArrayDeepMerge
* @param options.isArrayDeepMerge flag to decide whether to deep merge the objects or values inside array or not
*
* @example
Example for .firstName property
* getPConnect().setValue('.firstName', 'lorem ipsum');
* // here examples shows setting the `lorem ipsum` value in firstName property
*/
setValue(prop: string, value: {
[key: string]: any;
} | undefined, initialValue?: string, isImplicit?: boolean, options?: {
isArrayDeepMerge?: boolean;
}): void;
/**
* This function helps to update the value to property name in change list
* @function updateDirtyCheckChangeList
* @param prop property name whose data value need to set
* @param value property value which need to get assigned to the property name
*
* @example
Example for .firstName property
* getPConnect().updateDirtyCheckChangeList('.firstName', 'lorem ipsum');
* // here examples shows setting the `lorem ipsum` value in firstName property
* @private
*/
updateDirtyCheckChangeList(prop: string, value: string): void;
/**
* Return context data value like when results etc.,
* @example
getPConnect().getContextDataValue(prop)
* const value = getPConnect().getContextDataValue('.summary_of_when_conditions__.testWhen');
*
* @param prop property whose context data value is returned
* @param pageReference pageReference of parent view
* @returns Context data value
* @private
*/
getContextDataValue(prop: string, pageReference?: string): any;
/**
* this function helps to merge data object in store deeply.
* If an element at the same key is present in both store and data object,
* the value from data object will stay in the store.
*
* @function updateState
* @param dataObject - object to be merged into store.
*
* @example
Example usage to merge firstName key to store
* getPConnect().updateState({
* firstName: "Test"
* });
*/
updateState(dataObject: any): void;
/**
* this function helps to replace the state of a property or page in the store.
* @function replaceState
* @param prop property or page name whose value need to be replaced
* @param value value which need to get assigned to the property or page.
*
* @example
Example for .address property
* getPConnect().replaceState('.address', {
* apartment: "New Heights"
* streetName: "Park Street",
* });
* @param options.skipDirtyValidation - flag to decide whether the property has to considered in Dirty Validation. Default is false. If passed as true Dirty Validation will be skipped on the respected property.
* @example
Example for .address property will not be include in the response of formutils.getChanges() API
* getPConnect().replaceState('.address', {
* apartment: "New Heights"
* streetName: "Park Street",
* }, {skipDirtyValidation: true });
*/
replaceState(prop: string, value: string, options?: {
skipDirtyValidation?: boolean;
}): void;
/**
* this function helps to set error at Redux store level
* so that the errors that need to be handled at infra level can make use of this function
*
* @public
* @function reportError
* @param errorMsg - Error message to be logged to Redux store.
* @param errorObj - Error object that contains more error info.
* @param context - Context data value
*
* @example
Example usage for reportError function
* getPConnect().reportError(
* ': Error occurred during ajax call at fetchMessages API :',
* {
* errorClassification: 'Invalid inputs'
* errorDetails: {
* localizedValue: 'localized error message'
* }
* }
* );
*/
reportError(errorMsg: string, errorObj: any, context?: string): void;
/**
* Returns the env object.
* @returns env object
* @private
*/
getComponent(): any;
/**
* This API creates a component whose type is provided as part of the meta object and uses the other parameters to resolve the properties and get the context.
* The definition of the component type which is provided in meta object is upto consumer.
* @param componentMeta The metadata of the component to be created.
* @param dataSource The source reference to the Redux store. This contains properties that will be input to the created component.
* @param index In case of list datasource mention the index.
* @param additionalPropsToComp Props will be passed to component apart from the configured values.
*
* @function createComponent
* @example
Usage of createComponent: getPConnect().createComponent(meta, dataSource, index, additionalPropsToComp)
* Ex: getPConnect().createComponent(
* {
* type: "Button",
* config: {
* label: "@P .FirstName"
* }
* },
* "D_Employees.pxResults",
* 1,
* {
* active: true
* }
* );
*
* Call the createComponent with meta data and necessary arguments, such that the component receives the resolved props to the created component instance.
* For React: JSX: (or) React.createElement('Button', { label: 'resolved FirstName property value })
*
* @returns newly created component instance
*
* @public
*/
createComponent(componentMeta: Meta, dataSource?: string, index?: number, additionalPropsToComp?: {
[key: string]: any;
}): any;
/**
* This API returns the viewMetadata of the referenced view
* @function getReferencedView
* @example
* const meta = {
* meta: {
* type: 'reference',
* config: {
* type: 'view',
* name: 'Address'
* }
* }
* }
* const c11nEnv = createC11nEnv(meta).getPConnect();
* const viewMetadata = c11nEnv.getReferencedView();
* 'viewMetadata' is the metadata object of the 'Address' view
*
* @returns referenced view metadata
*/
getReferencedView(): Meta | undefined;
/**
*
* @param {string} context
* @returns {string} resolved page reference
* @private
*/
_resolvePageRef(context: string): string;
/**
* This API returns the PConnect object of the referenced view with in a reference
* @param passOptions this allows to pass reference's options to the view if it is true
* @function getReferencedViewPConnect
* @example
* @returns An PConnect object with getPConnect of the referenced view with in type reference
*
* @public
*/
getReferencedViewPConnect(passOptions?: boolean): CreateC11nEnv;
/**
* Returns an entry point to the Container Manager
* The Container Manager can be used to access any of the APIs found at {@link ContainerManager}
* @function getContainerManager
* @returns entry point to the {@link ContainerManager}
* @example
Example for getContainerManager()
* const containerManager = getPConnect().getContainerManager();
* //any of the container manager APIs can be called on the entry point returned
*/
getContainerManager(): ContainerManager;
/**
* Returns an entry point to the Actions API. This entry point
* can be used to access any of the APIs found at {@link ActionsApi}
* @function getActionsApi
* @example
* Example usage:
* const actionsAPI = pConn.getActionsApi();
* [...]
* actionsApi.showPage(actionInfo);
* actionsApi.createWork(actionInfo);
*
* where actionInfo is the JSON object that contains the information
* necessary for the action to be properly invoked.
*
* @returns entry point to the {@link ActionsApi}
*/
getActionsApi(): ActionsApi;
/**
* Returns the ActionManager object that can be used
* to access the Core's ActionManager API
* @returns - the {@link ActionManager} object
* @private
*/
getActionManager(): object;
/**
* This function helps to check whether the context exists in store or not
* @ignore
* @param context -- context name
* @returns - true if context exists otherwise false
* @private
*/
doesContextExist(context?: string): boolean;
/**
* used in the Location component of the Nebula layer to obtain the API key
* for the Google Maps applicationfrom the DSS setting(uiengine/map/googleapikey) and
* send it to the MapsContext control of the Cosmos layer as a property
* @function getGoogleMapsAPIKey
* @returns google maps api key
* @example
Example for getGoogleMapsAPIKey()
* let apiKey = getPConnect().getGoogleMapsAPIKey();
* // the API key to render Google Maps is obtained
*/
getGoogleMapsAPIKey(): string;
/**
* used in the Richtext component of the Nebula layer to obtain the server url.
* @function getServerURL
* @returns server url
* @example
Example for getServerURL()
* let serverurl = getPConnect().getServerURL();
* // the server url is obtained
*/
getServerURL(): string | undefined;
/**
* Returns the loading status of the current container context
* @function getLoadingStatus
* @param contextName representing the context for which we need to fetch the loading status
* @returns true/false : Loading Status of the current container
* @example
Get the Loading status of the current context container
* if(getPConnect().getLoadingStatus()==true){
* //Code to handle the loading status
* };
* @private
*/
getLoadingStatus(contextName: string): boolean;
/**
* Deletes the error messages associated with a specific context (like an assignment, case flow) or App container.
* @function clearErrorMessages
* @param errorMsgConfig The {@link ErrorMsgConfig} object contains information that specifies which error messages are cleared
*
* @example
Example for clearing messages on a context
* getPConnect().clearErrorMessages({category: "HTTP", context: "app/primary"});
* This will clear the error messages at the "app/primary" level which belong to category of type HTTP (like 4XX errors).
*
* @example
Example for clearing messages on AppShell
* getPConnect().clearErrorMessages({category: "HTTP"});
* This will clear the error messages at the App level which belongs to category HTTP.
*
* @example
Example for clearing messages on FirstName property
* getPConnect().clearErrorMessages({property: ".firstName"});
* This will clear the error messages on the property firstName.
*
* @public
*/
clearErrorMessages(errorMsgConfig: ErrorMsgConfig): void;
resolveDatasourceReference(datasourceRef: string): any;
/**
* Removes the field from form map
* @function removeFormField
*
* @example
Example for clearing form on a context
* getPConnect().removeFormField();
* This will clear the form in the current context.
*
* @private
*/
removeFormField(): void;
/**
* Adds the field from form map
* @private
*/
addFormField(): void;
/**
* This api is used to set the given sourcePage value to the given target
* @function setPageValue
* @param sourcePage source page object which needs to be set to target property name
* @param target target property name where the source page is being set.
* @param isPerform isPerform to allow generating Pageinstruction for form submission if applicable.
* @example
Example for setPageValue
* getPConnect().setPageValue({street: 'ABC', city: 'DEF'}, '.EmbeddedPage',true);
*/
setPageValue(sourcePage: {
[key: string]: any;
}, target: string, isPerform: boolean): void;
/**
* Accepts the value stored in the Suggestions Context for a field.
* @param target The field whose value stored in the Suggestions Context is accepted.
* @function acceptSuggestion
* @example
Example for acceptSuggestion
* In this example, the API accepts the value stored in the Suggestions Context for the Property1 field.
* getPConnect().acceptSuggestion('.Property1');
* @public
*/
acceptSuggestion(target: string): void;
/**
* Ignores the value stored in the Suggestions Context for a field.
* @param target The field whose value stored in the Suggestions Context is ignored.
* @function ignoreSuggestion
*
* @example
Example for ignoreSuggestion
* In this example, the API ignores the value stored in the Suggestions Context for the Property1 field.
* getPConnect().ignoreSuggestion('.Property1');
* @public
*/
ignoreSuggestion(target?: string): void;
/**
* Returns the self referencing data page keys for the property
* @function getSelfReferencingDatapageKeys
* @returns array of string : Self referencing data page keys
* @example
Get the self referencing data page keys for a property
* const selfReferencingDatapageKeys = getPConnect().getSelfReferencingDatapageKeys();
* @private
*/
getSelfReferencingDatapageKeys(): string[];
/**
*
* @param configData - an object, which contains the meta data about the field which helps in taking decision to mark the field as readonly.
* @param propertyName - the property (field) name.
* @returns - boolean
*/
private isReadOnlyField;
private getPropertyDetails;
private updateConfigData;
}
export declare function createC11nEnv(config: Config): CreateC11nEnv;
export declare function registerComponentCreator(creator: Function): void;
export default C11nEnv;