• 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

81.48
/modules/permutiveIdentityManagerIdSystem.js
1
import {MODULE_TYPE_UID} from '../src/activities/modules.js'
1✔
2
import {submodule} from '../src/hook.js'
3
import {getStorageManager} from '../src/storageManager.js'
4
import {prefixLog, safeJSONParse} from '../src/utils.js'
5
/**
6
 * @typedef {import('../modules/userId/index.js').Submodule} Submodule
7
 * @typedef {import('../modules/userId/index.js').SubmoduleConfig} SubmoduleConfig
8
 * @typedef {import('../modules/userId/index.js').ConsentData} ConsentData
9
 * @typedef {import('../modules/userId/index.js').IdResponse} IdResponse
10
 */
11

12
const MODULE_NAME = 'permutiveIdentityManagerId'
1✔
13
const PERMUTIVE_GVLID = 361
1✔
14
const PERMUTIVE_ID_DATA_STORAGE_KEY = 'permutive-prebid-id'
1✔
15

16
const ID5_DOMAIN = 'id5-sync.com'
1✔
17
const LIVERAMP_DOMAIN = 'liveramp.com'
1✔
18
const UID_DOMAIN = 'uidapi.com'
1✔
19

20
const PRIMARY_IDS = ['id5id', 'idl_env', 'uid2']
1✔
21

22
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: MODULE_NAME})
1✔
23

24
const logger = prefixLog('[PermutiveID]')
1✔
25

26
const readFromSdkLocalStorage = () => {
1✔
27
  const data = safeJSONParse(storage.getDataFromLocalStorage(PERMUTIVE_ID_DATA_STORAGE_KEY))
3✔
28
  const id = {}
3✔
29
  if (data && typeof data === 'object' && 'providers' in data && typeof data.providers === 'object') {
3✔
30
    const now = Date.now()
1✔
31
    for (const [idName, value] of Object.entries(data.providers)) {
1✔
32
      if (PRIMARY_IDS.includes(idName) && value.userId) {
2✔
33
        if (!value.expiryTime || value.expiryTime > now) {
1!
34
          id[idName] = value.userId
1✔
35
        }
36
      }
37
    }
38
  }
39
  return id
3✔
40
}
41

42
/**
43
 * Catch and log errors
44
 * @param {function} fn - Function to safely evaluate
45
 */
46
function makeSafe (fn) {
47
  try {
2✔
48
    return fn()
2✔
49
  } catch (e) {
UNCOV
50
    logger.logError(e)
×
51
  }
52
}
53

54
const waitAndRetrieveFromSdk = (timeoutMs) =>
1✔
55
  new Promise(
1✔
56
    resolve => {
57
      const fallback = setTimeout(() => {
1✔
58
        logger.logInfo('timeout expired waiting for SDK - attempting read from local storage again')
×
UNCOV
59
        resolve(readFromSdkLocalStorage())
×
60
      }, timeoutMs)
61
      return window?.permutive?.ready(() => makeSafe(() => {
1!
62
        logger.logInfo('Permutive SDK is ready')
1✔
63
        const onReady = makeSafe(() => window.permutive.addons.identity_manager.prebid.onReady)
1✔
64
        if (typeof onReady === 'function') {
1!
65
          onReady((ids) => {
1✔
66
            logger.logInfo('Permutive SDK has provided ids')
1✔
67
            resolve(ids)
1✔
68
            clearTimeout(fallback)
1✔
69
          })
70
        } else {
UNCOV
71
          logger.logError('Permutive SDK initialised but identity manager prebid api not present')
×
72
        }
73
      }))
74
    }
75
  )
76

77
/** @type {Submodule} */
78
export const permutiveIdentityManagerIdSubmodule = {
1✔
79
  /**
80
   * used to link submodule with config
81
   * @type {string}
82
   */
83
  name: MODULE_NAME,
84
  gvlid: PERMUTIVE_GVLID,
85

86
  /**
87
   * decode the stored id value for passing to bid requests
88
   * @function decode
89
   * @param {(Object|string)} value
90
   * @param {SubmoduleConfig|undefined} config
91
   * @returns {(Object|undefined)}
92
   */
93
  decode(value, config) {
94
    return value
1✔
95
  },
96

97
  /**
98
   * performs action to obtain id and return a value in the callback's response argument
99
   * @function getId
100
   * @param {SubmoduleConfig} submoduleConfig
101
   * @param {ConsentData} consentData
102
   * @param {(Object|undefined)} cacheIdObj
103
   * @returns {IdResponse|undefined}
104
   */
105
  getId(submoduleConfig, consentData, cacheIdObj) {
106
    const id = readFromSdkLocalStorage()
3✔
107
    if (Object.entries(id).length > 0) {
3✔
108
      logger.logInfo('found id in sdk storage')
1✔
109
      return { id }
1✔
110
    } else if ('params' in submoduleConfig && submoduleConfig.params.ajaxTimeout) {
2✔
111
      logger.logInfo('failed to find id in sdk storage - waiting for sdk')
1✔
112
      // Is ajaxTimeout an appropriate timeout to use here?
113
      return { callback: (done) => waitAndRetrieveFromSdk(submoduleConfig.params.ajaxTimeout).then(done) }
1✔
114
    } else {
115
      logger.logInfo('failed to find id in sdk storage and no wait time specified')
1✔
116
    }
117
  },
118

119
  primaryIds: PRIMARY_IDS,
120

121
  eids: {
122
    'id5id': {
123
      getValue: function (data) {
UNCOV
124
        return data.uid
×
125
      },
126
      source: ID5_DOMAIN,
127
      atype: 1,
128
      getUidExt: function (data) {
UNCOV
129
        if (data.ext) {
×
UNCOV
130
          return data.ext
×
131
        }
132
      }
133
    },
134
    'idl_env': {
135
      source: LIVERAMP_DOMAIN,
136
      atype: 3,
137
    },
138
    'uid2': {
139
      source: UID_DOMAIN,
140
      atype: 3,
141
      getValue: function(data) {
UNCOV
142
        return data.id
×
143
      },
144
      getUidExt: function(data) {
UNCOV
145
        if (data.ext) {
×
UNCOV
146
          return data.ext
×
147
        }
148
      }
149
    }
150
  }
151
}
152

153
submodule('userId', permutiveIdentityManagerIdSubmodule)
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