@highfivve/ad-tag 5.11.0 → 5.11.1

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.
@@ -5,12 +5,15 @@ const adStickyCloseButtonContent = '.h5v-closeButtonContent';
5
5
  const adStickyHidingClass = 'h5v-footerAd--hidden';
6
6
  const desktopInitialHidingClass = 'h5v-footerAd--hidden-d';
7
7
  const mobileInitialHidingClass = 'h5v-footerAd--hidden-m';
8
- const stickyRenderedEvent = (mobileStickyDomId, disallowedAdvertiserIds, window) => new Promise(resolve => {
8
+ const stickyRenderedEvent = (mobileStickyDomId, disallowedAdvertiserIds, channel, window) => new Promise(resolve => {
9
9
  const listener = (event) => {
10
10
  if (event.slot.getSlotElementId() !== mobileStickyDomId) {
11
11
  return;
12
12
  }
13
- if (event.isEmpty) {
13
+ if (channel === 'gam') {
14
+ resolve('disallowed');
15
+ }
16
+ else if (event.isEmpty) {
14
17
  resolve('empty');
15
18
  }
16
19
  else if (isAdvertiserIncluded(event, disallowedAdvertiserIds)) {
@@ -41,7 +44,7 @@ const hideAdSlot = (element) => {
41
44
  const showAdSlot = (element) => {
42
45
  element.classList.remove(adStickyHidingClass, desktopInitialHidingClass, mobileInitialHidingClass);
43
46
  };
44
- export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdvertiserIds, closingButtonText) => {
47
+ export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdvertiserIds, channel, closingButtonText) => {
45
48
  const stickyAd = 'sticky-ad';
46
49
  const adSticky = window.document.querySelector(adStickyContainerDataRef);
47
50
  const closeButton = window.document.querySelector(adStickyCloseButtonDataRef);
@@ -88,7 +91,7 @@ export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdve
88
91
  else if (renderResult === 'standard') {
89
92
  showAdSlot(adSticky);
90
93
  const stickyOnLoadEventPromise = stickyOnLoadEvent(footerStickyDomId, window);
91
- return stickyRenderedEvent(footerStickyDomId, disallowedAdvertiserIds, window)
94
+ return stickyRenderedEvent(footerStickyDomId, disallowedAdvertiserIds, channel, window)
92
95
  .then(result => result === 'empty' || result === 'disallowed'
93
96
  ? Promise.resolve(result)
94
97
  : stickyOnLoadEventPromise.then(() => result))
@@ -99,7 +102,7 @@ export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdve
99
102
  if (env === 'production') {
100
103
  if (footerStickyDomId) {
101
104
  const stickyOnLoadEventPromise = stickyOnLoadEvent(footerStickyDomId, window);
102
- stickyRenderedEvent(footerStickyDomId, disallowedAdvertiserIds, window)
105
+ stickyRenderedEvent(footerStickyDomId, disallowedAdvertiserIds, channel, window)
103
106
  .then(result => result === 'empty' || result === 'disallowed'
104
107
  ? Promise.resolve(result)
105
108
  : stickyOnLoadEventPromise.then(() => result))
@@ -21,7 +21,8 @@ export const createStickyFooterAdsV2 = () => {
21
21
  ctx.logger__.warn(name, 'mobile and desktop sticky footer are called!');
22
22
  }
23
23
  if (footerAdSlot) {
24
- initAdSticky(ctx.window__, ctx.env__, ctx.logger__, footerAdSlot.moliSlot.domId, config.disallowedAdvertiserIds, config.closingButtonText);
24
+ const channel = ctx.auction__.anchorBottomChannel(footerAdSlot.moliSlot.domId);
25
+ initAdSticky(ctx.window__, ctx.env__, ctx.logger__, footerAdSlot.moliSlot.domId, config.disallowedAdvertiserIds, channel, config.closingButtonText);
25
26
  }
26
27
  return Promise.resolve();
27
28
  })
@@ -64,7 +64,8 @@ export const createStickyHeaderAd = () => {
64
64
  ? ctx.window__.document.querySelector(navbarConfig.selector)
65
65
  : null;
66
66
  if (target) {
67
- const adRenderResultPromise = adRenderResult(ctx, headerSlot.moliSlot, config.disallowedAdvertiserIds, minVisibleDuration);
67
+ const channel = ctx.auction__.anchorTopChannel();
68
+ const adRenderResultPromise = adRenderResult(ctx, headerSlot.moliSlot, config.disallowedAdvertiserIds, channel, minVisibleDuration);
68
69
  observer = new IntersectionObserver(intersectionObserverFadeOutCallback(container, target, adRenderResultPromise, navbar, navbarHiddenClass, config.fadeOutClassName), options);
69
70
  observeTargetTimeoutId = ctx.window__.setTimeout(() => {
70
71
  if (observer) {
@@ -1,5 +1,5 @@
1
1
  import { isAdvertiserIncluded } from 'ad-tag/ads/isAdvertiserIncluded';
2
- export const adRenderResult = (ctx, headerSlot, disallowedAdvertiserIds, minVisibleDuration) => new Promise(resolve => {
2
+ export const adRenderResult = (ctx, headerSlot, disallowedAdvertiserIds, channel, minVisibleDuration) => new Promise(resolve => {
3
3
  if (ctx.env__ === 'test') {
4
4
  resolve('standard');
5
5
  return;
@@ -8,7 +8,10 @@ export const adRenderResult = (ctx, headerSlot, disallowedAdvertiserIds, minVisi
8
8
  if (event.slot.getSlotElementId() !== headerSlot.domId) {
9
9
  return;
10
10
  }
11
- if (isAdvertiserIncluded(event, disallowedAdvertiserIds)) {
11
+ if (channel === 'gam') {
12
+ resolve('disallowed');
13
+ }
14
+ else if (isAdvertiserIncluded(event, disallowedAdvertiserIds)) {
12
15
  resolve('disallowed');
13
16
  }
14
17
  else if (event.isEmpty) {
@@ -1,3 +1,3 @@
1
1
  export const packageJson = {
2
- version: '5.11.0'
2
+ version: '5.11.1'
3
3
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highfivve/ad-tag",
3
- "version": "5.11.0",
3
+ "version": "5.11.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "An ad tag implementation called moli",
6
6
  "main": "./lib/index.js",