import { PieItemElement, PieContent } from "./interface"; import { NewRelicEnabledClient } from "./new-relic"; /** * TODO: Clean up: PD-761 */ export declare const DEFAULT_ENDPOINTS: { prod: { bundleBase: string; buildServiceBase: string; }; stage: { bundleBase: string; buildServiceBase: string; }; dev: { bundleBase: string; buildServiceBase: string; }; }; export interface Entry { package: string; status: Status; tagName: string; controller?: any; config?: Element; element?: Element; } interface LoadedElementsQuery { name: string; tag: string; } interface LoadedElementsResp { elements: LoadedElementsQuery[]; val: boolean; } export interface BundleEndpoints { buildServiceBase: string; bundleBase: string; } export declare enum Status { loading = "loading", loaded = "loaded" } export declare enum BundleType { player = "player.js", clientPlayer = "client-player.js", editor = "editor.js" } export declare const needToLoad: (registry: any, bundle: BundleType) => (el: string, key: string) => boolean; /** * Configuration options for Pie Loader */ export declare type LoaderConfig = { /** * Enable tracking page actions/events with New Relic. * When enabled, all network requests will be instrumented. * Note: Setting this to true increases data sent to New Relic, which may affect costs. * Default: false */ trackPageActions?: boolean; }; /** * Pie Registry controls the loading of all PIEs from the pie build service */ export declare class PieLoader extends NewRelicEnabledClient { private readonly loaderConfig; endpoints: BundleEndpoints; /** * Create a PieLoader instance * Can provide config object for endpoints, will default to to production environment preset. * @param _endpoints * @param config */ constructor(_endpoints?: BundleEndpoints, config?: LoaderConfig); private static _registry; protected registry: { [elementName: string]: Entry; }; getController: (pieTagName: string) => any; elementsHaveLoaded: (els: LoadedElementsQuery[]) => Promise; private getBaseUrls; private getScriptsUrl; /** * * @param {Object} elements elements to load from pie cloud service * @param {HTMLDocument} doc - the document to load the scripts * @param {string} base_url - default base url for cloud service */ loadCloudPies: (options: { content: PieContent; doc: Document; endpoints?: BundleEndpoints; bundle?: BundleType; useCdn: boolean; forceBundleUrl: boolean; reFetchBundle: boolean; }) => Promise; /** * Given a definition of elements, will check the registry * and return the elements and tags that need to be loaded. * * @param els * @param bundle * @param registry */ protected getElementsToLoad: (els: PieItemElement, bundle: BundleType, registry: any) => PieItemElement; /** * Implementation of the abstract method from NewRelicEnabledClient */ protected getTrackingBaseAttributes(): Record; /** * Track operation start if trackPageActions is enabled */ private trackOperationStart; /** * Track operation complete if trackPageActions is enabled */ private trackOperationComplete; /** * Track retry attempt if trackPageActions is enabled */ private trackRetryAttempt; /** * Track operation failure if trackPageActions is enabled */ private trackOperationFailure; } export {};