@highfivve/ad-tag 5.13.1 → 5.13.3
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.
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { isAdvertiserIncluded } from 'ad-tag/ads/isAdvertiserIncluded';
|
|
2
|
+
import { isGamAnchor } from 'ad-tag/ads/auctions/anchorContext';
|
|
2
3
|
const adStickyContainerDataRef = '[data-ref=h5v-sticky-ad]';
|
|
3
4
|
const adStickyCloseButtonDataRef = '[data-ref=h5v-sticky-ad-close]';
|
|
4
5
|
const adStickyCloseButtonContent = '.h5v-closeButtonContent';
|
|
5
6
|
const adStickyHidingClass = 'h5v-footerAd--hidden';
|
|
6
7
|
const desktopInitialHidingClass = 'h5v-footerAd--hidden-d';
|
|
7
8
|
const mobileInitialHidingClass = 'h5v-footerAd--hidden-m';
|
|
8
|
-
const
|
|
9
|
+
const isStickySlotEvent = (slot, mobileStickyDomId, resolvedAdUnitPath, channel, window) => slot.getSlotElementId() === mobileStickyDomId ||
|
|
10
|
+
(channel === 'gam' && isGamAnchor(slot, window) && slot.getAdUnitPath() === resolvedAdUnitPath);
|
|
11
|
+
const stickyRenderedEvent = (mobileStickyDomId, resolvedAdUnitPath, disallowedAdvertiserIds, channel, window) => new Promise(resolve => {
|
|
9
12
|
const listener = (event) => {
|
|
10
|
-
if (event.slot
|
|
13
|
+
if (!isStickySlotEvent(event.slot, mobileStickyDomId, resolvedAdUnitPath, channel, window)) {
|
|
11
14
|
return;
|
|
12
15
|
}
|
|
13
16
|
if (channel === 'gam') {
|
|
@@ -44,7 +47,7 @@ const hideAdSlot = (element) => {
|
|
|
44
47
|
const showAdSlot = (element) => {
|
|
45
48
|
element.classList.remove(adStickyHidingClass, desktopInitialHidingClass, mobileInitialHidingClass);
|
|
46
49
|
};
|
|
47
|
-
export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdvertiserIds, channel, closingButtonText) => {
|
|
50
|
+
export const initAdSticky = (window, env, log, footerStickyDomId, resolvedAdUnitPath, disallowedAdvertiserIds, channel, closingButtonText) => {
|
|
48
51
|
const stickyAd = 'sticky-ad';
|
|
49
52
|
const adSticky = window.document.querySelector(adStickyContainerDataRef);
|
|
50
53
|
const closeButton = window.document.querySelector(adStickyCloseButtonDataRef);
|
|
@@ -91,7 +94,7 @@ export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdve
|
|
|
91
94
|
else if (renderResult === 'standard') {
|
|
92
95
|
showAdSlot(adSticky);
|
|
93
96
|
const stickyOnLoadEventPromise = stickyOnLoadEvent(footerStickyDomId, window);
|
|
94
|
-
return stickyRenderedEvent(footerStickyDomId, disallowedAdvertiserIds, channel, window)
|
|
97
|
+
return stickyRenderedEvent(footerStickyDomId, resolvedAdUnitPath, disallowedAdvertiserIds, channel, window)
|
|
95
98
|
.then(result => result === 'empty' || result === 'disallowed'
|
|
96
99
|
? Promise.resolve(result)
|
|
97
100
|
: stickyOnLoadEventPromise.then(() => result))
|
|
@@ -102,7 +105,7 @@ export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdve
|
|
|
102
105
|
if (env === 'production') {
|
|
103
106
|
if (footerStickyDomId) {
|
|
104
107
|
const stickyOnLoadEventPromise = stickyOnLoadEvent(footerStickyDomId, window);
|
|
105
|
-
stickyRenderedEvent(footerStickyDomId, disallowedAdvertiserIds, channel, window)
|
|
108
|
+
stickyRenderedEvent(footerStickyDomId, resolvedAdUnitPath, disallowedAdvertiserIds, channel, window)
|
|
106
109
|
.then(result => result === 'empty' || result === 'disallowed'
|
|
107
110
|
? Promise.resolve(result)
|
|
108
111
|
: stickyOnLoadEventPromise.then(() => result))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LOW_PRIORITY, mkPrepareRequestAdsStep } from 'ad-tag/ads/adPipeline';
|
|
2
|
+
import { resolveAdUnitPath } from 'ad-tag/ads/adUnitPath';
|
|
2
3
|
import { initAdSticky } from './footerStickyAd';
|
|
3
4
|
export const createStickyFooterAdsV2 = () => {
|
|
4
5
|
const name = 'sticky-footer-ads-v2';
|
|
@@ -22,7 +23,7 @@ export const createStickyFooterAdsV2 = () => {
|
|
|
22
23
|
}
|
|
23
24
|
if (footerAdSlot) {
|
|
24
25
|
const channel = ctx.auction__.anchorBottomChannel(footerAdSlot.moliSlot.domId);
|
|
25
|
-
initAdSticky(ctx.window__, ctx.env__, ctx.logger__, footerAdSlot.moliSlot.domId, config.disallowedAdvertiserIds, channel, config.closingButtonText);
|
|
26
|
+
initAdSticky(ctx.window__, ctx.env__, ctx.logger__, footerAdSlot.moliSlot.domId, resolveAdUnitPath(footerAdSlot.moliSlot.adUnitPath, ctx.adUnitPathVariables__), config.disallowedAdvertiserIds, channel, config.closingButtonText);
|
|
26
27
|
}
|
|
27
28
|
return Promise.resolve();
|
|
28
29
|
})
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { isAdvertiserIncluded } from 'ad-tag/ads/isAdvertiserIncluded';
|
|
2
|
+
import { resolveAdUnitPath } from 'ad-tag/ads/adUnitPath';
|
|
3
|
+
import { isGamAnchor } from 'ad-tag/ads/auctions/anchorContext';
|
|
2
4
|
export const adRenderResult = (ctx, headerSlot, disallowedAdvertiserIds, channel, minVisibleDuration) => new Promise(resolve => {
|
|
3
5
|
if (ctx.env__ === 'test') {
|
|
4
6
|
resolve('standard');
|
|
5
7
|
return;
|
|
6
8
|
}
|
|
9
|
+
const resolvedAdUnitPath = channel === 'gam'
|
|
10
|
+
? resolveAdUnitPath(headerSlot.adUnitPath, ctx.adUnitPathVariables__)
|
|
11
|
+
: null;
|
|
12
|
+
const isHeaderSlotEvent = (slot) => slot.getSlotElementId() === headerSlot.domId ||
|
|
13
|
+
(resolvedAdUnitPath !== null &&
|
|
14
|
+
isGamAnchor(slot, ctx.window__) &&
|
|
15
|
+
slot.getAdUnitPath() === resolvedAdUnitPath);
|
|
7
16
|
const listener = event => {
|
|
8
|
-
if (event.slot
|
|
17
|
+
if (!isHeaderSlotEvent(event.slot)) {
|
|
9
18
|
return;
|
|
10
19
|
}
|
|
11
20
|
if (channel === 'gam') {
|
package/lib/gen/packageJson.js
CHANGED