@streamlayer/feature-advertisement 1.2.0 → 1.2.1-rc.11.pd437c711
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/classic/package.json +5 -0
- package/lib/advertisement.d.ts +6 -6
- package/lib/advertisement.js +9 -9
- package/lib/cjs/advertisement.d.ts +64 -0
- package/lib/cjs/advertisement.js +322 -0
- package/lib/cjs/index.d.ts +21 -0
- package/lib/cjs/index.js +41 -0
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/units/ad-macros.d.ts +7 -0
- package/lib/cjs/units/ad-macros.js +91 -0
- package/lib/cjs/units/external-ad.d.ts +127 -0
- package/lib/cjs/units/external-ad.js +421 -0
- package/lib/cjs/units/external-pause-ad.d.ts +50 -0
- package/lib/cjs/units/external-pause-ad.js +259 -0
- package/lib/cjs/units/gam.d.ts +26 -0
- package/lib/cjs/units/gam.js +152 -0
- package/lib/cjs/units/parse-vast-extensions.d.ts +26 -0
- package/lib/cjs/units/parse-vast-extensions.js +56 -0
- package/lib/cjs/units/pause-ad-card.d.ts +49 -0
- package/lib/cjs/units/pause-ad-card.js +136 -0
- package/lib/cjs/units/pause-ad.d.ts +16 -0
- package/lib/cjs/units/pause-ad.js +52 -0
- package/lib/cjs/units/sponsor-logo.d.ts +78 -0
- package/lib/cjs/units/sponsor-logo.js +194 -0
- package/lib/cjs/units/ssai-ad-break.d.ts +21 -0
- package/lib/cjs/units/ssai-ad-break.js +11 -0
- package/lib/cjs/units/ssai-creative.d.ts +89 -0
- package/lib/cjs/units/ssai-creative.js +136 -0
- package/lib/cjs/units/ssai-detector.d.ts +180 -0
- package/lib/cjs/units/ssai-detector.js +1172 -0
- package/lib/cjs/units/ssai-log.d.ts +16 -0
- package/lib/cjs/units/ssai-log.js +23 -0
- package/lib/cjs/units/ssai-preload.d.ts +20 -0
- package/lib/cjs/units/ssai-preload.js +62 -0
- package/lib/cjs/units/ssai-providers.d.ts +117 -0
- package/lib/cjs/units/ssai-providers.js +300 -0
- package/lib/cjs/units/vast-tracker.d.ts +45 -0
- package/lib/cjs/units/vast-tracker.js +64 -0
- package/lib/classic/_virtual/_rollupPluginBabelHelpers.js +71 -0
- package/lib/classic/advertisement.js +348 -0
- package/lib/classic/cjs/_virtual/_rollupPluginBabelHelpers.js +77 -0
- package/lib/classic/cjs/advertisement.js +350 -0
- package/lib/classic/cjs/index.js +49 -0
- package/lib/classic/cjs/package.json +1 -0
- package/lib/classic/cjs/units/ad-macros.js +115 -0
- package/lib/classic/cjs/units/external-ad.js +500 -0
- package/lib/classic/cjs/units/external-pause-ad.js +278 -0
- package/lib/classic/cjs/units/gam.js +173 -0
- package/lib/classic/cjs/units/parse-vast-extensions.js +60 -0
- package/lib/classic/cjs/units/pause-ad-card.js +134 -0
- package/lib/classic/cjs/units/pause-ad.js +72 -0
- package/lib/classic/cjs/units/sponsor-logo.js +201 -0
- package/lib/classic/cjs/units/ssai-ad-break.js +11 -0
- package/lib/classic/cjs/units/ssai-creative.js +142 -0
- package/lib/classic/cjs/units/ssai-detector.js +1195 -0
- package/lib/classic/cjs/units/ssai-log.js +23 -0
- package/lib/classic/cjs/units/ssai-preload.js +72 -0
- package/lib/classic/cjs/units/ssai-providers.js +361 -0
- package/lib/classic/cjs/units/vast-tracker.js +81 -0
- package/lib/classic/index.js +29 -0
- package/lib/classic/units/ad-macros.js +113 -0
- package/lib/classic/units/external-ad.js +491 -0
- package/lib/classic/units/external-pause-ad.js +275 -0
- package/lib/classic/units/gam.js +171 -0
- package/lib/classic/units/parse-vast-extensions.js +58 -0
- package/lib/classic/units/pause-ad-card.js +131 -0
- package/lib/classic/units/pause-ad.js +70 -0
- package/lib/classic/units/sponsor-logo.js +197 -0
- package/lib/classic/units/ssai-ad-break.js +9 -0
- package/lib/classic/units/ssai-creative.js +140 -0
- package/lib/classic/units/ssai-detector.js +1192 -0
- package/lib/classic/units/ssai-log.js +21 -0
- package/lib/classic/units/ssai-preload.js +68 -0
- package/lib/classic/units/ssai-providers.js +351 -0
- package/lib/classic/units/vast-tracker.js +77 -0
- package/lib/index.d.ts +15 -14
- package/lib/index.js +9 -9
- package/lib/units/external-ad.d.ts +2 -2
- package/lib/units/external-ad.js +3 -3
- package/lib/units/external-pause-ad.js +1 -1
- package/lib/units/gam.js +1 -1
- package/lib/units/pause-ad.d.ts +1 -1
- package/lib/units/pause-ad.js +1 -1
- package/lib/units/sponsor-logo.d.ts +12 -4
- package/lib/units/sponsor-logo.js +4 -3
- package/lib/units/ssai-ad-break.d.ts +1 -1
- package/lib/units/ssai-creative.d.ts +1 -1
- package/lib/units/ssai-creative.js +1 -1
- package/lib/units/ssai-detector.d.ts +1 -1
- package/lib/units/ssai-detector.js +1 -1
- package/lib/units/ssai-preload.d.ts +1 -1
- package/lib/units/ssai-providers.d.ts +1 -1
- package/lib/units/ssai-providers.js +1 -1
- package/lib/units/vast-tracker.d.ts +1 -1
- package/lib/vast-client.d.ts +9 -0
- package/package.json +42 -9
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* The module also hosts iOS's second logo role, `SLRVASTSlotRole.cardLogo` (`selectCardLogo`) —
|
|
26
26
|
* the same ranking narrowed to `<Companion>` origins, for the hero-card display units.
|
|
27
27
|
*/
|
|
28
|
-
import {
|
|
28
|
+
import { VastCompanionAd, VastCreativeCompanion, VastCreativeNonLinear, VastNonLinearAd } from '@dailymotion/vast-client';
|
|
29
29
|
/**
|
|
30
30
|
* One image asset that may fill a sponsor-logo slot. Carries the creative + variation pair so the
|
|
31
31
|
* caller can build a `VASTTracker` for it through `createVastTracker` without re-deriving them.
|
|
@@ -42,13 +42,21 @@ export type SponsorLogoAsset = {
|
|
|
42
42
|
/** The `<Companion>` / `<NonLinear>` variation — the 4th argument; owns `creativeView`. */
|
|
43
43
|
variation: VastCompanionAd | VastNonLinearAd;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* What a caller hands the selector. A parsed `@dailymotion/vast-client` ad satisfies it.
|
|
47
|
+
* The published declarations must not name that package's types: its own `.d.ts` does not
|
|
48
|
+
* export them, and the local shim that does is not part of the tarball.
|
|
49
|
+
*/
|
|
50
|
+
export interface SponsorLogoSource {
|
|
51
|
+
creatives?: unknown;
|
|
52
|
+
}
|
|
46
53
|
/**
|
|
47
54
|
* Pick the image a parsed VAST ad offers for a sponsor-logo slot, or `undefined` when it offers
|
|
48
55
|
* none (a video-only tag, or an empty response). A caller that gets `undefined` must fall back to
|
|
49
56
|
* its own proto/Studio logo rather than suppressing the card.
|
|
50
57
|
*/
|
|
51
|
-
export declare const
|
|
58
|
+
export declare const collectAssets: (ad: SponsorLogoSource) => SponsorLogoAsset[];
|
|
59
|
+
export declare const selectSponsorLogo: (ad: SponsorLogoSource) => SponsorLogoAsset | undefined;
|
|
52
60
|
/**
|
|
53
61
|
* iOS `SLRVASTSlotRole.cardLogo` — the sponsor logo of a **hero card** (1:1 / 2:1 / Picture in
|
|
54
62
|
* Picture / Side-by-Side / Sponsor Frame). Same 1:1 aspect-dominant ranking as `.logo`, plus the
|
|
@@ -65,6 +73,6 @@ export declare const selectSponsorLogo: (ad: VastAd) => SponsorLogoAsset | undef
|
|
|
65
73
|
* pool object, so the caller passes the assets the hero already claimed and they are filtered
|
|
66
74
|
* out here by `imageUrl`.
|
|
67
75
|
*/
|
|
68
|
-
export declare const selectCardLogo: (ad:
|
|
76
|
+
export declare const selectCardLogo: (ad: SponsorLogoSource, exclude?: ({
|
|
69
77
|
imageUrl?: string;
|
|
70
78
|
} | undefined)[]) => SponsorLogoAsset | undefined;
|
|
@@ -79,7 +79,7 @@ const aspectDistance = (asset) => {
|
|
|
79
79
|
}
|
|
80
80
|
return Math.abs(Math.log(asset.width / asset.height));
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
const collectAssetsFrom = (ad) => {
|
|
83
83
|
const assets = [];
|
|
84
84
|
for (let i = 0; i < ad.creatives.length; i++) {
|
|
85
85
|
const creative = ad.creatives[i];
|
|
@@ -164,7 +164,8 @@ const rankBest = (assets) => {
|
|
|
164
164
|
* none (a video-only tag, or an empty response). A caller that gets `undefined` must fall back to
|
|
165
165
|
* its own proto/Studio logo rather than suppressing the card.
|
|
166
166
|
*/
|
|
167
|
-
export const
|
|
167
|
+
export const collectAssets = (ad) => collectAssetsFrom(ad);
|
|
168
|
+
export const selectSponsorLogo = (ad) => rankBest(collectAssetsFrom(ad));
|
|
168
169
|
/**
|
|
169
170
|
* iOS `SLRVASTSlotRole.cardLogo` — the sponsor logo of a **hero card** (1:1 / 2:1 / Picture in
|
|
170
171
|
* Picture / Side-by-Side / Sponsor Frame). Same 1:1 aspect-dominant ranking as `.logo`, plus the
|
|
@@ -183,5 +184,5 @@ export const selectSponsorLogo = (ad) => rankBest(collectAssets(ad));
|
|
|
183
184
|
*/
|
|
184
185
|
export const selectCardLogo = (ad, exclude) => {
|
|
185
186
|
const claimed = (exclude || []).map((item) => item?.imageUrl).filter((url) => !!url);
|
|
186
|
-
return rankBest(
|
|
187
|
+
return rankBest(collectAssetsFrom(ad).filter((asset) => asset.origin === 'companion' && claimed.indexOf(asset.imageUrl) === -1));
|
|
187
188
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSingleStore } from '@streamlayer/sdk-web-interfaces';
|
|
2
|
-
import type { SsaiCreative } from './ssai-creative';
|
|
2
|
+
import type { SsaiCreative } from './ssai-creative.js';
|
|
3
3
|
/**
|
|
4
4
|
* 'ending' = the ad's window closes within the detector's lead (~0.5s): the
|
|
5
5
|
* overlay's cue to play its closing animation so it completes AT the boundary
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_CREATIVE_API_BASE, type SsaiCreativeProvider } from './ssai-providers';
|
|
1
|
+
import { DEFAULT_CREATIVE_API_BASE, type SsaiCreativeProvider } from './ssai-providers.js';
|
|
2
2
|
export { DEFAULT_CREATIVE_API_BASE };
|
|
3
3
|
export type SsaiTrackingEvent = {
|
|
4
4
|
event: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fireBeacon, fireDefaultImpression, fireTrackingEvents, DEFAULT_CREATIVE_API_BASE, } from './ssai-providers';
|
|
1
|
+
import { fireBeacon, fireDefaultImpression, fireTrackingEvents, DEFAULT_CREATIVE_API_BASE, } from './ssai-providers.js';
|
|
2
2
|
export { DEFAULT_CREATIVE_API_BASE };
|
|
3
3
|
/**
|
|
4
4
|
* Per-instance cache + impression-firing wrapper around a SsaiCreativeProvider.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SsaiCreative } from './ssai-creative';
|
|
1
|
+
import type { SsaiCreative } from './ssai-creative.js';
|
|
2
2
|
/**
|
|
3
3
|
* How long the overlay is willing to wait for artwork. A slow or dead image host
|
|
4
4
|
* must never hold the bar back — the ad is already playing, and a bar that shows
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SsaiCreative } from './ssai-creative';
|
|
1
|
+
import type { SsaiCreative } from './ssai-creative.js';
|
|
2
2
|
export declare const DEFAULT_CREATIVE_API_BASE = "https://hls.next.streamlayer.io/api/creatives/";
|
|
3
3
|
/**
|
|
4
4
|
* A creative provider encapsulates everything that differs between ad sources:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from '@streamlayer/sdk-web-logger';
|
|
2
2
|
import { VASTClient } from '@dailymotion/vast-client';
|
|
3
|
-
import { ssaiq } from './ssai-log';
|
|
3
|
+
import { ssaiq } from './ssai-log.js';
|
|
4
4
|
const log = createLogger('ssai:provider');
|
|
5
5
|
export const DEFAULT_CREATIVE_API_BASE = 'https://hls.next.streamlayer.io/api/creatives/';
|
|
6
6
|
/**
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* player) and they are billing-visible, so collapsing them here would silently change counts.
|
|
14
14
|
*/
|
|
15
15
|
import { VASTTracker, VastAd, VastCompanionAd, VastCreativeCompanion, VastCreativeLinear, VastCreativeNonLinear, VastNonLinearAd } from '@dailymotion/vast-client';
|
|
16
|
-
import type { AdCompanion, AdData } from './external-ad';
|
|
16
|
+
import type { AdCompanion, AdData } from './external-ad.js';
|
|
17
17
|
/** The creative (and, for non-linear creatives, the variation) a tracker reports through. */
|
|
18
18
|
export type VastTrackerTarget = {
|
|
19
19
|
ad: VastAd;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare module '@dailymotion/vast-client' {
|
|
2
|
+
export interface VastAd {}
|
|
3
|
+
export interface VastCompanionAd {}
|
|
4
|
+
export interface VastCreativeCompanion {}
|
|
5
|
+
export interface VastCreativeLinear {}
|
|
6
|
+
export interface VastCreativeNonLinear {}
|
|
7
|
+
export interface VastNonLinearAd {}
|
|
8
|
+
export interface VastResponse {}
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-advertisement",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1-rc.11.pd437c711",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@dailymotion/vast-client": "^6.4.5",
|
|
6
6
|
"@streamlayer/sl-eslib": "^5.268.1",
|
|
7
|
+
"core-js": "^3.50.0",
|
|
7
8
|
"uuid": "^11.1.0",
|
|
8
9
|
"nanostores": "^1.1.0",
|
|
9
|
-
"@streamlayer/sdk-web-core": "
|
|
10
|
-
"@streamlayer/sdk-web-api": "
|
|
11
|
-
"@streamlayer/sdk-web-
|
|
12
|
-
"@streamlayer/sdk-web-
|
|
13
|
-
"@streamlayer/sdk-web-
|
|
14
|
-
"@streamlayer/sdk-web-storage": "
|
|
10
|
+
"@streamlayer/sdk-web-core": "1.24.1-rc.11.pd437c711",
|
|
11
|
+
"@streamlayer/sdk-web-api": "1.18.2-rc.11.pd437c711",
|
|
12
|
+
"@streamlayer/sdk-web-interfaces": "1.12.1-rc.11.pd437c711",
|
|
13
|
+
"@streamlayer/sdk-web-types": "2.0.2-rc.11.pd437c711",
|
|
14
|
+
"@streamlayer/sdk-web-logger": "1.3.1-rc.11.pd437c711",
|
|
15
|
+
"@streamlayer/sdk-web-storage": "1.2.3-rc.11.pd437c711"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
18
|
"@types/vast-client": "^3.0.4"
|
|
@@ -19,8 +20,40 @@
|
|
|
19
20
|
"type": "module",
|
|
20
21
|
"main": "./lib/index.js",
|
|
21
22
|
"typings": "./lib/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./lib/index.d.ts",
|
|
27
|
+
"default": "./lib/index.js"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./lib/cjs/index.d.ts",
|
|
31
|
+
"default": "./lib/cjs/index.js"
|
|
32
|
+
},
|
|
33
|
+
"module": "./lib/index.js",
|
|
34
|
+
"default": "./lib/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./*": "./*",
|
|
37
|
+
"./classic": {
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./lib/index.d.ts",
|
|
40
|
+
"default": "./lib/classic/index.js"
|
|
41
|
+
},
|
|
42
|
+
"require": {
|
|
43
|
+
"types": "./lib/cjs/index.d.ts",
|
|
44
|
+
"default": "./lib/classic/cjs/index.js"
|
|
45
|
+
},
|
|
46
|
+
"module": "./lib/classic/index.js",
|
|
47
|
+
"default": "./lib/classic/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./package.json": "./package.json"
|
|
50
|
+
},
|
|
22
51
|
"files": [
|
|
23
52
|
"lib/",
|
|
53
|
+
"classic/",
|
|
24
54
|
"package.json"
|
|
25
|
-
]
|
|
26
|
-
|
|
55
|
+
],
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"vmap": "^3.2.0"
|
|
58
|
+
}
|
|
59
|
+
}
|