import { SDKCardEvent as SDKCardEvent_2 } from 'src/lib/sdk-event'; export declare class AACHeadlessStreamContainer { readonly resolvedConfiguration: HeadlessSDKConfiguration & InternalConfiguration; readonly instanceId: string; streamFilters: StreamFilter; private analyticsQueue; private pollCounter; private pollTimer; private store; private boundActions; constructor(config: HeadlessSDKConfiguration, internalConfig: InternalConfiguration, analyticsQueue: AnalyticsQueue); /** * Starts card feed updates to the stream container instance either via WebSocket or HTTP polling depending on SDK configuration. */ start(): void; /** * Stops card feed updates. */ stop(): void; tokenProvider: { requestToken: () => Promise; }; /** * Polls the Atomic platform for card feed updates * @returns */ private pollCardFeed; private cancelCardListPolling; private sendWebSocketFeedSubscriptionMessage; /** * Takes a WebSocket card feed update message and processes it as required */ private handleCardFeedUpdate; /** * Compares the stored feed with an updated feed just received and updates the card count observer if required * @param currentFeed The card feed currently stored in application state * @param incomingFeed The new feed received from the platform */ private trackCardCountChange; /** * Triggers the resolution of runtime variables for supplied cards */ private runtimeVariableResolver; /** * Takes analytics event data and augments it before attempting to send it on the WebSocket and add it to the analytics queue. */ private sendAnalyticsEvent; /** * Manually triggers update of the runtime variables and passes the updated cards to the card feed handler */ updateVariables(): Promise; /** * Handles messages received from the SDK * @param event */ onMessageReceived(event: any): void; } /** * A structured object representing a push notification that was successfully parsed from an iOS or Android payload. */ export declare interface AACPushNotification { /** The instance ID of the card that the push notification relates to. Can be used to apply a filter on a stream container. */ cardInstanceId: string; /** The ID of the stream container that generated the notification. */ containerId: string; /** Detail object, defined as `notificationDetail` and sent as part of the event that generated the card. */ detail: object; } export declare class AACStreamContainer { private iframe; private modalIframe?; private toastIframe?; private outsideClickListener; private queuedMessages; private iframeLoaded; private appOpen; private launchButtonIconContainer?; private launcher?; private resizeObserver?; readonly resolvedConfiguration: SDKConfiguration & InternalConfiguration; readonly instanceId: string; streamFilters: StreamFilter; private config; private analyticsQueue; constructor(config: SDKConfiguration, internalConfig: InternalConfiguration, embedMode: EmbedMode, analyticsQueue: AnalyticsQueue, hostElement?: HTMLElement); /** * Stops the stream container instance, removing it from the page. */ stop(): void; updateVariables(): void; setOpen(open: boolean): void; private getIcon; private toggleAppOpen; private updateAppOpen; private initLauncherButton; private initIframe; onMessageReceived(event: any): Promise; private enqueueAnalyticsEvent; private updateVisibilityForLauncher; private handleRuntimeVariableResolution; sendMessageToIframe(message: SDKReply, appHostWindow?: Window | null): void; private flushMessages; getWindowOrigin(): string; } export declare interface AnalyticsCardContext { cardInstanceId: string; cardInstanceStatus: string; cardViewState: CardViewState; cardPresentation: string; } export declare interface AnalyticsEvent { eventName: string; properties?: AnalyticsEventProperties; hostContext?: AnalyticsEventProperties; cardInstanceId?: string; cardViewState?: CardViewState; } export declare interface AnalyticsEventContext { userLocalTimestamp: string; } export declare interface AnalyticsEventProperties { [key: string]: any; } export declare type AnalyticsEventType = 'standard' | 'custom' | 'sdk-initialized'; export declare class AnalyticsQueue { private authenticatedEventQueue?; private unauthenticatedEventQueue; private flushTimeout; private flushPromise; private authTokenProvider; private tokenUserIdAttribute?; constructor(authTokenProvider: AuthTokenProvider); private getKeyForAuthenticatedQueue; initializeAuthenticatedQueue(userId: string, tokenUserIdAttribute?: string): void; createEventPayload(eventData: AugmentedAnalyticsEvent | CustomAnalyticsEventData | SDKInitializedEventData, eventType: AnalyticsEventType): QueuedAnalyticsEvent | null; enqueue(eventData: AugmentedAnalyticsEvent | CustomAnalyticsEventData | SDKInitializedEventData, eventType?: AnalyticsEventType, eventQueue?: 'authenticated' | 'unauthenticated'): Promise; /** * Removes events from the queue that have been processed by the platform after being sent over the WebSocket. * @param eventIds IDs of events to remove from the queue. */ removeProcessedEvents(eventIds: string[]): void; private performFlush; flush(): Promise; private scheduleFlush; private persistQueue; } export declare interface AnalyticsSDKContext { containerId: string; containerIds?: Array; } export declare interface AnalyticsStreamContext { displayMode?: StreamDisplayMode; streamLength: number; streamLengthVisible: number; cardPositionInStream: number; } export declare type ApiCardActionType = 'dismiss' | 'snooze' | 'submit'; export declare type ApiProtocol = 'http' | 'webSockets'; export declare interface APIResponseMetric { active: number; unseen: number; activeCardInstanceIds: string[]; unseenCardInstanceIds: string[]; } /** * Supports the creation of stream containers in two embed modes: * 1. `launcher`, which displays a launcher button in the bottom right of the page. Clicking the button toggles * the display of the stream container; * 2. `standalone`, which allows you to embed the stream container in a parent element. The iframe can then be * managed as desired. */ declare class AtomicSDK { private static hasPerformedInitialisation; static webSocketDisabled: boolean; private static cachedUserMetrics; private static internalConfig; private static cachedToken?; static onError?: (error: Error) => void; static sdkEventObserver: SDKEventCallback | null; static readonly SDKEvents: { readonly cardCompleted: "card-completed"; readonly cardDismissed: "card-dismissed"; readonly cardSnoozed: "card-snoozed"; readonly cardFeedUpdated: "card-feed-updated"; readonly cardDisplayed: "card-displayed"; readonly cardVotedUp: "card-voted-up"; readonly cardVotedDown: "card-voted-down"; readonly runtimeVarsUpdated: "runtime-vars-updated"; readonly streamDisplayed: "stream-displayed"; readonly userRedirected: "user-redirected"; readonly snoozeOptionsDisplayed: "snooze-options-displayed"; readonly snoozeOptionsCanceled: "snooze-options-canceled"; readonly cardSubviewDisplayed: "card-subview-displayed"; readonly cardSubviewExited: "card-subview-exited"; readonly videoPlayed: "video-played"; readonly videoCompleted: "video-completed"; readonly sdkInitialized: "sdk-initialized"; readonly requestFailed: "request-failed"; readonly notificationReceived: "notification-received"; readonly userFileUploadsStarted: "user-file-uploads-started"; readonly userFileUploadsCompleted: "user-file-uploads-completed"; readonly userFileUploadsFailed: "user-file-uploads-failed"; }; static readonly userMetricsTriggerEvents: Set; static onAuthTokenRequested: AuthTokenCallback | undefined; static tokenRetryInterval: number; static tokenRetryTimer: ReturnType | undefined; static tokenExpiryInterval: number; static authMessageResolve: () => void; static authMessageReject: (error: any) => void; static streamContainers: { [instanceId: string]: { sendMessageToIframe: (message: any) => void; logout: () => void; embedMode: EmbedMode; }; }; static containersBroadcastChannel: ContainerBroadcastChannel | undefined; /** * Sets the session delegate on the AtomicSDK * * @param sessionDelegate Callback that will return a JWT for authentication when requested by the SDK * @param {string} [retryInterval] Optional time the SDK will wait for before calling session delegate again after failing to fetch a valid JWT */ static setSessionDelegate(sessionDelegate: AuthTokenCallback, retryInterval?: number): void; /** * Sets the interval from the token expiry timestamp, within which the SDK will consider the auth token expired and will request a new one. * * @param {number} [interval] number in seconds, greater than zero. */ static setTokenExpiryInterval(interval: number): void; static readonly analyticsQueue: AnalyticsQueue; /** * Create a stream container using the launcher embed mode. * In this mode, a launcher button displays in the bottom right, and clicking on it toggles the stream container. * * @param config Configuration for this stream container. * @return An `AACStreamContainer` instance, which allows you to perform actions on the stream container after * creation. */ static launch(config: SDKConfiguration): AACStreamContainer; /** * Create a stream container using the standalone embed mode. * In this mode, the stream container iframe is added to the provided element, allowing the integrator * to customise the display of the iframe as desired. * * @param hostElement The DOM element to embed the stream container in. * @param config Configuration for this stream container. * @param autosize Whether the iframe displaying the standalone embed should set its height to accommodate all available content and prevent it from scrolling. Defaults to false. * @return An `AACStreamContainer` instance, which allows you to perform actions on the stream container after * creation. */ static embed(hostElement: HTMLElement, config: SDKConfiguration, autosize?: Boolean): AACStreamContainer; static singleCard(hostElement: HTMLElement, config: SDKConfiguration): AACStreamContainer; /** * Instantiate a modal stream container that can be used to display a card feed in a modal dialog. * In this mode, the stream will open in a modal dialog over the top of the current page when cards are present. * Only one instance of a modal stream container can be created at a time. * * @param config Configuration for this stream container. * @return An `AACStreamContainer` instance, which allows you to perform actions on the stream container after * creation. */ static modalStreamContainer(config: SDKConfiguration): void | AACStreamContainer; /** * Create a stream container instance that can be used to observe the card feed, it will not render any UI. * * @param config A configuration object for the observable stream container * @returns An instance of the AACHeadlessStreamContainer */ static observableStreamContainer(config: HeadlessSDKConfiguration): AACHeadlessStreamContainer; private static init; static initialise(apiHost: string, apiKey: string, environmentId: string): Promise; private static initialiseSDKBroadcastChannel; /** * Sets the API protocol the Atomic SDK will use, must be called before intialising the SDK with `AtomicSDK.intialise`. * @param protocol The protocol to use for the card feed api. Defaults to WebSockets. */ static setApiProtocol(protocol: ApiProtocol): void; /** * Sets the verbosity of debug logging to be output by the SDK. * Level 0: Default, no logs exposed * Level 1: Operations and transactions are exposed * Level 2: Operations, transactions and its details are exposed, plus level 1. * Level 3: Internal developer logs, plus level 2 * @param level The logging level to use for the SDK. */ static enableDebugMode(level?: LogLevel): void; /** * Establishes a websocket connection to the '/socket' endpoint */ private static createWebSocketConnection; /** * Re-initialises the current SDK WebSocket connection */ static reinitialiseWebSocketConnection(): void; /** * Sends auth token message on WebSocket connection, if connection is not already authenticated will wait for auth-success * response message before proceeding. */ private static authenticateWebSocketConnection; /** * Method to simulate WebSocket errors on the platform: * https://github.com/atomic-app/action-cards/blob/development/services/client-api/readme.md#error-simulation * @param errorString string of format SOURCE_EVENT_CODE to be passed as error param on WebSocket URL * @param recreateConnection whether to attempt to create a new WebSocket connection after simulating the error, defaults to true */ private static simulateWebSocketError; /** * Sends a message to all active stream container instances to force them to fallback to http polling */ private static triggerPollingFallback; /** * Sets the value of the `X-Atomic-Test-Host` header used in HTTP requests to the client API. * Also sets the test host query parameter used in WebSocket connections. * Intended for local development purposes only. */ static setTestHostHeader(testHost?: string): void; static setClientAppVersion(version: string): void; static setTokenUserIdAttribute(attributeName: string): void; /** * If there has been a token retry interval set, creates a timer to wait for before allowing a subsequent auth token request */ private static setRetryTimer; /** * When a token is required for an authenticated request checks status of cached token * and requests a fresh token if required. * @param refresh If true will request a fresh token rather than return cached token * @returns */ static handleTokenRequest(options?: { skipCache?: boolean; authWebSocket?: boolean; }): Promise; /** * * @returns The current authenticated user ID or an empty string if no user is authenticated */ static getCurrentUserId(): string; /** * Returns the total number of cards within the provided stream container * @param {string} streamContainerId */ static requestCardCount(streamContainerId: string): Promise; /** * @deprecated Since version 24.1.0 this method has been deprecated and will be removed in a future release. * Sends an event to the Atomic Platform for the user identified by the given authentication token. * @param {EventData} event */ static sendEvent(event: EventData): Promise; /** * Queues a custom event to be sent to the Atomic platform * @param data An object consisting of two properties: `eventName`, a string value to identify your event, and `properties`, an optional object containing data for the event. * @throws Will throw an error if there is an issue preventing the custom event from being sent. */ static sendCustomEvent(data: { eventName: string; properties?: AnalyticsEventProperties; }): Promise; /** * Sets a callback that will be called with an event payload whenever an event is triggered in the SDK. * * @param {SDKEventCallback} onSDKEvent either a callback that will be invoked with an event payload whenever an event is triggered in the SDK, or null if you wish to clear the event observation. */ static observeSDKEvents(onSDKEvent: SDKEventCallback | null): void; /** * Requests user metrics for the currently logged in user. * User metrics include the total number of cards available to the user, the total number of cards that haven't yet * been seen by the user, and the number of available and unseen cards in a specific stream container. * Use the returned object to obtain these values. * * @returns A `UserMetrics` object that provides access to user metrics. */ static requestUserMetrics(): Promise; /** * * @param {UserUpdate} userUpdate An object containing the profile & preference properties to be updated on the user * @returns A boolean indicating whether the user update succeeded * @throws Will throw an error if there is an issue preventing the user update */ static updateUser(userUpdate: UserUpdate): Promise; /** * Attempts to execute the requested action on the specified card within the given stream container. * * @param streamContainerId a string identifying the stream container to execute the action in * @param cardId a string identifying the card to execute the action on * @returns an object with methods for 'dismiss', 'snooze' and 'submit' actions */ static onCardAction(streamContainerId: string, cardId: string): { /** * * @param onActionSuccess a function to be invoked when the card is successfully dismissed * @param onActionFailed a function to be invoked when the card fails to be dismissed, will be called with an error parameter */ dismiss: (onActionSuccess: () => void, onActionFailed: (error: Error) => void) => Promise; /** * * @param onActionSuccess a function to be invoked when the card is successfully snoozed * @param onActionFailed a function to be invoked when the card fails to be snoozed, will be called with an error parameter * @param interval the interval in seconds for which the card should be snoozed */ snooze: (onActionSuccess: () => void, onActionFailed: (error: Error) => void, interval: number) => Promise; /** * * @param onActionSuccess a function to be invoked when the card is successfully submitted * @param onActionFailed a function to be invoked when the card fails to be submitted, will be called with an error parameter * @param submitButtonName a string identifying the submit button pressed, this should be taken from the `name` attribute from the button node * @param response an optional object containing response values for the card. Keys must be strings and values must be strings, numbers or booleans */ submit: (onActionSuccess: () => void, onActionFailed: (error: Error) => void, submitButtonName: string, response?: CardResponse) => Promise; }; /** * Call this method each time the logged in user changes. * Flushes any pending analytics events so that they are sent to the Atomic Platform immediately. * Resets the state of active stream containers so no cards are displayed. * Clears the auth token so SDK is ready to accept a new token for the new user. * Resets the connection to the Atomic Platform so there will be no communication with the platform while unauthenticated. * For iOS and Android apps this method will also de-register the device for notifications if the parameter is supplied. * Stream containers elements are left in place so you can clean these up when appropriate to remove the container UI. * * @param {boolean} deregisterNotifications - If true, will de-register the device for notifications. Defaults to false. */ static logout(deregisterNotifications?: boolean): Promise; /** * A convenience method that can be used to supply your apiHost, apiKey, environmentId & sessionDelegate in one call. * Internally this will call AtomicSDK.initialise & AtomicSDK.setSessionDelegate with your supplied values. * * @param apiHost * @param apiKey * @param environmentId * @param sessionDelegate Callback that will return a JWT for authentication when requested by the SDK * @param {string} [retryInterval] Optional time the SDK will wait for before calling session delegate again after failing to fetch a valid JWT */ static login(apiHost: string, apiKey: string, environmentId: string, sessionDelegate: AuthTokenCallback, retryInterval?: number): void; /** * For iOS and Android apps only. * * Call this method when you are integrating the SDK inside of a native iOS or Android app. For example, * if you use a wrapper such as Cordova or Capacitor, and want to use push notifications. * * Must be called before registerDeviceForNotifications, registerStreamContainersForNotifications, deregisterDeviceForNotifications. * * @param deviceInfo information about the platform and device * @returns boolean true if the info was succesfully set */ static setNativeDeviceInfo(deviceInfo: DeviceInfo): boolean; /** * For iOS and Android apps only. * * Asks the SDK to register the given device token against the currently logged in user, identified by the auth * token returned by the global session delegate. * * @param deviceToken Push device token provided by the operating system. * @returns The returned promise is resolved if the registration succeeds, or is rejected if the request fails. */ static registerDeviceForNotifications(token: string): Promise; /** * For iOS and Android apps only. * * Asks the SDK to deregister the current device for Atomic push notifications, within the current app. */ static deregisterDeviceForNotifications(): Promise; /** * For iOS and Android apps only. * * Asks the SDK to register the currently logged in user for push notifications on the stream container IDs in the * provided array. The user is identified by the token returned in the global session delegate. * If you pass the optional `notificationsEnabled` argument, the user's notificationsEnabled preference will be * updated in the Atomic Platform. * * @param streamContainerIds The stream container IDs to register the current user against for push notifications. * @param notificationsEnabled (Optional) Whether push notifications, for the current user, should be enabled or disabled in the Atomic Platform. */ static registerStreamContainersForNotifications(streamContainersIds: [string], notificationsEnabled?: boolean): Promise; /** * For iOS and Android apps only. * * Determines whether the given push notification payload is for a push notification sent by the Atomic Platform. * If the push payload is for an Atomic push notification, this method returns an instance of * `AACPushNotification` populated with details of the notification. Otherwise, it returns null. * * @param payload The push notification payload provided from the operating system. */ static notificationFromPushPayload(payload: unknown): AACPushNotification | null; /** * For iOS and Android apps only. * * Tracks that a push notification, with the given payload, was received by this device. * If the payload does not represent an Atomic push notification, this method has no effect and returns false. * Otherwise, this method dispatches an analytics event back to Atomic to indicate that the user's device received the * notification and returns true. * * It is the responsibility of the integrator to ensure that this method is called at the correct location to * ensure accurate tracking. * * @param payload The push notification payload to inspect. */ static trackPushNotificationReceived(payload: unknown): boolean; } export default AtomicSDK; export declare interface AugmentedAnalyticsEvent extends AnalyticsEvent { endUserId: string; timestamp: Date; containerId?: string; containerIds?: Array; displayMode?: StreamDisplayMode; streamLength?: number; streamLengthVisible?: number; streamCardPosition?: number; cardInstanceStatus?: string; } export declare type AuthToken = string | undefined; export declare type AuthTokenCallback = () => Promise; export declare interface AuthTokenProvider { requestToken: AuthTokenCallback; } export declare type BroadcastChannelMessage = MessageEvent & { data: { type: CHANNEL_MESSAGE_TYPE; }; }; export declare interface CardActions { dismiss: CardActionType; snooze: CardActionType; voteDown: CardVotingActionType; voteUp: CardVotingActionType; } export declare type CardActionType = { overflow: boolean; }; export declare interface CardCountResponse { totalCards: number; } export declare interface CardEvent { type: CardEventType; eventPayload?: CardEventPayload; } /** * Different types of card events that the SDK can trigger * in the host app. */ export declare type CardEventPayload = Omit; export declare enum CardEventType { DISMISSED = "dismissed", DISMISS_FAILED = "dismiss-failed", SUBMITTED = "submitted", SUBMIT_FAILED = "submit-failed", SNOOZED = "snoozed", SNOOZE_FAILED = "snooze-failed", VOTED_USEFUL = "voted-useful", VOTED_NOT_USEFUL = "voted-not-useful" } export declare interface CardInstance { defaultView: CardLayout; actions: CardActions; subviews: { [key: string]: SubviewLayout; }; instance: CardInstanceMetadata; metadata: CardMetadata; runtimeVariables?: Array; } export declare interface CardInstanceMetadata { id: string; status: string; created: string; lifecycleId: string; eventName: string; } export declare interface CardLayout { nodes: Array; } export declare interface CardMetadata { lastCardActiveTime: string; receivedAt: string; processedAt: string; updatedAt: string; priority: number; payloadMetadata?: PayloadMetadata; expires?: string; } export declare interface CardResponse { [key: string]: string | number | boolean | undefined | FileResponse | CheckboxGroupResponse | null; } export declare interface CardsAPIResponse { ok: boolean; event?: SDKCardEvent; error?: Error; } export declare type CardViewState = 'topview' | 'subview'; export declare type CardVotingActionType = CardActionType & { feedback?: boolean; feedbackLabel?: string; }; export declare enum CHANNEL_MESSAGE_TYPE { STATE = "state-update", ANALYTICS_EVENT = "analytics-event-dispatched" } export declare type CheckboxGroupResponse = { [key: string]: boolean; }; /** * Wrapper around the Broadcast Channel API to provide an interface that shows the open status of the channel object * as well as a way to add and remove event listeners by id. */ export declare class ContainerBroadcastChannel { private channel; isOpen: boolean; private eventListeners; constructor(); /** * Adds an event listener to this broadcast channel object * @param eventName The name of the event to listen for. Can be 'message' or 'messageerror'. * @param listener The callback to be invoked when the event is dispatched. * @param id An optional string to identify the event listener. If not provided, a unique id will be generated. * @returns The id identifying the event listener stored in this Broadcast Channel object. */ addEventListener(eventName: 'message' | 'messageerror', listener: (event: BroadcastChannelMessage) => void, id?: string): string | void; /** * Removes the event listener identified by the given id from this broadcast channel object * @param id The id of the event listener to remove. * @returns True if the event listener was removed, false otherwise. */ removeEventListener(id: string): boolean | void; postMessage(message: any): void; close(): void; } export declare interface ContainerMetric extends APIResponseMetric { containerId: string; activeCardInstanceIds: string[]; unseenCardInstanceIds: string[]; } export declare interface CordovaConfiguration { enabled: boolean; } export declare interface CustomAnalyticsEvent extends Omit { eventType: 'custom'; analyticsEvent?: string; eventName: string; properties?: AnalyticsEventProperties; sdkContext: {}; } export declare interface CustomAnalyticsEventData { endUserId: string; eventName: string; properties?: AnalyticsEventProperties; timestamp: Date; } export declare interface CustomStrings { cardListTitle?: string; awaitingFirstCard?: string; allCardsCompleted?: string; cardSnoozeTitle?: string; votingUsefulTitle?: string; votingNotUsefulTitle?: string; votingFeedbackTitle?: string; votingFeedbackValidationMessage?: string; noInternetConnectionMessage?: string; dataLoadFailedMessage?: string; tryAgainTitle?: string; processingStateMessage?: string; processingStateCancelButtonTitle?: string; thumbnailImageActionLinkTitle?: string; thumbnailVideoActionLinkTitle?: string; } export declare interface DeviceInfo { platform: NativePlatform; deviceId: string; appId: string; } /** * Different ways in which a stream container can be embedded: * 1. launcher: Displays as a floating button in the bottom right of the screen. Tapping the button * toggles the stream container iframe. * 2. standalone: Embedded inside of a nominated element. Styling is controlled by the integrator. * 3. preview: The SDK is being displayed inside the Workbench card builder. * 4. single-card: The SDK is rendering a single card inside of an iframe. * 5. modal-subview: The iframe is rendering a modal iframe - it will never render the card feed, * and is designed to supplement the single card view. * 6. toast: The iframe is rendering a toast iframe, this */ export declare type EmbedMode = 'launcher' | 'standalone' | 'preview' | 'single-card' | 'modal-stream' | 'modal-subview' | 'toast' | 'headless'; export declare interface EventData { name: string; lifecycleId?: string; payload?: EventPayload; } export declare interface EventPayload { detail?: object; metadata?: object; notificationDetail?: object; } export declare interface EventResponse { batchId: string; processedEvents: ProcessedEvent[]; } export declare interface FeatureFlags { cordova?: CordovaConfiguration; runtimeVariableAnalytics?: boolean; /** * @deprecated * This feature is deprecated and will be removed in a future version of the SDK. * Use the card voting menu configuration in the atomic workbench instead https://documentation.atomic.io/guide/cards/behaviour#card-voting */ cardVoting?: VotingOptions; /** * @deprecated * This feature configuration is deprecated and will be removed in a future version of the SDK. * Use the card minimum height property on the stream container configuration instead https://documentation.atomic.io/sdks/web#card-minimum-height */ cardMinimumHeight?: number; /** * @deprecated * This feature configuration is deprecated and will be removed in a future version of the SDK. * Use the horizontal container configuration property on the stream container configuration instead https://documentation.atomic.io/sdks/web#displaying-a-horizontal-stream-container */ horizontalContainerConfig?: HorizontalContainerConfig; /** * @deprecated * This feature configuration is deprecated and will be removed in a future version of the SDK. * Use the controlled container open state property on the stream container configuration instead https://documentation.atomic.io/sdks/web#manually-controlling-other-stream-container-variants */ controlledContainerOpenState?: boolean; } export declare type FileResponse = { filename: string; targetBucketId: string; destinationFilename?: string; size?: number; type?: UploadFileType; }; export declare interface FileUploadDetail { filename: string; targetBucketId: string; } export declare type FileUploadsEventProperties = SubviewDetailProperties & { [key: string]: FileUploadDetail; }; export declare type FilterObject = { [key: string]: any; }; export declare interface FirstLoadStyles { backgroundColor: string; textColor: string; buttonTextColor: string; loadingSpinnerColor: string; } export declare interface HeadlessSDKConfiguration { streamContainerId: string; cardFeedHandler: (cardInstances: Array) => void; cardListRefreshInterval?: number; onRuntimeVariablesRequested?: RuntimeVariableResolverCallback; runtimeVariableResolutionTimeout?: number; onCardCountChanged?: (cardCount: number, totalCards: number) => void; features?: Pick; } export declare interface HorizontalContainerConfig { enabled: boolean; cardWidth: number; emptyStyle?: 'standard' | 'shrink'; headerAlignment?: 'center' | 'left'; scrollMode?: 'snap' | 'free'; lastCardAlignment?: 'left' | 'center'; } export declare type InterfaceStyle = 'light' | 'dark' | 'automatic'; export declare interface InternalConfiguration { apiHost?: string; apiKey?: string; environmentId?: string; autosizeFrame?: Boolean; testHost?: string; clientAppVersion?: string; tokenUserIdAttribute?: string; webSocketDisabled?: boolean; pollingFallbackDisabled?: boolean; } export declare const LAUNCHER_BUTTON_CLASS = "atomic-sdk-launcher"; export declare const LAUNCHER_WRAPPER_CLASS = "atomic-sdk-launcher-wrapper"; export declare interface LauncherButtonConfig { disabled?: boolean; backgroundColor?: string; openIconSrc?: string; closeIconSrc?: string; } export declare interface LayoutNode { type: string; attributes: LayoutNodeAttributes; key?: string; children?: Array; validations?: ValidationMap; } export declare interface LayoutNodeAttributes { [key: string]: any; } /** * Defines the level of detail for the logger. Higher levels include all the details of lower levels. */ export declare enum LogLevel { DISABLED = 0, TRANSACTIONS = 1, PAYLOAD = 2, FULL_DETAIL = 3 } export declare interface MaxCheckedValidationAttributes extends ValidationAttributes { maxChecked: number; } export declare interface MaxDateValidationAttributes extends ValidationAttributes { maximumDate: string; } export declare interface MaximumValidationAttributes extends ValidationAttributes { maximum: number; } export declare interface MaxLengthValidationAttributes extends ValidationAttributes { maximumLength: number; } export declare interface MaxSizeBytesValidationAttributes extends ValidationAttributes { maxSizeBytes: number; } export declare interface Metric { active: number; unseen: number; } export declare interface MinCheckedValidationAttributes extends ValidationAttributes { minChecked: number; } export declare interface MinDateValidationAttributes extends ValidationAttributes { minimumDate: string; } export declare interface MinimumValidationAttributes extends ValidationAttributes { minimum: number; } export declare interface MinLengthValidationAttributes extends ValidationAttributes { minimumLength: number; } export declare const MODAL_STREAM_EMBED_ID = "atomic-sdk-modal-stream-embed"; export declare type NativePlatform = 'iOS' | 'Android'; export declare type NotifyDays = { mon?: NotifyTimes[]; tue?: NotifyTimes[]; wed?: NotifyTimes[]; thu?: NotifyTimes[]; fri?: NotifyTimes[]; sat?: NotifyTimes[]; sun?: NotifyTimes[]; default?: NotifyTimes[]; }; export declare interface NotifyTimes { from: { hours: number; minutes: number; }; to: { hours: number; minutes: number; }; } export declare interface Operators { equals: (value: T) => void; greaterThan: (value: T) => void; greaterThanOrEqualTo: (value: T) => void; in: (value: T[]) => void; lessThan: (value: T) => void; lessThanOrEqualTo: (value: T) => void; notEqualTo: (value: T) => void; notIn: (value: T[]) => void; between: (value: [number, number]) => void; } export declare interface PayloadMetadata { [key: string]: any; } export declare type PriorityFilterValue = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; export declare interface ProcessedEvent { name: string; version: number; lifecycleId: string; } export declare type QueuedAnalyticsEvent = StandardAnalyticsEvent | SDKInitializedEvent | CustomAnalyticsEvent; export declare interface RegularExpressionValidationAttributes extends ValidationAttributes { regexp: string; } export declare interface RequiredValidationAttributes extends ValidationAttributes { required: boolean; } export declare interface RuntimeVariable { name: string; defaultValue: any; type: string; defaultFormatterOption?: string; } export declare interface RuntimeVariableResolutionCard { eventName: string; lifecycleId: string; id: string; runtimeVariables: Map; } export declare type RuntimeVariableResolverCallback = (cards: RuntimeVariableResolutionCard[], callback: (cards: RuntimeVariableResolutionCard[]) => void) => void; export declare interface SDKAnalyticsEvent extends SDKEventBase { eventName: SDKEventName; analyticsEvent: SDKEventName; sdkContext: { containerId: string; }; streamContext: { streamLength: number; streamLengthVisible: number; cardPositionInStream: number; }; cardContext: { cardInstanceId: string; cardInstanceStatus: string; cardViewState: string; }; } export declare interface SDKCardCompletedEvent extends SDKCardEvent { eventName: typeof SDKEventNames.cardCompleted; analyticsEvent: typeof SDKEventNames.cardCompleted; } export declare interface SDKCardDismissedEvent extends SDKCardEvent { eventName: typeof SDKEventNames.cardDismissed; analyticsEvent: typeof SDKEventNames.cardDismissed; } export declare interface SDKCardDisplayedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.cardDisplayed; analyticsEvent: typeof SDKEventNames.cardDisplayed; } export declare interface SDKCardEvent { id: string; endUserId: string; eventName: typeof SDKEventNames.cardCompleted | typeof SDKEventNames.cardDismissed | typeof SDKEventNames.cardSnoozed; analyticsEvent: typeof SDKEventNames.cardCompleted | typeof SDKEventNames.cardDismissed | typeof SDKEventNames.cardSnoozed; timestamp: string; sdkContext: { containerId: string; }; } export declare interface SDKCardSnoozedEvent extends SDKCardEvent { eventName: typeof SDKEventNames.cardSnoozed; analyticsEvent: typeof SDKEventNames.cardSnoozed; } export declare interface SDKCardVotedDownEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.cardVotedDown; analyticsEvent: typeof SDKEventNames.cardVotedDown; properties: { reason: string; source: string; message?: string; }; } export declare interface SDKCardVotedUpEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.cardVotedUp; analyticsEvent: typeof SDKEventNames.cardVotedUp; } export declare interface SDKConfiguration { streamContainerId?: string; cardListRefreshInterval?: number; runtimeVariableResolutionTimeout?: number; onCardCountChanged?: (cardCount: number, totalCards: number) => void; onRuntimeVariablesRequested?: RuntimeVariableResolverCallback; onLinkButtonPressed?: (payload: any) => void; onSubmitButtonPressed?: (payload: any) => void; onSizeChanged?: (width: number, height: number) => void; onCardEvent?: (event: CardEvent) => void; onLauncherToggled?: (open?: boolean) => void; onModalStreamToggled?: (open?: boolean) => void; customStrings?: CustomStrings; enabledUiElements?: UIElements; features?: FeatureFlags; firstLoadStyles?: FirstLoadStyles; interfaceStyle?: InterfaceStyle; controlledContainerOpenState?: boolean; cardMinimumHeight?: number; cardMaximumWidth?: number; horizontalContainerConfig?: HorizontalContainerConfig; modalContainerPositioning?: 'top' | 'center' | 'bottom'; modalContainerVerticalPadding?: number; cardHorizontalAlignment?: 'leading' | 'center' | 'trailing'; } export declare type SDKEvent = SDKCardCompletedEvent | SDKCardDismissedEvent | SDKCardSnoozedEvent | SDKFeedEvent | SDKCardDisplayedEvent | SDKCardVotedUpEvent | SDKCardVotedDownEvent | SDKRuntimeVarsUpdatedEvent | SDKStreamDisplayedEvent | SDKRedirectedEvent | SDKSnoozeOptionsDisplayedEvent | SDKSnoozeOptionsCanceledEvent | SDKSubviewDisplayedEvent | SDKSubviewExitedEvent | SDKVideoPlayedEvent | SDKVideoCompletedEvent | SDKInitEvent | SDKRequestFailedEvent | SDKNotificationReceivedEvent | SDKUserFileUploadsStartedEvent | SDKUserFileUploadsCompletedEvent | SDKUserFileUploadsFailedEvent; export declare interface SDKEventBase { id: string; endUserId: string; timestamp: string; eventContext: { userLocalTimestamp: string; }; } export declare type SDKEventCallback = (event: SDKEvent) => void; export declare type SDKEventName = (typeof SDKEventNames)[keyof typeof SDKEventNames]; export declare const SDKEventNames: { readonly cardCompleted: "card-completed"; readonly cardDismissed: "card-dismissed"; readonly cardSnoozed: "card-snoozed"; readonly cardFeedUpdated: "card-feed-updated"; readonly cardDisplayed: "card-displayed"; readonly cardVotedUp: "card-voted-up"; readonly cardVotedDown: "card-voted-down"; readonly runtimeVarsUpdated: "runtime-vars-updated"; readonly streamDisplayed: "stream-displayed"; readonly userRedirected: "user-redirected"; readonly snoozeOptionsDisplayed: "snooze-options-displayed"; readonly snoozeOptionsCanceled: "snooze-options-canceled"; readonly cardSubviewDisplayed: "card-subview-displayed"; readonly cardSubviewExited: "card-subview-exited"; readonly videoPlayed: "video-played"; readonly videoCompleted: "video-completed"; readonly sdkInitialized: "sdk-initialized"; readonly requestFailed: "request-failed"; readonly notificationReceived: "notification-received"; readonly userFileUploadsStarted: "user-file-uploads-started"; readonly userFileUploadsCompleted: "user-file-uploads-completed"; readonly userFileUploadsFailed: "user-file-uploads-failed"; }; export declare interface SDKFeedEvent { eventName: typeof SDKEventNames.cardFeedUpdated; analyticsEvent: typeof SDKEventNames.cardFeedUpdated; id: string; endUserId: string; timestamp: string; eventContext: { userLocalTimestamp: string; }; sdkContext: { containerId: string; }; properties: { cardCount: number; }; } export declare interface SDKInitEvent extends SDKEventBase { eventName: typeof SDKEventNames.sdkInitialized; analyticsEvent: typeof SDKEventNames.sdkInitialized; } export declare interface SDKInitializedEvent extends Omit { cardContext: {}; streamContext: {}; sdkContext: {}; } export declare interface SDKInitializedEventData extends Pick { eventName: 'sdk-initialized'; } export declare interface SDKNotificationReceivedEvent extends SDKEventBase { eventName: typeof SDKEventNames.notificationReceived; analyticsEvent: typeof SDKEventNames.notificationReceived; sdkContext: { containerId: string; }; cardContext: { cardInstanceId: string; }; } export declare interface SDKRedirectedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.userRedirected; analyticsEvent: typeof SDKEventNames.userRedirected; properties: { linkMethod: string; url?: string; payload?: any; }; } export declare interface SDKReply { action: string; values?: ValuesType; } export declare interface SDKRequestFailedEvent extends SDKEventBase { eventName: typeof SDKEventNames.requestFailed; analyticsEvent: typeof SDKEventNames.requestFailed; properties: { path: string; statusCode: string; }; sdkContext: { containerId?: string; containerIds?: Array; }; cardContext: { cardInstanceId?: string; }; } export declare interface SDKRuntimeVarsUpdatedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.runtimeVarsUpdated; analyticsEvent: typeof SDKEventNames.runtimeVarsUpdated; properties: { resolvedVariables: { [key: string]: string; }; }; } export declare interface SDKSnoozeOptionsCanceledEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.snoozeOptionsCanceled; analyticsEvent: typeof SDKEventNames.snoozeOptionsCanceled; } export declare interface SDKSnoozeOptionsDisplayedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.snoozeOptionsDisplayed; analyticsEvent: typeof SDKEventNames.snoozeOptionsDisplayed; } export declare interface SDKStreamDisplayedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.streamDisplayed; analyticsEvent: typeof SDKEventNames.streamDisplayed; } export declare interface SDKSubviewDisplayedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.cardSubviewDisplayed; properties: { subviewId: string; subviewTitle: string; subviewLevel: number; }; } export declare interface SDKSubviewExitedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.cardSubviewExited; properties: { subviewId: string; subviewTitle: string; subviewLevel: number; }; } export declare interface SDKUserFileUploadsCompletedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.userFileUploadsCompleted; properties: FileUploadsEventProperties; } export declare interface SDKUserFileUploadsFailedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.userFileUploadsFailed; properties: FileUploadsEventProperties & { error: string; }; } export declare interface SDKUserFileUploadsStartedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.userFileUploadsStarted; properties: FileUploadsEventProperties; } export declare interface SDKVideoCompletedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.videoCompleted; properties: { media: string; mediaURL: string; }; } export declare interface SDKVideoPlayedEvent extends SDKAnalyticsEvent { eventName: typeof SDKEventNames.videoPlayed; properties: { media: string; mediaURL: string; }; } export declare interface StandardAnalyticsEvent { id: string; endUserId: string; analyticsEvent: string; timestamp: string; properties: AnalyticsEventProperties; hostContext: AnalyticsEventProperties; eventContext: AnalyticsEventContext; sdkContext: AnalyticsSDKContext; streamContext: AnalyticsStreamContext; cardContext: AnalyticsCardContext; } declare const STREAM_DISPLAY_MODES: { readonly stream: "stream"; readonly single: "single"; readonly launcher: "launcher"; readonly horizontal: "horizontal"; readonly modal: "modal"; }; export declare type StreamDisplayMode = (typeof STREAM_DISPLAY_MODES)[keyof typeof STREAM_DISPLAY_MODES]; export declare class StreamFilter { private filters; private onApplyFilter; private onClearFilter; constructor(onApplyFilter: () => void, onClearFilter: () => void); addVariableFilter: (key: string) => Operators; addPayloadVariableFilter: (key: string) => Operators; addCardContentFilter: (key: string) => Operators; addSubviewContentFilter: (key: string) => Operators; addPayloadMetadataFilter: (key: string) => Operators; genericFilter: (namespace: string, key: string, callingFunctionName: string, propertyType?: string) => Operators; addCardTemplateIdFilter: () => Omit, "greaterThan" | "greaterThanOrEqualTo" | "lessThan" | "lessThanOrEqualTo" | "between">; addCardTemplateNameFilter: () => Omit, "greaterThan" | "greaterThanOrEqualTo" | "lessThan" | "lessThanOrEqualTo" | "between">; addCardCreatedFilter: () => Omit, "in" | "notIn" | "between">; addCardPriorityFilter: () => Operators; clearFilters: () => void; apply: () => void; getFilterObject: () => FilterObject; } export declare interface SubviewDetailProperties { subviewId?: string; subviewLevel?: number; subviewTitle?: string; } export declare interface SubviewLayout { title: string; nodes: Array; } export declare interface ToastConfig { timeout?: number; toastMessages?: { submittedCard?: string; dismissedCard?: string; snoozedCard?: string; feedbackReceived?: string; fileUploadFailed?: string; }; } export declare interface UIElements { cardListToast?: boolean; customToastContainer?: boolean; toastConfig?: ToastConfig; cardListHeader?: boolean; customContainerHeader?: { scrollHeader?: boolean; headerElement: string; }; launcherButton?: LauncherButtonConfig; } export declare type UploadFileType = 'image'; /** * Returns card-related metrics for the current user. * * Metrics include: * - How many cards are visible for the user in a given stream container; * - How many cards _in total_ are visible for the user; * - How many cards remain unseen for the user in a given stream container; * - How many cards _in total_ are unseen for the user. */ export declare class UserMetrics { private totals; private metricsByContainer; constructor(data: UserMetricsResponse); unseenCards(): number; totalCards(): number; unseenCardsForStreamContainer(streamContainerId: string): number; totalCardsForStreamContainer(streamContainerId: string): number; } export declare interface UserMetricsAggregates { cards: UserMetricsCards; } export declare interface UserMetricsCards { byContainer: ContainerMetric[]; total: APIResponseMetric; } export declare interface UserMetricsResponse { aggregates: UserMetricsAggregates; } export declare interface UserUpdate { /** * All profile fields are optional. * Custom profile fields can be supplied but must first be defined in the Workbench, * date values for a custom profile field must be a JS Date object or a valid ISO string. */ profile?: { external_id?: string; name?: string; email?: string; phone?: string; city?: string; country?: string; region?: string; [key: string]: string | undefined; }; preferences?: { notifications?: NotifyDays; notificationsEnabled?: boolean; }; } export declare interface Validation { attributes: A; } export declare interface ValidationAttributes { errorMessage?: string; } export declare type ValidationMap = Partial; export declare interface ValidationTypeMap { required: Validation; minimumDate: Validation; maximumDate: Validation; regexp: Validation; minimum: Validation; maximum: Validation; minimumLength: Validation; maximumLength: Validation; minChecked: Validation; maxChecked: Validation; maxSizeBytes: Validation; } export declare interface VotingOptions { canVoteUseful: boolean; canVoteNotUseful: boolean; } export { }