UNPKG

@kontent-ai/smart-link

Version:

Kontent.ai Smart Link SDK allowing to automatically inject [smart links](https://docs.kontent.ai/tutorials/develop-apps/build-strong-foundation/set-up-editing-from-preview#a-using-smart-links) to Kontent.ai according to manually specified [HTML data attri

32 lines (31 loc) 1.53 kB
import { type IRefreshMessageData, type IRefreshMessageMetadata, type IUpdateMessageData } from "./lib/IFrameCommunicatorTypes"; import { type KSLPublicConfiguration } from "./utils/configuration"; import { type Callback, type EventHandler } from "./utils/events"; export declare enum KontentSmartLinkEvent { Refresh = "refresh", Update = "update" } export type KontentSmartLinkEventMap = Readonly<{ [KontentSmartLinkEvent.Refresh]: EventHandler<IRefreshMessageData, IRefreshMessageMetadata, Callback>; [KontentSmartLinkEvent.Update]: EventHandler<IUpdateMessageData>; }>; declare class KontentSmartLinkSDK { private configuration; private readonly iframeCommunicator; private readonly domSmartLinkManager; private events; private queryPresenceIntervalCleanup; constructor(configuration?: Partial<KSLPublicConfiguration>); private static getSettingsStorage; initialize: () => Promise<void>; destroy: () => void; updateConfiguration: (configuration: Partial<KSLPublicConfiguration>) => void; on: <TEvent extends keyof KontentSmartLinkEventMap>(event: TEvent, handler: KontentSmartLinkEventMap[TEvent]) => void; off: <TEvent extends keyof KontentSmartLinkEventMap>(event: TEvent, handler: KontentSmartLinkEventMap[TEvent]) => void; private initializeIFrameCommunication; private handleStatusMessage; private handleRefreshMessage; private handleUpdateMessage; private handlePreviewIFrameCurrentUrlRequestMessage; } export default KontentSmartLinkSDK;