@highfivve/ad-tag 5.13.0 → 5.13.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,6 +5,7 @@ import { AssetLoadMethod } from '../util/assetLoaderService';
5
5
  import { tcfapi } from '../types/tcfapi';
6
6
  import { createTestSlots } from '../util/test-slots';
7
7
  import { resolveAdUnitPath } from './adUnitPath';
8
+ import { findGoogletagSlot } from './findGoogletagSlot';
8
9
  import { formatKey, CUSTOM_INTERSTITIAL_FORMAT, CUSTOM_ANCHOR_BOTTOM_FORMAT, CUSTOM_ANCHOR_TOP_FORMAT } from './keyValues';
9
10
  const testAdSlot = (domId, adUnitPath) => ({
10
11
  setCollapseEmptyDiv() {
@@ -124,17 +125,23 @@ export const gptDestroyAdSlots = () => {
124
125
  }
125
126
  return Promise.resolve();
126
127
  case 'requested':
127
- const allGptSlots = context.window__.googletag.pubads().getSlots();
128
128
  const gptSlots = slots
129
- .map(slot => allGptSlots.find(s => s.getSlotElementId() === slot.domId))
129
+ .map(slot => findGoogletagSlot({
130
+ domId: slot.domId,
131
+ adUnitPath: resolveAdUnitPath(slot.adUnitPath, context.adUnitPathVariables__)
132
+ }, context.window__.googletag))
130
133
  .filter(isNotNull);
131
134
  return destroySelectedSlots(gptSlots);
132
135
  case 'excluded':
133
136
  if (isNextRequestAdsCall) {
137
+ const excludedAdUnitPaths = context.config__.slots
138
+ .filter(moliSlot => cleanup.slotIds.includes(moliSlot.domId))
139
+ .map(moliSlot => resolveAdUnitPath(moliSlot.adUnitPath, context.adUnitPathVariables__));
134
140
  const destroyableSlots = context.window__.googletag
135
141
  .pubads()
136
142
  .getSlots()
137
- .filter(slot => !cleanup.slotIds.includes(slot.getSlotElementId()));
143
+ .filter(slot => !cleanup.slotIds.includes(slot.getSlotElementId()) &&
144
+ !excludedAdUnitPaths.includes(slot.getAdUnitPath()));
138
145
  return destroySelectedSlots(destroyableSlots);
139
146
  }
140
147
  return Promise.resolve();
@@ -1,3 +1,3 @@
1
1
  export const packageJson = {
2
- version: '5.13.0'
2
+ version: '5.13.1'
3
3
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highfivve/ad-tag",
3
- "version": "5.13.0",
3
+ "version": "5.13.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "An ad tag implementation called moli",
6
6
  "main": "./lib/index.js",