@schibsted/pulse-sdk 8.0.0-alpha.16 → 8.0.0-alpha.18

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 (398) hide show
  1. package/dist/cjs/EventBus/EventBus.js +146 -0
  2. package/dist/cjs/Tracker.js +2499 -0
  3. package/dist/cjs/Tracker.test-d.js +76 -0
  4. package/dist/cjs/app-integration.js +40 -0
  5. package/dist/cjs/builders/actor.js +60 -0
  6. package/dist/cjs/builders/consent-manager.js +134 -0
  7. package/dist/cjs/builders/consents.js +149 -0
  8. package/dist/cjs/builders/device-browser.js +89 -0
  9. package/dist/cjs/builders/device-node.js +63 -0
  10. package/dist/cjs/builders/device.js +23 -0
  11. package/dist/cjs/builders/events-anonymous-browser.js +6 -0
  12. package/dist/cjs/builders/events-anonymous-node.js +88 -0
  13. package/dist/cjs/builders/events-anonymous.js +17 -0
  14. package/dist/cjs/builders/events-browser.js +8 -0
  15. package/dist/cjs/builders/events-node.js +127 -0
  16. package/dist/cjs/builders/events.js +17 -0
  17. package/dist/cjs/builders/experimentMetadata.js +25 -0
  18. package/dist/cjs/builders/experiments.js +32 -0
  19. package/dist/cjs/builders/index.js +52 -0
  20. package/dist/cjs/builders/location.js +38 -0
  21. package/dist/cjs/builders/objects/objects-anonymous-browser.js +36 -0
  22. package/dist/cjs/builders/objects/objects-anonymous-node.js +95 -0
  23. package/dist/cjs/builders/objects/objects-anonymous.js +23 -0
  24. package/dist/cjs/builders/objects/objects-browser.js +36 -0
  25. package/dist/cjs/builders/objects/objects-node.js +126 -0
  26. package/dist/cjs/builders/objects/objects.js +23 -0
  27. package/dist/cjs/builders/objects/utils.js +23 -0
  28. package/dist/cjs/builders/origin-browser.js +28 -0
  29. package/dist/cjs/builders/origin-node.js +29 -0
  30. package/dist/cjs/builders/origin.js +23 -0
  31. package/dist/cjs/builders/provider.js +24 -0
  32. package/dist/cjs/builders/session-browser.js +97 -0
  33. package/dist/cjs/builders/session-node.js +9 -0
  34. package/dist/cjs/builders/session.js +23 -0
  35. package/dist/cjs/builders/tracker-browser.js +34 -0
  36. package/dist/cjs/builders/tracker-node.js +22 -0
  37. package/dist/cjs/builders/trackerBuilder.js +23 -0
  38. package/dist/cjs/config-browser.js +26 -0
  39. package/dist/cjs/config.js +9 -0
  40. package/dist/cjs/createPulseTracker.js +50 -0
  41. package/dist/cjs/defer.js +20 -0
  42. package/dist/cjs/getPulseTracker.js +74 -0
  43. package/dist/cjs/identity/actor.js +60 -0
  44. package/dist/cjs/identity/advertising.js +62 -0
  45. package/dist/cjs/identity/cis.js +66 -0
  46. package/dist/cjs/identity/device.js +20 -0
  47. package/dist/cjs/identity/index.js +20 -0
  48. package/dist/cjs/index.js +57 -0
  49. package/dist/cjs/leaveTracking/constants.js +26 -0
  50. package/dist/cjs/leaveTracking/index.js +368 -0
  51. package/dist/cjs/leaveTracking/types.js +19 -0
  52. package/dist/cjs/leaveTrackingTpaas/constants.js +18 -0
  53. package/dist/cjs/leaveTrackingTpaas/index.js +341 -0
  54. package/dist/cjs/leaveTrackingTpaas/types.js +19 -0
  55. package/dist/cjs/network-browser.js +35 -0
  56. package/dist/cjs/network.js +15 -0
  57. package/dist/cjs/remoteConfig/index.js +124 -0
  58. package/dist/cjs/tracker-proxy/consts.js +72 -0
  59. package/dist/cjs/tracker-proxy/proxy-provider.js +68 -0
  60. package/dist/cjs/types.js +2 -0
  61. package/dist/cjs/version.json +1 -0
  62. package/dist/cjs/visibility-observer/index.js +101 -0
  63. package/dist/cjs/warnOnce.js +11 -0
  64. package/dist/cjs/wrapper/engagement/ui-element/event-builder.js +21 -0
  65. package/dist/cjs/wrapper/engagement/ui-element/types.js +2 -0
  66. package/dist/cjs/wrapper/types/base-event.js +2 -0
  67. package/dist/cjs/wrapper/types/engagement-event.js +2 -0
  68. package/dist/cjs/wrapper/types/event.js +2 -0
  69. package/dist/cjs/wrapper/types/index.js +19 -0
  70. package/dist/cjs/wrapper/types/utils.js +2 -0
  71. package/dist/cjs/wrapper/utils/get-navigation-type.js +32 -0
  72. package/dist/cjs/wrapper/utils/page-from-page-view.js +9 -0
  73. package/dist/cjs/wrapper/view/article/event-builder.js +19 -0
  74. package/dist/cjs/wrapper/view/article/types.js +2 -0
  75. package/dist/cjs/wrapper/view/frontpage/event-builder.js +16 -0
  76. package/dist/cjs/wrapper/view/frontpage/types.js +2 -0
  77. package/dist/cjs/wrapper/view/listing/event-builder.js +14 -0
  78. package/dist/cjs/wrapper/view/listing/types.js +2 -0
  79. package/dist/cjs/wrapper/view/loginposter/event-builder.js +11 -0
  80. package/dist/cjs/wrapper/view/loginposter/types.js +2 -0
  81. package/dist/cjs/wrapper/view/page/event-builder.js +18 -0
  82. package/dist/cjs/wrapper/view/page/types.js +2 -0
  83. package/dist/cjs/wrapper/view/salesposter/event-builder.js +18 -0
  84. package/dist/cjs/wrapper/view/salesposter/types.js +2 -0
  85. package/dist/cjs/wrapper/view/ui-element/event-builder.js +15 -0
  86. package/dist/cjs/wrapper/view/ui-element/types.js +2 -0
  87. package/dist/ejs/EventBus/EventBus.js +140 -0
  88. package/dist/ejs/Tracker.js +2455 -0
  89. package/dist/ejs/Tracker.test-d.js +71 -0
  90. package/dist/ejs/app-integration.js +33 -0
  91. package/dist/ejs/builders/actor.js +53 -0
  92. package/dist/ejs/builders/consent-manager.js +125 -0
  93. package/dist/ejs/builders/consents.js +138 -0
  94. package/dist/ejs/builders/device-browser.js +69 -0
  95. package/dist/ejs/builders/device-node.js +57 -0
  96. package/dist/ejs/builders/device.js +2 -0
  97. package/dist/ejs/builders/events-anonymous-browser.js +1 -0
  98. package/dist/ejs/builders/events-anonymous-node.js +48 -0
  99. package/dist/ejs/builders/events-anonymous.js +1 -0
  100. package/dist/ejs/builders/events-browser.js +1 -0
  101. package/dist/ejs/builders/events-node.js +84 -0
  102. package/dist/ejs/builders/events.js +1 -0
  103. package/dist/ejs/builders/experimentMetadata.js +21 -0
  104. package/dist/ejs/builders/experiments.js +27 -0
  105. package/dist/ejs/builders/index.js +12 -0
  106. package/dist/ejs/builders/location.js +34 -0
  107. package/dist/ejs/builders/objects/objects-anonymous-browser.js +14 -0
  108. package/dist/ejs/builders/objects/objects-anonymous-node.js +90 -0
  109. package/dist/ejs/builders/objects/objects-anonymous.js +2 -0
  110. package/dist/ejs/builders/objects/objects-browser.js +14 -0
  111. package/dist/ejs/builders/objects/objects-node.js +121 -0
  112. package/dist/ejs/builders/objects/objects.js +2 -0
  113. package/dist/ejs/builders/objects/utils.js +20 -0
  114. package/dist/ejs/builders/origin-browser.js +6 -0
  115. package/dist/ejs/builders/origin-node.js +24 -0
  116. package/dist/ejs/builders/origin.js +2 -0
  117. package/dist/ejs/builders/provider.js +18 -0
  118. package/dist/ejs/builders/session-browser.js +90 -0
  119. package/dist/ejs/builders/session-node.js +4 -0
  120. package/dist/ejs/builders/session.js +2 -0
  121. package/dist/ejs/builders/tracker-browser.js +13 -0
  122. package/dist/ejs/builders/tracker-node.js +14 -0
  123. package/dist/ejs/builders/trackerBuilder.js +2 -0
  124. package/dist/ejs/config-browser.js +23 -0
  125. package/dist/ejs/config.js +6 -0
  126. package/dist/ejs/createPulseTracker.js +44 -0
  127. package/dist/ejs/defer.js +17 -0
  128. package/dist/ejs/getPulseTracker.js +71 -0
  129. package/dist/ejs/identity/actor.js +51 -0
  130. package/dist/ejs/identity/advertising.js +57 -0
  131. package/dist/ejs/identity/cis.js +58 -0
  132. package/dist/ejs/identity/device.js +17 -0
  133. package/dist/ejs/identity/index.js +4 -0
  134. package/dist/ejs/index.js +9 -0
  135. package/dist/ejs/leaveTracking/constants.js +19 -0
  136. package/dist/ejs/leaveTracking/index.js +319 -0
  137. package/dist/ejs/leaveTracking/types.js +16 -0
  138. package/dist/ejs/leaveTrackingTpaas/constants.js +13 -0
  139. package/dist/ejs/leaveTrackingTpaas/index.js +291 -0
  140. package/dist/ejs/leaveTrackingTpaas/types.js +16 -0
  141. package/dist/ejs/network-browser.js +32 -0
  142. package/dist/ejs/network.js +12 -0
  143. package/dist/ejs/remoteConfig/index.js +111 -0
  144. package/dist/ejs/tracker-proxy/consts.js +68 -0
  145. package/dist/ejs/tracker-proxy/proxy-provider.js +62 -0
  146. package/dist/ejs/types.js +1 -0
  147. package/dist/ejs/version.json +1 -0
  148. package/dist/ejs/visibility-observer/index.js +97 -0
  149. package/dist/ejs/warnOnce.js +9 -0
  150. package/dist/ejs/wrapper/engagement/ui-element/event-builder.js +17 -0
  151. package/dist/ejs/wrapper/engagement/ui-element/types.js +1 -0
  152. package/dist/ejs/wrapper/types/base-event.js +1 -0
  153. package/dist/ejs/wrapper/types/engagement-event.js +1 -0
  154. package/dist/ejs/wrapper/types/event.js +1 -0
  155. package/dist/ejs/wrapper/types/index.js +3 -0
  156. package/dist/ejs/wrapper/types/utils.js +1 -0
  157. package/dist/ejs/wrapper/utils/get-navigation-type.js +29 -0
  158. package/dist/ejs/wrapper/utils/page-from-page-view.js +6 -0
  159. package/dist/ejs/wrapper/view/article/event-builder.js +15 -0
  160. package/dist/ejs/wrapper/view/article/types.js +1 -0
  161. package/dist/ejs/wrapper/view/frontpage/event-builder.js +12 -0
  162. package/dist/ejs/wrapper/view/frontpage/types.js +1 -0
  163. package/dist/ejs/wrapper/view/listing/event-builder.js +10 -0
  164. package/dist/ejs/wrapper/view/listing/types.js +1 -0
  165. package/dist/ejs/wrapper/view/loginposter/event-builder.js +7 -0
  166. package/dist/ejs/wrapper/view/loginposter/types.js +1 -0
  167. package/dist/ejs/wrapper/view/page/event-builder.js +14 -0
  168. package/dist/ejs/wrapper/view/page/types.js +1 -0
  169. package/dist/ejs/wrapper/view/salesposter/event-builder.js +14 -0
  170. package/dist/ejs/wrapper/view/salesposter/types.js +1 -0
  171. package/dist/ejs/wrapper/view/ui-element/event-builder.js +11 -0
  172. package/dist/ejs/wrapper/view/ui-element/types.js +1 -0
  173. package/dist/types/EventBus/EventBus.d.ts +106 -0
  174. package/dist/types/Tracker.d.ts +1418 -0
  175. package/dist/types/Tracker.test-d.d.ts +1 -0
  176. package/dist/types/app-integration.d.ts +10 -0
  177. package/dist/types/builders/actor.d.ts +39 -0
  178. package/dist/types/builders/consent-manager.d.ts +49 -0
  179. package/dist/types/builders/consents.d.ts +107 -0
  180. package/dist/types/builders/device-browser.d.ts +6 -0
  181. package/dist/types/builders/device-node.d.ts +65 -0
  182. package/dist/types/builders/device.d.ts +2 -0
  183. package/dist/types/builders/events-anonymous-browser.d.ts +1 -0
  184. package/dist/types/builders/events-anonymous-node.d.ts +82 -0
  185. package/dist/types/builders/events-anonymous.d.ts +1 -0
  186. package/dist/types/builders/events-browser.d.ts +1 -0
  187. package/dist/types/builders/events-node.d.ts +130 -0
  188. package/dist/types/builders/events.d.ts +1 -0
  189. package/dist/types/builders/experimentMetadata.d.ts +25 -0
  190. package/dist/types/builders/experiments.d.ts +24 -0
  191. package/dist/types/builders/index.d.ts +23 -0
  192. package/dist/types/builders/location.d.ts +34 -0
  193. package/dist/types/builders/objects/objects-anonymous-browser.d.ts +11 -0
  194. package/dist/types/builders/objects/objects-anonymous-node.d.ts +52 -0
  195. package/dist/types/builders/objects/objects-anonymous.d.ts +2 -0
  196. package/dist/types/builders/objects/objects-browser.d.ts +11 -0
  197. package/dist/types/builders/objects/objects-node.d.ts +60 -0
  198. package/dist/types/builders/objects/objects.d.ts +2 -0
  199. package/dist/types/builders/objects/utils.d.ts +1 -0
  200. package/dist/types/builders/origin-browser.d.ts +5 -0
  201. package/dist/types/builders/origin-node.d.ts +18 -0
  202. package/dist/types/builders/origin.d.ts +2 -0
  203. package/dist/types/builders/provider.d.ts +14 -0
  204. package/dist/types/builders/session-browser.d.ts +20 -0
  205. package/dist/types/builders/session-node.d.ts +3 -0
  206. package/dist/types/builders/session.d.ts +2 -0
  207. package/dist/types/builders/tracker-browser.d.ts +2 -0
  208. package/dist/types/builders/tracker-node.d.ts +14 -0
  209. package/dist/types/builders/trackerBuilder.d.ts +2 -0
  210. package/dist/types/config-browser.d.ts +23 -0
  211. package/dist/types/config.d.ts +6 -0
  212. package/dist/types/createPulseTracker.d.ts +21 -0
  213. package/dist/types/defer.d.ts +28 -0
  214. package/dist/types/getPulseTracker.d.ts +59 -0
  215. package/dist/types/identity/actor.d.ts +28 -0
  216. package/dist/types/identity/advertising.d.ts +30 -0
  217. package/dist/types/identity/cis.d.ts +21 -0
  218. package/dist/types/identity/device.d.ts +12 -0
  219. package/dist/types/identity/index.d.ts +4 -0
  220. package/dist/types/index.d.ts +31 -0
  221. package/dist/types/leaveTracking/constants.d.ts +26 -0
  222. package/dist/types/leaveTracking/index.d.ts +23 -0
  223. package/dist/types/leaveTracking/types.d.ts +78 -0
  224. package/dist/types/leaveTrackingTpaas/constants.d.ts +13 -0
  225. package/dist/types/leaveTrackingTpaas/index.d.ts +28 -0
  226. package/dist/types/leaveTrackingTpaas/types.d.ts +45 -0
  227. package/dist/types/network-browser.d.ts +5 -0
  228. package/dist/types/network.d.ts +4 -0
  229. package/dist/types/remoteConfig/index.d.ts +32 -0
  230. package/dist/types/tracker-proxy/consts.d.ts +45 -0
  231. package/dist/types/tracker-proxy/proxy-provider.d.ts +2 -0
  232. package/dist/types/types.d.ts +93 -0
  233. package/dist/types/visibility-observer/index.d.ts +38 -0
  234. package/dist/types/warnOnce.d.ts +2 -0
  235. package/dist/types/wrapper/engagement/ui-element/event-builder.d.ts +3 -0
  236. package/dist/types/wrapper/engagement/ui-element/types.d.ts +29 -0
  237. package/dist/types/wrapper/types/base-event.d.ts +74 -0
  238. package/dist/types/wrapper/types/engagement-event.d.ts +5 -0
  239. package/dist/types/wrapper/types/event.d.ts +41 -0
  240. package/dist/types/wrapper/types/index.d.ts +3 -0
  241. package/dist/types/wrapper/types/utils.d.ts +5 -0
  242. package/dist/types/wrapper/utils/get-navigation-type.d.ts +3 -0
  243. package/dist/types/wrapper/utils/page-from-page-view.d.ts +3 -0
  244. package/dist/types/wrapper/view/article/event-builder.d.ts +2 -0
  245. package/dist/types/wrapper/view/article/types.d.ts +27 -0
  246. package/dist/types/wrapper/view/frontpage/event-builder.d.ts +2 -0
  247. package/dist/types/wrapper/view/frontpage/types.d.ts +18 -0
  248. package/dist/types/wrapper/view/listing/event-builder.d.ts +2 -0
  249. package/dist/types/wrapper/view/listing/types.d.ts +27 -0
  250. package/dist/types/wrapper/view/loginposter/event-builder.d.ts +2 -0
  251. package/dist/types/wrapper/view/loginposter/types.d.ts +14 -0
  252. package/dist/types/wrapper/view/page/event-builder.d.ts +2 -0
  253. package/dist/types/wrapper/view/page/types.d.ts +16 -0
  254. package/dist/types/wrapper/view/salesposter/event-builder.d.ts +2 -0
  255. package/dist/types/wrapper/view/salesposter/types.d.ts +15 -0
  256. package/dist/types/wrapper/view/ui-element/event-builder.d.ts +3 -0
  257. package/dist/types/wrapper/view/ui-element/types.d.ts +28 -0
  258. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.d.ts +26 -0
  259. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js +273 -0
  260. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js.map +1 -0
  261. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.d.ts +10 -0
  262. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js +7 -0
  263. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js.map +1 -0
  264. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.d.ts +14 -0
  265. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js +39 -0
  266. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js.map +1 -0
  267. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.d.ts +4 -0
  268. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js +12 -0
  269. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js.map +1 -0
  270. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.d.ts +55 -0
  271. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js +276 -0
  272. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js.map +1 -0
  273. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.d.ts +36 -0
  274. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js +87 -0
  275. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js.map +1 -0
  276. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.d.ts +6 -0
  277. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js +21 -0
  278. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js.map +1 -0
  279. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.d.ts +24 -0
  280. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js +3 -0
  281. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js.map +1 -0
  282. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.d.ts +26 -0
  283. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js +203 -0
  284. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js.map +1 -0
  285. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.d.ts +10 -0
  286. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js +4 -0
  287. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js.map +1 -0
  288. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.d.ts +14 -0
  289. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js +35 -0
  290. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js.map +1 -0
  291. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.d.ts +4 -0
  292. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js +3 -0
  293. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js.map +1 -0
  294. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.d.ts +55 -0
  295. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js +254 -0
  296. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js.map +1 -0
  297. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.d.ts +36 -0
  298. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js +50 -0
  299. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js.map +1 -0
  300. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.d.ts +6 -0
  301. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js +17 -0
  302. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js.map +1 -0
  303. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.d.ts +24 -0
  304. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js +2 -0
  305. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js.map +1 -0
  306. package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis-browser.d.ts +26 -0
  307. package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis.d.ts +10 -0
  308. package/node_modules/@schibsted/pulse-cis-sync/dist/types/eventEmitter.d.ts +14 -0
  309. package/node_modules/@schibsted/pulse-cis-sync/dist/types/index.d.ts +4 -0
  310. package/node_modules/@schibsted/pulse-cis-sync/dist/types/pulse-cookie.d.ts +55 -0
  311. package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/pulseStorage.d.ts +36 -0
  312. package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/storage.d.ts +6 -0
  313. package/node_modules/@schibsted/pulse-cis-sync/dist/types/types.d.ts +24 -0
  314. package/node_modules/@schibsted/pulse-cis-sync/package.json +44 -0
  315. package/node_modules/@schibsted/pulse-utils/dist/cjs/cookie-config.js +10 -0
  316. package/node_modules/@schibsted/pulse-utils/dist/cjs/cookie.js +86 -0
  317. package/node_modules/@schibsted/pulse-utils/dist/cjs/events.js +109 -0
  318. package/node_modules/@schibsted/pulse-utils/dist/cjs/get.js +18 -0
  319. package/node_modules/@schibsted/pulse-utils/dist/cjs/getRootDomain.js +54 -0
  320. package/node_modules/@schibsted/pulse-utils/dist/cjs/index.js +38 -0
  321. package/node_modules/@schibsted/pulse-utils/dist/cjs/merge.js +38 -0
  322. package/node_modules/@schibsted/pulse-utils/dist/cjs/objects.js +34 -0
  323. package/node_modules/@schibsted/pulse-utils/dist/cjs/omit.js +9 -0
  324. package/node_modules/@schibsted/pulse-utils/dist/cjs/randomString.js +18 -0
  325. package/node_modules/@schibsted/pulse-utils/dist/cjs/throttle.js +34 -0
  326. package/node_modules/@schibsted/pulse-utils/dist/cjs/webApi.js +21 -0
  327. package/node_modules/@schibsted/pulse-utils/dist/ejs/cookie-config.js +7 -0
  328. package/node_modules/@schibsted/pulse-utils/dist/ejs/cookie.js +81 -0
  329. package/node_modules/@schibsted/pulse-utils/dist/ejs/events.js +103 -0
  330. package/node_modules/@schibsted/pulse-utils/dist/ejs/get.js +15 -0
  331. package/node_modules/@schibsted/pulse-utils/dist/ejs/getRootDomain.js +49 -0
  332. package/node_modules/@schibsted/pulse-utils/dist/ejs/index.js +11 -0
  333. package/node_modules/@schibsted/pulse-utils/dist/ejs/merge.js +35 -0
  334. package/node_modules/@schibsted/pulse-utils/dist/ejs/objects.js +26 -0
  335. package/node_modules/@schibsted/pulse-utils/dist/ejs/omit.js +6 -0
  336. package/node_modules/@schibsted/pulse-utils/dist/ejs/randomString.js +15 -0
  337. package/node_modules/@schibsted/pulse-utils/dist/ejs/throttle.js +31 -0
  338. package/node_modules/@schibsted/pulse-utils/dist/ejs/webApi.js +17 -0
  339. package/node_modules/@schibsted/pulse-utils/dist/types/cookie-config.d.ts +7 -0
  340. package/node_modules/@schibsted/pulse-utils/dist/types/cookie.d.ts +23 -0
  341. package/node_modules/@schibsted/pulse-utils/dist/types/events.d.ts +17 -0
  342. package/node_modules/@schibsted/pulse-utils/dist/types/get.d.ts +1 -0
  343. package/node_modules/@schibsted/pulse-utils/dist/types/getRootDomain.d.ts +13 -0
  344. package/node_modules/@schibsted/pulse-utils/dist/types/index.d.ts +11 -0
  345. package/node_modules/@schibsted/pulse-utils/dist/types/merge.d.ts +4 -0
  346. package/node_modules/@schibsted/pulse-utils/dist/types/objects.d.ts +6 -0
  347. package/node_modules/@schibsted/pulse-utils/dist/types/omit.d.ts +3 -0
  348. package/node_modules/@schibsted/pulse-utils/dist/types/randomString.d.ts +1 -0
  349. package/node_modules/@schibsted/pulse-utils/dist/types/throttle.d.ts +3 -0
  350. package/node_modules/@schibsted/pulse-utils/dist/types/webApi.d.ts +10 -0
  351. package/node_modules/@schibsted/pulse-utils/package.json +36 -0
  352. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/anonymous.js +8 -0
  353. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/baseEvent.js +9 -0
  354. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/consents.js +15 -0
  355. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/device.js +211 -0
  356. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/experiments.js +11 -0
  357. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/navigationType.js +52 -0
  358. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/pageInfo.js +24 -0
  359. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/pageviewId.js +11 -0
  360. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/provider.js +12 -0
  361. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/referrer.js +19 -0
  362. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/session.js +114 -0
  363. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/time.js +15 -0
  364. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/trackerBuilder.js +15 -0
  365. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/user.js +26 -0
  366. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/utm.js +35 -0
  367. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders.js +264 -0
  368. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/index.js +17 -0
  369. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/types.js +2 -0
  370. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/anonymous.js +5 -0
  371. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/baseEvent.js +6 -0
  372. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/consents.js +12 -0
  373. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/device.js +174 -0
  374. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/experiments.js +7 -0
  375. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/navigationType.js +48 -0
  376. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/pageInfo.js +20 -0
  377. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/pageviewId.js +7 -0
  378. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/provider.js +9 -0
  379. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/referrer.js +15 -0
  380. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/session.js +108 -0
  381. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/time.js +11 -0
  382. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/trackerBuilder.js +11 -0
  383. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/user.js +22 -0
  384. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/utm.js +31 -0
  385. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders.js +209 -0
  386. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/index.js +1 -0
  387. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/types.js +1 -0
  388. package/node_modules/@schibsted/tpaas-event-builder/dist/index.d.ts +5171 -0
  389. package/node_modules/@schibsted/tpaas-event-builder/package.json +40 -0
  390. package/node_modules/@schibsted/tpaas-schemas/dist/cjs/constants.js +62 -1
  391. package/node_modules/@schibsted/tpaas-schemas/dist/ejs/constants.js +61 -0
  392. package/node_modules/@schibsted/tpaas-schemas/dist/index.d.ts +128 -0
  393. package/package.json +58 -13
  394. package/CHANGELOG.md +0 -1035
  395. package/dist/index.d.ts +0 -13
  396. package/dist/index.d.ts.map +0 -1
  397. package/dist/index.js +0 -47
  398. package/dist/index.js.map +0 -1
@@ -0,0 +1,1418 @@
1
+ import { type AdvertisingIdentifiers, type AdvertisingVendor } from '@schibsted/pulse-cis-sync';
2
+ import { getCommonBuildersOutput, type InputParams } from '@schibsted/tpaas-event-builder';
3
+ import { type IAnonymousViewUIElement, type ICompletedHealthAction, type IEngagementAudio, type IEngagementForm, type IEngagementHealthUIElement, type IEngagementOffer, type IEngagementTeaser, type IEngagementUIElement, type IEngagementVideo, type IEngagementVideoAd, type IEngagementWidget, type IImpressionAdSlot, type IImpressionForm, type IImpressionHealthUIElement, type IImpressionOffer, type IImpressionPlayer, type IImpressionTeaser, type IImpressionUIElement, type IImpressionWidget, type ILeave, type ILeaveArticle, type ILeaveAudioPage, type ILeaveError, type ILeaveFrontpage, type ILeaveLandingpage, type ILeaveListing, type ILeaveLockedArticle, type ILeaveLockedAudio, type ILeaveLockedAudioPage, type ILeaveLockedVideo, type ILeaveLockedVideoPage, type ILeavePage, type ILeaveVideoPage, type ILeaveWeather, type ITpaasEvent, type IViewArticle, type IViewAudio, type IViewAudioPage, type IViewError, type IViewFrontpage, type IViewHealthPage, type IViewLandingpage, type IViewListing, type IViewLockedArticle, type IViewLockedAudio, type IViewLockedAudioPage, type IViewLockedVideo, type IViewLockedVideoPage, type IViewPage, type IViewTitle, type IViewVideo, type IViewVideoPage, type IViewWeather } from '@schibsted/tpaas-schemas';
4
+ import logger from 'loglevel';
5
+ import type { ActorInput, Consents, ConsentsInput, DeviceInput, LocationInput, ObjectInput, OriginInput, ProviderInput, TrackerInput } from './builders';
6
+ import { engagementEvent, identityEvent, routableEvent, trackerEvent } from './builders/events';
7
+ import { anonymousEngagementEvent, anonymousTrackerEvent } from './builders/events-anonymous-node';
8
+ import type { Deferred, ResolvedInput } from './defer';
9
+ import { type Listener } from './EventBus/EventBus';
10
+ import type { LeaveEvent, LeaveEventBuilder, LeaveEventOptions } from './leaveTracking/types';
11
+ import type { AnonymousEventInputTypesByTrackingMethod, EventInput, EventInputTypesByTrackingMethod, TrackViewAudioPageOptions, TrackViewEventOptions, TrackViewVideoPageOptions } from './types';
12
+ import type { ClickUIElementInputProperties } from './wrapper/engagement/ui-element/types';
13
+ import type { BaseEventExperiment } from './wrapper/types';
14
+ import type { ViewArticleInputProperties } from './wrapper/view/article/types';
15
+ import type { ViewFrontpageInputProperties } from './wrapper/view/frontpage/types';
16
+ import type { ViewListingInputProperties } from './wrapper/view/listing/types';
17
+ import type { ViewLoginPosterInputProperties } from './wrapper/view/loginposter/types';
18
+ import type { ViewPageInputProperties } from './wrapper/view/page/types';
19
+ import type { ViewSalesPosterInputProperties } from './wrapper/view/salesposter/types';
20
+ import type { ViewUIElementInputProperties } from './wrapper/view/ui-element/types';
21
+ /**
22
+ * Builder types for each event type
23
+ * @internal
24
+ */
25
+ type EventTrackingMethods = {
26
+ identity: typeof identityEvent;
27
+ trackerEvent: typeof trackerEvent;
28
+ engagementEvent: typeof engagementEvent;
29
+ routableEvent: typeof routableEvent;
30
+ };
31
+ /**
32
+ * Builder types for each anonymous event type
33
+ * @internal
34
+ */
35
+ type AnonymousEventTrackingMethods = {
36
+ trackerEvent: typeof anonymousTrackerEvent;
37
+ engagementEvent: typeof anonymousEngagementEvent;
38
+ };
39
+ /**
40
+ * Base type for anonymous events
41
+ */
42
+ export type AnonymousEventType = keyof AnonymousEventTrackingMethods;
43
+ /**
44
+ * Function type for alternative event handler
45
+ * @param event Event stringified
46
+ */
47
+ export type AltEventHandler = (event: string) => void;
48
+ /**
49
+ * Core config options that are required for the SDK to function.
50
+ * @internal
51
+ *
52
+ * @privateRemarks
53
+ * These types should be dealt with by the media/marketplace implementation, and not (necessarily)
54
+ * exposed to the end user/developer.
55
+ *
56
+ * Make properties optional.
57
+ */
58
+ interface FallbackSDKConfig {
59
+ remoteConfigurationUrl: string;
60
+ fallbackCisBaseUrl: string;
61
+ fallbackCollectorBaseUrl: string;
62
+ schemaLocation: string;
63
+ }
64
+ /**
65
+ * Possible deployment stages targeted by the SDK api and/or the event routing
66
+ */
67
+ export type DeployStage = 'dev' | 'pre' | 'pro';
68
+ /**
69
+ * Override default settings of the SDK
70
+ *
71
+ * See `src/config-browser.js` and `src/config.js` for the default values for
72
+ * browser and no browser environments.
73
+ *
74
+ * **Note** that the `username` and `password` is *for Node.js environments only*.
75
+ */
76
+ export interface SDKConfigInput {
77
+ /**
78
+ * Function handler to call in place of the built-in tracker call.
79
+ * @function
80
+ * @deprecated This value is automatically populated from `window.pulseEventHandler`
81
+ */
82
+ altEventHandler?: AltEventHandler;
83
+ autoCreateConsents?: boolean;
84
+ cisBaseUrl?: string;
85
+ cisEnabled?: boolean;
86
+ collectorBaseUrl?: string;
87
+ collectorPath?: string;
88
+ configurationTag?: string;
89
+ consents?: Consents | ConsentsInput | Promise<Consents>;
90
+ deployStage?: DeployStage;
91
+ deployStageTpaas?: DeployStage;
92
+ eventDebounce?: number;
93
+ isHybrid?: boolean;
94
+ logLevel?: logger.LogLevelDesc;
95
+ /**
96
+ * @deprecated This value is automatically populated from window.__nativeJwe__ or window.hermesJwe
97
+ */
98
+ nativeJwe?: string;
99
+ password?: string;
100
+ requireAdvertisingOptIn?: boolean;
101
+ trackerId?: string;
102
+ useBeacon?: boolean;
103
+ useBeaconWhenAvailable?: boolean;
104
+ username?: string;
105
+ vendors?: AdvertisingVendor[];
106
+ /**
107
+ * @deprecated Xandr sync and AnId functionality no longer supported.
108
+ */
109
+ xandrEnabled?: boolean;
110
+ }
111
+ /**
112
+ * Internal state of the tracker.
113
+ *
114
+ * **Note** that the `username` and `password` is *for Node.js environments
115
+ * only*.
116
+ * @internal
117
+ */
118
+ export type SDKState = {
119
+ altEventHandler?: AltEventHandler;
120
+ autoCreateConsents?: boolean;
121
+ cisBaseUrl?: string;
122
+ cisEnabled?: boolean;
123
+ collectorBaseUrl?: string;
124
+ collectorPath: string;
125
+ configurationTag?: string;
126
+ consents?: Consents | ConsentsInput | Promise<Consents>;
127
+ deployStage: DeployStage;
128
+ deployStageTpaas: DeployStage;
129
+ environment: 'node' | 'browser';
130
+ eventDebounce?: number;
131
+ includeAdvertising: boolean | Promise<boolean>;
132
+ isHybrid?: boolean;
133
+ nativeJwe?: string;
134
+ pageViewId: string;
135
+ password?: string;
136
+ providerId: string;
137
+ remoteConfigurationUrl: string;
138
+ requireAdvertisingOptIn?: boolean;
139
+ schemaLocation: string;
140
+ trackerId?: string;
141
+ tpaasCollectorBaseUrl: string;
142
+ useBeacon?: boolean;
143
+ useBeaconWhenAvailable?: boolean;
144
+ username?: string;
145
+ vendors: AdvertisingVendor[];
146
+ /**
147
+ * @deprecated Xandr sync and AnId functionality no longer supported.
148
+ */
149
+ xandrEnabled?: boolean;
150
+ } & SDKConfigInput & FallbackSDKConfig;
151
+ /**
152
+ * Input for event builders. Different events will read and process different
153
+ * fields.
154
+ *
155
+ * You generally can pass any data to any part of the event, only the processed
156
+ * fields are documented.
157
+ */
158
+ export type Builders = {
159
+ actor?: Promise<ActorInput> | ActorInput;
160
+ provider?: ProviderInput;
161
+ device?: DeviceInput;
162
+ object?: ObjectInput;
163
+ target?: ObjectInput;
164
+ tracker?: TrackerInput;
165
+ location?: LocationInput;
166
+ origin?: OriginInput;
167
+ experiments?: BaseEventExperiment[];
168
+ };
169
+ /**
170
+ * Optional option used in `track` and `trackPageView`
171
+ *
172
+ * If `resolveOnQueued` is set to true then the promise returned by `track`/`trackPageView` will
173
+ * resolve when the event is evaluated and added to the internal queue. If it is falsy (default
174
+ * value us `undefined`) the promise will resolve when the event have been transmitted over the
175
+ * network.
176
+ */
177
+ export type TrackOptions = {
178
+ applyBookmarkKey?: string;
179
+ bookmarkKey?: string;
180
+ resolveOnQueued?: boolean;
181
+ };
182
+ export interface TrackCloneOptions {
183
+ trackerId?: string;
184
+ }
185
+ /**
186
+ * @internal
187
+ */
188
+ export declare const BookmarkKeys: {
189
+ PAGE_VIEW: string;
190
+ };
191
+ export type WebApi = {
192
+ /**
193
+ * Global tracker instance
194
+ * @privateRemarks
195
+ * Do not mix with `window.pulse`, which is the Autotracker script handler
196
+ */
197
+ __pulseTracker?: Promise<Tracker>;
198
+ };
199
+ type EventsToDispatch = {
200
+ 'tracker:ready': {
201
+ tracker: Tracker;
202
+ };
203
+ 'tracker:session:new': {
204
+ sessionId: string;
205
+ };
206
+ };
207
+ export declare function subscribe<T extends keyof EventsToDispatch>(eventName: T, callback: Listener<EventsToDispatch[T]>): () => void;
208
+ export declare function subscribeOnce<T extends keyof EventsToDispatch>(eventName: T, callback: Listener<EventsToDispatch[T]>): () => void;
209
+ export declare function subscribeWithState<T extends keyof EventsToDispatch>(eventName: T, callback: Listener<EventsToDispatch[T]>): () => void;
210
+ export declare function unsubscribe<T extends keyof EventsToDispatch>(eventName: T, callback: Listener<EventsToDispatch[T]>): void;
211
+ /**
212
+ * @class Tracker
213
+ */
214
+ export default class Tracker {
215
+ /**
216
+ * @property
217
+ * @internal
218
+ */
219
+ state: SDKState;
220
+ /**
221
+ * @property
222
+ * @internal
223
+ */
224
+ builders: Builders;
225
+ /**
226
+ * @property
227
+ * @internal
228
+ */
229
+ eventQueue: Array<Deferred>;
230
+ /**
231
+ * @property
232
+ * @internal
233
+ */
234
+ anonymousEventQueue: Array<Deferred>;
235
+ /**
236
+ * Queue for TPaaS events
237
+ * @property
238
+ * @internal
239
+ */
240
+ tpaasEventQueue: Array<ITpaasEvent>;
241
+ /**
242
+ * Queue for events that have already failed once
243
+ * @property
244
+ * @internal
245
+ */
246
+ retryEventQueue: Array<EventInput>;
247
+ /**
248
+ * Queue for anonymous events that have already failed once
249
+ * @property
250
+ * @internal
251
+ */
252
+ retryAnonymousEventQueue: Array<EventInput>;
253
+ /**
254
+ * Queue for TPaaS events that have already failed once
255
+ * @property
256
+ * @internal
257
+ */
258
+ retryTpaasEventQueue: Array<ITpaasEvent>;
259
+ /**
260
+ * @function
261
+ * @private
262
+ */
263
+ debouncedSend: () => Promise<EventInput[] | undefined>;
264
+ /**
265
+ * @function
266
+ * @private
267
+ */
268
+ debouncedSendAnonymous: () => Promise<EventInput[] | undefined>;
269
+ /**
270
+ * @function
271
+ * @private
272
+ */
273
+ debouncedSendTpaas: () => Promise<ITpaasEvent[] | undefined>;
274
+ /**
275
+ * @property
276
+ * @private
277
+ */
278
+ private bookmark;
279
+ private legacyVisibilityObservers;
280
+ private visibilityObservers;
281
+ private legacyCurrentPage;
282
+ private currentPage;
283
+ /**
284
+ * Promise that resolves when a session ID becomes available
285
+ * @private
286
+ */
287
+ private sessionIdPromise;
288
+ /**
289
+ * > [!WARNING]
290
+ * >
291
+ * > For legacy reasons the `providerId` parameter is called so, but it is actually the
292
+ * > `CLIENT-ID` of the site or app.
293
+ * > Do not mix it up with a full `SDRN` Provider ID. Ex:<br/>
294
+ * > * `PROVIDER-ID` = `sdrn:schibsted:client:my-client-id`<br/>
295
+ * > * `CLIENT-ID` = `my-client-id` = `config.providerId`
296
+ *
297
+ * @param providerId `CLIENT-ID` of the site or app.
298
+ * @param config Options to set the SDK with
299
+ * @param builders Initial values for event properties that will be persisted across events
300
+ */
301
+ constructor(providerId: string, config?: SDKConfigInput, builders?: Builders);
302
+ /**
303
+ * Add event to the tracker event queue
304
+ *
305
+ * The input can be objects, arrays, primitives or promises. The
306
+ * order of calls to the method is not guaranteed to be sent in the same
307
+ * sequence.
308
+ *
309
+ * ```
310
+ * tracker.track('trackerEvent', {
311
+ * actor: new Promise(resolve => setTimeout(() => resolve('person@example.org'), 2000))
312
+ * });
313
+ * tracker.track('trackerEvent', { type: 'Engagement '});
314
+ *
315
+ * ```
316
+ *
317
+ * The second call to `track` will be added to the event queue before the
318
+ * first since all input to events are resolved before being added to the
319
+ * internal queue. Setting the future value in the SDK state will block all
320
+ * events and events will be added to the queue in order.
321
+ *
322
+ * ```
323
+ * tracker.update({
324
+ * actor: new Promise(resolve =>
325
+ * setTimeout(() => resolve('person@example.org'), 2000)) })
326
+ * tracker.track('trackerEvent', { type: 'View' });
327
+ * tracker.track('trackerEvent', { type: 'Engagement' });
328
+ * ```
329
+ *
330
+ * Both of these events will be blocked for two seconds and executed in order.
331
+ *
332
+ * @typeParam T Type of event to track
333
+ * @param eventType. See [spt-tracking/pulse-event-builders]() for
334
+ * available event types
335
+ * @param input. input input to the given event. The given input and the
336
+ * persisted input in the tracker will be merged before passing it to the event
337
+ * function.
338
+ * @param {TrackOptions} options
339
+ * @category Legacy Tracking
340
+ */
341
+ track<T extends keyof EventTrackingMethods>(eventType: T, input: EventInputTypesByTrackingMethod[T], options?: TrackOptions): Promise<unknown>;
342
+ /**
343
+ * Add anonymous event to the tracker anonymous event queue
344
+ *
345
+ * The input can be objects, arrays, primitives or promises. The
346
+ * order of calls to the method is not guaranteed to be sent in the same
347
+ * sequence.
348
+ *
349
+ * ```
350
+ * tracker.trackAnonymous('trackerEvent', { type: 'Engagement'});
351
+ * ```
352
+ *
353
+ * Anonymous events will not contain: `session`, `actor`, `device`, `location`, `pageViewId`.
354
+ *
355
+ * Anonymous events will always have the `isAnonymous` field set to true.
356
+ *
357
+ * Anonymous events will not await for consents. They will be applied if available, otherwise it will fall back to `unknown`.
358
+ *
359
+ * Considering the above, you should *not* add custom fields that can break anonymity.
360
+ *
361
+ * If you are missing consents, you're also not allowed to interact with storage or cookies for the purpose of these events.
362
+ * @typeParam T Type of event to track
363
+ * @param eventType.
364
+ * @param input. input input to the given event. The given input and the
365
+ * persisted input in the tracker will be merged before passing it to the event
366
+ * function.
367
+ * @param {TrackOptions} options
368
+ * @category Tracking Anonymous
369
+ */
370
+ trackAnonymous<T extends AnonymousEventType>(eventType: T, input: AnonymousEventInputTypesByTrackingMethod[T], options?: TrackOptions): Promise<any>;
371
+ private adaptExperiments;
372
+ /**
373
+ *
374
+ * @private
375
+ * @category TPaaS Tracking
376
+ */
377
+ private prepareAnonymousTpaasEvent;
378
+ /**
379
+ *
380
+ * @private
381
+ * @category TPaaS Tracking
382
+ */
383
+ private prepareTpaasEvent;
384
+ /**
385
+ * Generate a generic TPaaS event with common builders output
386
+ * The method should be used for experiments, not for real production work.
387
+ * It doesn't have any real TPaaS schema associated with it.
388
+ * The method doesn't queue or send the event, it just returns the merged object.
389
+ * The method can be removed at any time in the future, so use it with caution.
390
+ *
391
+ * @param input - The input object to merge with the common builders output
392
+ * @returns A promise that resolves to the merged object
393
+ * @private
394
+ * @category TPaaS Tracking
395
+ */
396
+ generateGenericTpaasEvent<T>(input: T): Promise<T & ReturnType<typeof getCommonBuildersOutput>>;
397
+ /**
398
+ * This method extends the list of base experiments that will be automatically included in every event sent by the tracker.
399
+ *
400
+ * It accepts:
401
+ * - An array of experiments and/or promises resolving to the experiments
402
+ * - A Promise resolving to an array of experiments
403
+ *
404
+ * This allows to easily manage experiments without having to repeat them in every tracking call. For example:
405
+ *
406
+ * ```ts
407
+ * const experiments = [{ id: 'experiment-A', variant: 'blue-button' }];
408
+ *
409
+ * tracker.addExperiments(experiments);
410
+ * ```
411
+
412
+ Calling the method multiple times concatenates all given experiments and stores them as base experiments. Experiments can be either direct values or Promises, and they will be included in all future tracking events.
413
+
414
+ * @param experiments
415
+ * @category Tracking
416
+ */
417
+ addExperiments(experiments: BaseEventExperiment[]): void;
418
+ /**
419
+ * The `addUIElementVisibilityTracking` function provides an interface for sending tracking events when specific UI elements become visible within the viewport.
420
+ * It is built on the `VisibilityObserver` class, which efficiently detects visibility changes in DOM elements.
421
+ * When an element becomes at least 2/3 visible, a callback is triggered to process the element and create a tracking event.
422
+ * It leverages the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) for viewport tracking
423
+ * and the [Mutation Observer API](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) to monitor lazy-loaded elements.
424
+ *
425
+ * Example usage:
426
+ *
427
+ * ```ts
428
+ * addUIElementVisibilityTracking('[data-pulse-entity-id]', (element) => {
429
+ * const target = createPulseTarget(element);
430
+ * const object = createPulseObject(element);
431
+ *
432
+ * return { object, target };
433
+ * });
434
+ * ```
435
+ *
436
+ * @param {string} selector - CSS selector for elements to track.
437
+ * @param {Function} buildEventFromElement - Function to build event object when element is visible.
438
+ * @deprecated This only works for legacy events. For TPaaS events, use `addUIElementVisibilityTracking` instead.
439
+ * @category Legacy Tracking
440
+ */
441
+ addLegacyUIElementVisibilityTracking(selector: string, buildEventFromElement: (element: HTMLElement) => ViewUIElementInputProperties): void;
442
+ /**
443
+ * The `addUIElementVisibilityTracking` function provides an interface for sending tracking events when specific UI elements become visible within the viewport.
444
+ * It is built on the `VisibilityObserver` class, which efficiently detects visibility changes in DOM elements.
445
+ * When an element becomes at least 2/3 visible, a callback is triggered to process the element and create a tracking event.
446
+ * It leverages the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) for viewport tracking
447
+ * and the [Mutation Observer API](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) to monitor lazy-loaded elements.
448
+ *
449
+ * Example usage:
450
+ *
451
+ * ```ts
452
+ * addUIElementVisibilityTracking('[data-pulse-entity-id]', (element) => {
453
+ * const eventInput = createEventInput(element);
454
+ *
455
+ * return eventInput;
456
+ * });
457
+ * ```
458
+ *
459
+ * @param {string} selector - CSS selector for elements to track.
460
+ * @param {Function} buildEventFromElement - Function to build event object when element is visible.
461
+ * @category Tracking
462
+ */
463
+ addUIElementVisibilityTracking(selector: string, buildEventFromElement: (element: HTMLElement) => InputParams<IImpressionUIElement>): void;
464
+ private setPageDefaults;
465
+ /**
466
+ * The old trackViewArticle method from the Media Wrapper.
467
+ * When triggering this page-view function, both the "page" object and "origin"
468
+ * will be stored and re-used across subsequent events.
469
+ *
470
+ * @param inputProperties
471
+ * @param trackOptions
472
+ * @category Legacy Tracking
473
+ */
474
+ trackLegacyViewArticle(inputProperties: ViewArticleInputProperties, trackOptions?: TrackOptions): Promise<unknown>;
475
+ /**
476
+ * The old trackViewLoginPoster method from the Media Wrapper.
477
+ * When triggering this page-view function, both the "page" object and "origin"
478
+ * will be stored and re-used across subsequent events.
479
+ *
480
+ * @param inputProperties
481
+ * @param trackOptions
482
+ * @category Legacy Tracking
483
+ */
484
+ trackLegacyViewLoginPoster(inputProperties: ViewLoginPosterInputProperties, trackOptions?: TrackOptions): Promise<unknown>;
485
+ /**
486
+ * The old trackViewSalesPoster method from the Media Wrapper.
487
+ * When triggering this page-view function, both the "page" object and "origin"
488
+ * will be stored and re-used across subsequent events.
489
+ *
490
+ * @param inputProperties
491
+ * @param trackOptions
492
+ * @category Legacy Tracking
493
+ */
494
+ trackLegacyViewSalesPoster(inputProperties: ViewSalesPosterInputProperties, trackOptions?: TrackOptions): Promise<unknown>;
495
+ /**
496
+ * The old trackViewListing method from the Media Wrapper.
497
+ * When triggering this page-view function, both the "page" object and "origin"
498
+ * will be stored and re-used across subsequent events.
499
+ *
500
+ * @param inputProperties
501
+ * @param trackOptions
502
+ * @category Legacy Tracking
503
+ */
504
+ trackLegacyViewListing(inputProperties: ViewListingInputProperties, trackOptions?: TrackOptions): Promise<unknown>;
505
+ /**
506
+ * The old trackViewFrontpage method from the Media Wrapper.
507
+ * When triggering this page-view function, both the "page" object and "origin"
508
+ * will be stored and re-used across subsequent events.
509
+ *
510
+ * @param inputProperties
511
+ * @param trackOptions
512
+ * @category Legacy Tracking
513
+ */
514
+ trackLegacyViewFrontpage(inputProperties: ViewFrontpageInputProperties, trackOptions?: TrackOptions): Promise<unknown>;
515
+ /**
516
+ * The old trackViewPage method from the Media Wrapper.
517
+ * When triggering this page-view function, both the "page" object and "origin"
518
+ * will be stored and re-used across subsequent events.
519
+ *
520
+ * @param inputProperties
521
+ * @param trackOptions
522
+ * @category Legacy Tracking
523
+ */
524
+ trackLegacyViewPage(inputProperties: ViewPageInputProperties, trackOptions?: TrackOptions): Promise<unknown>;
525
+ /**
526
+ * The old trackViewUIElement method from the Media Wrapper.
527
+ *
528
+ * @param inputProperties
529
+ * @param trackOptions
530
+ * @category Legacy Tracking
531
+ */
532
+ trackLegacyViewUIElement(inputProperties: ViewUIElementInputProperties, trackOptions?: TrackOptions): Promise<unknown>;
533
+ /**
534
+ * The old trackClickUIElement method from the Media Wrapper.
535
+ *
536
+ * @param inputProperties
537
+ * @param trackOptions
538
+ * @category Legacy Tracking
539
+ */
540
+ trackLegacyClickUIElement(inputProperties: ClickUIElementInputProperties, trackOptions?: TrackOptions): Promise<unknown>;
541
+ /**
542
+ * The following methods are the track methods specific for the TPaaS schemas
543
+ */
544
+ /**
545
+ * @param input
546
+ * @category TPaaS Tracking
547
+ */
548
+ trackAnonymousViewUIElement(input: InputParams<IAnonymousViewUIElement>): Promise<unknown>;
549
+ private setCurrentPage;
550
+ trackCompletedHealthAction(input: InputParams<ICompletedHealthAction>): Promise<unknown>;
551
+ trackEngagementHealthUIElement(input: InputParams<IEngagementHealthUIElement>): Promise<unknown>;
552
+ trackViewHealthPage(input: InputParams<IViewHealthPage>, options: TrackViewEventOptions): Promise<unknown>;
553
+ trackImpressionHealthUIElement(input: InputParams<IImpressionHealthUIElement>): Promise<unknown>;
554
+ /**
555
+ * @param input
556
+ * @param options
557
+ * @category TPaaS Tracking
558
+ */
559
+ trackViewPage(input: InputParams<IViewPage>, options: TrackViewEventOptions): Promise<unknown>;
560
+ /**
561
+ * @param input
562
+ * @category TPaaS Tracking
563
+ */
564
+ trackViewTitle(input: InputParams<IViewTitle>): Promise<unknown>;
565
+ /**
566
+ * @param input
567
+ * @category TPaaS Tracking
568
+ */
569
+ trackImpressionWidget(input: InputParams<IImpressionWidget>): Promise<unknown>;
570
+ /**
571
+ * @param input
572
+ * @category TPaaS Tracking
573
+ */
574
+ trackImpressionAdSlot(input: InputParams<IImpressionAdSlot>): Promise<unknown>;
575
+ /**
576
+ * @param input
577
+ * @param options
578
+ * @category TPaaS Tracking
579
+ */
580
+ trackViewArticle(input: InputParams<IViewArticle>, options: TrackViewEventOptions): Promise<unknown>;
581
+ /**
582
+ * @param input
583
+ * @param options
584
+ * @category TPaaS Tracking
585
+ */
586
+ trackViewAudio(input: InputParams<IViewAudio>): Promise<unknown>;
587
+ /**
588
+ * Tracks a View AudioPage event and automatically fires a Leave AudioPage event when the user
589
+ * navigates away.
590
+ *
591
+ * The Leave AudioPage event requires audio engagement statistics (`leaveAudio`) that the SDK
592
+ * cannot compute on its own. Provide a `leaveAudioBuilder` callback in the `leaveTracking`
593
+ * options — it is called at leave time (not at registration time), so it always captures the
594
+ * latest state. If no builder is supplied all audio engagement fields default to `0`.
595
+ *
596
+ * `activityDurationMs` and `durationMs` are computed by the leave tracking system and must
597
+ * **not** be included in the value returned by `leaveAudioBuilder`.
598
+ *
599
+ * @example
600
+ * ```ts
601
+ * // Minimal — leave fires with zeroed audio stats
602
+ * await tracker.trackViewAudioPage(input, {
603
+ * leaveTracking: { objectElement: document.getElementById('audio-player')! },
604
+ * });
605
+ *
606
+ * // With leaveAudioBuilder — capture live playback stats at leave time
607
+ * await tracker.trackViewAudioPage(input, {
608
+ * leaveTracking: {
609
+ * objectElement: document.getElementById('audio-player')!,
610
+ * leaveAudioBuilder: () => ({
611
+ * audioStarted: player.tracksStarted,
612
+ * audioCompleted: player.tracksCompleted,
613
+ * maxPlaylistPosition: player.maxPosition,
614
+ * playlistPositionPercentage: player.positionPercentage,
615
+ * }),
616
+ * },
617
+ * });
618
+ *
619
+ * // Disable leave tracking entirely
620
+ * await tracker.trackViewAudioPage(input, { leaveTracking: false });
621
+ * ```
622
+ *
623
+ * @param input
624
+ * @param options
625
+ * @category TPaaS Tracking
626
+ */
627
+ trackViewAudioPage(input: InputParams<IViewAudioPage>, options: TrackViewAudioPageOptions): Promise<unknown>;
628
+ /**
629
+ * @param input
630
+ * @param options
631
+ * @category TPaaS Tracking
632
+ */
633
+ trackViewError(input: InputParams<IViewError>, options: TrackViewEventOptions): Promise<unknown>;
634
+ /**
635
+ * @param input
636
+ * @category TPaaS Tracking
637
+ */
638
+ trackImpressionForm(input: InputParams<IImpressionForm>): Promise<unknown>;
639
+ /**
640
+ * @param input
641
+ * @category TPaaS Tracking
642
+ */
643
+ trackImpressionOffer(input: InputParams<IImpressionOffer>): Promise<unknown>;
644
+ /**
645
+ * @param input
646
+ * @category TPaaS Tracking
647
+ */
648
+ trackImpressionPlayer(input: InputParams<IImpressionPlayer>): Promise<unknown>;
649
+ /**
650
+ * @param input
651
+ * @category TPaaS Tracking
652
+ */
653
+ trackImpressionTeaser(input: InputParams<IImpressionTeaser>): Promise<unknown>;
654
+ /**
655
+ * @param input
656
+ * @category TPaaS Tracking
657
+ */
658
+ trackImpressionUIElement(input: InputParams<IImpressionUIElement>): Promise<unknown>;
659
+ /**
660
+ * @param input
661
+ * @param options
662
+ * @category TPaaS Tracking
663
+ */
664
+ trackViewFrontpage(input: InputParams<IViewFrontpage>, options: TrackViewEventOptions): Promise<unknown>;
665
+ /**
666
+ * @param input
667
+ * @param options
668
+ * @category TPaaS Tracking
669
+ */
670
+ trackViewLandingpage(input: InputParams<IViewLandingpage>, options: TrackViewEventOptions): Promise<unknown>;
671
+ /**
672
+ * @param input
673
+ * @param options
674
+ * @category TPaaS Tracking
675
+ */
676
+ trackViewListing(input: InputParams<IViewListing>, options: TrackViewEventOptions): Promise<unknown>;
677
+ /**
678
+ * @param input
679
+ * @param options
680
+ * @category TPaaS Tracking
681
+ */
682
+ trackViewLockedArticle(input: InputParams<IViewLockedArticle>, options: TrackViewEventOptions): Promise<unknown>;
683
+ /**
684
+ * @param input
685
+ * @param options
686
+ * @category TPaaS Tracking
687
+ */
688
+ trackViewLockedAudio(input: InputParams<IViewLockedAudio>): Promise<unknown>;
689
+ /**
690
+ * @param input
691
+ * @param options
692
+ * @category TPaaS Tracking
693
+ */
694
+ trackViewLockedAudioPage(input: InputParams<IViewLockedAudioPage>, options: TrackViewEventOptions): Promise<unknown>;
695
+ /**
696
+ * @param input
697
+ * @category TPaaS Tracking
698
+ */
699
+ trackViewLockedVideo(input: InputParams<IViewLockedVideo>): Promise<unknown>;
700
+ /**
701
+ * @param input
702
+ * @param options
703
+ * @category TPaaS Tracking
704
+ */
705
+ trackViewLockedVideoPage(input: InputParams<IViewLockedVideoPage>, options: TrackViewEventOptions): Promise<unknown>;
706
+ /**
707
+ * @param input
708
+ * @category TPaaS Tracking
709
+ */
710
+ trackViewVideo(input: InputParams<IViewVideo>): Promise<unknown>;
711
+ /**
712
+ * Tracks a View VideoPage event and automatically fires a Leave VideoPage event when the user
713
+ * navigates away.
714
+ *
715
+ * The Leave VideoPage event supports an optional `leaveStories` field containing story carousel
716
+ * statistics that the SDK cannot compute. Provide a `leaveStoriesBuilder` callback in the
717
+ * `leaveTracking` options — it is called at leave time (not at registration time), so it always
718
+ * captures the latest state. If no builder is supplied `leaveStories` is omitted from the Leave
719
+ * VideoPage event.
720
+ *
721
+ * `activityDurationMs` and `durationMs` are computed by the leave tracking system and must
722
+ * **not** be included in the value returned by `leaveStoriesBuilder`.
723
+ *
724
+ * @example
725
+ * ```ts
726
+ * // Without story stats — leaveStories is omitted from the Leave VideoPage event
727
+ * await tracker.trackViewVideoPage(input, {
728
+ * leaveTracking: { objectElement: document.getElementById('video-player')! },
729
+ * });
730
+ *
731
+ * // With leaveStoriesBuilder — capture live story stats at leave time
732
+ * await tracker.trackViewVideoPage(input, {
733
+ * leaveTracking: {
734
+ * objectElement: document.getElementById('video-player')!,
735
+ * leaveStoriesBuilder: () => ({
736
+ * storiesCompleted: stories.completed,
737
+ * storiesStarted: stories.started,
738
+ * maxPlaylistPosition: stories.maxPosition,
739
+ * playlistPositionPercentage: stories.positionPercentage,
740
+ * adCount: stories.adCount,
741
+ * }),
742
+ * },
743
+ * });
744
+ *
745
+ * // Disable leave tracking entirely
746
+ * await tracker.trackViewVideoPage(input, { leaveTracking: false });
747
+ * ```
748
+ *
749
+ * @param input
750
+ * @param options
751
+ * @category TPaaS Tracking
752
+ */
753
+ trackViewVideoPage(input: InputParams<IViewVideoPage>, options: TrackViewVideoPageOptions): Promise<unknown>;
754
+ /**
755
+ * @param input
756
+ * @param options
757
+ * @category TPaaS Tracking
758
+ */
759
+ trackViewWeather(input: InputParams<IViewWeather>, options: TrackViewEventOptions): Promise<unknown>;
760
+ /**
761
+ * @param input
762
+ * @category TPaaS Tracking
763
+ */
764
+ trackLeaveArticle(input: InputParams<ILeaveArticle>): Promise<unknown>;
765
+ /**
766
+ * @param input
767
+ * @category TPaaS Tracking
768
+ */
769
+ trackLeaveAudioPage(input: InputParams<ILeaveAudioPage>): Promise<unknown>;
770
+ /**
771
+ * @param input
772
+ * @category TPaaS Tracking
773
+ */
774
+ trackLeaveError(input: InputParams<ILeaveError>): Promise<unknown>;
775
+ /**
776
+ * @param input
777
+ * @category TPaaS Tracking
778
+ */
779
+ trackLeaveFrontpage(input: InputParams<ILeaveFrontpage>): Promise<unknown>;
780
+ /**
781
+ * @param input
782
+ * @category TPaaS Tracking
783
+ */
784
+ trackLeaveLandingpage(input: InputParams<ILeaveLandingpage>): Promise<unknown>;
785
+ /**
786
+ * @param input
787
+ * @category TPaaS Tracking
788
+ */
789
+ trackLeaveListing(input: InputParams<ILeaveListing>): Promise<unknown>;
790
+ /**
791
+ * @param input
792
+ * @category TPaaS Tracking
793
+ */
794
+ trackLeaveLockedArticle(input: InputParams<ILeaveLockedArticle>): Promise<unknown>;
795
+ /**
796
+ * @param input
797
+ * @category TPaaS Tracking
798
+ */
799
+ trackLeaveLockedAudio(input: InputParams<ILeaveLockedAudio>): Promise<unknown>;
800
+ /**
801
+ * @param input
802
+ * @category TPaaS Tracking
803
+ */
804
+ trackLeaveLockedAudioPage(input: InputParams<ILeaveLockedAudioPage>): Promise<unknown>;
805
+ /**
806
+ * @param input
807
+ * @category TPaaS Tracking
808
+ */
809
+ trackLeaveLockedVideo(input: InputParams<ILeaveLockedVideo>): Promise<unknown>;
810
+ /**
811
+ * @param input
812
+ * @category TPaaS Tracking
813
+ */
814
+ trackLeaveLockedVideoPage(input: InputParams<ILeaveLockedVideoPage>): Promise<unknown>;
815
+ /**
816
+ * @param input
817
+ * @category TPaaS Tracking
818
+ */
819
+ trackLeavePage(input: InputParams<ILeavePage>): Promise<unknown>;
820
+ /**
821
+ * @param input
822
+ * @category TPaaS Tracking
823
+ */
824
+ trackLeaveVideoPage(input: InputParams<ILeaveVideoPage>): Promise<unknown>;
825
+ /**
826
+ * @param input
827
+ * @category TPaaS Tracking
828
+ */
829
+ trackLeaveWeather(input: InputParams<ILeaveWeather>): Promise<unknown>;
830
+ /**
831
+ * @param input
832
+ * @category TPaaS Tracking
833
+ */
834
+ trackEngagementAudio(input: InputParams<IEngagementAudio>): Promise<unknown>;
835
+ /**
836
+ * @param input
837
+ * @category TPaaS Tracking
838
+ */
839
+ trackEngagementForm(input: InputParams<IEngagementForm>): Promise<unknown>;
840
+ /**
841
+ * @param input
842
+ * @category TPaaS Tracking
843
+ */
844
+ trackEngagementOffer(input: InputParams<IEngagementOffer>): Promise<unknown>;
845
+ /**
846
+ * @param input
847
+ * @category TPaaS Tracking
848
+ */
849
+ trackEngagementTeaser(input: InputParams<IEngagementTeaser>): Promise<unknown>;
850
+ /**
851
+ * @param input
852
+ * @category TPaaS Tracking
853
+ */
854
+ trackEngagementUIElement(input: InputParams<IEngagementUIElement>): Promise<unknown>;
855
+ /**
856
+ * @param input
857
+ * @category TPaaS Tracking
858
+ */
859
+ trackEngagementVideo(input: InputParams<IEngagementVideo>): Promise<unknown>;
860
+ /**
861
+ * @param input
862
+ * @category TPaaS Tracking
863
+ */
864
+ trackEngagementVideoAd(input: InputParams<IEngagementVideoAd>): Promise<unknown>;
865
+ /**
866
+ * @param input
867
+ * @category TPaaS Tracking
868
+ */
869
+ trackEngagementWidget(input: InputParams<IEngagementWidget>): Promise<unknown>;
870
+ /**
871
+ * this is the method that actually sends the event to the server
872
+ * @private
873
+ * @category TPaaS Tracking
874
+ */
875
+ private sendTpaasEvent;
876
+ /**
877
+ * Send all events that are in the internal event queue.
878
+ *
879
+ * The returned Promise will resolve with the array of events that was
880
+ * successfully transmitted. These events will have been removed from the event
881
+ * queue. If the promise rejects, it means that the event queue could not be
882
+ * sent and the promise rejection will contain the events that failed (will be
883
+ * the entire queue initial call). Events that are unsuccessfully sent will
884
+ * remain in the event queue.
885
+ *
886
+ * @internal
887
+ * @category TPaaS Tracking
888
+ */
889
+ _sendImmediatelyTpaas(): Promise<Array<ITpaasEvent>>;
890
+ /**
891
+ * Prepares the received event queue and handles success / failure after sending.
892
+ *
893
+ * @param eventQueue
894
+ * @param retryEventQueue
895
+ * @private
896
+ * @category TPaaS Tracking
897
+ */
898
+ private prepareQueuesAndSendTpaas;
899
+ /**
900
+ * Evaluate all input given to the sdk/this method and pass it through the
901
+ * appropriate event formatter.
902
+ * @internal
903
+ * @category Legacy Tracking
904
+ */
905
+ evaluateEvent<T extends keyof EventTrackingMethods>(eventType: T, input: EventInputTypesByTrackingMethod[T], builders?: Builders, options?: TrackOptions): Promise<ReturnType<EventTrackingMethods[T]>>;
906
+ /**
907
+ * @param eventType
908
+ * @param eventInput
909
+ * @param builders
910
+ * @param options
911
+ * @internal
912
+ * @category Legacy Tracking
913
+ */
914
+ evaluateEventInputs<T extends keyof EventTrackingMethods>(eventType: T, eventInput: EventInputTypesByTrackingMethod[T], builders?: Builders, options?: TrackOptions): Promise<any>;
915
+ /**
916
+ * Gets user consents from the tracker's state.
917
+ * @returns {Consents}
918
+ * @category Consents
919
+ */
920
+ getConsents(): Promise<Consents>;
921
+ /**
922
+ * Sets user consents to be sent with each event.
923
+ * Given that User's consent for Advertising changed, the next call to get Advertising Identifiers must be forced, and
924
+ * not retrieve values from cache. The flag is passed with the trackers state, and updated to a "non-forcing" state
925
+ * right after, characterising the "force once" behaviour.
926
+ * accessing Advertising Identifiers directly must clear this flag.
927
+ * Not usable with autoCreateConsents option
928
+ * @param consentsInput
929
+ * @returns {Consents}
930
+ * @category Consents
931
+ */
932
+ setConsents(consentsInput: Consents): Consents;
933
+ /**
934
+ * Return a new Tracker with the current state
935
+ * @category Tracking
936
+ */
937
+ clone({ trackerId }?: TrackCloneOptions): Tracker;
938
+ /**
939
+ * Update the persisted state that is passed to all events
940
+ *
941
+ * Calling
942
+ * ```
943
+ * tracker.update({ actor: 'person@example.org' });
944
+ * tracker.trackPageView();
945
+ * tracker.trackPageView();
946
+ * ```
947
+ *
948
+ * is equivalent of doing
949
+ *
950
+ * ```
951
+ * tracker.trackPageView({ actor: 'person@example.org' });
952
+ * tracker.trackPageView({ actor: 'person@example.org' });
953
+ * ```
954
+ *
955
+ * @param builder data passed to event functions
956
+ * @param mergeBuilder the given data will be merged deeply with the
957
+ * existing state. False will result in the previous state being overwritten
958
+ * @category Legacy Tracking
959
+ */
960
+ update(builder: EventInput, mergeBuilder?: boolean): void;
961
+ /**
962
+ * Get the actor id (userId) from the current browser. A promise is returned
963
+ * because a call may be made to complete the login process.
964
+ *
965
+ * *Note*: This method will return a Promise that is always rejected on node
966
+ environments.
967
+ @category Identifiers
968
+ */
969
+ getUserId(): Promise<string | number | undefined>;
970
+ /**
971
+ * Get the advertisement id (adId) from the current browser. A promise is returned
972
+ * because a CIS call is done to generate a new adId if no cookie is
973
+ * found.
974
+ *
975
+ * *Note*: This method will return a Promise that is always rejected on node
976
+ * environments.
977
+ * @category Identifiers
978
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
979
+ */
980
+ getAdId(): Promise<string | undefined>;
981
+ /**
982
+ * @category Identifiers
983
+ * @deprecated moving away from "Actor" terminology, in favor of "User"
984
+ */
985
+ getActor(): Promise<ActorInput | undefined>;
986
+ /**
987
+ * Get the environment id from the current browser. A promise is returned
988
+ * because a CIS call is done to generate a new environmentId if no cookie is
989
+ * found.
990
+ *
991
+ * *Note*: This method will return a Promise that is always rejected on node
992
+ * environments.
993
+ * @category Identifiers
994
+ */
995
+ getEnvironmentId(): Promise<string | undefined>;
996
+ /**
997
+ * Returns the PPID1 value for Xandr integration.
998
+ * This is the "logged in identifier".
999
+ * @category Identifiers
1000
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
1001
+ */
1002
+ getXandrPPID1(): Promise<string | undefined>;
1003
+ /**
1004
+ * Returns the PPID2 value for Xandr integration.
1005
+ * This is the "not logged in identifier".
1006
+ * @category Identifiers
1007
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
1008
+ */
1009
+ getXandrPPID2(): Promise<string | undefined>;
1010
+ /**
1011
+ * Returns the Advertising Identifiers for the vendor given in SDK configuration
1012
+ * @category Identifiers
1013
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
1014
+ */
1015
+ getAdvertisingIdentifiers(): Promise<AdvertisingIdentifiers>;
1016
+ /**
1017
+ * Returns the Advertising Identifiers for the vendor given in SDK configuration
1018
+ * @param [_vendor]
1019
+ * @category Identifiers
1020
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
1021
+ */
1022
+ getAdvertisingIdentifiers(_vendor?: string[]): Promise<AdvertisingIdentifiers>;
1023
+ /**
1024
+ * Returns the UUID currently used as the page view (will be muted by `newPageView` and `trackPageView`).
1025
+ * @category Tracking
1026
+ */
1027
+ getPageViewId(): string;
1028
+ /**
1029
+ * Returns the current session ID.
1030
+ * If a session exists, returns the session ID immediately.
1031
+ * If no session exists yet, returns a promise that resolves with the session ID
1032
+ * when it gets created (typically when the first non-anonymous tracking event is sent).
1033
+ *
1034
+ * Note: Anonymous events (such as those sent via {@link trackAnonymous} or {@link trackAnonymousViewUIElement})
1035
+ * do not create sessions and will not resolve pending session ID promises. The promise will only resolve when a
1036
+ * non-anonymous tracking event is sent.
1037
+ *
1038
+ * It is possible the promise will never get resolved if there are no non-anonymous events being tracked after calling this method.
1039
+ *
1040
+ * @category Tracking
1041
+ * @returns The session ID, or a promise that resolves to the session ID
1042
+ */
1043
+ getSessionId(): Promise<string>;
1044
+ /**
1045
+ * Generate a new page view id. Will be attached to all events until a new id is generated.
1046
+ * @category Tracking
1047
+ */
1048
+ newPageView(): void;
1049
+ /**
1050
+ * Fetches the Remote Configuration, setting the CIS and Collector base urls
1051
+ * @internal
1052
+ * @category Configuration
1053
+ */
1054
+ _applyRemoteConfigEndpoints(): Promise<void>;
1055
+ /**
1056
+ * @param input
1057
+ * @param builders
1058
+ * @internal
1059
+ * @category Configuration
1060
+ */
1061
+ syncRemoteResources(input?: unknown, builders?: Builders): Promise<{
1062
+ adId?: string;
1063
+ doTracking: boolean;
1064
+ environmentId?: string;
1065
+ ppId?: import("@schibsted/pulse-cis-sync").PPIDsByVendor;
1066
+ }>;
1067
+ /**
1068
+ * @internal
1069
+ * @category Configuration
1070
+ */
1071
+ _getCollectorPath(): string;
1072
+ /**
1073
+ * Returns the collector URL for TPaaS events.
1074
+ * Uses the tpaasCollectorBaseUrl when available (driven by deployStageTpaas),
1075
+ *
1076
+ * @internal
1077
+ * @category Configuration
1078
+ */
1079
+ _getTpaasCollectorPath(): string;
1080
+ /**
1081
+ * Send all events that are in the internal event queue.
1082
+ *
1083
+ * The returned Promise will resolve with the array of events that was
1084
+ * successfully transmitted. These events will have been removed from the event
1085
+ * queue. If the promise rejects, it means that the event queue could not be
1086
+ * sent and the promise rejection will contain the events that failed (will be
1087
+ * the entire queue initial call). Events that are unsuccessfully sent will
1088
+ * remain in the event queue.
1089
+ *
1090
+ * @internal
1091
+ * @category Legacy Tracking
1092
+ *
1093
+ */
1094
+ _sendImmediately(): Promise<Array<EventInput>>;
1095
+ /**
1096
+ * @param event
1097
+ * @param options
1098
+ * @internal
1099
+ * @category Legacy Tracking
1100
+ */
1101
+ _push(event: EventInput, options?: TrackOptions): Promise<ResolvedInput>;
1102
+ /**
1103
+ * @param bookmarkKey
1104
+ * @internal
1105
+ * @category Legacy Tracking
1106
+ */
1107
+ getBookmarkedEvent(bookmarkKey: string): Record<string, unknown> | undefined;
1108
+ /**
1109
+ * Send the current event queue to the back end event receiver. This event is
1110
+ * debounced, @see {SDKConfigInput} to override the default timing.
1111
+ *
1112
+ * This method is called by `track()` so it is not necessary to call after
1113
+ * adding events to the queue.
1114
+ * @internal
1115
+ * @category Legacy Tracking
1116
+ */
1117
+ send(): Promise<EventInput[] | undefined | unknown>;
1118
+ /**
1119
+ * A convenience method which first updates the current pageViewId in the
1120
+ * tracker state and then sends a `tracker-event` with `@type: View` and the
1121
+ * merged result of the given data and the data saved in the tracker.
1122
+ *
1123
+ * Equivalent to
1124
+ *
1125
+ * ```ts
1126
+ * tracker.newPageView();
1127
+ * tracker.track('trackerEvent', { type: 'View', ...data });
1128
+ * ```
1129
+ * @category Legacy Tracking
1130
+ */
1131
+ trackPageView(data?: EventInput, options?: TrackOptions): Promise<unknown>;
1132
+ /**
1133
+ * Start sending events when users leave a page.
1134
+ * This will register handlers on the browser events 'pagehide', 'popstate', 'beforeunload' and 'visibilitychange'
1135
+ * and will send a Leave event when these are triggered. The leave event will be a copy of the last sent view-event
1136
+ * + engagement values. The fields in the default
1137
+ * event can be found here: https://pages.github.schibsted.io/mpt-data/pulse-standard/#leave-article.
1138
+ * The Leave event can be expanded further by passing an event-builder as the third param, but this is not recommended.
1139
+ *
1140
+ * Example usage:
1141
+ *
1142
+ * ```ts
1143
+ * const pageElement = document.querySelector('#application') || document.body;
1144
+ * const articleElement = document.getElementById('article-element');
1145
+ * tracker.addPageLeaveTracking(articleElement, pageElement);
1146
+ * ```
1147
+ *
1148
+ * Passing '\{ objectResizable: true \}' as the 4th param makes the SDK re-calculate the object height whenever it changes,
1149
+ * which is useful for when the page or object changes size after loading, by ex
1150
+ * ```
1151
+ * ...
1152
+ * tracker.addPageLeaveTracking(articleElement, pageElement, undefined, {
1153
+ * objectResizable: true,
1154
+ * });
1155
+ * ```
1156
+ *
1157
+ * Keep in mind that the Beacon API is used to send events to page leave, and in order to guarantee as good as
1158
+ * possible that these events are sent, the event creator parameter should be synchronous.
1159
+ *
1160
+ * For the same reasons, we advise that the event creator parameter returns an event that does not contain any promises.
1161
+ *
1162
+ * @param {Element} objectElement The DOM element that is used to calculate various view-related fields in the default event.
1163
+ * @param {Element} pageElement The DOM element that represents the page that the user is currently on.
1164
+ * @param {LeaveEventBuilder} eventBuilder Function that returns an event to send when user leaves the page.
1165
+ * @param {LeaveEventOptions} options
1166
+ * @returns {(leaveEvent: LeaveEvent) => void} A function to update the event to send on page leave.
1167
+ * @category Leave Event
1168
+ */
1169
+ addPageLeaveTracking(objectElement: Element, pageElement: Element, eventBuilder?: LeaveEventBuilder, options?: LeaveEventOptions): (leaveEvent: LeaveEvent) => void;
1170
+ /**
1171
+ * Stop sending events when users leave a page.
1172
+ * Removes all event handlers, meaning that to event will be sent if the user leaves the page.
1173
+ * @category Leave Event
1174
+ */
1175
+ removePageLeaveTracking(): void;
1176
+ /**
1177
+ * Update leave tracking.
1178
+ * Updates the DOM element used to calculate the default fields in the Leave event.
1179
+ * @param objectElement The DOM element that is used to calculate various view-related fields in the default event.
1180
+ * @param pageElement The DOM element that represents the page that the user is currently on.
1181
+ * @param resetProperties A flag that decided whether the engagement properties of the Leave event should
1182
+ * be reset when the tracking is updated. Defaults to false.
1183
+ * @category Leave Event
1184
+ */
1185
+ updatePageLeaveTracking(objectElement: Element, pageElement: Element, resetProperties?: boolean): void;
1186
+ /**
1187
+ * Manually trigger a viewed content recalculation including resetting max-values
1188
+ * @param objectElement The DOM element that is used to calculate various view-related fields in the
1189
+ * default event.
1190
+ * @param pageElement The DOM element that represents the page that the user is currently on.
1191
+ * @category Leave Event
1192
+ */
1193
+ resetPageLeaveViewedContent(objectElement: Element, pageElement: Element): void;
1194
+ /**
1195
+ * Manually trigger a viewed content recalculation without resetting max-values
1196
+ * @param objectElement The DOM element that is used to calculate various view-related fields in the
1197
+ * default event.
1198
+ * @param pageElement The DOM element that represents the page that the user is currently on.
1199
+ * @category Leave Event
1200
+ */
1201
+ updatePageLeaveViewedContent(objectElement: Element, pageElement: Element): void;
1202
+ /**
1203
+ * Manually trigger a Leave event
1204
+ * Useful if for example the consuming website is an SPA and the normal browser events are not triggered.
1205
+ * is generated internally in the SDK.
1206
+ * @param eventInput
1207
+ * @param eventName The optional name of the browser event to simulate.
1208
+ * @category Leave Event
1209
+ */
1210
+ trackPageLeave(eventInput?: LeaveEvent, eventName?: string): Promise<void>;
1211
+ /**
1212
+ * Manually trigger a Leave event only if Page Leave tracking is active in the SDK
1213
+ * This method works similarly to
1214
+ * ```
1215
+ * trackPageLeave(event: LeaveEvent, eventName?: string)
1216
+ * ```
1217
+ * with the added guarantee that a second Leave event will not be triggered if one already has been sent.
1218
+ * is generated internally in the SDK.
1219
+ * @param eventInput
1220
+ * @param eventName The optional name of the browser event to simulate.
1221
+ * @category Leave Event
1222
+ */
1223
+ trackActivePageLeave(eventInput?: LeaveEvent, eventName?: string): void;
1224
+ /**
1225
+ * Check if leave tracking is enabled (if an event will be sent when the user leaves the page)
1226
+ * ```
1227
+ * isLeaveTrackingActive()
1228
+ * ```
1229
+ * @category Leave Event
1230
+ */
1231
+ isLeaveTrackingActive(): boolean;
1232
+ /**
1233
+ * Update leave tracking.
1234
+ * Updates the DOM element used to calculate the default fields in the Leave event.
1235
+ * @param {Element} objectElement The DOM element that is used to calculate various view-related fields in the default event.
1236
+ * @param {Element} pageElement The DOM element that represents the page that the user is currently on.
1237
+ * @param {boolean} resetProperties A flag that decided whether the engagement properties of the Leave event should
1238
+ * be reset when the tracking is updated. Defaults to false.
1239
+ * @category TPaaS Leave Tracking
1240
+ */
1241
+ updateTpaasLeaveTracking(objectElement: Element, pageElement: Element, resetProperties?: boolean): void;
1242
+ /**
1243
+ * Manually trigger a viewed content recalculation including resetting max-values
1244
+ * @param {Element} objectElement The DOM element that is used to calculate various view-related fields in the
1245
+ * default event.
1246
+ * @param {Element} pageElement The DOM element that represents the page that the user is currently on.
1247
+ * @category TPaaS Leave Tracking
1248
+ */
1249
+ resetTpaasLeaveViewedContent(objectElement: Element, pageElement: Element): void;
1250
+ /**
1251
+ * Manually trigger a viewed content recalculation without resetting max-values
1252
+ * @param {Element} objectElement The DOM element that is used to calculate various view-related fields in the
1253
+ * default event.
1254
+ * @param {Element} pageElement The DOM element that represents the page that the user is currently on.
1255
+ * @category TPaaS Leave Tracking
1256
+ */
1257
+ updateTpaasLeaveViewedContent(objectElement: Element, pageElement: Element): void;
1258
+ /**
1259
+ * Get the current Leave object. Useful to fetch before manually sending a leave event using one of the trackLeaveX TPaaS methods.
1260
+ * @returns {ILeave} The current Leave event object.
1261
+ * @category TPaaS Leave Tracking
1262
+ */
1263
+ getTpaasLeaveObject(): ILeave;
1264
+ /**
1265
+ * Manually trigger a Leave event only if Page Leave tracking is active in the SDK
1266
+ * This method works similarly to the track TPaaS methods trackLeaveX
1267
+ * ```
1268
+ * trackLeavePage(input: InputParams<ILeavePage>)
1269
+ * ```
1270
+ * with the added guarantee that a second Leave event will not be triggered if one already has been sent.
1271
+ * @category TPaaS Leave Tracking
1272
+ */
1273
+ trackTpaasActiveLeave(): void;
1274
+ /**
1275
+ * Check if leave tracking is enabled (if an event will be sent when the user leaves the page)
1276
+ * ```
1277
+ * isLeaveTpaasTrackingActive()
1278
+ * ```
1279
+ * @category TPaaS Leave Tracking
1280
+ */
1281
+ isLeaveTpaasTrackingActive(): boolean;
1282
+ /**
1283
+ * Start listening for events from the Tracker Proxy clients.
1284
+ * @returns teardown function that stops the listener
1285
+ */
1286
+ exposeToProxyClients(): () => void;
1287
+ /**
1288
+ * @param input
1289
+ * @private
1290
+ */
1291
+ private resolveTrackInput;
1292
+ /**
1293
+ * @private
1294
+ */
1295
+ private resolveTrackGlobals;
1296
+ /**
1297
+ * Send all anonymous events that are in the internal anonymous event queue.
1298
+ *
1299
+ * The returned Promise will resolve with the array of anonymous events that was
1300
+ * successfully transmitted. These anonymous events will have been removed from the anonymous event
1301
+ * queue. If the promise rejects, it means that the anonymous event queue could not be
1302
+ * sent and the promise rejection will contain the anonymous events that failed.
1303
+ * Anonymous events that are unsuccessfully sent will remain in the anonymous event queue.
1304
+ *
1305
+ * @internal
1306
+ *
1307
+ */
1308
+ private _sendImmediatelyAnonymous;
1309
+ /**
1310
+ * @param event
1311
+ * @param options
1312
+ * @internal
1313
+ */
1314
+ private _pushAnonymous;
1315
+ /**
1316
+ * Send the current anonymous event queue to the back end event receiver. This event is
1317
+ * debounced, @see {SDKConfigInput} to override the default timing.
1318
+ *
1319
+ * This method is called by `trackAnonymous()` so it is not necessary to call after
1320
+ * adding events to the queue.
1321
+ *
1322
+ * @internal
1323
+ */
1324
+ private sendAnonymous;
1325
+ /**
1326
+ * Prepares the received event queue and handles success / failure after sending.
1327
+ *
1328
+ * @param eventQueue
1329
+ * @param retryEventQueue
1330
+ * @private
1331
+ */
1332
+ private prepareQueuesAndSend;
1333
+ /**
1334
+ * Creates a new event with values that are global to all event types, and are resolved internally by the sdk.
1335
+ * `creationDate` and `session` are defined as early as possible in the event lifecycle, ensuring they are aligned
1336
+ * and consistent across all events.
1337
+ *
1338
+ * @category Tracker
1339
+ * @private
1340
+ */
1341
+ private createEvent;
1342
+ /**
1343
+ * Helper method to resolve any pending session ID promise
1344
+ * @private
1345
+ */
1346
+ private resolveSessionIdPromise;
1347
+ /**
1348
+ * Creates a new anonymous event with values that are global to all event types, and are resolved internally by the sdk.
1349
+ * `creationDate` is defined as early as possible in the event lifecycle, ensuring it is aligned and consistent across all events.
1350
+ *
1351
+ * Note: anonymous events do not have a `session` object.
1352
+ *
1353
+ * @category Tracker
1354
+ * @private
1355
+ */
1356
+ private createAnonymousEvent;
1357
+ /**
1358
+ * applyEventTypeDefaults
1359
+ * @param eventInput
1360
+ * @param eventType
1361
+ * @private
1362
+ */
1363
+ private applyEventTypeDefaults;
1364
+ /**
1365
+ * @param eventInput
1366
+ * @param eventType
1367
+ * @private
1368
+ */
1369
+ private applyAnonymousEventTypeDefaults;
1370
+ /**
1371
+ * applyBookmarkedEvent
1372
+ * @param eventInput
1373
+ * @param bookmarkKey
1374
+ * @private
1375
+ */
1376
+ private applyBookmarkedEvent;
1377
+ /**
1378
+ * applyConsents
1379
+ * @param eventInput
1380
+ * @private
1381
+ */
1382
+ private applyConsents;
1383
+ /**
1384
+ * applyConsentsAnonymous
1385
+ * @param eventInput
1386
+ * @private
1387
+ */
1388
+ private applyConsentsAnonymous;
1389
+ /**
1390
+ * Enriches the event with consent data saved in state.
1391
+ * @private
1392
+ * @category Consents
1393
+ */
1394
+ private evaluateConsents;
1395
+ /**
1396
+ * Enriches the anonymous event with consent data saved in state.
1397
+ *
1398
+ * If the consents are a promise, it will return a fallback consent object, instead of waiting for consents to resolve
1399
+ * @private
1400
+ * @category Consents
1401
+ */
1402
+ private evaluateConsentsAnonymous;
1403
+ /**
1404
+ * Private version of {@link setConsents} that works with autoCreateConsents
1405
+ * @param consentsInput
1406
+ * @private
1407
+ * @category Consents
1408
+ */
1409
+ private setConsentsInternal;
1410
+ /**
1411
+ * Get the includeAdvertising flag, set on initialisation.
1412
+ * @see constructor
1413
+ * @private
1414
+ * @category Identifiers
1415
+ */
1416
+ private getIncludeAdvertising;
1417
+ }
1418
+ export {};