@jolibox/ads 1.1.19-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # Jolibox JSSDK Interface
@@ -0,0 +1,36 @@
1
+ import { IAFGAdBreakServerParams } from './type';
2
+ import type { IAbstractAFGProvider, IPlacementInfo, IAdBreakParams } from './ads-interface';
3
+ import type { IAdsContext } from '../type/base';
4
+ export declare class AdBreakAsyncProxy {
5
+ private context;
6
+ private continueCallback?;
7
+ private isBeforeAdCalled;
8
+ private isBeforeRewardCalled;
9
+ private isAdDismissedCalled;
10
+ private isAdViewedCalled;
11
+ private isAfterAdCalled;
12
+ private currentProvider?;
13
+ private currentClientParams?;
14
+ private adsHasResponse;
15
+ private videoChecker;
16
+ constructor(context: IAdsContext);
17
+ get paramsToTrack(): {
18
+ provider: string | null;
19
+ type: "reward" | "preroll" | "start" | "pause" | "next" | "browse" | undefined;
20
+ name: string | null;
21
+ };
22
+ private wrapBeforeAd;
23
+ private wrapShowAdFn;
24
+ private wrapBeforeReward;
25
+ private wrapAdDismissed;
26
+ private wrapAdViewed;
27
+ private wrapAfterAd;
28
+ private wrapAdBreakDone;
29
+ /**
30
+ * Manages ad break execution and continuation logic
31
+ * @param adsProvider The ad provider implementation
32
+ * @param clientParams Configuration for the ad break
33
+ * @returns Promise resolving with continuation flag and last placement info
34
+ */
35
+ callAdBreakAndContinue<T extends IAFGAdBreakServerParams>(adsProvider: IAbstractAFGProvider, clientParams: IAdBreakParams, serverParam: T): Promise<[boolean, IPlacementInfo]>;
36
+ }
@@ -0,0 +1,8 @@
1
+ import { IAdsContext } from '@/type/base';
2
+ export declare class AdsActionDetection {
3
+ private context;
4
+ adBreakIsShowing: boolean;
5
+ private reportPageJumpOut;
6
+ private reportPageHide;
7
+ constructor(context: IAdsContext);
8
+ }
@@ -0,0 +1,199 @@
1
+ import { IAFGAdBreakServerParams, IAFGInitServerParams } from './type';
2
+ declare global {
3
+ interface Window {
4
+ adsbygoogle: Array<unknown>;
5
+ JoliTesterBridge?: {
6
+ log: (message: string) => void;
7
+ };
8
+ }
9
+ }
10
+ export interface IAdsInitParams {
11
+ /**
12
+ * (OPTIONAL) Game ID provided by Jolibox
13
+ */
14
+ gameId?: string;
15
+ }
16
+ export interface IAdConfigParams {
17
+ /**
18
+ * (OPTIONAL) Whether ads should always be preloaded before the first call to adBreak()
19
+ *
20
+ * The default value of auto leaves the decision up to the Ad Placement API. preloadAdBreaks can be set only once with adConfig(), and further values passed to preloadAdBreaks have no effect.
21
+ *
22
+ * Setting preloadAdBreaks after the first call to adBreak() has no effect.
23
+ */
24
+ preloadAdBreaks?: 'on' | 'auto';
25
+ /**
26
+ * (OPTIONAL) Whether the game is currently playing sound.
27
+ *
28
+ * This call specifies whether your game is capable of sound, and whether the sound was enabled (ie unmuted) before the call to adBreak(). This helps the Ad Placement API to select the right kind of ad for your game.
29
+ *
30
+ * Call this function as soon as the sound state of your game changes, as the Ad Placement API may have to request new creatives, and this gives it the maximum amount of time to do so.
31
+ *
32
+ * The default value is sound on. So most games will need to make a call to adConfig() when they start to declare that they have sound enabled.
33
+ */
34
+ sound?: 'on' | 'off';
35
+ /**
36
+ * (OPTIONAL) Called when the API has initialized and has finished preloading ads (if you requested preloading using the preloadAdBreaks above).
37
+ * @returns
38
+ */
39
+ onReady?: () => void;
40
+ }
41
+ /**
42
+ * PlacementInfo object passed by **adBreakDone** function
43
+ */
44
+ export interface IPlacementInfo {
45
+ /**
46
+ * the type argument passed to adBreak()
47
+ */
48
+ breakType: string;
49
+ /**
50
+ * the name argument passed to adBreak()
51
+ */
52
+ breakName?: string;
53
+ breakFormat: 'interstitial' | 'reward';
54
+ /**
55
+ * the status of this placement and can be one of the following values:
56
+ *
57
+ * | breakStatus | Reason |
58
+ * | -------- | ------- |
59
+ * | 'notReady' | The Ad Placement API had not initialised |
60
+ * | 'timeout' | A placement timed out because the Ad Placement API took too long to respond |
61
+ * | 'invalid' | The placement was invalid and was ignored–for instance there should only be one preroll placement per page load, subsequent prerolls are failed with this status |
62
+ * | 'error' | There was a JavaScript error in a callback |
63
+ * | 'noAdPreloaded' | An ad had not been preloaded yet so this placement was skipped |
64
+ * | 'frequencyCapped' | An ad wasn't shown because the frequency cap was applied to this placement |
65
+ * | 'ignored' | The user didn't click on a reward prompt before they reached the next placement, that is showAdFn() wasn't called before the next adBreak(). |
66
+ * | 'other' | The ad was not shown for another reason. (e.g., The ad was still being fetched, or a previously cached ad was disposed because the screen was resized/rotated.) |
67
+ * | 'dismissed' | The user dismissed a rewarded ad before viewing it to completion |
68
+ * | 'viewed' | The ad was viewed by the user |
69
+ */
70
+ breakStatus: 'notReady' | 'timeout' | 'error' | 'noAdPreloaded' | 'frequencyCapped' | 'ignored' | 'other' | 'dismissed' | 'viewed';
71
+ }
72
+ /**
73
+ * Parameter when calling adBreak
74
+ */
75
+ export type IAdBreakParams = IPrerollParams | IInterstitialsParams | IRewardParams;
76
+ /**
77
+ * Parameter when calling preroll type adBreak
78
+ */
79
+ export interface IPrerollParams {
80
+ /**
81
+ * 'preroll' before the game loads (before UI has rendered)
82
+ */
83
+ type: 'preroll';
84
+ /**
85
+ * (OPTIONAL) Always called as the last step in an adBreak(), even if there was no ad shown. Function takes as argument a placementInfo object
86
+ * @param placementInfo
87
+ * @returns
88
+ */
89
+ adBreakDone?: (placementInfo: IPlacementInfo) => void;
90
+ }
91
+ export interface IInterstitialsParams {
92
+ /**
93
+ * 'start' before the gameplay starts (after UI has rendered)
94
+ * 'pause' the player pauses the game
95
+ * 'next' player navigates to the next level
96
+ * 'browse' the player explores options outside of the gameplay
97
+ */
98
+ type: 'start' | 'pause' | 'next' | 'browse';
99
+ /**
100
+ * (OPTIONAL) a name for this particular ad placement within your game. It is an internal identifier, and is not shown to the player. In future releases this identifier may be used to enable additional reporting and optimization features.
101
+ *
102
+ * We recommend you name all of your placements.
103
+ */
104
+ name?: string;
105
+ /**
106
+ * (OPTIONAL) Called before the ad is displayed. The game should pause and mute the sound. These actions must be done synchronously. The ad will be displayed immediately after this callback finishes.
107
+ *
108
+ * @returns
109
+ */
110
+ beforeAd?: () => void;
111
+ /**
112
+ *
113
+ * @returns (OPTIONAL) Called after the ad is finished (for any reason). For rewarded ads, it is called after either adDismissed or adViewed, depending on player actions. This function should be used to resume game flow. For example, use to unmute the sound and start the next level.
114
+ */
115
+ afterAd?: () => void;
116
+ /**
117
+ * (OPTIONAL) Always called as the last step in an adBreak(), even if there was no ad shown. Function takes as argument a placementInfo object
118
+ *
119
+ * @param placementInfo
120
+ * @returns
121
+ */
122
+ adBreakDone?: (placementInfo: IPlacementInfo) => void;
123
+ }
124
+ export interface IRewardParams {
125
+ /**
126
+ * 'reward' a rewarded ad
127
+ */
128
+ type: 'reward';
129
+ /**
130
+ * (OPTIONAL) a name for this particular ad placement within your game. It is an internal identifier, and is not shown to the player. In future releases this identifier may be used to enable additional reporting and optimization features.
131
+ *
132
+ * We recommend you name all of your placements.
133
+ */
134
+ name?: string;
135
+ /**
136
+ * (OPTIONAL) Called before the ad is displayed. The game should pause and mute the sound. These actions must be done synchronously. The ad will be displayed immediately after this callback finishes.
137
+ * @returns
138
+ */
139
+ beforeAd?: () => void;
140
+ /**
141
+ * (OPTIONAL) Called after the ad is finished (for any reason). For rewarded ads, it is called after either adDismissed or adViewed, depending on player actions. This function should be used to resume game flow. For example, use to unmute the sound and start the next level.
142
+ * @returns
143
+ */
144
+ afterAd?: () => void;
145
+ /**
146
+ * (OPTIONAL) Always called as the last step in an adBreak(), even if there was no ad shown. Function takes as argument a placementInfo object defined
147
+ * @param placementInfo
148
+ * @returns
149
+ */
150
+ adBreakDone?: (placementInfo: IPlacementInfo) => void;
151
+ /**
152
+ * Called if a rewarded ad is available. The function should take a single argument–showAdFn() which must be called to display the rewarded ad.
153
+ * @param showAdFn
154
+ * @returns
155
+ */
156
+ beforeReward: (showAdFn: () => void) => void;
157
+ /**
158
+ * Called only for rewarded ads when the player dismisses the ad. It is only called if the player dismisses the ad before it completes. In this case the reward should not be granted.
159
+ * @returns
160
+ */
161
+ adDismissed: () => void;
162
+ /**
163
+ * Called only for rewarded ads when the player completes the ad and should be granted the reward.
164
+ * @returns
165
+ */
166
+ adViewed: () => void;
167
+ }
168
+ /**
169
+ * Ad unit format, can be 'rectangle', 'vertical', 'horizontal'
170
+ */
171
+ export type AdUnitFormat = 'rectangle' | 'vertical' | 'horizontal';
172
+ export interface IAdUnitParams {
173
+ /**
174
+ * The element to attach the ad unit to, either an HTMLElement or a string selector. Should be the parent element of the ad unit (<ins> tag).
175
+ */
176
+ el: HTMLElement | string;
177
+ /**
178
+ * (OPTIONAL) Reserved for future usage. The slot ID of the ad unit. Currently the slot ID is automatically set by the SDK.
179
+ */
180
+ slot?: string;
181
+ /**
182
+ * (OPTIONAL) Ad format for the ad unit. Can be 'auto' or a single format or an array of formats. Default is 'auto'. If passed as an array, the array will be joined by ', ' and pass to the data-ad-format attribute.
183
+ */
184
+ adFormat?: 'auto' | AdUnitFormat | AdUnitFormat[];
185
+ /**
186
+ * (OPTIONAL) Whether the ad unit should be full width and responsive. Default is false.
187
+ */
188
+ fullWidthResponsive?: 'true' | 'false';
189
+ /**
190
+ * (OPTIONAL) Custom style for the ad unit. Default is empty.
191
+ */
192
+ style?: string;
193
+ }
194
+ export interface IAbstractAFGProvider<AdInitServerParam extends IAFGInitServerParams = any, AdBreakServerParam extends IAFGAdBreakServerParams = any> {
195
+ name: string;
196
+ init(): void;
197
+ adConfig(params: IAdConfigParams, serverParam: AdInitServerParam): void;
198
+ adBreak(params: IAdBreakParams, serverParam: AdBreakServerParam): void;
199
+ }
@@ -0,0 +1,27 @@
1
+ import type { IAbstractAFGProvider, IAdBreakParams, IAdConfigParams, IAdUnitParams } from '@/afg/ads-interface';
2
+ import type { IAdsContext } from '@/type/base';
3
+ import type { IGoogleAdSenseAdBreakServerParams, IGoogleAdSenseInitServerParams } from './type';
4
+ export * from './type';
5
+ /**
6
+ * Jolibox Ads SDK
7
+ */
8
+ export declare class GoogleAdSenseProvider implements IAbstractAFGProvider<IGoogleAdSenseInitServerParams, IGoogleAdSenseAdBreakServerParams> {
9
+ name: string;
10
+ private context;
11
+ private contextInfo;
12
+ private configured;
13
+ private initParams;
14
+ /**
15
+ * Internal constructor, should not be called directly
16
+ */
17
+ constructor(context: IAdsContext, initParams: IGoogleAdSenseInitServerParams['params']);
18
+ init(): Promise<void>;
19
+ /**
20
+ * Internal function to push adsbygoogle array
21
+ * @param params
22
+ */
23
+ private push;
24
+ adConfig: (params: IAdConfigParams) => void;
25
+ adBreak: (params: IAdBreakParams) => void;
26
+ adUnit: (params: IAdUnitParams) => Promise<void>;
27
+ }
@@ -0,0 +1,14 @@
1
+ export interface IGoogleAdSenseInitServerParams {
2
+ provider: 'ADSENSE';
3
+ params: {
4
+ type: 'ADSENSE' | 'ADMOB';
5
+ clientId: string;
6
+ channelId: string;
7
+ unitId: string;
8
+ admobInterstitialSlot?: string;
9
+ admobRewardedSlot?: string;
10
+ };
11
+ }
12
+ export interface IGoogleAdSenseAdBreakServerParams {
13
+ provider: 'ADSENSE';
14
+ }
@@ -0,0 +1,22 @@
1
+ import type { IAdsContext } from '../type/base';
2
+ export interface IChannelPolicy {
3
+ /**
4
+ * The rate at which interstitial ads should be shown.
5
+ * A value of 1 means always bypass interstitials call, while a value of 0 means always forbid calling interstitials.
6
+ * A value between 0 and 1 means the interstitial call will be bypassed with a probability of `rate`.
7
+ */
8
+ interstitialRate?: number;
9
+ }
10
+ export declare class ChannelPolicy {
11
+ private configs;
12
+ private firstRun;
13
+ private context;
14
+ private contextInfo;
15
+ constructor(context: IAdsContext);
16
+ private init;
17
+ /**
18
+ * Should bypass calling interstitial based on the channel policy.
19
+ * @returns
20
+ */
21
+ shouldBypassCallingInterstitial(): boolean;
22
+ }
@@ -0,0 +1,21 @@
1
+ import type { IAdBreakParams, IAdConfigParams, IAdsInitParams, IAdUnitParams } from './ads-interface';
2
+ import type { IAdsContext } from '../type/base';
3
+ export * from './okspin';
4
+ export * from './adsense';
5
+ export * from './ads-interface';
6
+ export declare class JoliboxAdsForGame {
7
+ private context;
8
+ private contextInfo;
9
+ private providers;
10
+ private channelPolicy;
11
+ private adsActionDetection;
12
+ private adsTrackSerializer;
13
+ private initialized;
14
+ constructor(context?: IAdsContext<'GAME'>);
15
+ private getRequestContextData;
16
+ private getRequestBizParams;
17
+ init(_config?: IAdsInitParams): Promise<void>;
18
+ adConfig(params: IAdConfigParams): void;
19
+ adBreak(params: IAdBreakParams): Promise<void>;
20
+ adUnit(params: IAdUnitParams): void;
21
+ }
@@ -0,0 +1,18 @@
1
+ import type { IAbstractAFGProvider, IAdBreakParams, IAdConfigParams } from '../ads-interface';
2
+ import type { IAdsContext } from '../../type/base';
3
+ import type { IOKSpinAdBreakServerParams, IOKSpinInitServerParams } from './type';
4
+ export declare class OKSpinForGameProvider implements IAbstractAFGProvider<IOKSpinInitServerParams, IOKSpinAdBreakServerParams> {
5
+ name: string;
6
+ private initialized;
7
+ private initCompleter;
8
+ private context;
9
+ private initParams;
10
+ private adsOverlay;
11
+ private adsIsShowing;
12
+ private lastUnDisplayedAdBreak;
13
+ private state;
14
+ constructor(context: IAdsContext, initParams: IOKSpinInitServerParams['params']);
15
+ init(): Promise<void>;
16
+ adConfig(params: IAdConfigParams): void;
17
+ adBreak(params: IAdBreakParams, serverParam: IOKSpinAdBreakServerParams): Promise<void>;
18
+ }
@@ -0,0 +1,13 @@
1
+ export interface IOKSpinInitServerParams {
2
+ provider: 'OKSPIN';
3
+ params: {
4
+ appk: string;
5
+ };
6
+ }
7
+ export interface IOKSpinAdBreakServerParams {
8
+ provider: 'OKSPIN';
9
+ params: {
10
+ url: string;
11
+ countdown?: number;
12
+ };
13
+ }
@@ -0,0 +1,9 @@
1
+ import type { IGoogleAdSenseInitServerParams, GoogleAdSenseProvider, IGoogleAdSenseAdBreakServerParams } from './adsense';
2
+ import type { OKSpinForGameProvider } from './okspin';
3
+ import type { IOKSpinAdBreakServerParams, IOKSpinInitServerParams } from './okspin/type';
4
+ export type IAFGInitServerParams = IGoogleAdSenseInitServerParams | IOKSpinInitServerParams;
5
+ export type IAFGAdBreakServerParams = IGoogleAdSenseAdBreakServerParams | IOKSpinAdBreakServerParams;
6
+ export interface IAFGProviders {
7
+ ADSENSE?: GoogleAdSenseProvider;
8
+ OKSPIN?: OKSpinForGameProvider;
9
+ }
@@ -0,0 +1,18 @@
1
+ import type { IAdsContext } from '../type/base';
2
+ import type { IAbstractAFVProvider, IRequestAdParams, WrappedError } from './ads-interface';
3
+ import type { IAFVRequestAdServerParams } from './type';
4
+ export declare class AdRequestAsyncProxy {
5
+ private context;
6
+ private currentProvider?;
7
+ private continueCallback?;
8
+ constructor(context: IAdsContext);
9
+ get paramsToTrack(): {
10
+ provider: string | null;
11
+ };
12
+ private wrapAdRequested;
13
+ private wrapAdLoaded;
14
+ private wrapAdPlaying;
15
+ private wrapAdCompleted;
16
+ private wrapAdError;
17
+ callAdRequestAndContinue(adsProvider: IAbstractAFVProvider, params: IRequestAdParams<any>, serverParams: IAFVRequestAdServerParams): Promise<[boolean, WrappedError<"GOOGLE_IMA_ERROR" | "JOLIBOX_IMA_ERROR", Error | import("./ima/ima").google.ima.AdError> | null]>;
18
+ }
@@ -0,0 +1,23 @@
1
+ import { google } from './ima/ima';
2
+ import type { IAFVInitServerParams, IAFVRequestAdServerParams } from './type';
3
+ type WrappedErrorType = 'GOOGLE_IMA_ERROR' | 'JOLIBOX_IMA_ERROR';
4
+ export declare class WrappedError<T extends WrappedErrorType = WrappedErrorType, R extends T extends 'GOOGLE_IMA_ERROR' ? google.ima.AdError : Error = T extends 'GOOGLE_IMA_ERROR' ? google.ima.AdError : Error> extends Error {
5
+ name: 'AFVRequestError';
6
+ type: T;
7
+ raw: R;
8
+ constructor(error: R, type: T);
9
+ static from(error: Error | google.ima.AdError, type: WrappedErrorType): WrappedError<"GOOGLE_IMA_ERROR", google.ima.AdError> | WrappedError<"JOLIBOX_IMA_ERROR", Error>;
10
+ }
11
+ export interface IRequestAdParams<AdEvent = any> {
12
+ onAdRequested?: () => void;
13
+ onAdLoaded?: (event: AdEvent) => void;
14
+ onAdPlaying?: (event: AdEvent) => void;
15
+ onAdCompleted?: (event: AdEvent) => void;
16
+ onAdError?: (error: WrappedError<'GOOGLE_IMA_ERROR' | 'JOLIBOX_IMA_ERROR', google.ima.AdError | Error>) => void;
17
+ }
18
+ export interface IAbstractAFVProvider<AdEvent = any, AdInitServerParams extends IAFVInitServerParams = any, AdRequestServerParams extends IAFVRequestAdServerParams = any> {
19
+ name: string;
20
+ init: (serverParams: AdInitServerParams) => Promise<void>;
21
+ requestAd: (clientParams: IRequestAdParams<AdEvent>, serverParam: AdRequestServerParams) => void;
22
+ }
23
+ export {};
@@ -0,0 +1,14 @@
1
+ export declare const createState: () => {
2
+ visible: import("@preact/signals").Signal<boolean>;
3
+ canRetry: import("@preact/signals").Signal<boolean>;
4
+ retry: import("@preact/signals").Signal<(() => void) | null>;
5
+ videoRef: import("react").RefObject<HTMLVideoElement>;
6
+ adContainerRef: import("react").RefObject<HTMLDivElement>;
7
+ };
8
+ type State = ReturnType<typeof createState>;
9
+ interface IProps {
10
+ onReady: () => void;
11
+ state: State;
12
+ }
13
+ export declare const JoliboxIMAOverlay: ({ onReady, state }: IProps) => JSX.Element;
14
+ export {};
@@ -0,0 +1,200 @@
1
+ import type { IRequestAdParams } from '../ads-interface';
2
+ import type { google } from './ima';
3
+ import type { IGoogleIMARequestAdServerParams } from './type';
4
+ declare global {
5
+ interface Window {
6
+ google: typeof google;
7
+ }
8
+ }
9
+ export declare class GoogleIMAImpl {
10
+ adsLoader?: google.ima.AdsLoader;
11
+ adDisplayContainer?: google.ima.AdDisplayContainer;
12
+ isAdPlaying: boolean;
13
+ isContentFinished: boolean;
14
+ videoContent: HTMLVideoElement;
15
+ adContainer: HTMLElement;
16
+ adsManager?: google.ima.AdsManager;
17
+ intervalTimer?: number;
18
+ completed: boolean;
19
+ adTagUrl: string;
20
+ notifyRequestAd?: () => void;
21
+ notifyLoaded?: (event: google.ima.AdEvent) => void;
22
+ notifyPlayingAd?: (event: google.ima.AdEvent) => void;
23
+ notifyCompleted?: (event: google.ima.AdEvent) => void;
24
+ notifyError?: (error: google.ima.AdError) => void;
25
+ constructor(adTagUrl: string, videoContent: HTMLVideoElement, adContainer: HTMLElement);
26
+ destroy: () => void;
27
+ /**
28
+ * Sets up IMA ad display container, ads loader, and makes an ad request.
29
+ */
30
+ requestAds: (clientParams: IRequestAdParams<google.ima.AdEvent>, serverParams: IGoogleIMARequestAdServerParams) => Promise<void>;
31
+ /**
32
+ * Sets the 'adContainer' div as the IMA ad display container.
33
+ */
34
+ createAdDisplayContainer: () => void;
35
+ /**
36
+ * Loads the video content and initializes IMA ad playback.
37
+ */
38
+ playAds: () => void;
39
+ /**
40
+ * Handles the ad manager loading and sets ad event listeners.
41
+ * @param {!google.ima.AdsManagerLoadedEvent} adsManagerLoadedEvent
42
+ */
43
+ onAdsManagerLoaded: (adsManagerLoadedEvent: google.ima.AdsManagerLoadedEvent) => void;
44
+ /**
45
+ * Handles actions taken in response to ad events.
46
+ * @param {!google.ima.AdEvent} adEvent
47
+ */
48
+ onAdEvent: (adEvent: google.ima.AdEvent) => void;
49
+ /**
50
+ * Handles ad errors.
51
+ * @param {!google.ima.AdErrorEvent} adErrorEvent
52
+ */
53
+ onAdError: (adErrorEvent: google.ima.AdErrorEvent) => void;
54
+ /**
55
+ * Pauses video content and sets up ad UI.
56
+ */
57
+ onContentPauseRequested: () => void;
58
+ /**
59
+ * Resumes video content and removes ad UI.
60
+ */
61
+ onContentResumeRequested: () => void;
62
+ }
63
+ export declare enum ErrorCode {
64
+ /**
65
+ * There was a problem requesting ads from the server. VAST error code 1012
66
+ */
67
+ ADS_REQUEST_NETWORK_ERROR = 1012,
68
+ /**
69
+ * There was an error with asset fallback. VAST error code 1021
70
+ */
71
+ ASSET_FALLBACK_FAILED = 1021,
72
+ /**
73
+ * The browser prevented playback initiated without user interaction. VAST error code 1205
74
+ */
75
+ AUTOPLAY_DISALLOWED = 1205,
76
+ /**
77
+ * A companion ad failed to load or render. VAST error code 603
78
+ */
79
+ COMPANION_AD_LOADING_FAILED = 603,
80
+ /**
81
+ * Unable to display one or more required companions. The master ad is discarded since the required companions could not be displayed. VAST error code 602
82
+ */
83
+ COMPANION_REQUIRED_ERROR = 602,
84
+ /**
85
+ * There was a problem requesting ads from the server. VAST error code 1005
86
+ */
87
+ FAILED_TO_REQUEST_ADS = 1005,
88
+ /**
89
+ * The ad tag url specified was invalid. It needs to be properly encoded. VAST error code 1013
90
+ */
91
+ INVALID_AD_TAG = 1013,
92
+ /**
93
+ * An invalid AdX extension was found. VAST error code 1105
94
+ */
95
+ INVALID_ADX_EXTENSION = 1105,
96
+ /**
97
+ * Invalid arguments were provided to SDK methods. VAST error code 1101
98
+ */
99
+ INVALID_ARGUMENTS = 1101,
100
+ /**
101
+ * Unable to display NonLinear ad because creative dimensions do not align with creative display area (i.e. creative dimension too large). VAST error code 501
102
+ */
103
+ NONLINEAR_DIMENSIONS_ERROR = 501,
104
+ /**
105
+ * An overlay ad failed to load. VAST error code 502
106
+ */
107
+ OVERLAY_AD_LOADING_FAILED = 502,
108
+ /**
109
+ * An overlay ad failed to render. VAST error code 500
110
+ */
111
+ OVERLAY_AD_PLAYING_FAILED = 500,
112
+ /**
113
+ * There was an error with stream initialization during server side ad insertion. VAST error code 1020
114
+ */
115
+ STREAM_INITIALIZATION_FAILED = 1020,
116
+ /**
117
+ * The ad response was not understood and cannot be parsed. VAST error code 1010
118
+ */
119
+ UNKNOWN_AD_RESPONSE = 1010,
120
+ /**
121
+ * An unexpected error occurred and the cause is not known. Refer to the inner error for more information. VAST error code 900
122
+ */
123
+ UNKNOWN_ERROR = 900,
124
+ /**
125
+ * Locale specified for the SDK is not supported. VAST error code 1011
126
+ */
127
+ UNSUPPORTED_LOCALE = 1011,
128
+ /**
129
+ * No assets were found in the VAST ad response. VAST error code 1007
130
+ */
131
+ VAST_ASSET_NOT_FOUND = 1007,
132
+ /**
133
+ * Empty VAST response. VAST error code 1009
134
+ */
135
+ VAST_EMPTY_RESPONSE = 1009,
136
+ /**
137
+ * Assets were found in the VAST ad response for linear ad, but none of them matched the video player's capabilities. VAST error code 403
138
+ */
139
+ VAST_LINEAR_ASSET_MISMATCH = 403,
140
+ /**
141
+ * The VAST URI provided, or a VAST URI provided in a subsequent wrapper element, was either unavailable or reached a timeout, as defined by the video player. The timeout is 5 seconds for initial VAST requests and each subsequent wrapper. VAST error code 301
142
+ */
143
+ VAST_LOAD_TIMEOUT = 301,
144
+ /**
145
+ * The ad response was not recognized as a valid VAST ad. VAST error code 100
146
+ */
147
+ VAST_MALFORMED_RESPONSE = 100,
148
+ /**
149
+ * Failed to load media assets from a VAST response. The default timeout for media loading is 8 seconds. VAST error code 402
150
+ */
151
+ VAST_MEDIA_LOAD_TIMEOUT = 402,
152
+ /**
153
+ * No Ads VAST response after one or more wrappers. VAST error code 303
154
+ */
155
+ VAST_NO_ADS_AFTER_WRAPPER = 303,
156
+ /**
157
+ * Assets were found in the VAST ad response for nonlinear ad, but none of them matched the video player's capabilities. VAST error code 503
158
+ */
159
+ VAST_NONLINEAR_ASSET_MISMATCH = 503,
160
+ /**
161
+ * Problem displaying MediaFile. Currently used if video playback is stopped due to poor playback quality. VAST error code 405
162
+ */
163
+ VAST_PROBLEM_DISPLAYING_MEDIA_FILE = 405,
164
+ /**
165
+ * VAST schema validation error. VAST error code 101
166
+ */
167
+ VAST_SCHEMA_VALIDATION_ERROR = 101,
168
+ /**
169
+ * The maximum number of VAST wrapper redirects has been reached. VAST error code 302
170
+ */
171
+ VAST_TOO_MANY_REDIRECTS = 302,
172
+ /**
173
+ * Trafficking error. Video player received an ad type that it was not expecting and/or cannot display. VAST error code 200
174
+ */
175
+ VAST_TRAFFICKING_ERROR = 200,
176
+ /**
177
+ * VAST duration is different from the actual media file duration. VAST error code 202
178
+ */
179
+ VAST_UNEXPECTED_DURATION_ERROR = 202,
180
+ /**
181
+ * Ad linearity is different from what the video player is expecting. VAST error code 201
182
+ */
183
+ VAST_UNEXPECTED_LINEARITY = 201,
184
+ /**
185
+ * The ad response contained an unsupported VAST version. VAST error code 102
186
+ */
187
+ VAST_UNSUPPORTED_VERSION = 102,
188
+ /**
189
+ * General VAST wrapper error. VAST error code 300
190
+ */
191
+ VAST_WRAPPER_ERROR = 300,
192
+ /**
193
+ * There was an error playing the video ad. VAST error code 400
194
+ */
195
+ VIDEO_PLAY_ERROR = 400,
196
+ /**
197
+ * A VPAID error occurred. Refer to the inner error for more information. VAST error code 901
198
+ */
199
+ VPAID_ERROR = 901
200
+ }
@@ -0,0 +1,15 @@
1
+ import type { IGoogleIMAInitServerParams, IGoogleIMARequestAdServerParams } from './type';
2
+ import type { google } from './ima';
3
+ import type { IAdsContext } from '@/type/base';
4
+ import { type IAbstractAFVProvider, type IRequestAdParams } from '../ads-interface';
5
+ export declare class GoogleIMAProvider implements IAbstractAFVProvider<google.ima.AdEvent> {
6
+ name: string;
7
+ private context;
8
+ private adsOverlay;
9
+ private initialized;
10
+ private ima;
11
+ private state;
12
+ constructor(context: IAdsContext);
13
+ init: (params: IGoogleIMAInitServerParams) => Promise<void>;
14
+ requestAd: (clientParams: IRequestAdParams<google.ima.AdEvent>, serverParams: IGoogleIMARequestAdServerParams) => void;
15
+ }
@@ -0,0 +1,10 @@
1
+ export interface IGoogleIMAInitServerParams {
2
+ provider: 'GOOGLE_IMA';
3
+ params: {
4
+ adTagUrl: string;
5
+ };
6
+ }
7
+ export interface IGoogleIMARequestAdServerParams {
8
+ provider: 'GOOGLE_IMA';
9
+ params: Record<string, string>;
10
+ }