import type { BuildRestAPIPayload } from '../router/types'; import type { ComponentConfig, ComponentSearchCriteria, ComponentData, Asset, LoadAssetOptions } from './types'; /** * @description * Exposes APIs to load the script and css files. */ declare class AssetLoader { loaderObj: { [key: string]: Function; }; staticServerURL: string | null; appStaticUrl: string | null; pegaOnlyUrl: boolean; loadedAssets: { [key: string]: boolean; }; componentsConfig: ComponentConfig[] | null; appAlias: string; b2sJWT: string | null; ccV2LibId: string | null; imageBlobUrlCache: { [key: string]: Promise; }; getTypes: { SCRIPT: string; STYLE: string; }; constructor(); /** * Returns the static content url * @description This exposes the method to fetch static content url * * @example Example for getStaticServerUrl() * Example can be seen in C11n getImagePath method * Example usage - AssetLoader.getStaticServerUrl() * // returns -- Static content url string * * @see {@link getStaticServerUrl} for further information. * @see {@link getImagePath} for example. * @returns the Asset Loader Object * @function */ getStaticServerUrl(): string | null; /** * This method is used to set the custom component library and version coming from DSS. * @description This exposes the method to set the custom component lib and version. * @example Example for setCCV2LibId() * Example can be seen in importCustomComponentMap method od AssetLoader * @param ccV2LibId name * @see {@link ccV2LibId} for further information. * @function * @private */ setCCV2LibId(ccV2LibId: string): void; /** * Returns the ccV2LibId from custom component library and version * @description This exposes the method to get the custom component library and version from DSS. * @example Example for getCCV2LibId() * Example usage - Custom component v2 tools - utils. * // returns -- ccV2LibId string for the current request. * @see {@link getCCV2LibId} for further information. * @returns the custom component library and version * @function * @private */ getCCV2LibId(): string | null; /** * Returns the theme schema json * @description This exposes the method to fetch theme schema json * * @example Example for getThemeSchemaJSON() * Example usage - AssetLoader.getThemeSchemaJSON() * // returns -- Theme schema json * * @see {@link getThemeSchemaJSON} for further information. * @returns the Asset Loader Object * @function * @private */ getThemeSchemaJSON(): Promise; /** * Returns the Constellation service url - no terminating / * @description This exposes the method to fetch the Constellation service url * * @example Example for getConstellationSErviceUrl() * Example can be seen in C11n getImagePath method * Example usage - AssetLoader.getConstellationServiceUrl() * // returns -- Constellation service url string * * @see {@link getConstellationServiceUrl} for further information. * @see {@link getImagePath} for example. * @returns the Asset Loader Object * @function */ getConstellationServiceUrl(): string | null; /** * This method is used to set the appAlias for the current request. * @description This exposes the method set the app alias for the current request. * @example Example for setAppAlias() * Example can be seen in bootstrap-utils setAppAlias method * @param appAlias name * @see {@link setAppAlias} for further information. * @function */ setAppAlias(appAlias: string): void; /** * Returns the appAlias for the current application * @description This exposes the method to get the app alias for the current request. * @example Example for getAppAlias() * Example can be seen in C11n getImagePath method * Example usage - AssetLoader.getAppAlias() * // returns -- appAlias string for the current request. * @see {@link getAppAlias} for further information. * @see {@link getImagePath} for example. * @returns the app alias * @function */ getAppAlias(): string; /** * This exposes a method to call the Constellation service to fetch the corresponding component config.json that satisfies the specified properties. * This call is authenticated by the service, using the token issued for the Constellation service (B2S JWT). * @example Example for getSvcComponentsConfig() * // In this example, the API retrieves an operator image and creates a DOMString containing a URL representing the image Blob object. * const templateDefinitionConfigJson = await AssetLoader * .getSvcComponentsConfig([{ field: 'name', value: ‘OneColumn’ }]) * .then((response) => { * if (response?.data?.components?.[0]) { * return response.data.components[0]; * } * throw new Error('templateDefinition for OneColumn not found!'); * }) * .catch(() => { * throw new Error('templateDefinition for OneColumn not found!'); * }); * @param criteriaToMatch of name-value pairs specifying the search criteria * @param options of additional information required such as: * -alternateDesignSystemURL {String} - Contains the URL for an alternative design system, used for fetching additional config-ext.json values * @returns - Contains an attribute data that maps to an array of config objects matching the criteria. In the event of an alternateDesignSystemURL specified in the options, * and only one config object is obtained via the initial fetch call, the alternative design system's config-ext.json will be embedded in an alternateDesignSystemConfig attribute within * the single config of the returned componentData. Errors will be stored inside the alternateDesignSystemConfig attribute as well in the case of an unsuccessful fetch. * @function */ getSvcComponentsConfig(criteriaToMatch: ComponentSearchCriteria[], options?: { alternateDesignSystemURL?: string; skipLoadCustomerComponents?: boolean; }): Promise; getSvcComponentsConfigSeparatedUrls(criteriaToMatch: ComponentSearchCriteria[], params: string, options: { alternateDesignSystemURL?: string; skipLoadCustomerComponents?: boolean; }): Promise<{ data: { components: ComponentConfig[]; }; }>; mergeComponentList: (componentConfigList: [ComponentConfig[], ComponentConfig[], ComponentConfig[]]) => ComponentConfig[]; fetchSDKComponent(params: string): Promise; loadAndFilterPegaComponentsConfig(criteriaToMatch: ComponentSearchCriteria[], builtOnApps?: string): Promise; loadPegaComponentsConfig(): Promise; loadLibraryComponentsConfig(libId: string): Promise; loadAndCustomerComponentsConfig(params: string, criteriaToMatch: ComponentSearchCriteria[]): Promise; checkForBuiltOnSupport(builtOnApps: string | undefined, allowedApplicationsFromConfig: string[]): boolean; getSvcComponentsConfigCombinedUrl(criteriaToMatch: ComponentSearchCriteria[], params: string, options: { alternateDesignSystemURL?: string; skipLoadCustomerComponents?: boolean; }): Promise; getSvcComponentsConfigADS(criteriaToMatch: ComponentSearchCriteria[], params: string, options: { alternateDesignSystemURL?: string; }): Promise; /** * This exposes a method to call the Constellation service to fetch an image. This call is authenticated * by the service, using the token issued for the Constellation service (B2S JWT). * @example Example for getSvcImage() * // In this example, the API retrieves an operator image and creates a DOMString containing a URL representing the image Blob object. * const operatorImg = await AssetLoader * .getSvcImage('DATA-CONTENT-IMAGE USER@CONSTELLATION.COM!PNG!/OPERATORIMAGES/') * .then((data) => { * const url = window.URL.createObjectURL(data); * return url; * }) * .catch(() => { * console.error('Unable to load the image!'); * }); * // returns -- Promise that resolves to the image (blob) specified as the key * @param key Identifier to the image * @returns Promise that resolves to the image (blob) specified as the key * @function */ getSvcImage(key: string): Promise; /** * Fetches an image as a blob URL from the Constellation service. This call is authenticated * using the token issued for the Constellation service (B2S JWT). * * @param {string} key Identifier for the image. * @returns {Promise} Promise that resolves to the image blob URL. */ getSvcImageUrl(key: string): Promise; /** * Builds the request details for fetching an image. * * @param {string} key Identifier for the image. * @param {boolean} infinityStaticService Flag indicating if the Infinity Static Service is available. * @returns {object} Object containing the callUrlKey, queryPayload, and callUrl. * @private */ buildImageRequest(key: string, infinityStaticService: string | undefined): { callUrlKey: string; queryPayload: { fileID: string; user_ID?: undefined; } | { user_ID: string; fileID?: undefined; } | undefined; callUrl: string; }; /** * Fetches the image and converts it to a blob URL. * * @param {string} callUrlKey API key for the request. * @param {object | null} queryPayload Payload for the API request. * @param {string} callUrl URL for the API request. * @returns {Promise} Promise that resolves to the image blob URL. * @private */ fetchImage(callUrlKey: string, queryPayload: BuildRestAPIPayload | undefined, callUrl: string, infinityStaticService: string | undefined): Promise; /** * Decodes a base64 string into a Uint8Array. * * @param {string} base64String Base64 encoded string. * @returns {Uint8Array} Decoded byte array. * @private */ decodeBase64ToByteArray(base64String: string): Uint8Array; /** * This API gets the localization instance from the constellation service for a given user locale and an instance key. This call is authenticated * by the service, using the token issued for the Constellation service (B2S JWT). * @example Example for getSvcLocale('en_US','WORK-!VIEW!PYCASESUMMARY.json') * // In this example, the API gets the localeJson for the en_US locale and for the view PyCaseSummary in the Work- class. * // This API call returns a Promise which when resolved gives the localeJson. * const localeJson = await AssetLoader.getSvcLocale('en_US', 'WORK-!VIEW!PYCASESUMMARY.json') * .then((data) => { * // data is the response from the constellation service which is the localeJson * }); * @param locale locale for which we need locale JSON * @param key Identifier to the JSON files * @returns Promise that resolves to a localeJson * @function */ getSvcLocale(locale: string | unknown, key: string): Promise; /** * This API gets all locale codes available in app-static for a given application. * This call is authenticated by the service, using the token issued for the Constellation service (B2S JWT). * @example Example for getSvcAvailableLocales() * // This API call returns a Promise which when resolved gives the available locale codes in Constellation service. * @returns Promise that resolves to list of strings of available locales * @function * @private */ getSvcAvailableLocales(): Promise; /** * This exposes a method to call the Constellation service to fetch a custom component. This call is authenticated * by the service, using the token issued for the Constellation service (B2S JWT). * @example Example for getSvcComponent() * // In this example, the API retrieves the JS implementation for the WeightInput component. * const WeightInputDefinition = await AssetLoader * .getSvcComponent('WeightInput.js') * .then((response) => { * return response; * }) * .catch(() => { * console.error('Unable to retrieve the component!'); * }); * // returns -- Promise that resolves to the corresponding JS implementation for the component * @param name Name of the component whose JS implementation we want to fetch * @returns Promise that resolves to the corresponding JS implementation for the component * @function */ getSvcComponent(name: string): Promise; /** * This exposes a method to call the Constellation service to fetch a custom components library map. This call is authenticated * by the service, using the token issued for the Constellation service (B2S JWT). * @example Example for importCustomComponentMap() * Example can be seen in bootstraping. * @param libId Custom Component Design Library Id and Version * @function * @private */ importCustomComponentMap(libId: string): Promise; appendCustomScriptToHead(data: string): Promise; /** * This exposes a method to call the Constellation service to fetch a custom component and attach the component script in document HEAD. This call is authenticated * by the service, using the token issued for the Constellation service (B2S JWT). * @example Example for loadSvcComponent() * // In this example, the API retrieves the JS implementation for the WeightInput component and attached to document HEAD in a