@guardian/commercial-core 0.0.0-beta-20250716121613
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/LICENSE +201 -0
- package/README.md +45 -0
- package/dist/cjs/ad-sizes.d.ts +202 -0
- package/dist/cjs/ad-sizes.js +400 -0
- package/dist/cjs/breakpoint.d.ts +8 -0
- package/dist/cjs/breakpoint.js +10 -0
- package/dist/cjs/constants/ad-label-height.d.ts +4 -0
- package/dist/cjs/constants/ad-label-height.js +7 -0
- package/dist/cjs/constants/index.d.ts +3 -0
- package/dist/cjs/constants/index.js +9 -0
- package/dist/cjs/constants/prebid-timeout.d.ts +4 -0
- package/dist/cjs/constants/prebid-timeout.js +7 -0
- package/dist/cjs/constants/top-above-nav-height.d.ts +10 -0
- package/dist/cjs/constants/top-above-nav-height.js +48 -0
- package/dist/cjs/detect-ad-blocker.d.ts +12 -0
- package/dist/cjs/detect-ad-blocker.js +61 -0
- package/dist/cjs/event-timer.d.ts +103 -0
- package/dist/cjs/event-timer.js +204 -0
- package/dist/cjs/geo/country-code.d.ts +3 -0
- package/dist/cjs/geo/country-code.js +34 -0
- package/dist/cjs/geo/geo-utils.d.ts +11 -0
- package/dist/cjs/geo/geo-utils.js +31 -0
- package/dist/cjs/geo/get-locale.d.ts +8 -0
- package/dist/cjs/geo/get-locale.js +43 -0
- package/dist/cjs/global.d.ts +71 -0
- package/dist/cjs/global.js +2 -0
- package/dist/cjs/index.d.ts +13 -0
- package/dist/cjs/index.js +46 -0
- package/dist/cjs/messenger/post-message.d.ts +1 -0
- package/dist/cjs/messenger/post-message.js +7 -0
- package/dist/cjs/permutive.d.ts +9 -0
- package/dist/cjs/permutive.js +38 -0
- package/dist/cjs/send-commercial-metrics.d.ts +58 -0
- package/dist/cjs/send-commercial-metrics.js +209 -0
- package/dist/cjs/targeting/build-page-targeting.d.ts +47 -0
- package/dist/cjs/targeting/build-page-targeting.js +112 -0
- package/dist/cjs/targeting/content.d.ts +87 -0
- package/dist/cjs/targeting/content.js +76 -0
- package/dist/cjs/targeting/personalised.d.ts +83 -0
- package/dist/cjs/targeting/personalised.js +140 -0
- package/dist/cjs/targeting/pick-targeting-values.d.ts +25 -0
- package/dist/cjs/targeting/pick-targeting-values.js +47 -0
- package/dist/cjs/targeting/session.d.ts +111 -0
- package/dist/cjs/targeting/session.js +61 -0
- package/dist/cjs/targeting/shared.d.ts +156 -0
- package/dist/cjs/targeting/shared.js +28 -0
- package/dist/cjs/targeting/teads-eligibility.d.ts +2 -0
- package/dist/cjs/targeting/teads-eligibility.js +20 -0
- package/dist/cjs/targeting/types.d.ts +6 -0
- package/dist/cjs/targeting/types.js +2 -0
- package/dist/cjs/targeting/viewport.d.ts +48 -0
- package/dist/cjs/targeting/viewport.js +22 -0
- package/dist/cjs/targeting/youtube-ima.d.ts +12 -0
- package/dist/cjs/targeting/youtube-ima.js +76 -0
- package/dist/cjs/types.d.ts +426 -0
- package/dist/cjs/types.js +12 -0
- package/dist/esm/ad-sizes.d.ts +202 -0
- package/dist/esm/ad-sizes.js +390 -0
- package/dist/esm/breakpoint.d.ts +8 -0
- package/dist/esm/breakpoint.js +6 -0
- package/dist/esm/constants/ad-label-height.d.ts +4 -0
- package/dist/esm/constants/ad-label-height.js +4 -0
- package/dist/esm/constants/index.d.ts +3 -0
- package/dist/esm/constants/index.js +3 -0
- package/dist/esm/constants/prebid-timeout.d.ts +4 -0
- package/dist/esm/constants/prebid-timeout.js +4 -0
- package/dist/esm/constants/top-above-nav-height.d.ts +10 -0
- package/dist/esm/constants/top-above-nav-height.js +45 -0
- package/dist/esm/detect-ad-blocker.d.ts +12 -0
- package/dist/esm/detect-ad-blocker.js +58 -0
- package/dist/esm/event-timer.d.ts +103 -0
- package/dist/esm/event-timer.js +199 -0
- package/dist/esm/geo/country-code.d.ts +3 -0
- package/dist/esm/geo/country-code.js +31 -0
- package/dist/esm/geo/geo-utils.d.ts +11 -0
- package/dist/esm/geo/geo-utils.js +20 -0
- package/dist/esm/geo/get-locale.d.ts +8 -0
- package/dist/esm/geo/get-locale.js +38 -0
- package/dist/esm/global.d.ts +71 -0
- package/dist/esm/global.js +0 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/messenger/post-message.d.ts +1 -0
- package/dist/esm/messenger/post-message.js +3 -0
- package/dist/esm/permutive.d.ts +9 -0
- package/dist/esm/permutive.js +33 -0
- package/dist/esm/send-commercial-metrics.d.ts +58 -0
- package/dist/esm/send-commercial-metrics.js +204 -0
- package/dist/esm/targeting/build-page-targeting.d.ts +47 -0
- package/dist/esm/targeting/build-page-targeting.js +108 -0
- package/dist/esm/targeting/content.d.ts +87 -0
- package/dist/esm/targeting/content.js +73 -0
- package/dist/esm/targeting/personalised.d.ts +83 -0
- package/dist/esm/targeting/personalised.js +137 -0
- package/dist/esm/targeting/pick-targeting-values.d.ts +25 -0
- package/dist/esm/targeting/pick-targeting-values.js +43 -0
- package/dist/esm/targeting/session.d.ts +111 -0
- package/dist/esm/targeting/session.js +57 -0
- package/dist/esm/targeting/shared.d.ts +156 -0
- package/dist/esm/targeting/shared.js +25 -0
- package/dist/esm/targeting/teads-eligibility.d.ts +2 -0
- package/dist/esm/targeting/teads-eligibility.js +17 -0
- package/dist/esm/targeting/types.d.ts +6 -0
- package/dist/esm/targeting/types.js +0 -0
- package/dist/esm/targeting/viewport.d.ts +48 -0
- package/dist/esm/targeting/viewport.js +19 -0
- package/dist/esm/targeting/youtube-ima.d.ts +12 -0
- package/dist/esm/targeting/youtube-ima.js +73 -0
- package/dist/esm/types.d.ts +426 -0
- package/dist/esm/types.js +10 -0
- package/package.json +65 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildImaAdTagUrl = void 0;
|
|
4
|
+
const libs_1 = require("@guardian/libs");
|
|
5
|
+
const build_page_targeting_1 = require("./build-page-targeting");
|
|
6
|
+
/**
|
|
7
|
+
* @param {Record<string, MaybeArray<string|number|boolean>>
|
|
8
|
+
* Follows https://support.google.com/admanager/answer/1080597
|
|
9
|
+
*/
|
|
10
|
+
const encodeCustomParams = (params) => {
|
|
11
|
+
const encodedParams = Object.entries(params)
|
|
12
|
+
.map(([key, value]) => {
|
|
13
|
+
const queryValue = Array.isArray(value)
|
|
14
|
+
? value.join(',')
|
|
15
|
+
: String(value);
|
|
16
|
+
return `${key}=${encodeURIComponent(queryValue)}`;
|
|
17
|
+
})
|
|
18
|
+
.join('&');
|
|
19
|
+
return encodedParams;
|
|
20
|
+
};
|
|
21
|
+
const mergeCustomParamsWithTargeting = (customParams, consentState, clientSideParticipations, isSignedIn) => {
|
|
22
|
+
let pageTargeting = {};
|
|
23
|
+
try {
|
|
24
|
+
pageTargeting = (0, build_page_targeting_1.buildPageTargeting)({
|
|
25
|
+
adFree: false,
|
|
26
|
+
clientSideParticipations,
|
|
27
|
+
consentState: consentState,
|
|
28
|
+
isSignedIn: isSignedIn,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
/**
|
|
33
|
+
* Defensive error handling in case YoutubeAtom is used in an
|
|
34
|
+
* environment where guardian.config, cookies, localstorage etc
|
|
35
|
+
* are not available
|
|
36
|
+
*/
|
|
37
|
+
(0, libs_1.log)('commercial', 'Error building YouTube IMA custom params', e);
|
|
38
|
+
return customParams;
|
|
39
|
+
}
|
|
40
|
+
const mergedCustomParams = {
|
|
41
|
+
...customParams,
|
|
42
|
+
...pageTargeting,
|
|
43
|
+
};
|
|
44
|
+
return mergedCustomParams;
|
|
45
|
+
};
|
|
46
|
+
const buildImaAdTagUrl = ({ adUnit, clientSideParticipations, consentState, customParams, isSignedIn, }) => {
|
|
47
|
+
const mergedCustomParams = mergeCustomParamsWithTargeting(customParams, consentState, clientSideParticipations, isSignedIn);
|
|
48
|
+
const queryParams = {
|
|
49
|
+
iu: adUnit,
|
|
50
|
+
tfcd: '0',
|
|
51
|
+
npa: '0',
|
|
52
|
+
sz: '480x360|480x361|400x300',
|
|
53
|
+
gdfp_req: '1',
|
|
54
|
+
output: 'vast',
|
|
55
|
+
unviewed_position_start: '1',
|
|
56
|
+
env: 'vp',
|
|
57
|
+
impl: 's',
|
|
58
|
+
vad_type: 'linear',
|
|
59
|
+
vpos: 'preroll',
|
|
60
|
+
plcmt: '1',
|
|
61
|
+
description_url: encodeURIComponent(`${window.guardian.config.page.host}/${window.guardian.config.page.pageId}`),
|
|
62
|
+
/**
|
|
63
|
+
* cust_params string is encoded
|
|
64
|
+
* cust_params values are also encoded so they will get double encoded
|
|
65
|
+
* this ensures any values with separator chars (=&,) do not conflict with the main string
|
|
66
|
+
*/
|
|
67
|
+
cust_params: encodeURIComponent(encodeCustomParams((0, build_page_targeting_1.filterValues)(mergedCustomParams))),
|
|
68
|
+
};
|
|
69
|
+
const queryParamsArray = [];
|
|
70
|
+
for (const [k, v] of Object.entries(queryParams)) {
|
|
71
|
+
queryParamsArray.push(`${k}=${v}`);
|
|
72
|
+
}
|
|
73
|
+
return ('https://securepubads.g.doubleclick.net/gampad/ads?' +
|
|
74
|
+
queryParamsArray.join('&'));
|
|
75
|
+
};
|
|
76
|
+
exports.buildImaAdTagUrl = buildImaAdTagUrl;
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import type { AdSize, SizeMapping } from './ad-sizes';
|
|
2
|
+
import type { PageTargeting } from './targeting/build-page-targeting';
|
|
3
|
+
type HeaderBiddingSize = AdSize;
|
|
4
|
+
interface Advert {
|
|
5
|
+
id: string;
|
|
6
|
+
node: HTMLElement;
|
|
7
|
+
prebidAdUnit: string;
|
|
8
|
+
sizes: SizeMapping;
|
|
9
|
+
headerBiddingSizes: HeaderBiddingSize[] | null;
|
|
10
|
+
size: AdSize | 'fluid' | null;
|
|
11
|
+
slot: googletag.Slot;
|
|
12
|
+
isEmpty: boolean | null;
|
|
13
|
+
isRendered: boolean;
|
|
14
|
+
shouldRefresh: boolean;
|
|
15
|
+
whenSlotReady: Promise<void>;
|
|
16
|
+
extraNodeClasses: string[];
|
|
17
|
+
hasPrebidSize: boolean;
|
|
18
|
+
headerBiddingBidRequest: Promise<unknown> | null;
|
|
19
|
+
lineItemId: number | null;
|
|
20
|
+
creativeId: number | null;
|
|
21
|
+
creativeTemplateId: number | null;
|
|
22
|
+
testgroup: string | undefined;
|
|
23
|
+
finishedRendering(isRendered: boolean): void;
|
|
24
|
+
updateExtraSlotClasses(...newClasses: string[]): Promise<void>;
|
|
25
|
+
generateSizeMapping(additionalSizeMapping: SizeMapping): SizeMapping;
|
|
26
|
+
updateSizeMapping(additionalSizeMapping: SizeMapping): void;
|
|
27
|
+
}
|
|
28
|
+
interface DfpEnv {
|
|
29
|
+
renderStartTime: number;
|
|
30
|
+
adSlotSelector: string;
|
|
31
|
+
lazyLoadEnabled: boolean;
|
|
32
|
+
lazyLoadObserve: boolean;
|
|
33
|
+
advertsToLoad: Advert[];
|
|
34
|
+
adverts: Map<Advert['id'], Advert>;
|
|
35
|
+
shouldLazyLoad: () => boolean;
|
|
36
|
+
}
|
|
37
|
+
type ConnectionType = 'bluetooth' | 'cellular' | 'ethernet' | 'mixed' | 'none' | 'other' | 'unknown' | 'wifi';
|
|
38
|
+
interface NetworkInformation extends EventTarget {
|
|
39
|
+
readonly type?: ConnectionType;
|
|
40
|
+
readonly downlink?: number;
|
|
41
|
+
readonly effectiveType?: string;
|
|
42
|
+
}
|
|
43
|
+
type OphanRecordFunction = (event: Record<string, unknown> & {
|
|
44
|
+
/**
|
|
45
|
+
* the experiences key will override previously set values.
|
|
46
|
+
* Use `recordExperiences` instead.
|
|
47
|
+
*/
|
|
48
|
+
experiences?: never;
|
|
49
|
+
}, callback?: () => void) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Generates a type which represents possible indices of this array
|
|
52
|
+
*
|
|
53
|
+
* Example usage:
|
|
54
|
+
* const list = ['foo', 'bar', 'baz'] as const;
|
|
55
|
+
* type Test = Indices<typeof list>
|
|
56
|
+
*/
|
|
57
|
+
type Indices<T extends readonly unknown[]> = Exclude<Partial<T>['length'], T['length']>;
|
|
58
|
+
type Edition = 'UK' | 'AU' | 'US';
|
|
59
|
+
type AdsConfigDisabled = {
|
|
60
|
+
disableAds: true;
|
|
61
|
+
};
|
|
62
|
+
type AdsConfigBasic = {
|
|
63
|
+
adTagParameters: {
|
|
64
|
+
iu: string;
|
|
65
|
+
cust_params: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
type AdsConfigUSNATorAus = AdsConfigBasic & {
|
|
69
|
+
restrictedDataProcessor: boolean;
|
|
70
|
+
};
|
|
71
|
+
type AdsConfigTCFV2 = AdsConfigBasic & {
|
|
72
|
+
adTagParameters: {
|
|
73
|
+
cmpGdpr: number;
|
|
74
|
+
cmpVcd: string;
|
|
75
|
+
cmpGvcd: string;
|
|
76
|
+
};
|
|
77
|
+
nonPersonalizedAd: boolean;
|
|
78
|
+
};
|
|
79
|
+
type AdsConfigEnabled = AdsConfigBasic | AdsConfigUSNATorAus | AdsConfigTCFV2;
|
|
80
|
+
type AdsConfig = AdsConfigEnabled | AdsConfigDisabled;
|
|
81
|
+
type AdTargetingBuilder = () => Promise<AdsConfig>;
|
|
82
|
+
interface Ophan {
|
|
83
|
+
trackComponentAttention: (name: string, el: Element, visiblityThreshold: number) => void;
|
|
84
|
+
record: OphanRecordFunction;
|
|
85
|
+
viewId: string;
|
|
86
|
+
pageViewId: string;
|
|
87
|
+
}
|
|
88
|
+
type PrebidBreakpoint = 'D' | 'T' | 'M';
|
|
89
|
+
type PrebidIndexSite = {
|
|
90
|
+
bp: PrebidBreakpoint;
|
|
91
|
+
id: number;
|
|
92
|
+
};
|
|
93
|
+
interface CommercialPageConfig {
|
|
94
|
+
pbIndexSites: PrebidIndexSite[];
|
|
95
|
+
adUnit: string;
|
|
96
|
+
appNexusPageTargeting?: string;
|
|
97
|
+
sharedAdTargeting?: Record<string, string | string[]>;
|
|
98
|
+
shouldHideAdverts: boolean;
|
|
99
|
+
pageAdTargeting?: PageTargeting;
|
|
100
|
+
dfpAccountId: string;
|
|
101
|
+
ipsosTag?: string;
|
|
102
|
+
a9PublisherId: string;
|
|
103
|
+
libs?: {
|
|
104
|
+
googletag?: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
interface PageConfig extends CommercialPageConfig {
|
|
108
|
+
ajaxUrl?: string;
|
|
109
|
+
assetsPath: string;
|
|
110
|
+
author: string;
|
|
111
|
+
authorIds: string;
|
|
112
|
+
blogIds: string;
|
|
113
|
+
commentable: boolean;
|
|
114
|
+
contentType: string;
|
|
115
|
+
dcrCouldRender: boolean;
|
|
116
|
+
edition: Edition;
|
|
117
|
+
frontendAssetsFullURL?: string;
|
|
118
|
+
hasPageSkin: boolean;
|
|
119
|
+
hasShowcaseMainElement: boolean;
|
|
120
|
+
hasYouTubeAtom: boolean;
|
|
121
|
+
headline: string;
|
|
122
|
+
host: string;
|
|
123
|
+
idApiUrl?: string;
|
|
124
|
+
idUrl?: string;
|
|
125
|
+
isbn?: string;
|
|
126
|
+
isDev: boolean;
|
|
127
|
+
isFront: boolean;
|
|
128
|
+
isHosted: boolean;
|
|
129
|
+
isImmersive?: boolean;
|
|
130
|
+
isLiveBlog?: boolean;
|
|
131
|
+
isPaidContent: boolean;
|
|
132
|
+
isPreview: boolean;
|
|
133
|
+
isProd: boolean;
|
|
134
|
+
isSensitive: boolean;
|
|
135
|
+
isMinuteArticle: boolean;
|
|
136
|
+
keywordIds: string;
|
|
137
|
+
keywords: string;
|
|
138
|
+
lightboxImages?: {
|
|
139
|
+
images: Array<{
|
|
140
|
+
src: string;
|
|
141
|
+
}>;
|
|
142
|
+
};
|
|
143
|
+
pageId: string;
|
|
144
|
+
publication: string;
|
|
145
|
+
revisionNumber: string;
|
|
146
|
+
section: string;
|
|
147
|
+
sectionName: string;
|
|
148
|
+
sentryHost: string;
|
|
149
|
+
sentryPublicApiKey: string;
|
|
150
|
+
series: string;
|
|
151
|
+
seriesId: string;
|
|
152
|
+
sharedAdTargeting?: Record<string, string | string[]>;
|
|
153
|
+
shouldHideReaderRevenue?: boolean;
|
|
154
|
+
showNewRecipeDesign?: boolean;
|
|
155
|
+
showRelatedContent?: boolean;
|
|
156
|
+
source: string;
|
|
157
|
+
sponsorshipType: string;
|
|
158
|
+
toneIds: string;
|
|
159
|
+
tones: string;
|
|
160
|
+
videoDuration: number;
|
|
161
|
+
webPublicationDate: number;
|
|
162
|
+
userAttributesApiUrl?: string;
|
|
163
|
+
}
|
|
164
|
+
type Stage = 'DEV' | 'CODE' | 'PROD';
|
|
165
|
+
interface UserConfig {
|
|
166
|
+
accountCreatedDate: number;
|
|
167
|
+
displayName: string;
|
|
168
|
+
emailVerified: boolean;
|
|
169
|
+
id: string;
|
|
170
|
+
rawResponse: string;
|
|
171
|
+
}
|
|
172
|
+
interface Config {
|
|
173
|
+
commercialMetricsInitialised?: boolean;
|
|
174
|
+
frontendAssetsFullURL?: string;
|
|
175
|
+
isDotcomRendering: boolean;
|
|
176
|
+
ophan: {
|
|
177
|
+
browserId?: string;
|
|
178
|
+
pageViewId: string;
|
|
179
|
+
};
|
|
180
|
+
page: PageConfig;
|
|
181
|
+
shouldSendCommercialMetrics?: boolean;
|
|
182
|
+
stage: Stage;
|
|
183
|
+
switches: Record<string, boolean | undefined>;
|
|
184
|
+
tests?: {
|
|
185
|
+
[key: `${string}Control`]: 'control';
|
|
186
|
+
[key: `${string}Variant`]: 'variant';
|
|
187
|
+
};
|
|
188
|
+
user?: UserConfig;
|
|
189
|
+
}
|
|
190
|
+
type AdBlockers = {
|
|
191
|
+
active: boolean | undefined;
|
|
192
|
+
onDetect: Array<(value: boolean | PromiseLike<boolean>) => void>;
|
|
193
|
+
};
|
|
194
|
+
type TagCounts = Record<string, number>;
|
|
195
|
+
type WeeklyArticleLog = {
|
|
196
|
+
week: number;
|
|
197
|
+
count: number;
|
|
198
|
+
tags?: TagCounts;
|
|
199
|
+
};
|
|
200
|
+
type WeeklyArticleHistory = WeeklyArticleLog[];
|
|
201
|
+
interface DailyArticleCount {
|
|
202
|
+
day: number;
|
|
203
|
+
count: number;
|
|
204
|
+
}
|
|
205
|
+
type DailyArticleHistory = DailyArticleCount[];
|
|
206
|
+
interface ArticleCounts {
|
|
207
|
+
weeklyArticleHistory: WeeklyArticleHistory;
|
|
208
|
+
dailyArticleHistory: DailyArticleHistory;
|
|
209
|
+
}
|
|
210
|
+
type FetchBidSizes = {
|
|
211
|
+
adSizes: `${number}x${number}`;
|
|
212
|
+
};
|
|
213
|
+
type FetchBidResponse = {
|
|
214
|
+
amznbid: string;
|
|
215
|
+
amzniid: string;
|
|
216
|
+
amznp: string;
|
|
217
|
+
amznsz: FetchBidSizes;
|
|
218
|
+
size: FetchBidSizes;
|
|
219
|
+
slotID: string;
|
|
220
|
+
};
|
|
221
|
+
interface HeaderNotification {
|
|
222
|
+
id: string;
|
|
223
|
+
target: string;
|
|
224
|
+
message: string;
|
|
225
|
+
ophanLabel: string;
|
|
226
|
+
logImpression: () => void;
|
|
227
|
+
}
|
|
228
|
+
interface OptOutInitializeOptions {
|
|
229
|
+
publisher: number;
|
|
230
|
+
onlyNoConsent?: 0 | 1;
|
|
231
|
+
alwaysNoConsent?: 0 | 1;
|
|
232
|
+
consentTimeOutMS?: 5000;
|
|
233
|
+
noLogging?: 0 | 1;
|
|
234
|
+
lazyLoading?: {
|
|
235
|
+
fractionInView?: number;
|
|
236
|
+
viewPortMargin?: string;
|
|
237
|
+
};
|
|
238
|
+
noRequestsOnPageLoad?: 0 | 1;
|
|
239
|
+
frequencyScript?: string;
|
|
240
|
+
timeoutFrequencyCappingMS?: number;
|
|
241
|
+
debug_forceCap?: number;
|
|
242
|
+
}
|
|
243
|
+
interface OptOutResponse {
|
|
244
|
+
adSlot: string;
|
|
245
|
+
width: number;
|
|
246
|
+
height: number;
|
|
247
|
+
ad: string;
|
|
248
|
+
creativeId: string;
|
|
249
|
+
meta: {
|
|
250
|
+
networkId: string;
|
|
251
|
+
networkName: string;
|
|
252
|
+
agencyId: string;
|
|
253
|
+
agencyName: string;
|
|
254
|
+
advertiserId: string;
|
|
255
|
+
advertiserName: string;
|
|
256
|
+
advertiserDomains: string[];
|
|
257
|
+
};
|
|
258
|
+
optOutExt: {
|
|
259
|
+
noSafeFrame: boolean;
|
|
260
|
+
tags: string[];
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
type OptOutFilledCallback = (adSlot: OptOutAdSlot, response: OptOutResponse) => void;
|
|
264
|
+
interface OptOutAdSlot {
|
|
265
|
+
adSlot: string;
|
|
266
|
+
targetId: string;
|
|
267
|
+
id: string;
|
|
268
|
+
filledCallback?: OptOutFilledCallback;
|
|
269
|
+
emptyCallback?: (adSlot: OptOutAdSlot) => void;
|
|
270
|
+
adShownCallback?: (adSlot: OptOutAdSlot, response: OptOutResponse) => void;
|
|
271
|
+
}
|
|
272
|
+
interface ImpressionsDfpObject {
|
|
273
|
+
s: string;
|
|
274
|
+
ad: string;
|
|
275
|
+
c: string;
|
|
276
|
+
I: string;
|
|
277
|
+
o: string;
|
|
278
|
+
A: string;
|
|
279
|
+
y: string;
|
|
280
|
+
co: string;
|
|
281
|
+
}
|
|
282
|
+
declare enum BlockingType {
|
|
283
|
+
Manual = 1,// Deprecated
|
|
284
|
+
Creative = 2,// Creative-based detection
|
|
285
|
+
ProviderSecurity = 3,// Domain-based detection for unsafe domains
|
|
286
|
+
BannedDomain = 4,// Domain-based detection for banned domains
|
|
287
|
+
ProviderIbv = 5,// Domain-based detection for in-banner-video
|
|
288
|
+
UnsafeJS = 6,// JavaScript-based detection for unsafe ads
|
|
289
|
+
Hrap = 7
|
|
290
|
+
}
|
|
291
|
+
type ConfiantCallback = (blockingType: BlockingType, blockingId: string, isBlocked: boolean, wrapperId: string, tagId: string, impressionsData?: {
|
|
292
|
+
prebid?: {
|
|
293
|
+
adId?: string | null;
|
|
294
|
+
cpm?: number | null;
|
|
295
|
+
s?: string;
|
|
296
|
+
};
|
|
297
|
+
dfp?: ImpressionsDfpObject;
|
|
298
|
+
}) => void;
|
|
299
|
+
interface Confiant extends Record<string, unknown> {
|
|
300
|
+
settings: {
|
|
301
|
+
callback: ConfiantCallback;
|
|
302
|
+
[key: string]: unknown;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
interface Permutive {
|
|
306
|
+
config?: {
|
|
307
|
+
projectId?: string;
|
|
308
|
+
apiKey?: string;
|
|
309
|
+
environment?: string;
|
|
310
|
+
};
|
|
311
|
+
q?: Array<{
|
|
312
|
+
functionName: string;
|
|
313
|
+
arguments: unknown[];
|
|
314
|
+
}>;
|
|
315
|
+
addon?: (name: string, props: Record<string, unknown>) => void;
|
|
316
|
+
identify?: (user: Array<{
|
|
317
|
+
id: string;
|
|
318
|
+
tag: string;
|
|
319
|
+
}>) => void;
|
|
320
|
+
track?: (name: string, props: Record<string, unknown>) => void;
|
|
321
|
+
}
|
|
322
|
+
type ApstagInitConfig = {
|
|
323
|
+
pubID: string;
|
|
324
|
+
adServer?: string;
|
|
325
|
+
bidTimeout?: number;
|
|
326
|
+
blockedBidders?: string[];
|
|
327
|
+
};
|
|
328
|
+
interface A9AdUnitInterface {
|
|
329
|
+
slotID: string;
|
|
330
|
+
slotName?: string;
|
|
331
|
+
sizes: number[][];
|
|
332
|
+
}
|
|
333
|
+
type FetchBidsBidConfig = {
|
|
334
|
+
slots: A9AdUnitInterface[];
|
|
335
|
+
};
|
|
336
|
+
type Apstag = {
|
|
337
|
+
init: (arg0: ApstagInitConfig) => void;
|
|
338
|
+
fetchBids: (arg0: FetchBidsBidConfig, callback: (res: FetchBidResponse[]) => void) => void;
|
|
339
|
+
setDisplayBids: () => void;
|
|
340
|
+
};
|
|
341
|
+
type ComscoreGlobals = {
|
|
342
|
+
c1: string;
|
|
343
|
+
c2: string;
|
|
344
|
+
cs_ucfr: string;
|
|
345
|
+
comscorekw?: string;
|
|
346
|
+
options?: {
|
|
347
|
+
enableFirstPartyCookie?: boolean;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
interface IasPETSlot {
|
|
351
|
+
adSlotId: string;
|
|
352
|
+
size: Array<[number, number]>;
|
|
353
|
+
adUnitPath: string;
|
|
354
|
+
}
|
|
355
|
+
interface IasPET {
|
|
356
|
+
queue?: Array<{
|
|
357
|
+
adSlots: IasPETSlot[];
|
|
358
|
+
dataHandler: (targetingJSON: string) => void;
|
|
359
|
+
}>;
|
|
360
|
+
pubId?: string;
|
|
361
|
+
}
|
|
362
|
+
interface TeadsAnalytics {
|
|
363
|
+
analytics_tag_id?: string;
|
|
364
|
+
share?: () => void;
|
|
365
|
+
shared_data?: unknown[];
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Types for the IAB Safeframe API
|
|
369
|
+
*
|
|
370
|
+
* Note this type definition is incomplete.
|
|
371
|
+
* These types can be refined as/when they are required
|
|
372
|
+
*/
|
|
373
|
+
interface SafeFrameAPI {
|
|
374
|
+
ver: string;
|
|
375
|
+
specVersion: string;
|
|
376
|
+
lib: {
|
|
377
|
+
lang: Record<string, unknown>;
|
|
378
|
+
dom: {
|
|
379
|
+
iframes: Record<string, unknown>;
|
|
380
|
+
msghost: Record<string, unknown>;
|
|
381
|
+
};
|
|
382
|
+
logger: Record<string, unknown>;
|
|
383
|
+
};
|
|
384
|
+
env: {
|
|
385
|
+
isIE: boolean;
|
|
386
|
+
ua: Record<string, unknown>;
|
|
387
|
+
};
|
|
388
|
+
info: {
|
|
389
|
+
errs: unknown[];
|
|
390
|
+
list: unknown[];
|
|
391
|
+
};
|
|
392
|
+
host: {
|
|
393
|
+
Config: {
|
|
394
|
+
new (o: {
|
|
395
|
+
renderFile: string;
|
|
396
|
+
positions: Record<string, unknown>;
|
|
397
|
+
}): unknown;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Types for IMR Worldwide
|
|
403
|
+
*/
|
|
404
|
+
interface NSdkInstance {
|
|
405
|
+
ggPM: (type: string, dcrStaticMetadata: {
|
|
406
|
+
type: string;
|
|
407
|
+
assetid: unknown;
|
|
408
|
+
section: string;
|
|
409
|
+
}) => void;
|
|
410
|
+
ggInitialize: (nolggGlobalParams: {
|
|
411
|
+
sfcode: string;
|
|
412
|
+
apid: string;
|
|
413
|
+
apn: string;
|
|
414
|
+
}) => void;
|
|
415
|
+
}
|
|
416
|
+
interface Trac {
|
|
417
|
+
record: () => this;
|
|
418
|
+
post: () => this;
|
|
419
|
+
}
|
|
420
|
+
type GoogleTagParams = unknown;
|
|
421
|
+
type GoogleTrackConversionObject = {
|
|
422
|
+
google_conversion_id: number;
|
|
423
|
+
google_custom_params: GoogleTagParams;
|
|
424
|
+
google_remarketing_only: boolean;
|
|
425
|
+
};
|
|
426
|
+
export type { Advert, DfpEnv, ConnectionType, NetworkInformation, OphanRecordFunction, Indices, Edition, AdsConfigDisabled, AdsConfigEnabled, AdsConfigBasic, AdsConfigUSNATorAus, AdsConfigTCFV2, AdsConfig, AdTargetingBuilder, Ophan, Config, AdBlockers, ArticleCounts, FetchBidResponse, HeaderNotification, OptOutInitializeOptions, OptOutAdSlot, Confiant, Permutive, Apstag, ComscoreGlobals, IasPET, TeadsAnalytics, SafeFrameAPI, NSdkInstance, Trac, GoogleTagParams, GoogleTrackConversionObject, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var BlockingType;
|
|
4
|
+
(function (BlockingType) {
|
|
5
|
+
BlockingType[BlockingType["Manual"] = 1] = "Manual";
|
|
6
|
+
BlockingType[BlockingType["Creative"] = 2] = "Creative";
|
|
7
|
+
BlockingType[BlockingType["ProviderSecurity"] = 3] = "ProviderSecurity";
|
|
8
|
+
BlockingType[BlockingType["BannedDomain"] = 4] = "BannedDomain";
|
|
9
|
+
BlockingType[BlockingType["ProviderIbv"] = 5] = "ProviderIbv";
|
|
10
|
+
BlockingType[BlockingType["UnsafeJS"] = 6] = "UnsafeJS";
|
|
11
|
+
BlockingType[BlockingType["Hrap"] = 7] = "Hrap";
|
|
12
|
+
})(BlockingType || (BlockingType = {}));
|