@streamlayer/feature-advertisement 1.0.0 → 1.1.1-rc.1342
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/cjs/advertisement.d.ts +64 -0
- package/lib/cjs/advertisement.js +307 -0
- package/lib/cjs/index.d.ts +19 -0
- package/lib/cjs/index.js +39 -0
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/units/external-ad.d.ts +58 -0
- package/lib/cjs/units/external-ad.js +390 -0
- package/lib/cjs/units/external-pause-ad.d.ts +50 -0
- package/lib/cjs/units/external-pause-ad.js +253 -0
- package/lib/cjs/units/gam.d.ts +16 -0
- package/lib/cjs/units/gam.js +104 -0
- package/lib/cjs/units/parse-vast-extensions.d.ts +17 -0
- package/lib/cjs/units/parse-vast-extensions.js +52 -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/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 +1156 -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 +263 -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 +331 -0
- package/lib/classic/cjs/_virtual/_rollupPluginBabelHelpers.js +77 -0
- package/lib/classic/cjs/advertisement.js +333 -0
- package/lib/classic/cjs/index.js +47 -0
- package/lib/classic/cjs/package.json +1 -0
- package/lib/classic/cjs/units/external-ad.js +453 -0
- package/lib/classic/cjs/units/external-pause-ad.js +274 -0
- package/lib/classic/cjs/units/gam.js +110 -0
- package/lib/classic/cjs/units/parse-vast-extensions.js +56 -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/ssai-ad-break.js +11 -0
- package/lib/classic/cjs/units/ssai-creative.js +142 -0
- package/lib/classic/cjs/units/ssai-detector.js +1170 -0
- package/lib/classic/cjs/units/ssai-preload.js +72 -0
- package/lib/classic/cjs/units/ssai-providers.js +299 -0
- package/lib/classic/cjs/units/vast-tracker.js +81 -0
- package/lib/classic/index.js +28 -0
- package/lib/classic/units/external-ad.js +447 -0
- package/lib/classic/units/external-pause-ad.js +271 -0
- package/lib/classic/units/gam.js +108 -0
- package/lib/classic/units/parse-vast-extensions.js +54 -0
- package/lib/classic/units/pause-ad-card.js +131 -0
- package/lib/classic/units/pause-ad.js +70 -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 +1167 -0
- package/lib/classic/units/ssai-preload.js +68 -0
- package/lib/classic/units/ssai-providers.js +289 -0
- package/lib/classic/units/vast-tracker.js +77 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -0
- package/lib/units/pause-ad-card.d.ts +49 -0
- package/lib/units/pause-ad-card.js +130 -0
- package/lib/units/pause-ad.d.ts +1 -18
- package/lib/units/pause-ad.js +2 -49
- package/package.json +42 -9
package/lib/units/pause-ad.js
CHANGED
|
@@ -2,49 +2,9 @@ import { createLogger } from '@streamlayer/sdk-web-logger';
|
|
|
2
2
|
import { atom } from 'nanostores';
|
|
3
3
|
import '@streamlayer/sdk-web-api';
|
|
4
4
|
import '@streamlayer/sdk-web-core/store';
|
|
5
|
-
import { CardFormat, NotificationSponsorLogoMode, PauseAdLayout as PauseAdLayoutProto, PromotionButtonType, PromotionFormat, QRCode, UseGeneralLogo, UserAccountInfo, } from '@streamlayer/sl-eslib/interactive/interactive.common_pb';
|
|
6
5
|
import { Feed } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb';
|
|
6
|
+
import { parsePauseAdCards } from './pause-ad-card';
|
|
7
7
|
const log = createLogger('advertisement:pause-ad');
|
|
8
|
-
const parsePauseAdCard = (question) => {
|
|
9
|
-
const backgroundImageSrc = question.backgroundImage?.landscapeUrl;
|
|
10
|
-
if (!backgroundImageSrc) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const promotionOptions = question.options?.options.case === 'promotion' ? question.options.options.value : undefined;
|
|
14
|
-
const pauseAdOptions = promotionOptions?.pauseAdOptions;
|
|
15
|
-
const optionsSponsor = promotionOptions?.sponsor;
|
|
16
|
-
const layoutProto = pauseAdOptions?.layout ?? PauseAdLayoutProto.UNSET;
|
|
17
|
-
const layout = layoutProto === PauseAdLayoutProto.CENTER ? 'center' : layoutProto === PauseAdLayoutProto.IMAGE ? 'image' : 'left';
|
|
18
|
-
const isInteractive = promotionOptions?.buttonType === PromotionButtonType.SEND_TO_USER;
|
|
19
|
-
const hasQr = pauseAdOptions?.qrCode === QRCode.QR_CODE_ENABLED && !!pauseAdOptions?.qrCodeUrl;
|
|
20
|
-
let ctaLabel;
|
|
21
|
-
let ctaUrl;
|
|
22
|
-
if (isInteractive && promotionOptions?.buttonOptions.case === 'sendToUserOptions') {
|
|
23
|
-
const accountInfo = promotionOptions.buttonOptions.value.userAccountInfo;
|
|
24
|
-
const isPhone = accountInfo === UserAccountInfo.PHONE;
|
|
25
|
-
ctaUrl = isPhone ? 'sendToPhone:' : 'sendToEmail:';
|
|
26
|
-
ctaLabel = isPhone ? 'Send info to account phone' : 'Send info to account email';
|
|
27
|
-
}
|
|
28
|
-
const logoSrc = optionsSponsor?.logoPosition === NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE
|
|
29
|
-
? undefined
|
|
30
|
-
: optionsSponsor?.useGeneralLogo === UseGeneralLogo.ENABLED
|
|
31
|
-
? question.promotion?.generalTabMetadata?.advertiserTransparentLogo || undefined
|
|
32
|
-
: optionsSponsor?.centerLogo || undefined;
|
|
33
|
-
return {
|
|
34
|
-
id: question.id,
|
|
35
|
-
parentId: question.eventId || question.id,
|
|
36
|
-
backgroundImageSrc,
|
|
37
|
-
layout,
|
|
38
|
-
logoSrc,
|
|
39
|
-
title: promotionOptions?.banner?.title || undefined,
|
|
40
|
-
description: promotionOptions?.banner?.body || undefined,
|
|
41
|
-
isInteractive,
|
|
42
|
-
ctaLabel: ctaLabel || undefined,
|
|
43
|
-
ctaUrl: ctaUrl || undefined,
|
|
44
|
-
qrCodeUrl: hasQr ? (pauseAdOptions?.qrCodeUrl ?? undefined) : undefined,
|
|
45
|
-
qrCodeLabel: hasQr ? (pauseAdOptions?.qrCodeLabel ?? undefined) : undefined,
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
8
|
export const pauseAdListStore = (instance) => {
|
|
49
9
|
const $slStreamId = instance.stores.slStreamId.getAtomStore();
|
|
50
10
|
return ($enabled, options) => {
|
|
@@ -61,14 +21,7 @@ export const pauseAdListStore = (instance) => {
|
|
|
61
21
|
}
|
|
62
22
|
log.debug({ eventId }, 'fetching pause ad list');
|
|
63
23
|
const res = await client.pauseAdList({ eventId });
|
|
64
|
-
const
|
|
65
|
-
const cards = questions
|
|
66
|
-
.filter((q) => {
|
|
67
|
-
const opts = q.options?.options.case === 'promotion' ? q.options.options.value : undefined;
|
|
68
|
-
return opts?.format === PromotionFormat.FULL_BLEED || q.format === CardFormat.FULL_BLEED;
|
|
69
|
-
})
|
|
70
|
-
.map((q) => parsePauseAdCard(q))
|
|
71
|
-
.filter((c) => c !== null);
|
|
24
|
+
const cards = parsePauseAdCards(res.data ?? []);
|
|
72
25
|
log.debug({ count: cards.length }, 'parsed %d fullbleed pause ad cards');
|
|
73
26
|
return cards;
|
|
74
27
|
},
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/feature-advertisement",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1-rc.1342",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dailymotion/vast-client": "^6.4.
|
|
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-
|
|
10
|
-
"@streamlayer/sdk-web-
|
|
11
|
-
"@streamlayer/sdk-web-
|
|
12
|
-
"@streamlayer/sdk-web-
|
|
13
|
-
"@streamlayer/sdk-web-
|
|
14
|
-
"@streamlayer/sdk-web-
|
|
10
|
+
"@streamlayer/sdk-web-api": "^1.18.2-rc.1342",
|
|
11
|
+
"@streamlayer/sdk-web-interfaces": "^1.11.2-rc.1342",
|
|
12
|
+
"@streamlayer/sdk-web-types": "^2.0.2-rc.1342",
|
|
13
|
+
"@streamlayer/sdk-web-logger": "^1.2.2-rc.1342",
|
|
14
|
+
"@streamlayer/sdk-web-storage": "^1.2.2-rc.1342",
|
|
15
|
+
"@streamlayer/sdk-web-core": "^1.23.2-rc.1342"
|
|
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
|
-
]
|
|
55
|
+
],
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"vmap": "^3.2.0"
|
|
58
|
+
}
|
|
26
59
|
}
|