• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

prebid / Prebid.js / 20273590687

16 Dec 2025 03:36PM UTC coverage: 96.204% (-0.004%) from 96.208%
20273590687

push

github

web-flow
Allegro Bid Adapter: initial release (#14111)

* Allegro Bid Adapter implementation

* copilot review fixes

* Update test/spec/modules/allegroBidAdapter_spec.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* tmp

* Revert "tmp"

This reverts commit a200026cb.

* retry tests

* trigger tests

* send requests with `text/plain` header

* update docs

* update docs

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Patrick McCann <patmmccann@gmail.com>
Co-authored-by: tkogut-allegro <tomasz.kogut@allegro.com>

41437 of 50987 branches covered (81.27%)

185 of 200 new or added lines in 2 files covered. (92.5%)

4 existing lines in 3 files now uncovered.

207284 of 215462 relevant lines covered (96.2%)

71.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.29
/modules/videoModule/coreVideo.js
1
import { module } from '../../src/hook.js';
2
import { ParentModule, SubmoduleBuilder } from '../../libraries/video/shared/parentModule.js';
3

4
// define, ortb object,  events
5

6
/**
7
 * Video Provider Submodule interface. All submodules of the Core Video module must adhere to this.
8
 * @description attached to a video player instance.
9
 * @typedef {Object} VideoProvider
10
 * @function init - Instantiates the Video Provider and the video player, if not already instantiated.
11
 * @function getId - retrieves the div id (unique identifier) of the attached player instance.
12
 * @function getOrtbVideo - retrieves the oRTB Video params for a player's current video session.
13
 * @function getOrtbContent - retrieves the oRTB Content params for a player's current video session.
14
 * @function setAdTagUrl - Requests that a player render the ad in the provided ad tag url.
15
 * @function onEvent - attaches an event listener to the player instance.
16
 * @function offEvent - removes event listener to the player instance.
17
 * @function destroy - deallocates the player instance
18
 */
19

20
/**
21
 * @function VideoProvider#init
22
 */
23

24
/**
25
 * @function VideoProvider#getId
26
 * @returns {string}
27
 */
28

29
/**
30
 * @function VideoProvider#getOrtbVideo
31
 * @returns {Object}
32
 */
33

34
/**
35
 * @function VideoProvider#getOrtbContent
36
 * @returns {Object}
37
 */
38

39
/**
40
 * @function VideoProvider#setAdTagUrl
41
 * @param {string} adTagUrl - URL to a VAST ad tag
42
 * @param {Object} options - Optional params
43
 */
44

45
/**
46
 * @function VideoProvider#onEvent
47
 * @param {string} event - name of event for which the listener should be added
48
 * @param {function} callback - function that will get called when the event is triggered
49
 * @param {Object} basePayload - Base payload for every event; includes common parameters such as divId and type. Event payload should be built on top of this.
50
 */
51

52
/**
53
 * @function VideoProvider#offEvent
54
 * @param {string} event - name of event for which the attached listener should be removed
55
 * @param {function} callback - function that was assigned as a callback when the listener was added
56
 */
57

58
/**
59
 * @function VideoProvider#destroy
60
 */
61

62
/**
63
 * @typedef {Object} videoProviderConfig
64
 * @name videoProviderConfig
65
 * @summary contains data indicating which submodule to create and which player instance to attach it to
66
 * @property {string} divId - unique identifier of the player instance
67
 * @property {number} vendorCode - numeric identifier of the Video Provider type i.e. video.js or jwplayer
68
 * @property {playerConfig} playerConfig
69
 */
70

71
/**
72
 * @typedef {Object} playerConfig
73
 * @name playerConfig
74
 * @summary contains data indicating the behavior the player instance should have
75
 * @property {boolean} autoStart - determines if the player should start automatically when instantiated
76
 * @property {boolean} mute - determines if the player should be muted when instantiated
77
 * @property {string} licenseKey - authentication key required for commercial players. Optional for free players.
78
 * @property {playerVendorParams} params
79
 */
80

81
/**
82
 * @typedef playerVendorParams
83
 * @name playerVendorParams
84
 * @summary configuration options specific to a Video Vendor's Provider
85
 * @property {Object} vendorConfig - the settings object which can be used as an argument when instantiating a player. Specific to the video player's API.
86
 */
87

88
/**
89
 * @typedef videoEvent
90
 *
91
 */
92

93
/**
94
 * Routes commands to the appropriate video submodule.
95
 * @typedef {Object} VideoCore
96
 * @class
97
 * @function registerProvider
98
 * @function getOrtbVideo
99
 * @function getOrtbContent
100
 * @function setAdTagUrl
101
 * @function onEvents
102
 * @function offEvents
103
 */
104

105
/**
106
 * @summary Maps a Video Provider factory to the video player's vendor code.
107
 */
108
const videoVendorDirectory = {};
1✔
109

110
/**
111
 * @class
112
 * @param {ParentModule} parentModule_
113
 * @returns {VideoCore}
114
 */
115
export function VideoCore(parentModule_) {
116
  const parentModule = parentModule_;
2✔
117

118
  /**
119
   * requests that a submodule be instantiated for the specific player instance described by the @providerConfig
120
   * @name VideoCore#registerProvider
121
   * @param {videoProviderConfig} providerConfig
122
   */
123
  function registerProvider(providerConfig) {
124
    try {
2✔
125
      parentModule.registerSubmodule(providerConfig.divId, providerConfig.vendorCode, providerConfig);
2✔
126
    } catch (e) {}
127
  }
128

129
  function initProvider(divId) {
130
    const submodule = parentModule.getSubmodule(divId);
×
131
    submodule && submodule.init && submodule.init();
×
132
  }
133

134
  /**
135
   * @name VideoCore#getOrtbVideo
136
   * @summary Obtains the oRTB Video params for a player's current video session.
137
   * @param {string} divId - unique identifier of the player instance
138
   * @returns {Object} oRTB Video params
139
   */
140
  function getOrtbVideo(divId) {
141
    const submodule = parentModule.getSubmodule(divId);
2✔
142
    return submodule && submodule.getOrtbVideo();
2✔
143
  }
144

145
  /**
146
   * @name VideoCore#getOrtbContent
147
   * @summary Obtains the oRTB Content params for a player's current video session.
148
   * @param {string} divId - unique identifier of the player instance
149
   * @returns {Object} oRTB Content params
150
   */
151
  function getOrtbContent(divId) {
152
    const submodule = parentModule.getSubmodule(divId);
2✔
153
    return submodule && submodule.getOrtbContent();
2✔
154
  }
155

156
  /**
157
   * @name VideoCore#setAdTagUrl
158
   * @summary Requests that a player render the ad in the provided ad tag
159
   * @param {string} adTagUrl - URL to a VAST ad tag
160
   * @param {string} divId - unique identifier of the player instance
161
   * @param {Object} options - additional params
162
   */
163
  function setAdTagUrl(adTagUrl, divId, options) {
164
    const submodule = parentModule.getSubmodule(divId);
2✔
165
    submodule && submodule.setAdTagUrl(adTagUrl, options);
2✔
166
  }
167

168
  /**
169
   * @name VideoCore#setAdXml
170
   * @summary Requests that a player render the ad in the provided ad tag
171
   * @param {string} vastXml - VAST content in xml format
172
   * @param {string} divId - unique identifier of the player instance
173
   * @param {Object} options - additional params
174
   */
175
  function setAdXml(vastXml, divId, options) {
176
    const submodule = parentModule.getSubmodule(divId);
×
177
    submodule && submodule.setAdXml(vastXml, options);
×
178
  }
179

180
  /**
181
   * @name VideoCore#onEvents
182
   * @summary attaches event listeners
183
   * @param {[string]} events - List of event names for which the listener should be added
184
   * @param {function} callback - function that will get called when one of the events is triggered
185
   * @param {string} divId - unique identifier of the player instance
186
   */
187
  function onEvents(events, callback, divId) {
188
    if (!callback) {
2!
189
      return;
×
190
    }
191

192
    const submodule = parentModule.getSubmodule(divId);
2✔
193
    if (!submodule) {
2!
194
      return;
×
195
    }
196

197
    for (let i = 0; i < events.length; i++) {
2✔
198
      const type = events[i];
2✔
199
      const basePayload = {
2✔
200
        divId,
201
        type
202
      };
203
      submodule.onEvent(type, callback, basePayload);
2✔
204
    }
205
  }
206

207
  /**
208
   * @name VideoCore#offEvents
209
   * @summary removes event listeners
210
   * @param {[string]} events - List of event names for which the listener should be removed
211
   * @param {function} callback - function that was assigned as a callback when the listener was added
212
   * @param {string} divId - unique identifier of the player instance
213
   */
214
  function offEvents(events, callback, divId) {
215
    const submodule = parentModule.getSubmodule(divId);
2✔
216
    if (!submodule) {
2!
217
      return;
×
218
    }
219

220
    events.forEach(event => {
2✔
221
      submodule.offEvent(event, callback);
2✔
222
    });
223
  }
224

225
  return {
2✔
226
    registerProvider,
227
    initProvider,
228
    getOrtbVideo,
229
    getOrtbContent,
230
    setAdTagUrl,
231
    setAdXml,
232
    onEvents,
233
    offEvents,
234
    hasProviderFor(divId) {
235
      return !!parentModule.getSubmodule(divId);
×
236
    }
237
  };
238
}
239

240
/**
241
 * @function videoCoreFactory
242
 * @summary Factory to create a Video Core instance
243
 * @returns {VideoCore}
244
 */
245
export function videoCoreFactory() {
246
  const videoSubmoduleBuilder = SubmoduleBuilder(videoVendorDirectory);
1✔
247
  const parentModule = ParentModule(videoSubmoduleBuilder);
1✔
248
  return VideoCore(parentModule);
1✔
249
}
250

251
function attachVideoProvider(submoduleFactory) {
UNCOV
252
  videoVendorDirectory[submoduleFactory.vendorCode] = submoduleFactory;
×
253
}
254

255
module('video', attachVideoProvider);
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc