UNPKG

video-ad-sdk

Version:

VAST/VPAID SDK that allows video ads to be played on top of any player

174 lines (173 loc) 5.82 kB
import type { ParsedAd, ParsedXML, VastChain, VastMacro, WrapperOptions, MediaFile, InteractiveFile, ParsedOffset, VpaidCreativeData, Optional } from '../types'; import { getLinearTrackingEvents } from './getLinearTrackingEvents'; import { getNonLinearTrackingEvents } from './getNonLinearTrackingEvents'; import { getIcons } from './getIcons'; /** * Selects the ads of the passed VAST. * * @param parsedVast Parsed VAST xml. * @returns Array of ads or empty array. */ export declare const getAds: (parsedVast?: ParsedXML) => ParsedAd[]; /** * Gets the Error URI of the passed parsed VAST xml. * * @param parsedVast Parsed VAST xml. * @returns array of the Vast Error URI */ export declare const getVastErrorURI: (parsedVast?: ParsedXML) => Optional<VastMacro[]>; /** * Gets the sequence of the pod ad. * * @param ad Parsed ad definition object. * @returns The pod ad sequence number. */ export declare const getPodAdSequence: (ad: ParsedAd) => Optional<number>; /** * Checks if the passed ad definition is a pod ad. * * @param ad Parsed ad definition object. * @returns Returns true if there the ad is a pod ad and false otherwise. */ export declare const isPodAd: (ad: ParsedAd) => boolean; /** * Checks if the passed array of ads have an ad pod. * * @param parsedVast Parsed VAST xml. * @returns Returns true if there is an ad pod in the array and false otherwise. */ export declare const hasAdPod: (parsedVast?: ParsedXML) => boolean; /** * Returns true if the passed vastChain has an ad pod or false otherwise. * * @param vastChain Array of VAST responses. See `load` or `requestAd` for more info. * @returns True if the vastChain contains an ad pod and false otherwise. */ export declare const isAdPod: (vastChain?: VastChain) => boolean; /** * Selects the first ad of the passed VAST. If the passed VAST response contains an ad pod it will return the first ad in the ad pod sequence. * * @param parsedVast Parsed VAST xml. * @returns First ad of the VAST xml. */ export declare const getFirstAd: (parsedVast?: ParsedXML) => Optional<ParsedAd>; /** * Checks if the passed ad is a Wrapper. * * @param ad VAST ad object. * @returns `true` if the ad contains a wrapper and `false` otherwise. */ export declare const isWrapper: (ad?: ParsedAd) => boolean; /** * Checks if the passed ad is an Inline. * * @param ad VAST ad object. * @returns Returns `true` if the ad contains an Inline or `false` otherwise. */ export declare const isInline: (ad?: ParsedAd) => boolean; /** * Returns the VASTAdTagURI from the wrapper ad. * * @param ad VAST ad object. * @returns Returns the VASTAdTagURI from the wrapper ad. */ export declare const getVASTAdTagURI: (ad: ParsedAd) => Optional<string>; /** * Returns the options from the wrapper ad. * * @param ad VAST ad object. * @returns Returns the options from the wrapper ad. */ export declare const getWrapperOptions: (ad: ParsedAd) => WrapperOptions; /** * Gets the Error URI of the passed ad. * * @param ad VAST ad object. * @returns array of the Vast ad Error URI. */ export declare const getAdErrorURI: (ad: ParsedAd) => Optional<string[]>; /** * Gets array of the Impression URI of the passed ad. * * @param ad VAST ad object. * @returns array of the Vast ad Impression URI. */ export declare const getImpression: (ad: ParsedAd) => Optional<string[]>; /** * Gets array of the Viewable URI of the passed ad. * * @param ad VAST ad object. * @returns array of the Vast ad Viewable URI. */ export declare const getViewable: (ad: ParsedAd) => Optional<string[]>; /** * Gets array of the NotViewable URI of the passed ad. * * @param ad VAST ad object. * @returns array of the Vast ad NotViewable URI. */ export declare const getNotViewable: (ad: ParsedAd) => Optional<string[]>; /** * Gets array of the ViewUndetermined URI of the passed ad. * * @param ad VAST ad object. * @returns array of the Vast ad ViewUndetermined URI. */ export declare const getViewUndetermined: (ad: ParsedAd) => Optional<string[]>; /** * Gets the ad's MediaFiles. * * @param ad VAST ad object. * @returns array of media files */ export declare const getMediaFiles: (ad: ParsedAd) => Optional<MediaFile[]>; /** * Gets the ad's InteractiveFiles. That were added with the `InteractiveCreativeFile` tag. * * @param ad VAST ad object. * @returns array of media files. */ export declare const getInteractiveCreativeFiles: (ad: ParsedAd) => Optional<InteractiveFile[]>; /** * Gets all the ad's InteractiveFiles. * * @param ad VAST ad object. * @returns array of media files */ export declare const getInteractiveFiles: (ad: ParsedAd) => Optional<InteractiveFile[]>; /** * Gets the click through {@link VastMacro}. * * @param ad VAST ad object. * @returns clickthrough macro */ export declare const getClickThrough: (ad: ParsedAd) => Optional<VastMacro>; /** * Gets the click through {@link VastMacro}. * * @param ad VAST ad object. * @returns click tracking macro */ export declare const getClickTracking: (ad: ParsedAd) => Optional<VastMacro[]>; /** * Gets the custom click {@link VastMacro}. * * @param ad VAST ad object. * @returns click tracking macro */ export declare const getCustomClick: (ad: ParsedAd) => Optional<VastMacro[]>; /** * Gets the skipoffset. * * @param ad VAST ad object. * @returns the time offset in milliseconds or a string with the percentage */ export declare const getSkipOffset: (ad: ParsedAd) => Optional<ParsedOffset>; /** * Gets the creative data. * * @param xml VAST XML text. * @returns with `AdParameters` as they come in the XML and a flag `xmlEncoded` to indicate if the ad parameters are xml encoded. */ export declare const getCreativeData: (xml: string) => VpaidCreativeData; export { getIcons, getLinearTrackingEvents, getNonLinearTrackingEvents };