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

prebid / Prebid.js / 19437775255

17 Nov 2025 05:00PM UTC coverage: 96.213% (-0.02%) from 96.231%
19437775255

push

github

web-flow
sevioBidAdapter_bugfix: Send all sizes instead of just maxSize (#14133)

* Send all sizes instead of just maxSize

* Added tests to cover modifs in the sizes that we are sending

53222 of 65234 branches covered (81.59%)

10 of 10 new or added lines in 2 files covered. (100.0%)

304 existing lines in 58 files now uncovered.

202715 of 210693 relevant lines covered (96.21%)

71.77 hits per line

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

62.71
/modules/hadronIdSystem.js
1
/**
1✔
2
 * This module adds HadronID to the User ID module
3
 * The {@link module:modules/userId} module is required
4
 * @module modules/hadronIdSystem
5
 * @requires module:modules/userId
6
 */
7

8
import {ajax} from '../src/ajax.js';
9
import {getStorageManager} from '../src/storageManager.js';
10
import {submodule} from '../src/hook.js';
11
import {isFn, isStr, isPlainObject, logError, logInfo} from '../src/utils.js';
12
import { config } from '../src/config.js';
13
import {MODULE_TYPE_UID} from '../src/activities/modules.js';
14
import { gdprDataHandler, uspDataHandler, gppDataHandler } from '../src/adapterManager.js';
15

16
/**
17
 * @typedef {import('../modules/userId/index.js').Submodule} Submodule
18
 * @typedef {import('../modules/userId/index.js').SubmoduleConfig} SubmoduleConfig
19
 * @typedef {import('../modules/userId/index.js').IdResponse} IdResponse
20
 */
21

22
export const MODULE_NAME = 'hadronId';
1✔
23
const LOG_PREFIX = `[${MODULE_NAME}System]`;
1✔
24
export const LS_TAM_KEY = 'auHadronId';
1✔
25
const AU_GVLID = 561;
1✔
26
const DEFAULT_HADRON_URL_ENDPOINT = 'https://id.hadron.ad.gt/api/v1/pbhid';
1✔
27

28
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: MODULE_NAME});
1✔
29

30
/**
31
 * Param or default.
32
 * @param {String|function} param
33
 * @param {String} defaultVal
34
 * @param arg
35
 */
36
function paramOrDefault(param, defaultVal, arg) {
37
  if (isFn(param)) {
1!
38
    return param(arg);
×
39
  } else if (isStr(param)) {
1✔
40
    return param;
1✔
41
  }
42
  return defaultVal;
×
43
}
44

45
/**
46
 * @param {string} url
47
 * @param {string} params
48
 * @returns {string}
49
 */
50
const urlAddParams = (url, params) => {
1✔
51
  return url + (url.indexOf('?') > -1 ? '&' : '?') + params
1!
52
}
53

54
const isDebug = config.getConfig('debug') || false;
1✔
55

56
/** @type {Submodule} */
57
export const hadronIdSubmodule = {
1✔
58
  /**
59
   * used to link submodule with config
60
   * @type {string}
61
   */
62
  name: MODULE_NAME,
63
  gvlid: AU_GVLID,
64
  /**
65
   * decode the stored id value for passing to bid requests
66
   * @function
67
   * @param {string} value
68
   * @returns {Object}
69
   */
70
  decode(value) {
71
    return {
×
72
      hadronId: isStr(value) ? value : value.hasOwnProperty('id') ? value.id[MODULE_NAME] : value[MODULE_NAME]
×
73
    }
74
  },
75
  /**
76
   * performs action to obtain id and return a value in the callback's response argument
77
   * @function
78
   * @param {SubmoduleConfig} [config]
79
   * @returns {IdResponse|undefined}
80
   */
81
  getId(config) {
82
    logInfo(LOG_PREFIX, `getId is called`, config);
2✔
83
    if (!isPlainObject(config.params)) {
2!
84
      config.params = {};
×
85
    }
86
    let hadronId = '';
2✔
87
    // at this point hadronId was not found by prebid, let check if it is in the webpage by other ways
88
    hadronId = storage.getDataFromLocalStorage(LS_TAM_KEY);
2✔
89
    if (isStr(hadronId) && hadronId.length > 0) {
2✔
90
      logInfo(LOG_PREFIX, `${LS_TAM_KEY} found in localStorage = ${hadronId}`)
1✔
91
      // return {callback: function(cb) { cb(hadronId) }};
92
      return {id: hadronId}
1✔
93
    }
94
    const partnerId = config.params.partnerId | 0;
1✔
95
    const resp = function (callback) {
1✔
96
      let responseObj = {};
1✔
97
      const callbacks = {
1✔
98
        success: response => {
99
          if (response) {
×
100
            try {
×
101
              responseObj = JSON.parse(response);
×
102
            } catch (error) {
103
              logError(error);
×
104
              callback();
×
105
            }
106
            logInfo(LOG_PREFIX, `Response from backend is ${response}`, responseObj);
×
107
            if (isPlainObject(responseObj) && responseObj.hasOwnProperty(MODULE_NAME)) {
×
108
              hadronId = responseObj[MODULE_NAME];
×
109
            }
110
            responseObj = hadronId; // {id: {hadronId: hadronId}};
×
111
          }
112
          callback(responseObj);
×
113
        },
114
        error: error => {
115
          logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
×
116
          callback();
×
117
        }
118
      };
119
      let url = urlAddParams(
1✔
120
        // config.params.url and config.params.urlArg are not documented
121
        // since their use is for debugging purposes only
122
        paramOrDefault(config.params.url, DEFAULT_HADRON_URL_ENDPOINT, config.params.urlArg),
123
        `partner_id=${partnerId}&_it=prebid&t=1&src=id&domain=${document.location.hostname}` // src=id => the backend was called from getId
124
      );
125
      if (isDebug) {
1!
UNCOV
126
        url += '&debug=1'
×
127
      }
128
      const gdprConsent = gdprDataHandler.getConsentData()
1✔
129
      if (gdprConsent) {
1!
130
        url += `${gdprConsent.consentString ? '&gdprString=' + encodeURIComponent(gdprConsent.consentString) : ''}`;
×
131
        url += `&gdpr=${gdprConsent.gdprApplies === true ? 1 : 0}`;
×
132
      }
133

134
      const usPrivacyString = uspDataHandler.getConsentData();
1✔
135
      if (usPrivacyString) {
1!
136
        url += `&us_privacy=${encodeURIComponent(usPrivacyString)}`;
×
137
      }
138

139
      const gppConsent = gppDataHandler.getConsentData();
1✔
140
      if (gppConsent) {
1!
141
        url += `${gppConsent.gppString ? '&gpp=' + encodeURIComponent(gppConsent.gppString) : ''}`;
×
142
        url += `${gppConsent.applicableSections ? '&gpp_sid=' + encodeURIComponent(gppConsent.applicableSections) : ''}`;
×
143
      }
144

145
      logInfo(LOG_PREFIX, `${MODULE_NAME} not found, calling home (${url})`);
1✔
146

147
      ajax(url, callbacks, undefined, {method: 'GET'});
1✔
148
    };
149
    return {callback: resp};
1✔
150
  },
151
  eids: {
152
    'hadronId': {
153
      source: 'audigent.com',
154
      atype: 1
155
    },
156
  }
157
};
158

159
submodule('userId', hadronIdSubmodule);
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