import type { AxiosResponse } from 'axios'; import type { ConfigurationType } from '../initialiser/configurations'; /** * helper functions for case */ declare class CaseUtils { /** * It Checks whether the Case is Active or Inactive * @param key case key * @param target target * @returns returns true if the Case is Active else returns false * @static * @example Example for isCaseActive. * PCore.getCaseUtils().isCaseActive('CS-WORK-INTERACTION I-383039', app/primary'); * returns true if the currently opened Case has key CS-WORK-INTERACTION I-383039 */ static isCaseActive(key: string, target: string): boolean; /** * This API returns a promise which when resolved returns edit metadata of a case. * @param caseID - The caseID on which edit is being performed * @param context - context name eq., primary * @example In the example below, the API returns the edit metadata o a case. * * const caseID = "METORG-VEHICLEMANAGER-WORK V-7222"; * const context = "app/primary_1" * PCore.getDataApiUtils().getCaseEditMetadata(caseID, context); * * //The response of this api will be like shown below. * { * uiResources: {}, * data: { * caseInfo: { "caseTypeID": "MetOrg-VehicleManager-Work-VehiclePurchase", "owner": "abc@xyz.com", "availableActions": [], "lastUpdatedBy": "abc@xyz.com", "sla": {}, "content": { "classID": "MetOrg-VehicleManager-Work-VehiclePurchase", "VehicleUsage": "", "Year": "2013", "VehicleType": "e7faf92e-e6b0-4793-b59f-e406a2abdb75", "NeededBy": "20200605T181445.999 GMT", "Model": "458 Italia", "Make": "Ferrari", "RequestingDepartment": "52724c8d-54b9-4819-851d-3765098adebb" }, "createdBy": "abc@xyz.com", "createTime": "2020-05-28T20:05:41.235Z", "urgency": "10", "name": "2013 Ferrari 458 ITALIA", "stages": [], "ID": "METORG-VEHICLEMANAGER-WORK V-7222", "lastUpdateTime": "2020-05-28T20:05:41.541Z", "stageID": "PRIM3", "stageLabel": "Delivery", "status": "New" * } * } * } * * * @returns - edit metadata of a case. * * @function * */ static getCaseEditMetadata: (caseID: string, context: string) => Promise>; /** * This API returns a promise which when resolved indicates that acquiring the lock of the case is successful. * @param caseID - The caseID (or pzInsKey) to which the lock has to be acquired. * @param context - context name eq., primary * * @example In the example below, the API returns the successful lock to edit the case. * * const caseID = "METORG-VEHICLEMANAGER-WORK V-7222"; * const context = "app/primary_2"; * PCore.getDataApiUtils().getCaseEditLock(caseID, context); * * // The response of this api will be like shown below. * { * uiResources: {}, * data: {} * } * * Having above structure in the response indicates successfull lock acquiring. * * * @returns - complete metadata of the case. * * @function * */ static getCaseEditLock: (caseID: string, context: string) => Promise>; /** * This API returns a promise which when resolved indicates that updation of the case data is successful. * @param caseID - The caseID (or pzInsKey) to which the lock has been acquired. * @param changeSet - The object which holds the updated details in the case. * @param eTag - PCore.getDataApiUtils().getCaseEditLock() response headers contain the "etag" header, pass that value as eTag here. * @param context - context name eq., primary * @example In the example below, the API returns the object indicating successful updation of case data. * * const caseID = "METORG-VEHICLEMANAGER-WORK V-7222"; * const changeSet = { "METORG-VEHICLEMANAGER-WORK V-7222": { Make: "New Value" } }; * const eTag = "20200831T114802.686 GMT"; * PCore.getDataApiUtils().updateCaseEditFieldsData(caseID, changeSet, eTag); * * // The response of this api will be like shown below. * { * uiResources: {}, * data: {} * } * * Having above structure in the response indicates successfull lock acquiring. * { "data": { "caseInfo": { "caseTypeID": "MetOrg-VehicleManager-Work-VehiclePurchase", "owner": "reactuser", "availableActions": [], "lastUpdatedBy": "smith", "assignments": [], "sla": {}, "createdBy": "reactuser", "createTime": "2020-06-08T12:10:08.813Z", "urgency": "10", "name": "Vehicle Purchase", "stages": [], "ID": "METORG-VEHICLEMANAGER-WORK V-10001", "lastUpdateTime": "2020-09-01T05:52:54.225Z", "stageID": "PRIM5", "stageLabel": "Request", "status": "New" } }, "confirmationNote": "Thank you! The next step in this case has been routed appropriately." } * * @returns - Returns the object with caseInfo and confirmationNote. * * @function * */ static updateCaseEditFieldsData: (caseID: string, changeSet: { [key: string]: any; }, eTag: string, context: string) => Promise>; /** * returns the caseMessages(confirmationNote) * @param containerItemID containerItemID * @returns caseMessages * @static * PCore.getCaseUtils().getCaseMessages('app/primary_2/workarea_2'); * returns case messages(confirmation note) array if the container has any * @private */ static getCaseMessages: (containerItemID: string) => any[]; static getPropertiesToReplace: (context: string) => string[]; /** * return Five characters unique id * @param * @returns {string} * @private */ static getUniqueGadgetId: () => string; /** * This API returns remote case mapping object * usage: * PCore.getCaseUtils().getRemoteCaseMapping(); * The response of this api will be like shown below. * eg: * { * "MetOrg-VehicleManager-Work-VehiclePurchase":{ * RemoteClassName: "Work-Remote", * RemoteSystemID: "SystemName", * RemoteApplicationType: "Traditional" * } * } * @returns {object} * @private */ static getRemoteCaseMapping: () => NonNullable; /** * This API is to check if case is traditional remote case * usage: * PCore.getCaseUtils().isTraditionalRemoteCase("MetOrg-VehicleManager-Work-VehiclePurchase") * return true/false based on the given consumer case class name is traditional remote case * @returns {boolean} * @private */ static isTraditionalRemoteCase: (caseClassName: string) => boolean; /** * This function is for seperating caseID from traditional case assignment key * it returns key ON8TTL-C11nGall-Work T-1234 when the assignmentKey is given ASSIGNWORK ON8TTL-C11nGall-Work T-1234!CREATE_DEFAULT * @returns string * @private */ static getRemoteCaseKey: (assignmentKey?: string, caseID?: string) => string | undefined; } export default CaseUtils;