@streamlayer/feature-advertisement 1.1.1-rc.8.pd3aefe41 → 1.2.0
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/lib/advertisement.d.ts +6 -6
- package/lib/advertisement.js +9 -9
- package/lib/index.d.ts +14 -15
- 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 +4 -12
- package/lib/units/sponsor-logo.js +3 -4
- 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/package.json +9 -42
- package/classic/package.json +0 -5
- package/lib/cjs/advertisement.d.ts +0 -64
- package/lib/cjs/advertisement.js +0 -322
- package/lib/cjs/index.d.ts +0 -21
- package/lib/cjs/index.js +0 -41
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/units/ad-macros.d.ts +0 -7
- package/lib/cjs/units/ad-macros.js +0 -91
- package/lib/cjs/units/external-ad.d.ts +0 -127
- package/lib/cjs/units/external-ad.js +0 -421
- package/lib/cjs/units/external-pause-ad.d.ts +0 -50
- package/lib/cjs/units/external-pause-ad.js +0 -259
- package/lib/cjs/units/gam.d.ts +0 -26
- package/lib/cjs/units/gam.js +0 -152
- package/lib/cjs/units/parse-vast-extensions.d.ts +0 -26
- package/lib/cjs/units/parse-vast-extensions.js +0 -56
- package/lib/cjs/units/pause-ad-card.d.ts +0 -49
- package/lib/cjs/units/pause-ad-card.js +0 -136
- package/lib/cjs/units/pause-ad.d.ts +0 -16
- package/lib/cjs/units/pause-ad.js +0 -52
- package/lib/cjs/units/sponsor-logo.d.ts +0 -78
- package/lib/cjs/units/sponsor-logo.js +0 -194
- package/lib/cjs/units/ssai-ad-break.d.ts +0 -21
- package/lib/cjs/units/ssai-ad-break.js +0 -11
- package/lib/cjs/units/ssai-creative.d.ts +0 -89
- package/lib/cjs/units/ssai-creative.js +0 -136
- package/lib/cjs/units/ssai-detector.d.ts +0 -180
- package/lib/cjs/units/ssai-detector.js +0 -1172
- package/lib/cjs/units/ssai-log.d.ts +0 -16
- package/lib/cjs/units/ssai-log.js +0 -23
- package/lib/cjs/units/ssai-preload.d.ts +0 -20
- package/lib/cjs/units/ssai-preload.js +0 -62
- package/lib/cjs/units/ssai-providers.d.ts +0 -117
- package/lib/cjs/units/ssai-providers.js +0 -300
- package/lib/cjs/units/vast-tracker.d.ts +0 -45
- package/lib/cjs/units/vast-tracker.js +0 -64
- package/lib/classic/_virtual/_rollupPluginBabelHelpers.js +0 -71
- package/lib/classic/advertisement.js +0 -348
- package/lib/classic/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -77
- package/lib/classic/cjs/advertisement.js +0 -350
- package/lib/classic/cjs/index.js +0 -49
- package/lib/classic/cjs/package.json +0 -1
- package/lib/classic/cjs/units/ad-macros.js +0 -115
- package/lib/classic/cjs/units/external-ad.js +0 -500
- package/lib/classic/cjs/units/external-pause-ad.js +0 -278
- package/lib/classic/cjs/units/gam.js +0 -173
- package/lib/classic/cjs/units/parse-vast-extensions.js +0 -60
- package/lib/classic/cjs/units/pause-ad-card.js +0 -134
- package/lib/classic/cjs/units/pause-ad.js +0 -72
- package/lib/classic/cjs/units/sponsor-logo.js +0 -201
- package/lib/classic/cjs/units/ssai-ad-break.js +0 -11
- package/lib/classic/cjs/units/ssai-creative.js +0 -142
- package/lib/classic/cjs/units/ssai-detector.js +0 -1195
- package/lib/classic/cjs/units/ssai-log.js +0 -23
- package/lib/classic/cjs/units/ssai-preload.js +0 -72
- package/lib/classic/cjs/units/ssai-providers.js +0 -361
- package/lib/classic/cjs/units/vast-tracker.js +0 -81
- package/lib/classic/index.js +0 -29
- package/lib/classic/units/ad-macros.js +0 -113
- package/lib/classic/units/external-ad.js +0 -491
- package/lib/classic/units/external-pause-ad.js +0 -275
- package/lib/classic/units/gam.js +0 -171
- package/lib/classic/units/parse-vast-extensions.js +0 -58
- package/lib/classic/units/pause-ad-card.js +0 -131
- package/lib/classic/units/pause-ad.js +0 -70
- package/lib/classic/units/sponsor-logo.js +0 -197
- package/lib/classic/units/ssai-ad-break.js +0 -9
- package/lib/classic/units/ssai-creative.js +0 -140
- package/lib/classic/units/ssai-detector.js +0 -1192
- package/lib/classic/units/ssai-log.js +0 -21
- package/lib/classic/units/ssai-preload.js +0 -68
- package/lib/classic/units/ssai-providers.js +0 -351
- package/lib/classic/units/vast-tracker.js +0 -77
- package/lib/vast-client.d.ts +0 -9
package/lib/advertisement.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AbstractFeatureUnit, StreamLayerContext } from '@streamlayer/sdk-web-interfaces';
|
|
2
|
-
import { externalAd } from './units/external-ad
|
|
3
|
-
import { externalPauseAd, type ExternalPauseAdOptions } from './units/external-pause-ad
|
|
4
|
-
import { type PauseAdListOptions, type PauseAdStore } from './units/pause-ad
|
|
5
|
-
import { type SsaiProviderOption } from './units/ssai-providers
|
|
6
|
-
import { type HlsLike, type SsaiDebugSnapshot } from './units/ssai-detector
|
|
7
|
-
import { type SsaiAdBreakStore } from './units/ssai-ad-break
|
|
2
|
+
import { externalAd } from './units/external-ad';
|
|
3
|
+
import { externalPauseAd, type ExternalPauseAdOptions } from './units/external-pause-ad';
|
|
4
|
+
import { type PauseAdListOptions, type PauseAdStore } from './units/pause-ad';
|
|
5
|
+
import { type SsaiProviderOption } from './units/ssai-providers';
|
|
6
|
+
import { type HlsLike, type SsaiDebugSnapshot } from './units/ssai-detector';
|
|
7
|
+
import { type SsaiAdBreakStore } from './units/ssai-ad-break';
|
|
8
8
|
export type ExternalAdStore = ReturnType<ReturnType<typeof externalAd>>;
|
|
9
9
|
export type ExternalPauseAdStore = ReturnType<ReturnType<typeof externalPauseAd>>;
|
|
10
10
|
export type SsaiMonitorOptions = {
|
package/lib/advertisement.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AbstractFeatureUnit, createSingleStore, eventBus } from '@streamlayer/sdk-web-interfaces';
|
|
2
2
|
import { createLogger } from '@streamlayer/sdk-web-logger';
|
|
3
|
-
import { externalAd } from './units/external-ad
|
|
4
|
-
import { externalPauseAd } from './units/external-pause-ad
|
|
5
|
-
import { pauseAdListStore } from './units/pause-ad
|
|
6
|
-
import { SsaiCreativeCache } from './units/ssai-creative
|
|
7
|
-
import { resolveProvider } from './units/ssai-providers
|
|
8
|
-
import { createSsaiDetector, } from './units/ssai-detector
|
|
9
|
-
import { createSsaiAdBreakStore } from './units/ssai-ad-break
|
|
10
|
-
import { ssaiq } from './units/ssai-log
|
|
11
|
-
import { preloadCreativeAssets } from './units/ssai-preload
|
|
3
|
+
import { externalAd } from './units/external-ad';
|
|
4
|
+
import { externalPauseAd } from './units/external-pause-ad';
|
|
5
|
+
import { pauseAdListStore } from './units/pause-ad';
|
|
6
|
+
import { SsaiCreativeCache } from './units/ssai-creative';
|
|
7
|
+
import { resolveProvider } from './units/ssai-providers';
|
|
8
|
+
import { createSsaiDetector, } from './units/ssai-detector';
|
|
9
|
+
import { createSsaiAdBreakStore } from './units/ssai-ad-break';
|
|
10
|
+
import { ssaiq } from './units/ssai-log';
|
|
11
|
+
import { preloadCreativeAssets } from './units/ssai-preload';
|
|
12
12
|
export class Advertisement extends AbstractFeatureUnit {
|
|
13
13
|
getExternalAd;
|
|
14
14
|
getExternalPauseAd;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
/// <reference path="./vast-client.d.ts" />
|
|
2
1
|
import { StreamLayerContext } from '@streamlayer/sdk-web-interfaces';
|
|
3
2
|
declare module '@streamlayer/sdk-web-interfaces' {
|
|
4
3
|
interface StreamLayerSDK {
|
|
5
|
-
advertisement: import('./advertisement
|
|
4
|
+
advertisement: import('./advertisement').Advertisement;
|
|
6
5
|
}
|
|
7
6
|
}
|
|
8
|
-
export { type ExternalAdStore, type ExternalPauseAdStore, type SsaiMonitorOptions } from './advertisement
|
|
9
|
-
export { type GAMStaticCore, type PauseAdTemplate, isFullbleedVideoTemplate } from './units/external-pause-ad
|
|
10
|
-
export { INSIGHT_BODY_MAX_LENGTH, type PauseAdCard, type PauseAdKind, type PauseAdMediaMode, } from './units/pause-ad-card
|
|
11
|
-
export { type PauseAdStore } from './units/pause-ad
|
|
12
|
-
export { type AdStore, type AdData, type AdCompanion, type AdNonLinear } from './units/external-ad
|
|
13
|
-
export { selectSponsorLogo, type SponsorLogoAsset } from './units/sponsor-logo
|
|
14
|
-
export { gam, type GamNonceResult, type PalNonceManager } from './units/gam
|
|
15
|
-
export { createCompanionTracker, createVastTracker, resolveVastTrackerTarget, type VastTrackerTarget, } from './units/vast-tracker
|
|
16
|
-
export { type SsaiCreative, type SsaiTrackingEvent, type SsaiCompanion, type SsaiProgressEvent, DEFAULT_CREATIVE_API_BASE, } from './units/ssai-creative
|
|
17
|
-
export { type SsaiCreativeProvider, type SsaiProviderOption, type SsaiProviderName, type SsaiProviderConfig, type StreamLayerProviderConfig, type QuortexProviderConfig, createStreamLayerProvider, createQuortexProvider, createVastProvider, resolveProvider, fireBeacon, fireTrackingEvents, BUILTIN_PROVIDERS, } from './units/ssai-providers
|
|
18
|
-
export { type SsaiDateRange, type SsaiTrackingMarker, type HlsLike, type SsaiClockSource, type SsaiDebugEvent, type SsaiDebugRange, type SsaiDebugSnapshot, } from './units/ssai-detector
|
|
19
|
-
export { preloadImages, preloadCreativeAssets, DEFAULT_PRELOAD_TIMEOUT_MS } from './units/ssai-preload
|
|
20
|
-
export { type SsaiAdBreakState, type SsaiAdBreakStatus, type SsaiAdBreakStore } from './units/ssai-ad-break
|
|
7
|
+
export { type ExternalAdStore, type ExternalPauseAdStore, type SsaiMonitorOptions } from './advertisement';
|
|
8
|
+
export { type GAMStaticCore, type PauseAdTemplate, isFullbleedVideoTemplate } from './units/external-pause-ad';
|
|
9
|
+
export { INSIGHT_BODY_MAX_LENGTH, type PauseAdCard, type PauseAdKind, type PauseAdMediaMode, } from './units/pause-ad-card';
|
|
10
|
+
export { type PauseAdStore } from './units/pause-ad';
|
|
11
|
+
export { type AdStore, type AdData, type AdCompanion, type AdNonLinear } from './units/external-ad';
|
|
12
|
+
export { selectSponsorLogo, type SponsorLogoAsset } from './units/sponsor-logo';
|
|
13
|
+
export { gam, type GamNonceResult, type PalNonceManager } from './units/gam';
|
|
14
|
+
export { createCompanionTracker, createVastTracker, resolveVastTrackerTarget, type VastTrackerTarget, } from './units/vast-tracker';
|
|
15
|
+
export { type SsaiCreative, type SsaiTrackingEvent, type SsaiCompanion, type SsaiProgressEvent, DEFAULT_CREATIVE_API_BASE, } from './units/ssai-creative';
|
|
16
|
+
export { type SsaiCreativeProvider, type SsaiProviderOption, type SsaiProviderName, type SsaiProviderConfig, type StreamLayerProviderConfig, type QuortexProviderConfig, createStreamLayerProvider, createQuortexProvider, createVastProvider, resolveProvider, fireBeacon, fireTrackingEvents, BUILTIN_PROVIDERS, } from './units/ssai-providers';
|
|
17
|
+
export { type SsaiDateRange, type SsaiTrackingMarker, type HlsLike, type SsaiClockSource, type SsaiDebugEvent, type SsaiDebugRange, type SsaiDebugSnapshot, } from './units/ssai-detector';
|
|
18
|
+
export { preloadImages, preloadCreativeAssets, DEFAULT_PRELOAD_TIMEOUT_MS } from './units/ssai-preload';
|
|
19
|
+
export { type SsaiAdBreakState, type SsaiAdBreakStatus, type SsaiAdBreakStore } from './units/ssai-ad-break';
|
|
21
20
|
export declare const advertisement: (instance: StreamLayerContext, _opts: unknown, done: () => void) => void;
|
package/lib/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Advertisement } from './advertisement
|
|
2
|
-
export { isFullbleedVideoTemplate } from './units/external-pause-ad
|
|
1
|
+
import { Advertisement } from './advertisement';
|
|
2
|
+
export { isFullbleedVideoTemplate } from './units/external-pause-ad';
|
|
3
3
|
// Card shapes come straight from the pure module rather than through `units/pause-ad`. NOT a bundle
|
|
4
4
|
// guarantee for barrel consumers — this file value-imports `Advertisement` on line 3, which imports
|
|
5
5
|
// the store module anyway, and the package declares no `sideEffects: false`. What it does buy: the
|
|
6
6
|
// unit spec and any deep importer get the card shapes without the store, and dropping the
|
|
7
7
|
// `export *` keeps `units/pause-ad` from silently re-exporting `parsePauseAdCards`.
|
|
8
|
-
export { INSIGHT_BODY_MAX_LENGTH, } from './units/pause-ad-card
|
|
9
|
-
export { selectSponsorLogo } from './units/sponsor-logo
|
|
10
|
-
export { gam } from './units/gam
|
|
11
|
-
export { createCompanionTracker, createVastTracker, resolveVastTrackerTarget, } from './units/vast-tracker
|
|
12
|
-
export { DEFAULT_CREATIVE_API_BASE, } from './units/ssai-creative
|
|
13
|
-
export { createStreamLayerProvider, createQuortexProvider, createVastProvider, resolveProvider, fireBeacon, fireTrackingEvents, BUILTIN_PROVIDERS, } from './units/ssai-providers
|
|
14
|
-
export { preloadImages, preloadCreativeAssets, DEFAULT_PRELOAD_TIMEOUT_MS } from './units/ssai-preload
|
|
8
|
+
export { INSIGHT_BODY_MAX_LENGTH, } from './units/pause-ad-card';
|
|
9
|
+
export { selectSponsorLogo } from './units/sponsor-logo';
|
|
10
|
+
export { gam } from './units/gam';
|
|
11
|
+
export { createCompanionTracker, createVastTracker, resolveVastTrackerTarget, } from './units/vast-tracker';
|
|
12
|
+
export { DEFAULT_CREATIVE_API_BASE, } from './units/ssai-creative';
|
|
13
|
+
export { createStreamLayerProvider, createQuortexProvider, createVastProvider, resolveProvider, fireBeacon, fireTrackingEvents, BUILTIN_PROVIDERS, } from './units/ssai-providers';
|
|
14
|
+
export { preloadImages, preloadCreativeAssets, DEFAULT_PRELOAD_TIMEOUT_MS } from './units/ssai-preload';
|
|
15
15
|
export const advertisement = (instance, _opts, done) => {
|
|
16
16
|
instance.sdk.advertisement = new Advertisement(instance);
|
|
17
17
|
instance.sdk.onMount({ name: 'advertisement' }, () => {
|
|
@@ -2,8 +2,8 @@ import type { AdTagParams } from '@streamlayer/sdk-web-core';
|
|
|
2
2
|
import { StreamLayerContext } from '@streamlayer/sdk-web-interfaces';
|
|
3
3
|
import { VastAd, VastCompanionAd, VastCreativeCompanion, VastCreativeLinear, VastCreativeNonLinear, VastNonLinearAd, VastResponse } from '@dailymotion/vast-client';
|
|
4
4
|
import '@streamlayer/sdk-web-api';
|
|
5
|
-
import { type PalNonceManager } from './gam
|
|
6
|
-
import { VastCreative } from './parse-vast-extensions
|
|
5
|
+
import { type PalNonceManager } from './gam';
|
|
6
|
+
import { VastCreative } from './parse-vast-extensions';
|
|
7
7
|
export type AdCompanion = {
|
|
8
8
|
imageUrl?: string;
|
|
9
9
|
clickUrl?: string;
|
package/lib/units/external-ad.js
CHANGED
|
@@ -7,9 +7,9 @@ import { createLogger } from '@streamlayer/sdk-web-logger';
|
|
|
7
7
|
import { VASTClient, VASTParser, } from '@dailymotion/vast-client';
|
|
8
8
|
import '@streamlayer/sdk-web-api';
|
|
9
9
|
import VMAP from 'vmap';
|
|
10
|
-
import { gam } from './gam
|
|
11
|
-
import { parseVastExtension } from './parse-vast-extensions
|
|
12
|
-
import { collectAssets, selectCardLogo } from './sponsor-logo
|
|
10
|
+
import { gam } from './gam';
|
|
11
|
+
import { parseVastExtension } from './parse-vast-extensions';
|
|
12
|
+
import { collectAssets, selectCardLogo } from './sponsor-logo';
|
|
13
13
|
const log = createLogger('ui:gam-external-ad');
|
|
14
14
|
/** Default budget for a single VAST resolution before it is treated as "no ad". */
|
|
15
15
|
const VAST_FETCH_TIMEOUT_MS = 10_000;
|
|
@@ -7,7 +7,7 @@ import { eventBus } from '@streamlayer/sdk-web-interfaces';
|
|
|
7
7
|
import { createLogger } from '@streamlayer/sdk-web-logger';
|
|
8
8
|
import '@streamlayer/sdk-web-api';
|
|
9
9
|
import { VASTClient } from '@dailymotion/vast-client';
|
|
10
|
-
import { substituteAdTagMacros } from './ad-macros
|
|
10
|
+
import { substituteAdTagMacros } from './ad-macros';
|
|
11
11
|
const FULLBLEED_VIDEO_TEMPLATES = [
|
|
12
12
|
'fullbleed-video',
|
|
13
13
|
'fullbleed-video-center',
|
package/lib/units/gam.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { safeLocalStorage, safeSessionStorage } from '@streamlayer/sdk-web-storage';
|
|
2
2
|
import { validate as uuidValidate, v5 as uuid5, v4 as uuid4 } from 'uuid';
|
|
3
|
-
import { substituteAdTagMacros } from './ad-macros
|
|
3
|
+
import { substituteAdTagMacros } from './ad-macros';
|
|
4
4
|
const urlIsNotGam = (url) => {
|
|
5
5
|
return url.origin !== 'https://pubads.g.doubleclick.net';
|
|
6
6
|
};
|
package/lib/units/pause-ad.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSingleStore, StreamLayerContext } from '@streamlayer/sdk-web-interfaces';
|
|
2
2
|
import '@streamlayer/sdk-web-api';
|
|
3
3
|
import '@streamlayer/sdk-web-core/store';
|
|
4
|
-
import { type PauseAdCard } from './pause-ad-card
|
|
4
|
+
import { type PauseAdCard } from './pause-ad-card';
|
|
5
5
|
export type PauseAdListOptions = {
|
|
6
6
|
refetchInterval: number;
|
|
7
7
|
$enabled: boolean;
|
package/lib/units/pause-ad.js
CHANGED
|
@@ -3,7 +3,7 @@ import { atom } from 'nanostores';
|
|
|
3
3
|
import '@streamlayer/sdk-web-api';
|
|
4
4
|
import '@streamlayer/sdk-web-core/store';
|
|
5
5
|
import { Feed } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb';
|
|
6
|
-
import { parsePauseAdCards } from './pause-ad-card
|
|
6
|
+
import { parsePauseAdCards } from './pause-ad-card';
|
|
7
7
|
const log = createLogger('advertisement:pause-ad');
|
|
8
8
|
export const pauseAdListStore = (instance) => {
|
|
9
9
|
const $slStreamId = instance.stores.slStreamId.getAtomStore();
|
|
@@ -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 { VastCompanionAd, VastCreativeCompanion, VastCreativeNonLinear, VastNonLinearAd } from '@dailymotion/vast-client';
|
|
28
|
+
import { VastAd, 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,21 +42,13 @@ export type SponsorLogoAsset = {
|
|
|
42
42
|
/** The `<Companion>` / `<NonLinear>` variation — the 4th argument; owns `creativeView`. */
|
|
43
43
|
variation: VastCompanionAd | VastNonLinearAd;
|
|
44
44
|
};
|
|
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
|
-
}
|
|
45
|
+
export declare const collectAssets: (ad: VastAd) => SponsorLogoAsset[];
|
|
53
46
|
/**
|
|
54
47
|
* Pick the image a parsed VAST ad offers for a sponsor-logo slot, or `undefined` when it offers
|
|
55
48
|
* none (a video-only tag, or an empty response). A caller that gets `undefined` must fall back to
|
|
56
49
|
* its own proto/Studio logo rather than suppressing the card.
|
|
57
50
|
*/
|
|
58
|
-
export declare const
|
|
59
|
-
export declare const selectSponsorLogo: (ad: SponsorLogoSource) => SponsorLogoAsset | undefined;
|
|
51
|
+
export declare const selectSponsorLogo: (ad: VastAd) => SponsorLogoAsset | undefined;
|
|
60
52
|
/**
|
|
61
53
|
* iOS `SLRVASTSlotRole.cardLogo` — the sponsor logo of a **hero card** (1:1 / 2:1 / Picture in
|
|
62
54
|
* Picture / Side-by-Side / Sponsor Frame). Same 1:1 aspect-dominant ranking as `.logo`, plus the
|
|
@@ -73,6 +65,6 @@ export declare const selectSponsorLogo: (ad: SponsorLogoSource) => SponsorLogoAs
|
|
|
73
65
|
* pool object, so the caller passes the assets the hero already claimed and they are filtered
|
|
74
66
|
* out here by `imageUrl`.
|
|
75
67
|
*/
|
|
76
|
-
export declare const selectCardLogo: (ad:
|
|
68
|
+
export declare const selectCardLogo: (ad: VastAd, exclude?: ({
|
|
77
69
|
imageUrl?: string;
|
|
78
70
|
} | 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
|
-
const
|
|
82
|
+
export const collectAssets = (ad) => {
|
|
83
83
|
const assets = [];
|
|
84
84
|
for (let i = 0; i < ad.creatives.length; i++) {
|
|
85
85
|
const creative = ad.creatives[i];
|
|
@@ -164,8 +164,7 @@ 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
|
|
168
|
-
export const selectSponsorLogo = (ad) => rankBest(collectAssetsFrom(ad));
|
|
167
|
+
export const selectSponsorLogo = (ad) => rankBest(collectAssets(ad));
|
|
169
168
|
/**
|
|
170
169
|
* iOS `SLRVASTSlotRole.cardLogo` — the sponsor logo of a **hero card** (1:1 / 2:1 / Picture in
|
|
171
170
|
* Picture / Side-by-Side / Sponsor Frame). Same 1:1 aspect-dominant ranking as `.logo`, plus the
|
|
@@ -184,5 +183,5 @@ export const selectSponsorLogo = (ad) => rankBest(collectAssetsFrom(ad));
|
|
|
184
183
|
*/
|
|
185
184
|
export const selectCardLogo = (ad, exclude) => {
|
|
186
185
|
const claimed = (exclude || []).map((item) => item?.imageUrl).filter((url) => !!url);
|
|
187
|
-
return rankBest(
|
|
186
|
+
return rankBest(collectAssets(ad).filter((asset) => asset.origin === 'companion' && claimed.indexOf(asset.imageUrl) === -1));
|
|
188
187
|
};
|
|
@@ -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';
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
17
17
|
/** The creative (and, for non-linear creatives, the variation) a tracker reports through. */
|
|
18
18
|
export type VastTrackerTarget = {
|
|
19
19
|
ad: VastAd;
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-advertisement",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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",
|
|
8
7
|
"uuid": "^11.1.0",
|
|
9
8
|
"nanostores": "^1.1.0",
|
|
10
|
-
"@streamlayer/sdk-web-core": "1.
|
|
11
|
-
"@streamlayer/sdk-web-api": "1.18.
|
|
12
|
-
"@streamlayer/sdk-web-
|
|
13
|
-
"@streamlayer/sdk-web-
|
|
14
|
-
"@streamlayer/sdk-web-
|
|
15
|
-
"@streamlayer/sdk-web-storage": "1.2.2
|
|
9
|
+
"@streamlayer/sdk-web-core": "^1.24.0",
|
|
10
|
+
"@streamlayer/sdk-web-api": "^1.18.1",
|
|
11
|
+
"@streamlayer/sdk-web-logger": "^1.3.0",
|
|
12
|
+
"@streamlayer/sdk-web-interfaces": "^1.12.0",
|
|
13
|
+
"@streamlayer/sdk-web-types": "^2.0.1",
|
|
14
|
+
"@streamlayer/sdk-web-storage": "^1.2.2"
|
|
16
15
|
},
|
|
17
16
|
"devDependencies": {
|
|
18
17
|
"@types/vast-client": "^3.0.4"
|
|
@@ -20,40 +19,8 @@
|
|
|
20
19
|
"type": "module",
|
|
21
20
|
"main": "./lib/index.js",
|
|
22
21
|
"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
|
-
},
|
|
51
22
|
"files": [
|
|
52
23
|
"lib/",
|
|
53
|
-
"classic/",
|
|
54
24
|
"package.json"
|
|
55
|
-
]
|
|
56
|
-
|
|
57
|
-
"vmap": "^3.2.0"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
25
|
+
]
|
|
26
|
+
}
|
package/classic/package.json
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { AbstractFeatureUnit, StreamLayerContext } from '@streamlayer/sdk-web-interfaces';
|
|
2
|
-
import { externalAd } from './units/external-ad.js';
|
|
3
|
-
import { externalPauseAd, type ExternalPauseAdOptions } from './units/external-pause-ad.js';
|
|
4
|
-
import { type PauseAdListOptions, type PauseAdStore } from './units/pause-ad.js';
|
|
5
|
-
import { type SsaiProviderOption } from './units/ssai-providers.js';
|
|
6
|
-
import { type HlsLike, type SsaiDebugSnapshot } from './units/ssai-detector.js';
|
|
7
|
-
import { type SsaiAdBreakStore } from './units/ssai-ad-break.js';
|
|
8
|
-
export type ExternalAdStore = ReturnType<ReturnType<typeof externalAd>>;
|
|
9
|
-
export type ExternalPauseAdStore = ReturnType<ReturnType<typeof externalPauseAd>>;
|
|
10
|
-
export type SsaiMonitorOptions = {
|
|
11
|
-
player?: HlsLike;
|
|
12
|
-
videoRef?: HTMLVideoElement;
|
|
13
|
-
manifestUrl?: string;
|
|
14
|
-
/** Creative provider: a ready instance, a built-in name, or `{ name, config }`. Defaults to `streamlayer`. */
|
|
15
|
-
provider?: SsaiProviderOption;
|
|
16
|
-
};
|
|
17
|
-
export declare class Advertisement extends AbstractFeatureUnit {
|
|
18
|
-
getExternalAd: (adUrl?: string) => [ExternalAdStore, string];
|
|
19
|
-
getExternalPauseAd: (adUrl: string, options: ExternalPauseAdOptions) => [ExternalPauseAdStore, string];
|
|
20
|
-
getPauseAdList: (options: PauseAdListOptions) => PauseAdStore;
|
|
21
|
-
readonly ssaiAdBreak: SsaiAdBreakStore;
|
|
22
|
-
startSsaiMonitoring: (options: SsaiMonitorOptions) => void;
|
|
23
|
-
stopSsaiMonitoring: () => void;
|
|
24
|
-
/**
|
|
25
|
-
* Fire the impression tracking pixel for a creative. Called by the UI the
|
|
26
|
-
* moment the bar actually renders the creative, so "impression" means the
|
|
27
|
-
* viewer saw it (not merely that metadata resolved).
|
|
28
|
-
*/
|
|
29
|
-
fireSsaiImpression: (creativeId: string) => void;
|
|
30
|
-
/**
|
|
31
|
-
* Fire a named tracking beacon for a creative (`clickThrough`, or any event
|
|
32
|
-
* the creative carries). Lifecycle beacons — `start`, the quartiles and
|
|
33
|
-
* `complete` — are fired automatically by the detector as playback crosses
|
|
34
|
-
* them; this is for the ones only the UI knows about.
|
|
35
|
-
*/
|
|
36
|
-
fireSsaiTracking: (creativeId: string, event: string) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Fire the companion's `clickTracking` beacons. Exposed for hosts that render
|
|
39
|
-
* the companion banner themselves — the TV overlay has no companion surface,
|
|
40
|
-
* so nothing in this SDK calls it.
|
|
41
|
-
*/
|
|
42
|
-
fireSsaiCompanionClick: (creativeId: string) => void;
|
|
43
|
-
/**
|
|
44
|
-
* User-dismissed the current break: hide the bar now and keep it hidden for
|
|
45
|
-
* the rest of this break (a later break/creative shows again).
|
|
46
|
-
*/
|
|
47
|
-
dismissSsaiBreak: () => void;
|
|
48
|
-
/**
|
|
49
|
-
* Read-only timing introspection of the running SSAI monitor (null while no
|
|
50
|
-
* monitor runs). Feeds the demo app's SSAI debug window; safe to poll.
|
|
51
|
-
*/
|
|
52
|
-
getSsaiDebugSnapshot: () => SsaiDebugSnapshot | null;
|
|
53
|
-
private externalAdStores;
|
|
54
|
-
private externalPauseAdStores;
|
|
55
|
-
private externalPauseAdEnabled;
|
|
56
|
-
private pauseAdStore;
|
|
57
|
-
private pauseAdEnabled;
|
|
58
|
-
private ssaiDetector;
|
|
59
|
-
private ssaiCache;
|
|
60
|
-
private log;
|
|
61
|
-
constructor(instance: StreamLayerContext);
|
|
62
|
-
connect: () => void;
|
|
63
|
-
disconnect: () => void;
|
|
64
|
-
}
|