prebid.js 9.1.0 → 9.3.0

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.
Files changed (362) hide show
  1. package/browsers.json +3 -3
  2. package/dist/33acrossAnalyticsAdapter.js +1 -1
  3. package/dist/33acrossBidAdapter.js +1 -1
  4. package/dist/33acrossIdSystem.js +1 -1
  5. package/dist/BTBidAdapter.js +1 -1
  6. package/dist/acuityadsBidAdapter.js +1 -1
  7. package/dist/adagioAnalyticsAdapter.js +1 -1
  8. package/dist/adagioBidAdapter.js +1 -1
  9. package/dist/adagioRtdProvider.js +1 -1
  10. package/dist/adagioUtils.js +1 -0
  11. package/dist/addefendBidAdapter.js +1 -1
  12. package/dist/adgenerationBidAdapter.js +1 -1
  13. package/dist/adlooxRtdProvider.js +1 -1
  14. package/dist/admanBidAdapter.js +1 -1
  15. package/dist/adnuntiusBidAdapter.js +1 -1
  16. package/dist/adpod.js +1 -1
  17. package/dist/adprimeBidAdapter.js +1 -1
  18. package/dist/adqueryBidAdapter.js +1 -1
  19. package/dist/adrelevantisBidAdapter.js +1 -1
  20. package/dist/adstirBidAdapter.js +1 -1
  21. package/dist/adtrgtmeBidAdapter.js +1 -1
  22. package/dist/adxcgAnalyticsAdapter.js +1 -1
  23. package/dist/adxcgBidAdapter.js +1 -1
  24. package/dist/adyoulikeBidAdapter.js +1 -1
  25. package/dist/agmaAnalyticsAdapter.js +1 -1
  26. package/dist/ajaBidAdapter.js +1 -1
  27. package/dist/amxBidAdapter.js +1 -1
  28. package/dist/amxIdSystem.js +1 -1
  29. package/dist/appierAnalyticsAdapter.js +1 -1
  30. package/dist/appnexusBidAdapter.js +1 -1
  31. package/dist/appnexusUtils.js +1 -1
  32. package/dist/asoBidAdapter.js +1 -1
  33. package/dist/autoplayDetection.js +1 -1
  34. package/dist/axisBidAdapter.js +1 -1
  35. package/dist/axonixBidAdapter.js +1 -1
  36. package/dist/beyondmediaBidAdapter.js +1 -1
  37. package/dist/bidglassBidAdapter.js +1 -1
  38. package/dist/big-richmediaBidAdapter.js +1 -1
  39. package/dist/bliinkBidAdapter.js +1 -1
  40. package/dist/boldwinBidAdapter.js +1 -1
  41. package/dist/bridBidAdapter.js +1 -1
  42. package/dist/bridgewellBidAdapter.js +1 -1
  43. package/dist/brightMountainMediaBidAdapter.js +1 -1
  44. package/dist/carodaBidAdapter.js +1 -1
  45. package/dist/chtnwBidAdapter.js +1 -1
  46. package/dist/chunk-core.js +1 -1
  47. package/dist/compassBidAdapter.js +1 -1
  48. package/dist/concertBidAdapter.js +1 -1
  49. package/dist/connectadBidAdapter.js +1 -1
  50. package/dist/consentManagement.js +1 -0
  51. package/dist/consentManagementGpp.js +1 -1
  52. package/dist/consentManagementTcf.js +1 -1
  53. package/dist/consumableBidAdapter.js +1 -1
  54. package/dist/contentexchangeBidAdapter.js +1 -1
  55. package/dist/conversantAnalyticsAdapter.js +1 -1
  56. package/dist/conversantBidAdapter.js +1 -1
  57. package/dist/copper6sspBidAdapter.js +1 -0
  58. package/dist/craftBidAdapter.js +1 -1
  59. package/dist/criteoBidAdapter.js +1 -1
  60. package/dist/cwireBidAdapter.js +1 -1
  61. package/dist/dailymotionBidAdapter.js +1 -1
  62. package/dist/dependencies.json +96 -6
  63. package/dist/dspxBidAdapter.js +1 -1
  64. package/dist/dxkultureBidAdapter.js +1 -1
  65. package/dist/e_volutionBidAdapter.js +1 -1
  66. package/dist/emtvBidAdapter.js +1 -1
  67. package/dist/eplanningBidAdapter.js +1 -1
  68. package/dist/euidIdSystem.js +1 -1
  69. package/dist/exadsBidAdapter.js +1 -1
  70. package/dist/feedadBidAdapter.js +1 -1
  71. package/dist/finativeBidAdapter.js +1 -1
  72. package/dist/freewheel-sspBidAdapter.js +1 -1
  73. package/dist/globalsunBidAdapter.js +1 -1
  74. package/dist/gmosspBidAdapter.js +1 -1
  75. package/dist/goldbachBidAdapter.js +1 -1
  76. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  77. package/dist/greenbidsRtdProvider.js +1 -1
  78. package/dist/gridBidAdapter.js +1 -1
  79. package/dist/gumgumBidAdapter.js +1 -1
  80. package/dist/h12mediaBidAdapter.js +1 -1
  81. package/dist/hypelabBidAdapter.js +1 -1
  82. package/dist/id5AnalyticsAdapter.js +1 -1
  83. package/dist/id5IdSystem.js +1 -1
  84. package/dist/illuminBidAdapter.js +1 -1
  85. package/dist/imdsBidAdapter.js +1 -1
  86. package/dist/improvedigitalBidAdapter.js +1 -1
  87. package/dist/insticatorBidAdapter.js +1 -1
  88. package/dist/intentIqIdSystem.js +1 -1
  89. package/dist/iqzoneBidAdapter.js +1 -1
  90. package/dist/ixBidAdapter.js +1 -1
  91. package/dist/jixieBidAdapter.js +1 -1
  92. package/dist/justpremiumBidAdapter.js +1 -1
  93. package/dist/kargoBidAdapter.js +1 -1
  94. package/dist/kimberliteBidAdapter.js +1 -1
  95. package/dist/kiviadsBidAdapter.js +1 -1
  96. package/dist/konduitAnalyticsAdapter.js +1 -1
  97. package/dist/krushmediaBidAdapter.js +1 -1
  98. package/dist/kueezBidAdapter.js +1 -1
  99. package/dist/kueezRtbBidAdapter.js +1 -1
  100. package/dist/lassoBidAdapter.js +1 -1
  101. package/dist/lifestreetBidAdapter.js +1 -1
  102. package/dist/liveIntentIdSystem.js +1 -1
  103. package/dist/logicadBidAdapter.js +1 -1
  104. package/dist/loglyliftBidAdapter.js +1 -1
  105. package/dist/loyalBidAdapter.js +1 -1
  106. package/dist/luceadBidAdapter.js +1 -1
  107. package/dist/lunamediahbBidAdapter.js +1 -1
  108. package/dist/mabidderBidAdapter.js +1 -1
  109. package/dist/magniteAnalyticsAdapter.js +1 -1
  110. package/dist/malltvAnalyticsAdapter.js +1 -1
  111. package/dist/marsmediaBidAdapter.js +1 -1
  112. package/dist/mathildeadsBidAdapter.js +1 -1
  113. package/dist/mediafuseBidAdapter.js +1 -1
  114. package/dist/medianetAnalyticsAdapter.js +1 -1
  115. package/dist/medianetBidAdapter.js +1 -1
  116. package/dist/mediasquareBidAdapter.js +1 -1
  117. package/dist/mgidBidAdapter.js +1 -1
  118. package/dist/mgidXBidAdapter.js +1 -1
  119. package/dist/minutemediaBidAdapter.js +1 -1
  120. package/dist/missenaBidAdapter.js +1 -1
  121. package/dist/mobfoxpbBidAdapter.js +1 -1
  122. package/dist/mobianRtdProvider.js +1 -1
  123. package/dist/nexx360BidAdapter.js +1 -1
  124. package/dist/nobidAnalyticsAdapter.js +1 -1
  125. package/dist/nobidBidAdapter.js +1 -1
  126. package/dist/not-for-prod/prebid.js +211 -204
  127. package/dist/oguryBidAdapter.js +1 -1
  128. package/dist/onetagBidAdapter.js +1 -1
  129. package/dist/ooloAnalyticsAdapter.js +1 -1
  130. package/dist/openwebBidAdapter.js +1 -1
  131. package/dist/openxBidAdapter.js +1 -1
  132. package/dist/optidigitalBidAdapter.js +1 -1
  133. package/dist/orakiBidAdapter.js +1 -0
  134. package/dist/orbidderBidAdapter.js +1 -1
  135. package/dist/ortbConverter.js +1 -1
  136. package/dist/outbrainBidAdapter.js +1 -1
  137. package/dist/ozoneBidAdapter.js +1 -1
  138. package/dist/paapi.js +1 -1
  139. package/dist/pairIdSystem.js +1 -1
  140. package/dist/pgamsspBidAdapter.js +1 -1
  141. package/dist/pixfutureBidAdapter.js +1 -1
  142. package/dist/playdigoBidAdapter.js +1 -1
  143. package/dist/prebidServerBidAdapter.js +1 -1
  144. package/dist/pubCircleBidAdapter.js +1 -1
  145. package/dist/publinkIdSystem.js +1 -1
  146. package/dist/publirBidAdapter.js +1 -1
  147. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  148. package/dist/pubmaticBidAdapter.js +1 -1
  149. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  150. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  151. package/dist/pxyzBidAdapter.js +1 -1
  152. package/dist/qtBidAdapter.js +1 -1
  153. package/dist/quantcastBidAdapter.js +1 -1
  154. package/dist/raynRtdProvider.js +1 -1
  155. package/dist/readpeakBidAdapter.js +1 -1
  156. package/dist/relaidoBidAdapter.js +1 -1
  157. package/dist/retailspotBidAdapter.js +1 -1
  158. package/dist/rhythmoneBidAdapter.js +1 -1
  159. package/dist/riseBidAdapter.js +1 -1
  160. package/dist/rubiconBidAdapter.js +1 -1
  161. package/dist/seedingAllianceBidAdapter.js +1 -1
  162. package/dist/seedtagBidAdapter.js +1 -1
  163. package/dist/setupadBidAdapter.js +1 -1
  164. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  165. package/dist/sharethroughBidAdapter.js +1 -1
  166. package/dist/shinezBidAdapter.js +1 -1
  167. package/dist/shinezRtbBidAdapter.js +1 -1
  168. package/dist/smaatoBidAdapter.js +1 -1
  169. package/dist/smartadserverBidAdapter.js +1 -1
  170. package/dist/smartxBidAdapter.js +1 -1
  171. package/dist/smartyadsBidAdapter.js +1 -1
  172. package/dist/smartyadsUtils.js +1 -0
  173. package/dist/smartytechBidAdapter.js +1 -1
  174. package/dist/smilewantedBidAdapter.js +1 -1
  175. package/dist/snigelBidAdapter.js +1 -1
  176. package/dist/sonobiBidAdapter.js +1 -1
  177. package/dist/sovrnBidAdapter.js +1 -1
  178. package/dist/sspBCBidAdapter.js +1 -1
  179. package/dist/stnBidAdapter.js +1 -1
  180. package/dist/stvBidAdapter.js +1 -1
  181. package/dist/sublimeBidAdapter.js +1 -1
  182. package/dist/taboolaBidAdapter.js +1 -1
  183. package/dist/tagorasBidAdapter.js +1 -1
  184. package/dist/tappxBidAdapter.js +1 -1
  185. package/dist/targetVideoBidAdapter.js +1 -1
  186. package/dist/teadsBidAdapter.js +1 -1
  187. package/dist/teqblazeUtils.js +1 -0
  188. package/dist/terceptAnalyticsAdapter.js +1 -1
  189. package/dist/themoneytizerBidAdapter.js +1 -1
  190. package/dist/topicsFpdModule.js +1 -1
  191. package/dist/trionBidAdapter.js +1 -1
  192. package/dist/tripleliftBidAdapter.js +1 -1
  193. package/dist/ttdBidAdapter.js +1 -1
  194. package/dist/twistDigitalBidAdapter.js +1 -1
  195. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  196. package/dist/uid2IdSystem.js +1 -1
  197. package/dist/underdogmediaBidAdapter.js +1 -1
  198. package/dist/undertoneBidAdapter.js +1 -1
  199. package/dist/unrulyBidAdapter.js +1 -1
  200. package/dist/userId.js +1 -1
  201. package/dist/vidazooBidAdapter.js +1 -1
  202. package/dist/vidazooUtils.js +1 -0
  203. package/dist/videobyteBidAdapter.js +1 -1
  204. package/dist/visiblemeasuresBidAdapter.js +1 -1
  205. package/dist/visxBidAdapter.js +1 -1
  206. package/dist/vuukleBidAdapter.js +1 -1
  207. package/dist/widespaceBidAdapter.js +1 -1
  208. package/dist/winrBidAdapter.js +1 -1
  209. package/dist/yahooAdsBidAdapter.js +1 -1
  210. package/dist/yieldmoBidAdapter.js +1 -1
  211. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  212. package/dist/yuktamediaAnalyticsAdapter.js +1 -1
  213. package/integrationExamples/gpt/raynRtdProvider_example.html +1 -0
  214. package/libraries/adagioUtils/adagioUtils.js +35 -0
  215. package/libraries/appnexusUtils/anUtils.js +1 -0
  216. package/libraries/autoplayDetection/autoplay.js +8 -1
  217. package/libraries/consentManagement/cmUtils.js +38 -0
  218. package/libraries/ortbConverter/converter.js +1 -1
  219. package/libraries/smartyadsUtils/getAdUrlByRegion.js +32 -0
  220. package/libraries/teqblazeUtils/bidderUtils.js +253 -0
  221. package/libraries/vidazooUtils/bidderUtils.js +481 -0
  222. package/libraries/vidazooUtils/constants.js +7 -0
  223. package/modules/.submodules.json +1 -0
  224. package/modules/acuityadsBidAdapter.js +5 -203
  225. package/modules/adagioBidAdapter.js +1 -17
  226. package/modules/adagioRtdProvider.js +41 -51
  227. package/modules/adagioRtdProvider.md +1 -0
  228. package/modules/addefendBidAdapter.js +1 -2
  229. package/modules/adlooxRtdProvider.js +1 -1
  230. package/modules/admanBidAdapter.js +31 -188
  231. package/modules/adnuntiusBidAdapter.js +1 -0
  232. package/modules/adprimeBidAdapter.js +28 -165
  233. package/modules/adxcgAnalyticsAdapter.js +1 -2
  234. package/modules/axisBidAdapter.js +33 -165
  235. package/modules/beyondmediaBidAdapter.js +5 -189
  236. package/modules/bliinkBidAdapter.js +3 -31
  237. package/modules/boldwinBidAdapter.js +21 -159
  238. package/modules/ceeIdSystem.js +1 -1
  239. package/modules/compassBidAdapter.js +5 -198
  240. package/modules/consentManagementGpp.js +2 -38
  241. package/modules/consentManagementTcf.js +7 -38
  242. package/modules/contentexchangeBidAdapter.js +5 -200
  243. package/modules/conversantAnalyticsAdapter.js +1 -2
  244. package/modules/conversantBidAdapter.js +1 -0
  245. package/modules/copper6sspBidAdapter.js +19 -0
  246. package/modules/copper6sspBidAdapter.md +79 -0
  247. package/modules/criteoBidAdapter.js +10 -3
  248. package/modules/e_volutionBidAdapter.js +4 -186
  249. package/modules/emtvBidAdapter.js +5 -198
  250. package/modules/globalsunBidAdapter.js +5 -199
  251. package/modules/id5AnalyticsAdapter.js +1 -2
  252. package/modules/id5IdSystem.js +31 -2
  253. package/modules/id5IdSystem.md +67 -2
  254. package/modules/intentIqIdSystem.js +408 -50
  255. package/modules/intentIqIdSystem.md +92 -0
  256. package/modules/iqzoneBidAdapter.js +5 -224
  257. package/modules/kiviadsBidAdapter.js +5 -199
  258. package/modules/krushmediaBidAdapter.js +25 -143
  259. package/modules/liveIntentIdSystem.js +2 -2
  260. package/modules/loyalBidAdapter.js +4 -178
  261. package/modules/lunamediahbBidAdapter.js +5 -118
  262. package/modules/mabidderBidAdapter.js +1 -2
  263. package/modules/mathildeadsBidAdapter.js +5 -198
  264. package/modules/medianetAnalyticsAdapter.js +1 -2
  265. package/modules/medianetBidAdapter.js +1 -1
  266. package/modules/mgidXBidAdapter.js +14 -207
  267. package/modules/mobfoxpbBidAdapter.js +4 -135
  268. package/modules/mobianRtdProvider.js +2 -2
  269. package/modules/nobidAnalyticsAdapter.js +2 -3
  270. package/modules/orakiBidAdapter.js +19 -0
  271. package/modules/orakiBidAdapter.md +79 -0
  272. package/modules/orbidderBidAdapter.js +4 -2
  273. package/modules/ozoneBidAdapter.js +117 -58
  274. package/modules/paapi.js +2 -1
  275. package/modules/pairIdSystem.js +27 -10
  276. package/modules/pgamsspBidAdapter.js +5 -240
  277. package/modules/pixfutureBidAdapter.js +1 -2
  278. package/modules/playdigoBidAdapter.js +4 -186
  279. package/modules/prebidServerBidAdapter/index.js +10 -3
  280. package/modules/pubCircleBidAdapter.js +5 -218
  281. package/modules/pubmaticAnalyticsAdapter.js +21 -8
  282. package/modules/pubxaiAnalyticsAdapter.js +1 -5
  283. package/modules/qtBidAdapter.js +5 -224
  284. package/modules/raynRtdProvider.js +36 -3
  285. package/modules/seedtagBidAdapter.js +5 -0
  286. package/modules/setupadBidAdapter.js +58 -140
  287. package/modules/smartadserverBidAdapter.js +3 -0
  288. package/modules/smartyadsBidAdapter.js +6 -110
  289. package/modules/smartytechBidAdapter.js +7 -2
  290. package/modules/snigelBidAdapter.js +1 -2
  291. package/modules/tappxBidAdapter.js +1 -2
  292. package/modules/terceptAnalyticsAdapter.js +1 -2
  293. package/modules/topicsFpdModule.js +1 -1
  294. package/modules/twistDigitalBidAdapter.js +1 -12
  295. package/modules/uid2IdSystem.js +0 -1
  296. package/modules/uid2IdSystem_shared.js +0 -1
  297. package/modules/userId/index.js +31 -21
  298. package/modules/vidazooBidAdapter.js +26 -468
  299. package/modules/visiblemeasuresBidAdapter.js +5 -199
  300. package/modules/yahooAdsBidAdapter.js +4 -1
  301. package/modules/yuktamediaAnalyticsAdapter.js +1 -2
  302. package/package.json +1 -1
  303. package/src/auction.js +5 -63
  304. package/src/utils/focusTimeout.js +41 -0
  305. package/src/utils/ttlCollection.js +2 -1
  306. package/src/utils.js +42 -0
  307. package/src/videoCache.js +72 -0
  308. package/test/mocks/videoCacheStub.js +1 -1
  309. package/test/spec/auctionmanager_spec.js +16 -1
  310. package/test/spec/fpd/gdpr_spec.js +24 -2
  311. package/test/spec/libraries/teqblazeUtils/bidderUtils_spec.js +519 -0
  312. package/test/spec/modules/acuityadsBidAdapter_spec.js +79 -43
  313. package/test/spec/modules/adagioRtdProvider_spec.js +62 -1
  314. package/test/spec/modules/admanBidAdapter_spec.js +370 -247
  315. package/test/spec/modules/adnuntiusBidAdapter_spec.js +6 -3
  316. package/test/spec/modules/adprimeBidAdapter_spec.js +225 -78
  317. package/test/spec/modules/axisBidAdapter_spec.js +78 -14
  318. package/test/spec/modules/beyondmediaBidAdapter_spec.js +80 -18
  319. package/test/spec/modules/bliinkBidAdapter_spec.js +8 -2
  320. package/test/spec/modules/boldwinBidAdapter_spec.js +221 -75
  321. package/test/spec/modules/compassBidAdapter_spec.js +130 -16
  322. package/test/spec/modules/contentexchangeBidAdapter_spec.js +134 -21
  323. package/test/spec/modules/conversantAnalyticsAdapter_spec.js +1 -1
  324. package/test/spec/modules/conversantBidAdapter_spec.js +7 -0
  325. package/test/spec/modules/copper6sspBidAdapter_spec.js +514 -0
  326. package/test/spec/modules/e_volutionBidAdapter_spec.js +65 -3
  327. package/test/spec/modules/emtvBidAdapter_spec.js +131 -16
  328. package/test/spec/modules/globalsunBidAdapter_spec.js +130 -16
  329. package/test/spec/modules/id5IdSystem_spec.js +79 -3
  330. package/test/spec/modules/intentIqIdSystem_spec.js +264 -36
  331. package/test/spec/modules/iqzoneBidAdapter_spec.js +66 -12
  332. package/test/spec/modules/kiviadsBidAdapter_spec.js +131 -20
  333. package/test/spec/modules/krushmediaBidAdapter_spec.js +272 -90
  334. package/test/spec/modules/loyalBidAdapter_spec.js +114 -14
  335. package/test/spec/modules/lunamediahbBidAdapter_spec.js +221 -87
  336. package/test/spec/modules/mathildeadsBidAdapter_spec.js +87 -18
  337. package/test/spec/modules/mgidXBidAdapter_spec.js +11 -3
  338. package/test/spec/modules/mobfoxpbBidAdapter_spec.js +229 -91
  339. package/test/spec/modules/orakiBidAdapter_spec.js +510 -0
  340. package/test/spec/modules/ozoneBidAdapter_spec.js +192 -22
  341. package/test/spec/modules/paapi_spec.js +5 -5
  342. package/test/spec/modules/pgamsspBidAdapter_spec.js +83 -16
  343. package/test/spec/modules/playdigoBidAdapter_spec.js +38 -9
  344. package/test/spec/modules/prebidServerBidAdapter_spec.js +14 -0
  345. package/test/spec/modules/pubCircleBidAdapter_spec.js +82 -17
  346. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +52 -5
  347. package/test/spec/modules/qtBidAdapter_spec.js +15 -3
  348. package/test/spec/modules/raynRtdProvider_spec.js +25 -0
  349. package/test/spec/modules/seedtagBidAdapter_spec.js +29 -0
  350. package/test/spec/modules/setupadBidAdapter_spec.js +124 -97
  351. package/test/spec/modules/smartadserverBidAdapter_spec.js +7 -0
  352. package/test/spec/modules/smartyadsBidAdapter_spec.js +6 -83
  353. package/test/spec/modules/smartytechBidAdapter_spec.js +5 -1
  354. package/test/spec/modules/topicsFpdModule_spec.js +43 -59
  355. package/test/spec/modules/twistDigitalBidAdapter_spec.js +5 -3
  356. package/test/spec/modules/userId_spec.js +86 -47
  357. package/test/spec/modules/vidazooBidAdapter_spec.js +21 -23
  358. package/test/spec/modules/visiblemeasuresBidAdapter_spec.js +130 -16
  359. package/test/spec/modules/yahooAdsBidAdapter_spec.js +1 -1
  360. package/test/spec/ortbConverter/converter_spec.js +7 -3
  361. package/test/spec/unit/utils/focusTimeout_spec.js +60 -0
  362. package/test/spec/videoCache_spec.js +56 -53
@@ -4,7 +4,7 @@ import {
4
4
  coreStorage,
5
5
  dep,
6
6
  findRootDomain,
7
- getConsentHash,
7
+ getConsentHash, getValidSubmoduleConfigs,
8
8
  init,
9
9
  PBJS_USER_ID_OPTOUT_NAME,
10
10
  requestBidsHook,
@@ -190,6 +190,65 @@ describe('User ID', function () {
190
190
  })
191
191
  })
192
192
 
193
+ describe('userId config validation', () => {
194
+ beforeEach(() => {
195
+ sandbox.stub(utils, 'logWarn');
196
+ });
197
+
198
+ function mockConfig(storageConfig = {}) {
199
+ return {
200
+ name: 'mockModule',
201
+ storage: {
202
+ name: 'mockStorage',
203
+ type: 'cookie',
204
+ ...storageConfig
205
+ }
206
+ }
207
+ }
208
+
209
+ Object.entries({
210
+ 'not an object': 'garbage',
211
+ 'missing name': {},
212
+ 'empty name': {name: ''},
213
+ 'empty storage config': {name: 'mockId', storage: {}},
214
+ 'storage type, but no storage name': mockConfig({name: ''}),
215
+ 'storage name, but no storage type': mockConfig({type: undefined}),
216
+ }).forEach(([t, config]) => {
217
+ it(`should log a warning and reject configuration with ${t}`, () => {
218
+ expect(getValidSubmoduleConfigs([config]).length).to.equal(0);
219
+ sinon.assert.called(utils.logWarn);
220
+ });
221
+ });
222
+
223
+ it('should reject non-array userId configuration', () => {
224
+ expect(getValidSubmoduleConfigs({})).to.eql([]);
225
+ sinon.assert.called(utils.logWarn);
226
+ });
227
+
228
+ it('should accept null configuration', () => {
229
+ expect(getValidSubmoduleConfigs()).to.eql([]);
230
+ sinon.assert.notCalled(utils.logWarn);
231
+ });
232
+
233
+ ['refreshInSeconds', 'expires'].forEach(param => {
234
+ describe(`${param} parameter`, () => {
235
+ it('should be made a number, when possible', () => {
236
+ expect(getValidSubmoduleConfigs([mockConfig({[param]: '123'})])[0].storage[param]).to.equal(123);
237
+ });
238
+
239
+ it('should log a warning when not a number', () => {
240
+ expect(getValidSubmoduleConfigs([mockConfig({[param]: 'garbage'})])[0].storage[param]).to.not.exist;
241
+ sinon.assert.called(utils.logWarn)
242
+ });
243
+
244
+ it('should be left untouched when not specified', () => {
245
+ expect(getValidSubmoduleConfigs([mockConfig()])[0].storage[param]).to.not.exist;
246
+ sinon.assert.notCalled(utils.logWarn);
247
+ });
248
+ })
249
+ })
250
+ })
251
+
193
252
  describe('Decorate Ad Units', function () {
194
253
  beforeEach(function () {
195
254
  // reset mockGpt so nothing else interferes
@@ -2173,60 +2232,40 @@ describe('User ID', function () {
2173
2232
  });
2174
2233
  });
2175
2234
 
2176
- describe('Set cookie behavior', function () {
2177
- let cookie, cookieStub;
2178
-
2179
- beforeEach(function () {
2180
- setSubmoduleRegistry([sharedIdSystemSubmodule]);
2181
- init(config);
2182
- cookie = document.cookie;
2183
- cookieStub = sinon.stub(document, 'cookie');
2184
- cookieStub.get(() => cookie);
2185
- cookieStub.set((val) => cookie = val);
2186
- });
2187
-
2188
- afterEach(function () {
2189
- cookieStub.restore();
2190
- });
2191
-
2192
- it('should allow submodules to override the domain', function () {
2193
- const submodule = {
2194
- submodule: {
2195
- domainOverride: function () {
2196
- return 'foo.com'
2197
- }
2198
- },
2235
+ describe('Submodule ID storage', () => {
2236
+ let submodule;
2237
+ beforeEach(() => {
2238
+ submodule = {
2239
+ submodule: {},
2199
2240
  config: {
2200
2241
  name: 'mockId',
2201
- storage: {
2202
- type: 'cookie'
2203
- }
2204
2242
  },
2205
2243
  storageMgr: {
2206
- setCookie: sinon.stub()
2244
+ setCookie: sinon.stub(),
2245
+ setDataInLocalStorage: sinon.stub()
2207
2246
  },
2208
- enabledStorageTypes: [ 'cookie' ]
2247
+ enabledStorageTypes: ['cookie', 'html5']
2209
2248
  }
2210
- setStoredValue(submodule, 'bar');
2211
- expect(submodule.storageMgr.setCookie.getCall(0).args[4]).to.equal('foo.com');
2212
2249
  });
2213
2250
 
2214
- it('should pass no domain if submodule does not override the domain', function () {
2215
- const submodule = {
2216
- submodule: {},
2217
- config: {
2218
- name: 'mockId',
2219
- storage: {
2220
- type: 'cookie'
2221
- }
2222
- },
2223
- storageMgr: {
2224
- setCookie: sinon.stub()
2225
- },
2226
- enabledStorageTypes: [ 'cookie' ]
2227
- }
2228
- setStoredValue(submodule, 'bar');
2229
- expect(submodule.storageMgr.setCookie.getCall(0).args[4]).to.equal(null);
2251
+ describe('Set cookie behavior', function () {
2252
+ beforeEach(() => {
2253
+ submodule.config.storage = {
2254
+ type: 'cookie'
2255
+ }
2256
+ });
2257
+ it('should allow submodules to override the domain', function () {
2258
+ submodule.submodule.domainOverride = function() {
2259
+ return 'foo.com'
2260
+ }
2261
+ setStoredValue(submodule, 'bar');
2262
+ expect(submodule.storageMgr.setCookie.getCall(0).args[4]).to.equal('foo.com');
2263
+ });
2264
+
2265
+ it('should pass no domain if submodule does not override the domain', function () {
2266
+ setStoredValue(submodule, 'bar');
2267
+ expect(submodule.storageMgr.setCookie.getCall(0).args[4]).to.equal(null);
2268
+ });
2230
2269
  });
2231
2270
  });
2232
2271
 
@@ -1,7 +1,11 @@
1
1
  import {expect} from 'chai';
2
2
  import {
3
3
  spec as adapter,
4
+ storage,
4
5
  createDomain,
6
+ webSessionId
7
+ } from 'modules/vidazooBidAdapter.js';
8
+ import {
5
9
  hashCode,
6
10
  extractPID,
7
11
  extractCID,
@@ -11,9 +15,9 @@ import {
11
15
  tryParseJSON,
12
16
  getUniqueDealId,
13
17
  getNextDealId,
14
- getVidazooSessionId,
15
- webSessionId
16
- } from 'modules/vidazooBidAdapter.js';
18
+ getTopWindowQueryParams,
19
+ getVidazooSessionId
20
+ } from 'libraries/vidazooUtils/bidderUtils.js'
17
21
  import * as utils from 'src/utils.js';
18
22
  import {version} from 'package.json';
19
23
  import {useFakeTimers} from 'sinon';
@@ -205,15 +209,6 @@ const REQUEST = {
205
209
  }
206
210
  };
207
211
 
208
- function getTopWindowQueryParams() {
209
- try {
210
- const parsedUrl = utils.parseUrl(window.top.document.URL, {decodeSearchAsString: true});
211
- return parsedUrl.search;
212
- } catch (e) {
213
- return '';
214
- }
215
- }
216
-
217
212
  describe('VidazooBidAdapter', function () {
218
213
  describe('validtae spec', function () {
219
214
  it('exists and is a function', function () {
@@ -317,6 +312,7 @@ describe('VidazooBidAdapter', function () {
317
312
  gpid: '',
318
313
  prebidVersion: version,
319
314
  ptrace: '1000',
315
+ vdzhum: '1000',
320
316
  publisherId: '59ac17c192832d0011283fe3',
321
317
  url: 'https%3A%2F%2Fwww.greatsite.com',
322
318
  referrer: 'https://www.somereferrer.com',
@@ -436,6 +432,7 @@ describe('VidazooBidAdapter', function () {
436
432
  prebidVersion: version,
437
433
  schain: BID.schain,
438
434
  ptrace: '1000',
435
+ vdzhum: '1000',
439
436
  res: `${window.top.screen.width}x${window.top.screen.height}`,
440
437
  mediaTypes: [BANNER],
441
438
  uqs: getTopWindowQueryParams(),
@@ -526,6 +523,7 @@ describe('VidazooBidAdapter', function () {
526
523
  prebidVersion: version,
527
524
  schain: BID.schain,
528
525
  ptrace: '1000',
526
+ vdzhum: '1000',
529
527
  res: `${window.top.screen.width}x${window.top.screen.height}`,
530
528
  mediaTypes: [BANNER],
531
529
  uqs: getTopWindowQueryParams(),
@@ -800,14 +798,14 @@ describe('VidazooBidAdapter', function () {
800
798
  $$PREBID_GLOBAL$$.bidderSettings = {};
801
799
  });
802
800
  it('should get undefined vidazoo session id', function () {
803
- const sessionId = getVidazooSessionId();
801
+ const sessionId = getVidazooSessionId(storage);
804
802
  expect(sessionId).to.be.empty;
805
803
  });
806
804
 
807
805
  it('should get vidazoo session id from storage', function () {
808
806
  const vidSid = '1234-5678';
809
807
  window.localStorage.setItem('vidSid', vidSid);
810
- const sessionId = getVidazooSessionId();
808
+ const sessionId = getVidazooSessionId(storage);
811
809
  expect(sessionId).to.be.equal(vidSid);
812
810
  });
813
811
  });
@@ -826,15 +824,15 @@ describe('VidazooBidAdapter', function () {
826
824
  const key = 'myDealKey';
827
825
 
828
826
  it('should get the next deal id', function () {
829
- const dealId = getNextDealId(key);
830
- const nextDealId = getNextDealId(key);
827
+ const dealId = getNextDealId(storage, key);
828
+ const nextDealId = getNextDealId(storage, key);
831
829
  expect(dealId).to.be.equal(1);
832
830
  expect(nextDealId).to.be.equal(2);
833
831
  });
834
832
 
835
833
  it('should get the first deal id on expiration', function (done) {
836
834
  setTimeout(function () {
837
- const dealId = getNextDealId(key, 100);
835
+ const dealId = getNextDealId(storage, key, 100);
838
836
  expect(dealId).to.be.equal(1);
839
837
  done();
840
838
  }, 200);
@@ -855,13 +853,13 @@ describe('VidazooBidAdapter', function () {
855
853
  const key = 'myKey';
856
854
  let uniqueDealId;
857
855
  beforeEach(() => {
858
- uniqueDealId = getUniqueDealId(key, 0);
856
+ uniqueDealId = getUniqueDealId(storage, key, 0);
859
857
  })
860
858
 
861
859
  it('should get current unique deal id', function (done) {
862
860
  // waiting some time so `now` will become past
863
861
  setTimeout(() => {
864
- const current = getUniqueDealId(key);
862
+ const current = getUniqueDealId(storage, key);
865
863
  expect(current).to.be.equal(uniqueDealId);
866
864
  done();
867
865
  }, 200);
@@ -869,7 +867,7 @@ describe('VidazooBidAdapter', function () {
869
867
 
870
868
  it('should get new unique deal id on expiration', function (done) {
871
869
  setTimeout(() => {
872
- const current = getUniqueDealId(key, 100);
870
+ const current = getUniqueDealId(storage, key, 100);
873
871
  expect(current).to.not.be.equal(uniqueDealId);
874
872
  done();
875
873
  }, 200)
@@ -893,8 +891,8 @@ describe('VidazooBidAdapter', function () {
893
891
  shouldAdvanceTime: true,
894
892
  now
895
893
  });
896
- setStorageItem('myKey', 2020);
897
- const {value, created} = getStorageItem('myKey');
894
+ setStorageItem(storage, 'myKey', 2020);
895
+ const {value, created} = getStorageItem(storage, 'myKey');
898
896
  expect(created).to.be.equal(now);
899
897
  expect(value).to.be.equal(2020);
900
898
  expect(typeof value).to.be.equal('number');
@@ -905,7 +903,7 @@ describe('VidazooBidAdapter', function () {
905
903
  it('should get external stored value', function () {
906
904
  const value = 'superman'
907
905
  window.localStorage.setItem('myExternalKey', value);
908
- const item = getStorageItem('myExternalKey');
906
+ const item = getStorageItem(storage, 'myExternalKey');
909
907
  expect(item).to.be.equal(value);
910
908
  });
911
909
 
@@ -3,11 +3,21 @@ import { spec } from '../../../modules/visiblemeasuresBidAdapter.js';
3
3
  import { BANNER, VIDEO, NATIVE } from '../../../src/mediaTypes.js';
4
4
  import { getUniqueIdentifierStr } from '../../../src/utils.js';
5
5
 
6
- const bidder = 'visiblemeasures'
6
+ const bidder = 'visiblemeasures';
7
7
  const adUrl = 'https://us-e.visiblemeasures.com/pbjs';
8
8
  const syncUrl = 'https://cs.visiblemeasures.com';
9
9
 
10
10
  describe('VisibleMeasuresBidAdapter', function () {
11
+ const userIdAsEids = [{
12
+ source: 'test.org',
13
+ uids: [{
14
+ id: '01**********',
15
+ atype: 1,
16
+ ext: {
17
+ third: '01***********'
18
+ }
19
+ }]
20
+ }];
11
21
  const bids = [
12
22
  {
13
23
  bidId: getUniqueIdentifierStr(),
@@ -18,8 +28,9 @@ describe('VisibleMeasuresBidAdapter', function () {
18
28
  }
19
29
  },
20
30
  params: {
21
- placementId: 'testBanner',
22
- }
31
+ placementId: 'testBanner'
32
+ },
33
+ userIdAsEids
23
34
  },
24
35
  {
25
36
  bidId: getUniqueIdentifierStr(),
@@ -32,8 +43,9 @@ describe('VisibleMeasuresBidAdapter', function () {
32
43
  }
33
44
  },
34
45
  params: {
35
- placementId: 'testVideo',
36
- }
46
+ placementId: 'testVideo'
47
+ },
48
+ userIdAsEids
37
49
  },
38
50
  {
39
51
  bidId: getUniqueIdentifierStr(),
@@ -55,8 +67,9 @@ describe('VisibleMeasuresBidAdapter', function () {
55
67
  }
56
68
  },
57
69
  params: {
58
- placementId: 'testNative',
59
- }
70
+ placementId: 'testNative'
71
+ },
72
+ userIdAsEids
60
73
  }
61
74
  ];
62
75
 
@@ -75,9 +88,20 @@ describe('VisibleMeasuresBidAdapter', function () {
75
88
 
76
89
  const bidderRequest = {
77
90
  uspConsent: '1---',
78
- gdprConsent: 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw',
91
+ gdprConsent: {
92
+ consentString: 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw',
93
+ vendorData: {}
94
+ },
79
95
  refererInfo: {
80
- referer: 'https://test.com'
96
+ referer: 'https://test.com',
97
+ page: 'https://test.com'
98
+ },
99
+ ortb2: {
100
+ device: {
101
+ w: 1512,
102
+ h: 982,
103
+ language: 'en-UK'
104
+ }
81
105
  },
82
106
  timeout: 500
83
107
  };
@@ -131,7 +155,7 @@ describe('VisibleMeasuresBidAdapter', function () {
131
155
  expect(data.host).to.be.a('string');
132
156
  expect(data.page).to.be.a('string');
133
157
  expect(data.coppa).to.be.a('number');
134
- expect(data.gdpr).to.be.a('string');
158
+ expect(data.gdpr).to.be.a('object');
135
159
  expect(data.ccpa).to.be.a('string');
136
160
  expect(data.tmax).to.be.a('number');
137
161
  expect(data.placements).to.have.lengthOf(3);
@@ -147,6 +171,56 @@ describe('VisibleMeasuresBidAdapter', function () {
147
171
  expect(placement.schain).to.be.an('object');
148
172
  expect(placement.bidfloor).to.exist.and.to.equal(0);
149
173
  expect(placement.type).to.exist.and.to.equal('publisher');
174
+ expect(placement.eids).to.exist.and.to.be.deep.equal(userIdAsEids);
175
+
176
+ if (placement.adFormat === BANNER) {
177
+ expect(placement.sizes).to.be.an('array');
178
+ }
179
+ switch (placement.adFormat) {
180
+ case BANNER:
181
+ expect(placement.sizes).to.be.an('array');
182
+ break;
183
+ case VIDEO:
184
+ expect(placement.playerSize).to.be.an('array');
185
+ expect(placement.minduration).to.be.an('number');
186
+ expect(placement.maxduration).to.be.an('number');
187
+ break;
188
+ case NATIVE:
189
+ expect(placement.native).to.be.an('object');
190
+ break;
191
+ }
192
+ }
193
+ });
194
+
195
+ it('Returns valid endpoints', function () {
196
+ const bids = [
197
+ {
198
+ bidId: getUniqueIdentifierStr(),
199
+ bidder: bidder,
200
+ mediaTypes: {
201
+ [BANNER]: {
202
+ sizes: [[300, 250]]
203
+ }
204
+ },
205
+ params: {
206
+ endpointId: 'testBanner',
207
+ },
208
+ userIdAsEids
209
+ }
210
+ ];
211
+
212
+ let serverRequest = spec.buildRequests(bids, bidderRequest);
213
+
214
+ const { placements } = serverRequest.data;
215
+ for (let i = 0, len = placements.length; i < len; i++) {
216
+ const placement = placements[i];
217
+ expect(placement.endpointId).to.be.oneOf(['testBanner', 'testVideo', 'testNative']);
218
+ expect(placement.adFormat).to.be.oneOf([BANNER, VIDEO, NATIVE]);
219
+ expect(placement.bidId).to.be.a('string');
220
+ expect(placement.schain).to.be.an('object');
221
+ expect(placement.bidfloor).to.exist.and.to.equal(0);
222
+ expect(placement.type).to.exist.and.to.equal('network');
223
+ expect(placement.eids).to.exist.and.to.be.deep.equal(userIdAsEids);
150
224
 
151
225
  if (placement.adFormat === BANNER) {
152
226
  expect(placement.sizes).to.be.an('array');
@@ -172,8 +246,10 @@ describe('VisibleMeasuresBidAdapter', function () {
172
246
  serverRequest = spec.buildRequests(bids, bidderRequest);
173
247
  let data = serverRequest.data;
174
248
  expect(data.gdpr).to.exist;
175
- expect(data.gdpr).to.be.a('string');
176
- expect(data.gdpr).to.equal(bidderRequest.gdprConsent);
249
+ expect(data.gdpr).to.be.a('object');
250
+ expect(data.gdpr).to.have.property('consentString');
251
+ expect(data.gdpr).to.not.have.property('vendorData');
252
+ expect(data.gdpr.consentString).to.equal(bidderRequest.gdprConsent.consentString);
177
253
  expect(data.ccpa).to.not.exist;
178
254
  delete bidderRequest.gdprConsent;
179
255
  });
@@ -188,12 +264,38 @@ describe('VisibleMeasuresBidAdapter', function () {
188
264
  expect(data.ccpa).to.equal(bidderRequest.uspConsent);
189
265
  expect(data.gdpr).to.not.exist;
190
266
  });
267
+ });
268
+
269
+ describe('gpp consent', function () {
270
+ it('bidderRequest.gppConsent', () => {
271
+ bidderRequest.gppConsent = {
272
+ gppString: 'abc123',
273
+ applicableSections: [8]
274
+ };
191
275
 
192
- it('Returns empty data if no valid requests are passed', function () {
193
- serverRequest = spec.buildRequests([], bidderRequest);
276
+ let serverRequest = spec.buildRequests(bids, bidderRequest);
194
277
  let data = serverRequest.data;
195
- expect(data.placements).to.be.an('array').that.is.empty;
196
- });
278
+ expect(data).to.be.an('object');
279
+ expect(data).to.have.property('gpp');
280
+ expect(data).to.have.property('gpp_sid');
281
+
282
+ delete bidderRequest.gppConsent;
283
+ })
284
+
285
+ it('bidderRequest.ortb2.regs.gpp', () => {
286
+ bidderRequest.ortb2 = bidderRequest.ortb2 || {};
287
+ bidderRequest.ortb2.regs = bidderRequest.ortb2.regs || {};
288
+ bidderRequest.ortb2.regs.gpp = 'abc123';
289
+ bidderRequest.ortb2.regs.gpp_sid = [8];
290
+
291
+ let serverRequest = spec.buildRequests(bids, bidderRequest);
292
+ let data = serverRequest.data;
293
+ expect(data).to.be.an('object');
294
+ expect(data).to.have.property('gpp');
295
+ expect(data).to.have.property('gpp_sid');
296
+
297
+ bidderRequest.ortb2;
298
+ })
197
299
  });
198
300
 
199
301
  describe('interpretResponse', function () {
@@ -397,5 +499,17 @@ describe('VisibleMeasuresBidAdapter', function () {
397
499
  expect(syncData[0].url).to.be.a('string')
398
500
  expect(syncData[0].url).to.equal(`${syncUrl}/image?pbjs=1&ccpa_consent=1---&coppa=0`)
399
501
  });
502
+ it('Should return array of objects with proper sync config , include GPP', function() {
503
+ const syncData = spec.getUserSyncs({}, {}, {}, {}, {
504
+ gppString: 'abc123',
505
+ applicableSections: [8]
506
+ });
507
+ expect(syncData).to.be.an('array').which.is.not.empty;
508
+ expect(syncData[0]).to.be.an('object')
509
+ expect(syncData[0].type).to.be.a('string')
510
+ expect(syncData[0].type).to.equal('image')
511
+ expect(syncData[0].url).to.be.a('string')
512
+ expect(syncData[0].url).to.equal(`${syncUrl}/image?pbjs=1&gpp=abc123&gpp_sid=8&coppa=0`);
513
+ });
400
514
  });
401
515
  });
@@ -193,7 +193,7 @@ describe('Yahoo Advertising Bid Adapter:', () => {
193
193
  });
194
194
 
195
195
  it('should define the correct bidder aliases', () => {
196
- expect(spec.aliases).to.deep.equal(['yahoossp', 'yahooAdvertising']);
196
+ expect(spec.aliases).to.deep.equal([{ 'code': 'yahoossp', 'gvlid': 25 }, { 'code': 'yahooAdvertising', 'gvlid': 25 }]);
197
197
  });
198
198
 
199
199
  it('should define the correct vendor ID', () => {
@@ -80,6 +80,7 @@ describe('pbjs-ortb converter', () => {
80
80
  if (context.reqContext?.ctx) {
81
81
  bidResponse.reqCtx = context.reqContext?.ctx;
82
82
  }
83
+ bidResponse.seatbid = context.seatbid;
83
84
  }
84
85
  }
85
86
  },
@@ -116,13 +117,16 @@ describe('pbjs-ortb converter', () => {
116
117
  const response = cvt.fromORTB({request, response: MOCK_ORTB_RESPONSE});
117
118
  expect(response.bids).to.eql([{
118
119
  impid: 'imp0',
119
- bidId: 111
120
+ bidId: 111,
121
+ seatbid: MOCK_ORTB_RESPONSE.seatbid[0]
120
122
  }, {
121
123
  impid: 'imp1',
122
- bidId: 112
124
+ bidId: 112,
125
+ seatbid: MOCK_ORTB_RESPONSE.seatbid[0]
123
126
  }, {
124
127
  impid: 'imp1',
125
- bidId: 112
128
+ bidId: 112,
129
+ seatbid: MOCK_ORTB_RESPONSE.seatbid[1]
126
130
  }]);
127
131
  expect(response.marker).to.be.true;
128
132
  });
@@ -0,0 +1,60 @@
1
+ import setFocusTimeout from '../../../../src/utils/focusTimeout';
2
+
3
+ export const setDocumentHidden = (hidden) => {
4
+ Object.defineProperty(document, 'hidden', {
5
+ configurable: true,
6
+ get: () => hidden,
7
+ });
8
+ document.dispatchEvent(new Event('visibilitychange'));
9
+ };
10
+
11
+ describe('focusTimeout', () => {
12
+ let clock;
13
+
14
+ beforeEach(() => {
15
+ clock = sinon.useFakeTimers();
16
+ });
17
+
18
+ afterEach(() => {
19
+ clock.restore();
20
+ })
21
+
22
+ it('should invoke callback when page is visible', () => {
23
+ let callback = sinon.stub();
24
+ setFocusTimeout(callback, 2000);
25
+ clock.tick(2000);
26
+ expect(callback.called).to.be.true;
27
+ });
28
+
29
+ it('should not invoke callback if page was hidden', () => {
30
+ let callback = sinon.stub();
31
+ setFocusTimeout(callback, 2000);
32
+ setDocumentHidden(true);
33
+ clock.tick(3000);
34
+ expect(callback.called).to.be.false;
35
+ });
36
+
37
+ it('should defer callback execution when page is hidden', () => {
38
+ let callback = sinon.stub();
39
+ setFocusTimeout(callback, 4000);
40
+ clock.tick(2000);
41
+ setDocumentHidden(true);
42
+ clock.tick(2000);
43
+ setDocumentHidden(false);
44
+ expect(callback.called).to.be.false;
45
+ clock.tick(2000);
46
+ expect(callback.called).to.be.true;
47
+ });
48
+
49
+ it('should return updated timerId after page was showed again', () => {
50
+ let callback = sinon.stub();
51
+ const getCurrentTimerId = setFocusTimeout(callback, 4000);
52
+ const oldTimerId = getCurrentTimerId();
53
+ clock.tick(2000);
54
+ setDocumentHidden(true);
55
+ clock.tick(2000);
56
+ setDocumentHidden(false);
57
+ const newTimerId = getCurrentTimerId();
58
+ expect(oldTimerId).to.not.equal(newTimerId);
59
+ });
60
+ });