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

prebid / Prebid.js / 18136225893

30 Sep 2025 04:07PM UTC coverage: 96.245% (+0.006%) from 96.239%
18136225893

push

github

web-flow
Advertising Bid Adapter: Update the regex while parsing bid.impid to support the change to UUID format for bid ids (#13879)

51890 of 63472 branches covered (81.75%)

1 of 1 new or added line in 1 file covered. (100.0%)

70 existing lines in 12 files now uncovered.

198517 of 206262 relevant lines covered (96.25%)

125.12 hits per line

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

97.67
/modules/utiqMtpIdSystem.js
1
/**
1✔
2
 * This module adds Utiq MTP provided by Utiq SA/NV to the User ID module
3
 * The {@link module:modules/userId} module is required
4
 * @module modules/utiqMtpIdSystem
5
 * @requires module:modules/userId
6
 */
7
import { logInfo } from '../src/utils.js';
8
import { submodule } from '../src/hook.js';
9
import { getStorageManager } from '../src/storageManager.js';
10
import { MODULE_TYPE_UID } from '../src/activities/modules.js';
11
import { findUtiqService } from "../libraries/utiqUtils/utiqUtils.ts";
12
import { getGlobal } from '../src/prebidGlobal.js';
13

14
/**
15
 * @typedef {import('../modules/userId/index.js').Submodule} Submodule
16
 */
17

18
const MODULE_NAME = 'utiqMtpId';
1✔
19
const LOG_PREFIX = 'Utiq MTP module';
1✔
20

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

26
/**
27
 * Get the "mtid" from html5 local storage to make it available to the UserId module.
28
 * @returns {{utiqMtp: (*|string)}}
29
 */
30
function getUtiqFromStorage() {
31
  let utiqPass;
32
  const utiqPassStorage = JSON.parse(
28✔
33
    storage.getDataFromLocalStorage('utiqPass')
34
  );
35
  logInfo(
28✔
36
    `${LOG_PREFIX}: Local storage utiqPass: ${JSON.stringify(
37
      utiqPassStorage
38
    )}`
39
  );
40

41
  if (
28✔
42
    utiqPassStorage &&
67✔
43
    utiqPassStorage.connectId &&
44
    Array.isArray(utiqPassStorage.connectId.idGraph) &&
45
    utiqPassStorage.connectId.idGraph.length > 0
46
  ) {
47
    utiqPass = utiqPassStorage.connectId.idGraph[0];
13✔
48
  }
49
  logInfo(
28✔
50
    `${LOG_PREFIX}: Graph of utiqPass: ${JSON.stringify(
51
      utiqPass
52
    )}`
53
  );
54

55
  return {
28✔
56
    utiqMtp:
57
      utiqPass && utiqPass.mtid
69✔
58
        ? utiqPass.mtid
59
        : null,
60
  };
61
}
62

63
/** @type {Submodule} */
64
export const utiqMtpIdSubmodule = {
1✔
65
  /**
66
   * Used to link submodule with config
67
   * @type {string}
68
   */
69
  name: MODULE_NAME,
70
  disclosureURL: 'local://modules/utiqDeviceStorageDisclosure.json',
71
  /**
72
   * Decodes the stored id value for passing to bid requests.
73
   * @function
74
   * @returns {{utiqMtp: string} | null}
75
   */
76
  decode(bidId) {
77
    logInfo(`${LOG_PREFIX}: Decoded ID value ${JSON.stringify(bidId)}`);
5✔
78
    return bidId.utiqMtp ? bidId : null;
5✔
79
  },
80
  /**
81
   * Get the id from helper function and initiate a new user sync.
82
   * @param config
83
   * @returns {{callback: Function}|{id: {utiqMtp: string}}}
84
   */
85
  getId: function (config) {
86
    const data = getUtiqFromStorage();
10✔
87
    if (data.utiqMtp) {
10✔
88
      logInfo(`${LOG_PREFIX}: Local storage ID value ${JSON.stringify(data)}`);
4✔
89
      return { id: { utiqMtp: data.utiqMtp } };
4✔
90
    } else {
91
      if (!config) {
6✔
92
        config = {};
5✔
93
      }
94
      if (!config.params) {
6✔
95
        config.params = {};
5✔
96
      }
97
      if (
6✔
98
        typeof config.params.maxDelayTime === 'undefined' ||
7✔
99
        config.params.maxDelayTime === null
100
      ) {
101
        config.params.maxDelayTime = 1000;
5✔
102
      }
103
      // Current delay and delay step in milliseconds
104
      let currentDelay = 0;
6✔
105
      const delayStep = 50;
6✔
106
      const result = (callback) => {
6✔
107
        const data = getUtiqFromStorage();
18✔
108
        if (!data.utiqMtp) {
18✔
109
          if (currentDelay > config.params.maxDelayTime) {
16✔
110
            logInfo(
1✔
111
              `${LOG_PREFIX}: No utiq value set after ${config.params.maxDelayTime} max allowed delay time`
112
            );
113
            callback(null);
1✔
114
          } else {
115
            currentDelay += delayStep;
15✔
116
            setTimeout(() => {
15✔
117
              result(callback);
15✔
118
            }, delayStep);
119
          }
120
        } else {
121
          const dataToReturn = { utiqMtp: data.utiqMtp };
2✔
122
          logInfo(
2✔
123
            `${LOG_PREFIX}: Returning ID value data of ${JSON.stringify(
124
              dataToReturn
125
            )}`
126
          );
127
          callback(dataToReturn);
2✔
128
        }
129
      };
130
      return { callback: result };
6✔
131
    }
132
  },
133
  eids: {
134
    'utiqMtp': {
135
      source: 'utiq-mtp.com',
136
      atype: 1,
137
      getValue: function (data) {
UNCOV
138
        return data;
×
139
      },
140
    },
141
  }
142
};
143

144
const pbjsGlobal = getGlobal();
1✔
145
const refreshUserIds = pbjsGlobal && typeof pbjsGlobal.refreshUserIds === 'function'
1!
146
  ? pbjsGlobal.refreshUserIds.bind(pbjsGlobal)
147
  : () => {};
148
findUtiqService(storage, refreshUserIds, LOG_PREFIX, MODULE_NAME);
1✔
149
submodule('userId', utiqMtpIdSubmodule);
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