@schibsted/pulse-sdk 8.0.0-rc.1 → 8.0.0-rc.11

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 (351) hide show
  1. package/dist/cjs/Tracker.js +280 -305
  2. package/dist/cjs/app-integration.js +3 -3
  3. package/dist/cjs/builders/actor.js +6 -6
  4. package/dist/cjs/builders/consents.js +8 -8
  5. package/dist/cjs/builders/device-browser.js +8 -8
  6. package/dist/cjs/builders/device-node.js +3 -3
  7. package/dist/cjs/builders/events-anonymous-node.js +3 -3
  8. package/dist/cjs/builders/events-node.js +7 -7
  9. package/dist/cjs/builders/experimentMetadata.js +2 -2
  10. package/dist/cjs/builders/experiments.js +1 -0
  11. package/dist/cjs/builders/objects/objects-anonymous-browser.js +2 -2
  12. package/dist/cjs/builders/objects/objects-anonymous-node.js +9 -9
  13. package/dist/cjs/builders/objects/objects-browser.js +2 -2
  14. package/dist/cjs/builders/objects/objects-node.js +10 -10
  15. package/dist/cjs/builders/objects/utils.js +3 -3
  16. package/dist/cjs/builders/origin-browser.js +2 -2
  17. package/dist/cjs/builders/origin-node.js +4 -4
  18. package/dist/cjs/builders/session-browser.js +5 -5
  19. package/dist/cjs/cis-sync/cis-browser.js +219 -0
  20. package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/cis.js +0 -1
  21. package/dist/cjs/cis-sync/eventEmitter.js +37 -0
  22. package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/index.js +0 -1
  23. package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/pulse-cookie.js +53 -63
  24. package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/storage/pulseStorage.js +28 -21
  25. package/dist/cjs/cis-sync/storage/storage.js +24 -0
  26. package/dist/cjs/createPulseTracker.js +4 -4
  27. package/dist/cjs/identity/actor.js +20 -8
  28. package/dist/cjs/identity/advertising.js +1 -1
  29. package/dist/cjs/identity/cis.js +7 -6
  30. package/dist/cjs/index.js +3 -3
  31. package/dist/cjs/leaveTracking/index.js +10 -10
  32. package/dist/cjs/leaveTrackingTpaas/constants.js +2 -7
  33. package/dist/cjs/leaveTrackingTpaas/index.js +59 -47
  34. package/dist/cjs/network-browser.js +3 -3
  35. package/dist/cjs/remoteConfig/index.js +5 -5
  36. package/dist/cjs/tpaas-builders/builders/catalogVersion.js +9 -0
  37. package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/device.js +10 -4
  38. package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/navigationType.js +2 -3
  39. package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/pageInfo.js +2 -2
  40. package/dist/cjs/tpaas-builders/builders/provider.js +16 -0
  41. package/dist/cjs/tpaas-builders/builders/referrer.js +17 -0
  42. package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/session.js +25 -12
  43. package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/user.js +1 -1
  44. package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/utm.js +3 -3
  45. package/dist/cjs/tpaas-builders/builders.js +263 -0
  46. package/dist/cjs/tpaas-builders/guards.js +7 -0
  47. package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/index.js +3 -0
  48. package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/tpaas-builders}/types.js +0 -1
  49. package/{node_modules/@schibsted/tpaas-schemas/dist/cjs → dist/cjs/tpaas-schemas}/constants.js +74 -140
  50. package/{node_modules/@schibsted/tpaas-schemas/dist/cjs → dist/cjs/tpaas-schemas}/index.js +1 -0
  51. package/dist/cjs/tpaas-schemas/types.js +2 -0
  52. package/dist/cjs/tracker-proxy/consts.js +12 -6
  53. package/dist/cjs/tracker-proxy/proxy-provider.js +8 -2
  54. package/dist/cjs/version.js +1 -1
  55. package/dist/cjs/visibility-observer/index.js +9 -7
  56. package/dist/cjs/wrapper/types/event.js +5 -0
  57. package/dist/cjs/wrapper/utils/map-page-to-page-ref.js +13 -0
  58. package/dist/ejs/Tracker.js +208 -233
  59. package/dist/ejs/app-integration.js +1 -1
  60. package/dist/ejs/builders/actor.js +3 -3
  61. package/dist/ejs/builders/consents.js +4 -4
  62. package/dist/ejs/builders/device-browser.js +2 -2
  63. package/dist/ejs/builders/device-node.js +1 -1
  64. package/dist/ejs/builders/events-anonymous-node.js +1 -1
  65. package/dist/ejs/builders/events-node.js +4 -4
  66. package/dist/ejs/builders/experimentMetadata.js +1 -1
  67. package/dist/ejs/builders/experiments.js +1 -1
  68. package/dist/ejs/builders/objects/objects-anonymous-browser.js +1 -1
  69. package/dist/ejs/builders/objects/objects-anonymous-node.js +1 -1
  70. package/dist/ejs/builders/objects/objects-browser.js +1 -1
  71. package/dist/ejs/builders/objects/objects-node.js +1 -1
  72. package/dist/ejs/builders/objects/utils.js +1 -1
  73. package/dist/ejs/builders/origin-browser.js +1 -1
  74. package/dist/ejs/builders/origin-node.js +1 -1
  75. package/dist/ejs/builders/session-browser.js +1 -1
  76. package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/cis-browser.js +17 -4
  77. package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/cis.js +0 -1
  78. package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/eventEmitter.js +0 -1
  79. package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/index.js +0 -1
  80. package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/pulse-cookie.js +1 -2
  81. package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/storage/pulseStorage.js +12 -4
  82. package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/storage/storage.js +6 -2
  83. package/dist/ejs/createPulseTracker.js +1 -1
  84. package/dist/ejs/identity/actor.js +21 -9
  85. package/dist/ejs/identity/advertising.js +1 -1
  86. package/dist/ejs/identity/cis.js +4 -3
  87. package/dist/ejs/index.js +4 -3
  88. package/dist/ejs/leaveTracking/index.js +1 -1
  89. package/dist/ejs/leaveTrackingTpaas/constants.js +1 -5
  90. package/dist/ejs/leaveTrackingTpaas/index.js +54 -42
  91. package/dist/ejs/network-browser.js +1 -1
  92. package/dist/ejs/remoteConfig/index.js +1 -1
  93. package/dist/ejs/tpaas-builders/builders/catalogVersion.js +6 -0
  94. package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/device.js +9 -3
  95. package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/navigationType.js +2 -3
  96. package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/pageInfo.js +1 -1
  97. package/dist/ejs/tpaas-builders/builders/provider.js +13 -0
  98. package/dist/ejs/tpaas-builders/builders/referrer.js +13 -0
  99. package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/session.js +20 -7
  100. package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/user.js +1 -1
  101. package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/utm.js +2 -2
  102. package/dist/ejs/tpaas-builders/builders.js +212 -0
  103. package/dist/ejs/tpaas-builders/guards.js +4 -0
  104. package/dist/ejs/tpaas-builders/index.js +2 -0
  105. package/{node_modules/@schibsted/tpaas-schemas/dist/ejs → dist/ejs/tpaas-schemas}/constants.js +72 -138
  106. package/{node_modules/@schibsted/tpaas-schemas/dist/ejs → dist/ejs/tpaas-schemas}/index.js +1 -0
  107. package/dist/ejs/tpaas-schemas/types.js +1 -0
  108. package/dist/ejs/tracker-proxy/consts.js +12 -6
  109. package/dist/ejs/tracker-proxy/proxy-provider.js +7 -1
  110. package/dist/ejs/version.js +1 -1
  111. package/dist/ejs/visibility-observer/index.js +9 -7
  112. package/dist/ejs/wrapper/types/event.js +4 -1
  113. package/dist/ejs/wrapper/utils/map-page-to-page-ref.js +10 -0
  114. package/dist/types/Tracker.d.ts +104 -96
  115. package/dist/types/builders/actor.d.ts +3 -2
  116. package/dist/types/builders/consents.d.ts +2 -2
  117. package/dist/types/builders/experiments.d.ts +1 -0
  118. package/dist/types/builders/index.d.ts +1 -1
  119. package/{node_modules/@schibsted/pulse-cis-sync/dist/types → dist/types/cis-sync}/cis-browser.d.ts +1 -0
  120. package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/types/cis-sync}/storage/pulseStorage.d.ts +4 -0
  121. package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/storage/storage.d.ts +2 -1
  122. package/dist/types/identity/actor.d.ts +3 -3
  123. package/dist/types/identity/advertising.d.ts +2 -2
  124. package/dist/types/identity/cis.d.ts +4 -4
  125. package/dist/types/index.d.ts +5 -6
  126. package/dist/types/leaveTrackingTpaas/constants.d.ts +1 -5
  127. package/dist/types/leaveTrackingTpaas/index.d.ts +6 -6
  128. package/dist/types/leaveTrackingTpaas/types.d.ts +2 -10
  129. package/dist/types/tpaas-builders/builders/anonymous.d.ts +3 -0
  130. package/dist/types/tpaas-builders/builders/baseEvent.d.ts +3 -0
  131. package/dist/types/tpaas-builders/builders/catalogVersion.d.ts +3 -0
  132. package/dist/types/tpaas-builders/builders/consents.d.ts +5 -0
  133. package/dist/types/tpaas-builders/builders/device.d.ts +5 -0
  134. package/dist/types/tpaas-builders/builders/experiments.d.ts +9 -0
  135. package/dist/types/tpaas-builders/builders/navigationType.d.ts +6 -0
  136. package/dist/types/tpaas-builders/builders/pageInfo.d.ts +6 -0
  137. package/dist/types/tpaas-builders/builders/pageviewId.d.ts +6 -0
  138. package/dist/types/tpaas-builders/builders/provider.d.ts +5 -0
  139. package/dist/types/tpaas-builders/builders/referrer.d.ts +6 -0
  140. package/dist/types/tpaas-builders/builders/session.d.ts +15 -0
  141. package/dist/types/tpaas-builders/builders/time.d.ts +4 -0
  142. package/dist/types/tpaas-builders/builders/trackerBuilder.d.ts +5 -0
  143. package/dist/types/tpaas-builders/builders/user.d.ts +5 -0
  144. package/dist/types/tpaas-builders/builders/utm.d.ts +6 -0
  145. package/dist/types/tpaas-builders/builders.d.ts +122 -0
  146. package/dist/types/tpaas-builders/guards.d.ts +2 -0
  147. package/dist/types/tpaas-builders/index.d.ts +3 -0
  148. package/dist/types/tpaas-builders/types.d.ts +30 -0
  149. package/dist/types/tpaas-schemas/constants.d.ts +360 -0
  150. package/dist/types/tpaas-schemas/index.d.ts +5 -0
  151. package/dist/types/tpaas-schemas/types/ITpaasEvent.d.ts +98 -0
  152. package/dist/types/tpaas-schemas/types/schemas/IAnonymousViewUIElement.d.ts +58 -0
  153. package/dist/types/tpaas-schemas/types/schemas/ICompletedHealthAction.d.ts +144 -0
  154. package/dist/types/tpaas-schemas/types/schemas/IEngagementAudio.d.ts +227 -0
  155. package/dist/types/tpaas-schemas/types/schemas/IEngagementForm.d.ts +111 -0
  156. package/dist/types/tpaas-schemas/types/schemas/IEngagementHealthUIElement.d.ts +138 -0
  157. package/dist/types/tpaas-schemas/types/schemas/IEngagementOffer.d.ts +107 -0
  158. package/dist/types/tpaas-schemas/types/schemas/IEngagementTeaser.d.ts +103 -0
  159. package/dist/types/tpaas-schemas/types/schemas/IEngagementUIElement.d.ts +101 -0
  160. package/dist/types/tpaas-schemas/types/schemas/IEngagementVideo.d.ts +253 -0
  161. package/dist/types/tpaas-schemas/types/schemas/IEngagementVideoAd.d.ts +153 -0
  162. package/dist/types/tpaas-schemas/types/schemas/IEngagementWidget.d.ts +91 -0
  163. package/dist/types/tpaas-schemas/types/schemas/IImpressionAdSlot.d.ts +89 -0
  164. package/dist/types/tpaas-schemas/types/schemas/IImpressionForm.d.ts +113 -0
  165. package/dist/types/tpaas-schemas/types/schemas/IImpressionHealthUIElement.d.ts +143 -0
  166. package/dist/types/tpaas-schemas/types/schemas/IImpressionOffer.d.ts +109 -0
  167. package/dist/types/tpaas-schemas/types/schemas/IImpressionPlayer.d.ts +104 -0
  168. package/dist/types/tpaas-schemas/types/schemas/IImpressionTeaser.d.ts +101 -0
  169. package/dist/types/tpaas-schemas/types/schemas/IImpressionUIElement.d.ts +107 -0
  170. package/dist/types/tpaas-schemas/types/schemas/IImpressionWidget.d.ts +89 -0
  171. package/dist/types/tpaas-schemas/types/schemas/ILeaveArticle.d.ts +131 -0
  172. package/dist/types/tpaas-schemas/types/schemas/ILeaveAudioPage.d.ts +88 -0
  173. package/dist/types/tpaas-schemas/types/schemas/ILeaveError.d.ts +95 -0
  174. package/dist/types/tpaas-schemas/types/schemas/ILeaveFrontpage.d.ts +83 -0
  175. package/dist/types/tpaas-schemas/types/schemas/ILeaveLandingpage.d.ts +90 -0
  176. package/dist/types/tpaas-schemas/types/schemas/ILeaveListing.d.ts +114 -0
  177. package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedArticle.d.ts +139 -0
  178. package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedAudioPage.d.ts +97 -0
  179. package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedVideoPage.d.ts +97 -0
  180. package/dist/types/tpaas-schemas/types/schemas/ILeavePage.d.ts +82 -0
  181. package/dist/types/tpaas-schemas/types/schemas/ILeaveSportsPage.d.ts +90 -0
  182. package/dist/types/tpaas-schemas/types/schemas/ILeaveVideoPage.d.ts +91 -0
  183. package/dist/types/tpaas-schemas/types/schemas/ILeaveWeather.d.ts +94 -0
  184. package/dist/types/tpaas-schemas/types/schemas/IViewArticle.d.ts +131 -0
  185. package/dist/types/tpaas-schemas/types/schemas/IViewAudioPage.d.ts +87 -0
  186. package/dist/types/tpaas-schemas/types/schemas/IViewError.d.ts +90 -0
  187. package/dist/types/tpaas-schemas/types/schemas/IViewFrontpage.d.ts +80 -0
  188. package/dist/types/tpaas-schemas/types/schemas/IViewHealthPage.d.ts +124 -0
  189. package/dist/types/tpaas-schemas/types/schemas/IViewLandingpage.d.ts +76 -0
  190. package/dist/types/tpaas-schemas/types/schemas/IViewListing.d.ts +109 -0
  191. package/dist/types/tpaas-schemas/types/schemas/IViewLockedArticle.d.ts +139 -0
  192. package/dist/types/tpaas-schemas/types/schemas/IViewLockedAudioPage.d.ts +95 -0
  193. package/dist/types/tpaas-schemas/types/schemas/IViewLockedVideoPage.d.ts +95 -0
  194. package/dist/types/tpaas-schemas/types/schemas/IViewPage.d.ts +86 -0
  195. package/dist/types/tpaas-schemas/types/schemas/IViewSportsPage.d.ts +88 -0
  196. package/dist/types/tpaas-schemas/types/schemas/IViewTitle.d.ts +92 -0
  197. package/dist/types/tpaas-schemas/types/schemas/IViewVideoPage.d.ts +87 -0
  198. package/dist/types/tpaas-schemas/types/schemas/IViewWeather.d.ts +94 -0
  199. package/dist/types/tpaas-schemas/types/schemas/index.d.ts +47 -0
  200. package/dist/types/tpaas-schemas/types/templates/IConsents.d.ts +34 -0
  201. package/dist/types/tpaas-schemas/types/templates/IContent.d.ts +56 -0
  202. package/dist/types/tpaas-schemas/types/templates/IDevice.d.ts +62 -0
  203. package/dist/types/tpaas-schemas/types/templates/IEngagement.d.ts +21 -0
  204. package/dist/types/tpaas-schemas/types/templates/IExperiments.d.ts +35 -0
  205. package/dist/types/tpaas-schemas/types/templates/IHealthFood.d.ts +55 -0
  206. package/dist/types/tpaas-schemas/types/templates/IHealthOrigin.d.ts +27 -0
  207. package/dist/types/tpaas-schemas/types/templates/IHealthPhysicalActivity.d.ts +36 -0
  208. package/dist/types/tpaas-schemas/types/templates/IHealthTraining.d.ts +70 -0
  209. package/dist/types/tpaas-schemas/types/templates/IHealthUserData.d.ts +25 -0
  210. package/dist/types/tpaas-schemas/types/templates/ILeave.d.ts +54 -0
  211. package/dist/types/tpaas-schemas/types/templates/ILeaveAudio.d.ts +37 -0
  212. package/dist/types/tpaas-schemas/types/templates/ILeaveStories.d.ts +44 -0
  213. package/dist/types/tpaas-schemas/types/templates/ILocation.d.ts +21 -0
  214. package/dist/types/tpaas-schemas/types/templates/IMetrics.d.ts +32 -0
  215. package/dist/types/tpaas-schemas/types/templates/IPageRef.d.ts +41 -0
  216. package/dist/types/tpaas-schemas/types/templates/IPlacement.d.ts +45 -0
  217. package/dist/types/tpaas-schemas/types/templates/IProvider.d.ts +73 -0
  218. package/dist/types/tpaas-schemas/types/templates/ISession.d.ts +33 -0
  219. package/dist/types/tpaas-schemas/types/templates/ISports.d.ts +137 -0
  220. package/dist/types/tpaas-schemas/types/templates/ITime.d.ts +32 -0
  221. package/dist/types/tpaas-schemas/types/templates/ITracker.d.ts +43 -0
  222. package/dist/types/tpaas-schemas/types/templates/IUser.d.ts +34 -0
  223. package/dist/types/tpaas-schemas/types/templates/IUtmTags.d.ts +40 -0
  224. package/dist/types/tpaas-schemas/types/templates/index.d.ts +24 -0
  225. package/dist/types/tpaas-schemas/types.d.ts +42 -0
  226. package/dist/types/tracker-proxy/consts.d.ts +1 -1
  227. package/dist/types/types.d.ts +19 -13
  228. package/dist/types/version.d.ts +1 -1
  229. package/dist/types/visibility-observer/index.d.ts +6 -1
  230. package/dist/types/wrapper/engagement/ui-element/types.d.ts +1 -1
  231. package/dist/types/wrapper/types/base-event.d.ts +1 -1
  232. package/dist/types/wrapper/types/event.d.ts +4 -2
  233. package/dist/types/wrapper/types/utils.d.ts +1 -1
  234. package/dist/types/wrapper/utils/map-page-to-page-ref.d.ts +3 -0
  235. package/dist/types/wrapper/view/article/types.d.ts +1 -1
  236. package/dist/types/wrapper/view/frontpage/types.d.ts +1 -1
  237. package/dist/types/wrapper/view/listing/types.d.ts +1 -1
  238. package/dist/types/wrapper/view/loginposter/types.d.ts +1 -1
  239. package/dist/types/wrapper/view/page/types.d.ts +1 -1
  240. package/dist/types/wrapper/view/salesposter/types.d.ts +1 -1
  241. package/dist/types/wrapper/view/ui-element/types.d.ts +1 -1
  242. package/package.json +20 -20
  243. package/dist/cjs/Tracker.test-d.js +0 -76
  244. package/dist/ejs/Tracker.test-d.js +0 -71
  245. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.d.ts +0 -26
  246. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js +0 -273
  247. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js.map +0 -1
  248. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js.map +0 -1
  249. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js +0 -39
  250. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js.map +0 -1
  251. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js.map +0 -1
  252. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js.map +0 -1
  253. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.d.ts +0 -36
  254. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js.map +0 -1
  255. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js +0 -21
  256. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js.map +0 -1
  257. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js.map +0 -1
  258. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.d.ts +0 -26
  259. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js.map +0 -1
  260. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.d.ts +0 -10
  261. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js.map +0 -1
  262. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.d.ts +0 -14
  263. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js.map +0 -1
  264. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.d.ts +0 -4
  265. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js.map +0 -1
  266. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.d.ts +0 -55
  267. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js.map +0 -1
  268. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js.map +0 -1
  269. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.d.ts +0 -6
  270. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js.map +0 -1
  271. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.d.ts +0 -24
  272. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js +0 -2
  273. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js.map +0 -1
  274. package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis.d.ts +0 -10
  275. package/node_modules/@schibsted/pulse-cis-sync/dist/types/eventEmitter.d.ts +0 -14
  276. package/node_modules/@schibsted/pulse-cis-sync/dist/types/index.d.ts +0 -4
  277. package/node_modules/@schibsted/pulse-cis-sync/dist/types/pulse-cookie.d.ts +0 -55
  278. package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/pulseStorage.d.ts +0 -36
  279. package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/storage.d.ts +0 -6
  280. package/node_modules/@schibsted/pulse-cis-sync/dist/types/types.d.ts +0 -24
  281. package/node_modules/@schibsted/pulse-cis-sync/package.json +0 -44
  282. package/node_modules/@schibsted/pulse-utils/package.json +0 -36
  283. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/provider.js +0 -12
  284. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/referrer.js +0 -19
  285. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders.js +0 -272
  286. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/provider.js +0 -9
  287. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/referrer.js +0 -15
  288. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders.js +0 -215
  289. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/index.js +0 -1
  290. package/node_modules/@schibsted/tpaas-event-builder/dist/index.d.ts +0 -5403
  291. package/node_modules/@schibsted/tpaas-event-builder/package.json +0 -40
  292. package/node_modules/@schibsted/tpaas-schemas/dist/index.d.ts +0 -6176
  293. package/node_modules/@schibsted/tpaas-schemas/package.json +0 -35
  294. /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/cis-sync}/types.js +0 -0
  295. /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/anonymous.js +0 -0
  296. /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/baseEvent.js +0 -0
  297. /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/consents.js +0 -0
  298. /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/experiments.js +0 -0
  299. /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/pageviewId.js +0 -0
  300. /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/time.js +0 -0
  301. /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/trackerBuilder.js +0 -0
  302. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/cookie-config.js +0 -0
  303. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/cookie.js +0 -0
  304. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/events.js +0 -0
  305. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/get.js +0 -0
  306. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/getRootDomain.js +0 -0
  307. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/index.js +0 -0
  308. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/merge.js +0 -0
  309. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/objects.js +0 -0
  310. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/omit.js +0 -0
  311. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/randomString.js +0 -0
  312. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/throttle.js +0 -0
  313. /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/webApi.js +0 -0
  314. /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/cis-sync}/types.js +0 -0
  315. /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/anonymous.js +0 -0
  316. /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/baseEvent.js +0 -0
  317. /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/consents.js +0 -0
  318. /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/experiments.js +0 -0
  319. /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/pageviewId.js +0 -0
  320. /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/time.js +0 -0
  321. /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/trackerBuilder.js +0 -0
  322. /package/dist/{types/Tracker.test-d.d.ts → ejs/tpaas-builders/types.js} +0 -0
  323. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/cookie-config.js +0 -0
  324. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/cookie.js +0 -0
  325. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/events.js +0 -0
  326. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/get.js +0 -0
  327. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/getRootDomain.js +0 -0
  328. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/index.js +0 -0
  329. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/merge.js +0 -0
  330. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/objects.js +0 -0
  331. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/omit.js +0 -0
  332. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/randomString.js +0 -0
  333. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/throttle.js +0 -0
  334. /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/webApi.js +0 -0
  335. /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/cis.d.ts +0 -0
  336. /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/eventEmitter.d.ts +0 -0
  337. /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/index.d.ts +0 -0
  338. /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/pulse-cookie.d.ts +0 -0
  339. /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/types.d.ts +0 -0
  340. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/cookie-config.d.ts +0 -0
  341. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/cookie.d.ts +0 -0
  342. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/events.d.ts +0 -0
  343. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/get.d.ts +0 -0
  344. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/getRootDomain.d.ts +0 -0
  345. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/index.d.ts +0 -0
  346. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/merge.d.ts +0 -0
  347. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/objects.d.ts +0 -0
  348. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/omit.d.ts +0 -0
  349. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/randomString.d.ts +0 -0
  350. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/throttle.d.ts +0 -0
  351. /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/webApi.d.ts +0 -0
@@ -41,10 +41,6 @@ exports.subscribe = subscribe;
41
41
  exports.subscribeOnce = subscribeOnce;
42
42
  exports.subscribeWithState = subscribeWithState;
43
43
  exports.unsubscribe = unsubscribe;
44
- const pulse_cis_sync_1 = require("@schibsted/pulse-cis-sync");
45
- const pulse_utils_1 = require("@schibsted/pulse-utils");
46
- const tpaas_event_builder_1 = require("@schibsted/tpaas-event-builder");
47
- const tpaas_schemas_1 = require("@schibsted/tpaas-schemas");
48
44
  const loglevel_1 = __importDefault(require("loglevel"));
49
45
  const uuid_1 = require("uuid");
50
46
  const app_integration_1 = require("./app-integration");
@@ -53,7 +49,9 @@ const consent_manager_1 = require("./builders/consent-manager");
53
49
  const consents_1 = require("./builders/consents");
54
50
  const events_1 = require("./builders/events");
55
51
  const events_anonymous_node_1 = require("./builders/events-anonymous-node");
52
+ const experiments_1 = require("./builders/experiments");
56
53
  const session_browser_1 = require("./builders/session-browser");
54
+ const cis_sync_1 = require("./cis-sync");
57
55
  const config_1 = require("./config");
58
56
  const config_browser_1 = require("./config-browser");
59
57
  const defer_1 = __importDefault(require("./defer"));
@@ -63,11 +61,16 @@ const leaveTracking_1 = require("./leaveTracking");
63
61
  const leaveTrackingTpaas_1 = require("./leaveTrackingTpaas");
64
62
  const network_1 = __importDefault(require("./network"));
65
63
  const config = __importStar(require("./remoteConfig"));
64
+ const tpaas_builders_1 = require("./tpaas-builders");
65
+ const tpaas_schemas_1 = require("./tpaas-schemas");
66
66
  const proxy_provider_1 = require("./tracker-proxy/proxy-provider");
67
+ const utils_1 = require("./utils");
67
68
  const version_1 = require("./version");
68
69
  const visibility_observer_1 = require("./visibility-observer");
69
70
  const warnOnce_1 = __importDefault(require("./warnOnce"));
70
71
  const event_builder_1 = require("./wrapper/engagement/ui-element/event-builder");
72
+ const types_1 = require("./wrapper/types");
73
+ const map_page_to_page_ref_1 = require("./wrapper/utils/map-page-to-page-ref");
71
74
  const page_from_page_view_1 = require("./wrapper/utils/page-from-page-view");
72
75
  const event_builder_2 = require("./wrapper/view/article/event-builder");
73
76
  const event_builder_3 = require("./wrapper/view/frontpage/event-builder");
@@ -157,6 +160,21 @@ function unsubscribe(eventName, callback) {
157
160
  * @class Tracker
158
161
  */
159
162
  class Tracker {
163
+ async getCurrentTpaasPage() {
164
+ const { id, type, url } = await this.currentPageInfo;
165
+ return (0, map_page_to_page_ref_1.mapPageToPageRef)(id, type, url);
166
+ }
167
+ async getCurrentLegacyPage() {
168
+ const { id, type, url } = await this.currentPageInfo;
169
+ // make sure the pageType is valid for legacy events
170
+ const validatedType = (0, types_1.isLegacyPageType)(type) ? type : 'Page';
171
+ return {
172
+ // add the SDRN prefix if it's not there, legacy events expect the full SDRN format
173
+ id: id.startsWith('sdrn:') ? id : `sdrn:${this.state.providerId}:${validatedType.toLowerCase()}:${id}`,
174
+ type: validatedType,
175
+ url,
176
+ };
177
+ }
160
178
  /**
161
179
  * > [!WARNING]
162
180
  * >
@@ -175,44 +193,74 @@ class Tracker {
175
193
  // the tracking of the same element with both old and new events at the same time
176
194
  this.legacyVisibilityObservers = new Map();
177
195
  this.visibilityObservers = new Map();
178
- this.legacyCurrentPage = {
179
- id: 'undefined-id',
196
+ /**
197
+ * @private
198
+ *
199
+ * This is used as the source of truth for the current page's information, which is updated based on the View Page-level event
200
+ * As a single source of truth for the current page, this needs to be compatible between legacy and TPaaS events, hence the need for a custom data type.
201
+ * Legacy events can provide an id with SDRN, while TPaaS events don't need it
202
+ */
203
+ this.currentPageInfo = {
204
+ id: 'unknown',
180
205
  type: 'Page',
181
- url: typeof window !== 'undefined' ? window.location.href : '',
206
+ url: utils_1.isBrowser ? window.location.href : undefined,
207
+ };
208
+ /**
209
+ * @private
210
+ *
211
+ * This is used as the source of truth for the current page's referrer information, which is updated based on the View Page-level event
212
+ * !! This is only used in TPaaS events and contexts, as we don't want to risk changing the behaviour of legacy events
213
+ * This is also the reason this is being kept as a separate variable from the currentPageInfo property,
214
+ * which is used for both legacy and TPaaS events
215
+ */
216
+ this.currentPageReferrer = {
217
+ url: utils_1.isBrowser ? document.referrer || undefined : undefined,
218
+ };
219
+ this.setCurrentTpaasPageData = (id, type, referrer) => {
220
+ this.currentPageInfo = {
221
+ id: id || 'unknown',
222
+ type: type || 'Page',
223
+ url: utils_1.isBrowser ? window.location.href : undefined,
224
+ };
225
+ this.currentPageReferrer = {
226
+ ...referrer,
227
+ url: referrer?.url ?? (utils_1.isBrowser ? document.referrer || undefined : undefined),
228
+ };
182
229
  };
183
- this.currentPage = undefined;
184
230
  /**
185
231
  * Promise that resolves when a session ID becomes available
186
232
  * @private
187
233
  */
188
234
  this.sessionIdPromise = null;
235
+ /**
236
+ * A simple flag used to prevent duplicate listeners being registered
237
+ * if `exposeToProxyClients` or `startProxyProviderListener` is called more than once.
238
+ */
239
+ this.hasProxyListener = false;
189
240
  this.setPageDefaults = (pageViewEvent) => {
190
- this.legacyCurrentPage = (0, page_from_page_view_1.pageFromPageView)(pageViewEvent);
241
+ this.currentPageInfo = (0, page_from_page_view_1.pageFromPageView)(pageViewEvent);
242
+ this.currentPageReferrer = Promise.resolve(pageViewEvent.origin).then((originProperties) => (0, map_page_to_page_ref_1.mapPageToPageRef)(originProperties?.id, originProperties?.type, originProperties?.url));
191
243
  if (pageViewEvent.origin) {
192
244
  const pageDefaults = { origin: pageViewEvent.origin };
193
245
  this.update(pageDefaults, true);
194
246
  }
195
247
  };
196
- this.setCurrentPage = (id, type) => {
197
- this.currentPage = {
198
- pageId: id,
199
- pageType: type,
200
- url: pulse_utils_1.isBrowser ? window.location.href : undefined,
201
- };
202
- };
203
248
  loglevel_1.default.setLevel(config?.logLevel ?? loglevel_1.default.levels.ERROR);
204
249
  // runtime check for providerId inconsistency
205
250
  if (!providerId || !(typeof providerId === 'string')) {
206
251
  throw new Error('Required parameter `providerId` missing');
207
252
  }
253
+ if (config?.componentVersion !== undefined && config?.component === undefined) {
254
+ throw new Error('`componentVersion` cannot be provided without `component`');
255
+ }
208
256
  let includeAdvertising;
209
- if (pulse_utils_1.isBrowser && config?.autoCreateConsents) {
257
+ if (utils_1.isBrowser && config?.autoCreateConsents) {
210
258
  config.consents = (0, consent_manager_1.getConsentsWaitForAnalytics)((consents) => {
211
259
  loglevel_1.default.debug('Consents received from CMP', consents);
212
260
  return this.setConsentsInternal(consents);
213
261
  });
214
262
  }
215
- if ((0, pulse_utils_1.isPromise)(config?.consents)) {
263
+ if ((0, utils_1.isPromise)(config?.consents)) {
216
264
  includeAdvertising = (0, consents_1.applyAdvertisingConsent)(config?.consents, config?.requireAdvertisingOptIn);
217
265
  }
218
266
  else {
@@ -228,7 +276,7 @@ class Tracker {
228
276
  identity.clearCookieJweIfStale(config?.nativeJwe);
229
277
  const deployStage = config?.deployStage || 'pro';
230
278
  const deployStageTpaas = config?.deployStageTpaas || 'pre';
231
- this.state = (0, pulse_utils_1.pulseMerge)({}, config_1.baseConfig, {
279
+ this.state = (0, utils_1.pulseMerge)({}, config_1.baseConfig, {
232
280
  collectorBaseUrl: config_browser_1.collectorEndpoints[deployStage],
233
281
  deployStage,
234
282
  deployStageTpaas,
@@ -245,9 +293,11 @@ class Tracker {
245
293
  vendors: config?.vendors?.length ? [] : ['xandr'],
246
294
  }, config);
247
295
  // Move to default config?
248
- this.builders = (0, pulse_utils_1.pulseMerge)({}, builders, {
296
+ this.builders = (0, utils_1.pulseMerge)({}, builders, {
249
297
  provider: {
250
298
  id: providerId,
299
+ ...(config?.component !== undefined && { component: config.component }),
300
+ ...(config?.componentVersion !== undefined && { componentVersion: config.componentVersion }),
251
301
  },
252
302
  tracker: {
253
303
  version: version_1.SDK_VERSION,
@@ -263,7 +313,7 @@ class Tracker {
263
313
  this.retryTpaasEventQueue = [];
264
314
  if (this.state.environment === 'browser') {
265
315
  // @ts-expect-error
266
- if (pulse_utils_1.isBrowser && window.navigator?.sendBeacon) {
316
+ if (utils_1.isBrowser && window.navigator?.sendBeacon) {
267
317
  const originalUseBeacon = this.state.useBeacon;
268
318
  window.addEventListener('pagehide', () => {
269
319
  this.state.useBeacon = true;
@@ -277,7 +327,7 @@ class Tracker {
277
327
  }
278
328
  }
279
329
  // @ts-expect-error
280
- this.debouncedSend = (0, pulse_utils_1.throttle)(async () => {
330
+ this.debouncedSend = (0, utils_1.throttle)(async () => {
281
331
  try {
282
332
  return await this._sendImmediately();
283
333
  }
@@ -286,7 +336,7 @@ class Tracker {
286
336
  }
287
337
  }, this.state.eventDebounce);
288
338
  // @ts-expect-error
289
- this.debouncedSendAnonymous = (0, pulse_utils_1.throttle)(async () => {
339
+ this.debouncedSendAnonymous = (0, utils_1.throttle)(async () => {
290
340
  try {
291
341
  return await this._sendImmediatelyAnonymous();
292
342
  }
@@ -295,7 +345,7 @@ class Tracker {
295
345
  }
296
346
  }, this.state.eventDebounce);
297
347
  // @ts-expect-error
298
- this.debouncedSendTpaas = (0, pulse_utils_1.throttle)(async () => {
348
+ this.debouncedSendTpaas = (0, utils_1.throttle)(async () => {
299
349
  try {
300
350
  return await this._sendImmediatelyTpaas();
301
351
  }
@@ -364,6 +414,11 @@ class Tracker {
364
414
  return queuedEvent.then((result) => result);
365
415
  });
366
416
  };
417
+ /*
418
+ * Casting `input` as `Partial<Builders>` to formalise the intention of processing the event input in relation to the properties in
419
+ * the Builders type. It would justify changing the public api for `.track`, but as this deals with legacy code, we
420
+ * keep it internal, so dependencies from now on can count on objects being a Partial<Builder>
421
+ */
367
422
  return this.syncRemoteResources(input, currentBuilders).then(_track, _track);
368
423
  }
369
424
  /**
@@ -401,7 +456,7 @@ class Tracker {
401
456
  await this._applyRemoteConfigEndpoints();
402
457
  // Resolve all available properties ----------------
403
458
  const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.resolveTrackGlobals()]);
404
- let eventOutput = resolvedOutput.reduce((acc, p) => (0, pulse_utils_1.pulseMerge)(acc, p), {});
459
+ let eventOutput = resolvedOutput.reduce((acc, p) => (0, utils_1.pulseMerge)(acc, p), {});
405
460
  eventOutput = this.applyAnonymousEventTypeDefaults(eventOutput, eventType);
406
461
  // Leave Events ----------------
407
462
  // they require (most) properties of the previous PageView event, which was saved under a bookmark key when tracked
@@ -433,6 +488,11 @@ class Tracker {
433
488
  return {
434
489
  name: exp.name || exp.id,
435
490
  variant: exp.variant || '',
491
+ // nobody should be sending experiment id with an sdrn format, but in case they do
492
+ // we want to be able to handle it and not generate an invalid sdrn by adding another layer to it
493
+ experimentSdrn: exp.id.startsWith('sdrn:') ? exp.id : (0, experiments_1.generateExperimentSDRN)(exp.id, exp.platform),
494
+ platform: exp.platform || '',
495
+ testId: exp.custom?.testId,
436
496
  };
437
497
  });
438
498
  }
@@ -448,17 +508,25 @@ class Tracker {
448
508
  catch (ex) {
449
509
  loglevel_1.default.trace('Failed to sync remote config', ex);
450
510
  }
511
+ const [experiments, currentPageReferrer] = await Promise.all([
512
+ this.adaptExperiments(this.builders.experiments),
513
+ this.currentPageReferrer,
514
+ ]);
451
515
  return {
452
516
  autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
453
517
  version: version_1.SDK_VERSION,
454
518
  isHybrid: !!this.state.isHybrid,
455
519
  pageviewId: this.state.pageViewId,
456
520
  providerId: this.state.providerId,
457
- experiments: await this.adaptExperiments(this.builders.experiments),
521
+ providerName: this.state.provider?.name,
522
+ providerGroup: this.state.provider?.group,
523
+ component: this.state.component,
524
+ componentVersion: this.state.componentVersion,
525
+ experiments,
526
+ currentPageReferrer,
458
527
  };
459
528
  }
460
529
  /**
461
- *
462
530
  * @private
463
531
  * @category TPaaS Tracking
464
532
  */
@@ -480,7 +548,7 @@ class Tracker {
480
548
  id: actor.id?.toString() || '',
481
549
  realm: actor.realm || '',
482
550
  hasAnySubscription: !!actor.hasAnySubscription,
483
- region: (0, pulse_utils_1.isString)(actor.region) ? actor.region : undefined,
551
+ region: (0, utils_1.isString)(actor.region) ? actor.region : undefined,
484
552
  };
485
553
  }
486
554
  function adaptConsentsToNewFormat(consents) {
@@ -518,12 +586,14 @@ class Tracker {
518
586
  source: source || 'unknown',
519
587
  };
520
588
  }
521
- const [actor, consents, experiments] = await Promise.all([
589
+ const [actor, consents, experiments, currentPage, currentPageReferrer] = await Promise.all([
522
590
  this.getActor(),
523
591
  this.getConsents(),
524
592
  this.adaptExperiments(this.builders.experiments),
593
+ this.getCurrentTpaasPage(),
594
+ this.currentPageReferrer,
525
595
  ]);
526
- const { environmentId, jwe } = (0, pulse_cis_sync_1.parsePulseCookies)();
596
+ const { environmentId, jwe } = (0, cis_sync_1.parsePulseCookies)();
527
597
  return {
528
598
  autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
529
599
  version: version_1.SDK_VERSION,
@@ -531,29 +601,18 @@ class Tracker {
531
601
  user: adaptActorToNewFormat(actor),
532
602
  consents: adaptConsentsToNewFormat(consents),
533
603
  providerId: this.state.providerId,
604
+ providerName: this.state.provider?.name,
605
+ providerGroup: this.state.provider?.group,
606
+ component: this.state.component,
607
+ componentVersion: this.state.componentVersion,
534
608
  pageviewId: this.state.pageViewId,
535
- currentPage: this.currentPage,
609
+ currentPage,
610
+ currentPageReferrer,
536
611
  experiments,
537
612
  environmentId,
538
613
  jwe,
539
614
  };
540
615
  }
541
- /**
542
- * Generate a generic TPaaS event with common builders output
543
- * The method should be used for experiments, not for real production work.
544
- * It doesn't have any real TPaaS schema associated with it.
545
- * The method doesn't queue or send the event, it just returns the merged object.
546
- * The method can be removed at any time in the future, so use it with caution.
547
- *
548
- * @param input - The input object to merge with the common builders output
549
- * @returns A promise that resolves to the merged object
550
- * @private
551
- * @category TPaaS Tracking
552
- */
553
- async generateGenericTpaasEvent(input) {
554
- const dependencies = await this.prepareTpaasEvent();
555
- return (0, pulse_utils_1.pulseMerge)({}, input, (0, tpaas_event_builder_1.getCommonBuildersOutput)(new Date(), dependencies));
556
- }
557
616
  /**
558
617
  * This method extends the list of base experiments that will be automatically included in every event sent by the tracker.
559
618
  *
@@ -575,6 +634,9 @@ class Tracker {
575
634
  * @category Tracking
576
635
  */
577
636
  addExperiments(experiments) {
637
+ if (experiments.some((experiment) => experiment.id.startsWith('sdrn:'))) {
638
+ loglevel_1.default.warn('Pulse - addExperiments received an experiment id starting with "sdrn:"; pass the raw experiment id instead. The SDK will generate the sdrn automatically.');
639
+ }
578
640
  this.update({ experiments }, true);
579
641
  }
580
642
  /**
@@ -609,7 +671,7 @@ class Tracker {
609
671
  const viewUIElementInputProperties = buildEventFromElement(element);
610
672
  this.trackLegacyViewUIElement(viewUIElementInputProperties);
611
673
  }));
612
- this.legacyVisibilityObservers.get(selector)?.observe(selector);
674
+ this.legacyVisibilityObservers.get(selector)?.observe(selector, {});
613
675
  }
614
676
  /**
615
677
  * The `addUIElementVisibilityTracking` function provides an interface for sending tracking events when specific UI elements become visible within the viewport.
@@ -641,7 +703,38 @@ class Tracker {
641
703
  const eventInput = buildEventFromElement(element);
642
704
  this.trackImpressionUIElement(eventInput);
643
705
  }));
644
- this.visibilityObservers.get(selector)?.observe(selector);
706
+ this.visibilityObservers.get(selector)?.observe(selector, {});
707
+ }
708
+ /**
709
+ * The `addElementVisibilityObserver` function provides an interface for executing arbitrary code when specific DOM Elements become visible within the viewport.
710
+ * It is built on the `VisibilityObserver` class, which efficiently detects visibility changes in DOM elements.
711
+ * When an element becomes at least 2/3 visible, a callback is triggered, with the Element that invoked the callback call as argument.
712
+ * It leverages the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) for viewport tracking
713
+ * and the [Mutation Observer API](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) to monitor lazy-loaded elements.
714
+ *
715
+ * Example usage:
716
+ *
717
+ * ```ts
718
+ * tracker.addElementVisibilityObserver('[data-pulse-entity-id]', (element) => {
719
+ * const eventInput = parseElementIntoEventInput(element); // user-defined function
720
+ * tracker.trackImpressionTeaser(eventInput); // can be anything actually, not necessarily a Teaser tracking call
721
+ * });
722
+ * ```
723
+ * @param selector
724
+ * @param callback
725
+ * @param options {ObserverOptions}
726
+ * @param options.threshold - A number between 0 and 1 indicating how much of the element should be visible to trigger
727
+ * the callback. Default is 0.67 (2/3 of the element).
728
+ */
729
+ addElementVisibilityObserver(selector, callback, options = {}) {
730
+ if (this.visibilityObservers.has(selector)) {
731
+ console.warn(`Cannot add UI Element visibility tracking for selector "${selector}" as it is already being tracked.`);
732
+ return;
733
+ }
734
+ this.visibilityObservers.set(selector, new visibility_observer_1.VisibilityObserver((element) => {
735
+ callback(element);
736
+ }));
737
+ this.visibilityObservers.get(selector)?.observe(selector, options);
645
738
  }
646
739
  /**
647
740
  * The old trackViewArticle method from the Media Wrapper.
@@ -735,7 +828,7 @@ class Tracker {
735
828
  * @category Legacy Tracking
736
829
  */
737
830
  trackLegacyViewUIElement(inputProperties, trackOptions) {
738
- const viewUIElementEventData = (0, event_builder_8.buildLegacyViewUIElementEvent)(inputProperties, this.legacyCurrentPage);
831
+ const viewUIElementEventData = (0, event_builder_8.buildLegacyViewUIElementEvent)(inputProperties, this.getCurrentLegacyPage());
739
832
  return this.track('trackerEvent', viewUIElementEventData, trackOptions);
740
833
  }
741
834
  /**
@@ -746,7 +839,7 @@ class Tracker {
746
839
  * @category Legacy Tracking
747
840
  */
748
841
  trackLegacyClickUIElement(inputProperties, trackOptions) {
749
- const clickUIElementEventData = (0, event_builder_1.buildClickUIElementEvent)(inputProperties, this.legacyCurrentPage);
842
+ const clickUIElementEventData = (0, event_builder_1.buildClickUIElementEvent)(inputProperties, this.getCurrentLegacyPage());
750
843
  return this.track('trackerEvent', clickUIElementEventData, trackOptions);
751
844
  }
752
845
  /**
@@ -758,34 +851,33 @@ class Tracker {
758
851
  */
759
852
  async trackAnonymousViewUIElement(input) {
760
853
  const dependencies = await this.prepareAnonymousTpaasEvent();
761
- const event = (0, tpaas_event_builder_1.buildAnonymousViewUIElementEvent)(input, dependencies);
854
+ const event = (0, tpaas_builders_1.buildAnonymousViewUIElementEvent)(input, dependencies);
762
855
  return this.sendTpaasEvent(event);
763
856
  }
764
857
  async trackCompletedHealthAction(input) {
765
858
  const dependencies = await this.prepareTpaasEvent();
766
- const event = (0, tpaas_event_builder_1.buildCompletedHealthActionEvent)(input, dependencies);
859
+ const event = (0, tpaas_builders_1.buildCompletedHealthActionEvent)(input, dependencies);
767
860
  return this.sendTpaasEvent(event);
768
861
  }
769
862
  async trackEngagementHealthUIElement(input) {
770
863
  const dependencies = await this.prepareTpaasEvent();
771
- const event = (0, tpaas_event_builder_1.buildEngagementHealthUIElementEvent)(input, dependencies);
864
+ const event = (0, tpaas_builders_1.buildEngagementHealthUIElementEvent)(input, dependencies);
772
865
  return this.sendTpaasEvent(event);
773
866
  }
774
867
  async trackViewHealthPage(input, options) {
775
868
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
776
- this.setCurrentPage(input.object.objectId, 'Page'); // ViewHealthPage.object.objectType is HealthPage, which is not allowed as a pageType
869
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewHealthPage.object.objectType, input.page?.referrer);
777
870
  const dependencies = await this.prepareTpaasEvent();
778
- const event = (0, tpaas_event_builder_1.buildViewHealthPageEvent)(input, dependencies);
871
+ const event = (0, tpaas_builders_1.buildViewHealthPageEvent)(input, dependencies);
779
872
  const result = this.sendTpaasEvent(event);
780
873
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
781
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
782
- // HealthView Page is a bit special, in the sense that in doesn't have a dedicated Leave event.
783
- // Instead, we need to reuse the generic Leave Page event, but adapt the input accordingly.
784
- // This means omitting some fields from HealthView Page that are not part of Leave Page schema.
785
- const { experiments, metrics, object, ...restInput } = input;
786
- const { category, custom, intent, name, tags, ...restObject } = input.object;
787
- const leavePageCallback = (leave) => {
788
- this.trackLeavePage({
874
+ const leavePageCallback = async (leave) => {
875
+ // HealthView Page is a bit special, in the sense that in doesn't have a dedicated Leave event.
876
+ // Instead, we need to reuse the generic Leave Page event, but adapt the input accordingly.
877
+ // This means omitting some fields from HealthView Page that are not part of Leave Page schema.
878
+ const { experiments, metrics, object, origin, userHealthData, ...restInput } = input;
879
+ const { category, custom, intent, name, tags, food, physicalActivity, training, ...restObject } = input.object;
880
+ await this.trackLeavePage({
789
881
  leave,
790
882
  ...restInput,
791
883
  object: {
@@ -795,10 +887,7 @@ class Tracker {
795
887
  });
796
888
  };
797
889
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
798
- objectElement,
799
- pageElement,
800
- objectResizable,
801
- heightBuilder,
890
+ ...options.leaveTracking,
802
891
  schema: tpaas_schemas_1.LeavePage.object.objectType,
803
892
  trackMethod: leavePageCallback,
804
893
  });
@@ -807,7 +896,7 @@ class Tracker {
807
896
  }
808
897
  async trackImpressionHealthUIElement(input) {
809
898
  const dependencies = await this.prepareTpaasEvent();
810
- const event = (0, tpaas_event_builder_1.buildImpressionHealthUIElementEvent)(input, dependencies);
899
+ const event = (0, tpaas_builders_1.buildImpressionHealthUIElementEvent)(input, dependencies);
811
900
  return this.sendTpaasEvent(event);
812
901
  }
813
902
  /**
@@ -817,23 +906,19 @@ class Tracker {
817
906
  */
818
907
  async trackViewPage(input, options) {
819
908
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
820
- this.setCurrentPage(input.object.objectId, tpaas_schemas_1.ViewPage.object.objectType);
909
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewPage.object.objectType, input.page?.referrer);
821
910
  const dependencies = await this.prepareTpaasEvent();
822
- const event = (0, tpaas_event_builder_1.buildViewPageEvent)(input, dependencies);
911
+ const event = (0, tpaas_builders_1.buildViewPageEvent)(input, dependencies);
823
912
  const result = this.sendTpaasEvent(event);
824
913
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
825
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
826
- const leavePageCallback = (leave) => {
827
- this.trackLeavePage({
914
+ const leavePageCallback = async (leave) => {
915
+ await this.trackLeavePage({
828
916
  leave,
829
917
  ...input,
830
918
  });
831
919
  };
832
920
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
833
- objectElement,
834
- pageElement,
835
- objectResizable,
836
- heightBuilder,
921
+ ...options.leaveTracking,
837
922
  schema: tpaas_schemas_1.LeavePage.object.objectType,
838
923
  trackMethod: leavePageCallback,
839
924
  });
@@ -847,23 +932,19 @@ class Tracker {
847
932
  */
848
933
  async trackViewSportsPage(input, options) {
849
934
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
850
- this.setCurrentPage(input.object.objectId, 'Page'); // ViewSportsPage.object.objectType is SportsPage, which is not allowed as a pageType
935
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewSportsPage.object.objectType, input.page?.referrer);
851
936
  const dependencies = await this.prepareTpaasEvent();
852
- const event = (0, tpaas_event_builder_1.buildViewSportsPageEvent)(input, dependencies);
937
+ const event = (0, tpaas_builders_1.buildViewSportsPageEvent)(input, dependencies);
853
938
  const result = this.sendTpaasEvent(event);
854
939
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
855
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
856
- const leaveSportsPageCallback = (leave) => {
857
- this.trackLeaveSportsPage({
940
+ const leaveSportsPageCallback = async (leave) => {
941
+ await this.trackLeaveSportsPage({
858
942
  leave,
859
943
  ...input,
860
944
  });
861
945
  };
862
946
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
863
- objectElement,
864
- pageElement,
865
- objectResizable,
866
- heightBuilder,
947
+ ...options.leaveTracking,
867
948
  schema: tpaas_schemas_1.LeaveSportsPage.object.objectType,
868
949
  trackMethod: leaveSportsPageCallback,
869
950
  });
@@ -876,9 +957,9 @@ class Tracker {
876
957
  */
877
958
  async trackViewTitle(input) {
878
959
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
879
- this.setCurrentPage(input.object.objectId, tpaas_schemas_1.ViewTitle.object.objectType);
960
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewTitle.object.objectType, input.page?.referrer);
880
961
  const dependencies = await this.prepareTpaasEvent();
881
- const event = (0, tpaas_event_builder_1.buildViewTitleEvent)(input, dependencies);
962
+ const event = (0, tpaas_builders_1.buildViewTitleEvent)(input, dependencies);
882
963
  return this.sendTpaasEvent(event);
883
964
  // there's no Leave Title event
884
965
  }
@@ -888,16 +969,7 @@ class Tracker {
888
969
  */
889
970
  async trackImpressionWidget(input) {
890
971
  const dependencies = await this.prepareTpaasEvent();
891
- const event = (0, tpaas_event_builder_1.buildImpressionWidgetEvent)(input, dependencies);
892
- return this.sendTpaasEvent(event);
893
- }
894
- /**
895
- * @param input
896
- * @category TPaaS Tracking
897
- */
898
- async trackImpressionAdSlot(input) {
899
- const dependencies = await this.prepareTpaasEvent();
900
- const event = (0, tpaas_event_builder_1.buildImpressionAdSlotEvent)(input, dependencies);
972
+ const event = (0, tpaas_builders_1.buildImpressionWidgetEvent)(input, dependencies);
901
973
  return this.sendTpaasEvent(event);
902
974
  }
903
975
  /**
@@ -907,41 +979,25 @@ class Tracker {
907
979
  */
908
980
  async trackViewArticle(input, options) {
909
981
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
910
- this.setCurrentPage(input.object.objectId, tpaas_schemas_1.ViewArticle.object.objectType);
982
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewArticle.object.objectType, input.page?.referrer);
911
983
  const dependencies = await this.prepareTpaasEvent();
912
- const event = (0, tpaas_event_builder_1.buildViewArticleEvent)(input, dependencies);
984
+ const event = (0, tpaas_builders_1.buildViewArticleEvent)(input, dependencies);
913
985
  const result = this.sendTpaasEvent(event);
914
986
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
915
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
916
- const leaveArticleCallback = (leave) => {
917
- this.trackLeaveArticle({
987
+ const leaveArticleCallback = async (leave) => {
988
+ await this.trackLeaveArticle({
918
989
  leave,
919
990
  ...input,
920
991
  });
921
992
  };
922
993
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
923
- objectElement,
924
- pageElement,
925
- heightBuilder,
926
- objectResizable,
994
+ ...options.leaveTracking,
927
995
  schema: tpaas_schemas_1.LeaveArticle.object.objectType,
928
996
  trackMethod: leaveArticleCallback,
929
997
  });
930
998
  }
931
999
  return result;
932
1000
  }
933
- /**
934
- * @param input
935
- * @param options
936
- * @category TPaaS Tracking
937
- */
938
- async trackViewAudio(input) {
939
- // despite the View event type, this is not a page view event, but rather a media object view event
940
- // so we shouldn't reset the page view ID here or enable leave tracking
941
- const dependencies = await this.prepareTpaasEvent();
942
- const event = (0, tpaas_event_builder_1.buildViewAudioEvent)(input, dependencies);
943
- return this.sendTpaasEvent(event);
944
- }
945
1001
  /**
946
1002
  * Tracks a View AudioPage event and automatically fires a Leave AudioPage event when the user
947
1003
  * navigates away.
@@ -984,20 +1040,20 @@ class Tracker {
984
1040
  */
985
1041
  async trackViewAudioPage(input, options) {
986
1042
  this.newPageView();
987
- this.setCurrentPage(input.object.objectId, 'Audio'); // ViewAudioPage.object.objectType is AudioPage, which is not allowed as a pageType
1043
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewAudioPage.object.objectType, input.page?.referrer);
988
1044
  const dependencies = await this.prepareTpaasEvent();
989
- const event = (0, tpaas_event_builder_1.buildViewAudioPageEvent)(input, dependencies);
1045
+ const event = (0, tpaas_builders_1.buildViewAudioPageEvent)(input, dependencies);
990
1046
  const result = this.sendTpaasEvent(event);
991
1047
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
992
- const { objectElement, pageElement, heightBuilder, objectResizable, leaveAudioBuilder } = options.leaveTracking;
993
- const leaveAudioPageCallback = (leave) => {
1048
+ const { leaveAudioBuilder, ...restLeaveTrackingOptions } = options.leaveTracking;
1049
+ const leaveAudioPageCallback = async (leave) => {
994
1050
  const leaveAudioInput = leaveAudioBuilder?.() ?? {
995
1051
  audioCompleted: 0,
996
1052
  audioStarted: 0,
997
1053
  maxPlaylistPosition: 0,
998
1054
  playlistPositionPercentage: 0,
999
1055
  };
1000
- this.trackLeaveAudioPage({
1056
+ await this.trackLeaveAudioPage({
1001
1057
  leave,
1002
1058
  leaveAudio: {
1003
1059
  ...leaveAudioInput,
@@ -1008,10 +1064,7 @@ class Tracker {
1008
1064
  });
1009
1065
  };
1010
1066
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1011
- objectElement,
1012
- pageElement,
1013
- heightBuilder,
1014
- objectResizable,
1067
+ ...restLeaveTrackingOptions,
1015
1068
  schema: tpaas_schemas_1.LeaveAudioPage.object.objectType,
1016
1069
  trackMethod: leaveAudioPageCallback,
1017
1070
  });
@@ -1025,36 +1078,41 @@ class Tracker {
1025
1078
  */
1026
1079
  async trackViewError(input, options) {
1027
1080
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
1028
- this.setCurrentPage(input.object.objectId, tpaas_schemas_1.ViewError.object.objectType);
1081
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewError.object.objectType, input.page?.referrer);
1029
1082
  const dependencies = await this.prepareTpaasEvent();
1030
- const event = (0, tpaas_event_builder_1.buildViewErrorEvent)(input, dependencies);
1083
+ const event = (0, tpaas_builders_1.buildViewErrorEvent)(input, dependencies);
1031
1084
  const result = this.sendTpaasEvent(event);
1032
1085
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1033
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
1034
- const leaveErrorCallback = (leave) => {
1035
- this.trackLeaveError({
1086
+ const leaveErrorCallback = async (leave) => {
1087
+ await this.trackLeaveError({
1036
1088
  leave,
1037
1089
  ...input,
1038
1090
  });
1039
1091
  };
1040
1092
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1041
- objectElement,
1042
- pageElement,
1043
- heightBuilder,
1044
- objectResizable,
1093
+ ...options.leaveTracking,
1045
1094
  schema: tpaas_schemas_1.LeaveError.object.objectType,
1046
1095
  trackMethod: leaveErrorCallback,
1047
1096
  });
1048
1097
  }
1049
1098
  return result;
1050
1099
  }
1100
+ /**
1101
+ * @param input
1102
+ * @category TPaaS Tracking
1103
+ */
1104
+ async trackImpressionAdSlot(input) {
1105
+ const dependencies = await this.prepareTpaasEvent();
1106
+ const event = (0, tpaas_builders_1.buildImpressionAdSlotEvent)(input, dependencies);
1107
+ return this.sendTpaasEvent(event);
1108
+ }
1051
1109
  /**
1052
1110
  * @param input
1053
1111
  * @category TPaaS Tracking
1054
1112
  */
1055
1113
  async trackImpressionForm(input) {
1056
1114
  const dependencies = await this.prepareTpaasEvent();
1057
- const event = (0, tpaas_event_builder_1.buildImpressionFormEvent)(input, dependencies);
1115
+ const event = (0, tpaas_builders_1.buildImpressionFormEvent)(input, dependencies);
1058
1116
  return this.sendTpaasEvent(event);
1059
1117
  }
1060
1118
  /**
@@ -1063,7 +1121,7 @@ class Tracker {
1063
1121
  */
1064
1122
  async trackImpressionOffer(input) {
1065
1123
  const dependencies = await this.prepareTpaasEvent();
1066
- const event = (0, tpaas_event_builder_1.buildImpressionOfferEvent)(input, dependencies);
1124
+ const event = (0, tpaas_builders_1.buildImpressionOfferEvent)(input, dependencies);
1067
1125
  return this.sendTpaasEvent(event);
1068
1126
  }
1069
1127
  /**
@@ -1072,7 +1130,7 @@ class Tracker {
1072
1130
  */
1073
1131
  async trackImpressionPlayer(input) {
1074
1132
  const dependencies = await this.prepareTpaasEvent();
1075
- const event = (0, tpaas_event_builder_1.buildImpressionPlayerEvent)(input, dependencies);
1133
+ const event = (0, tpaas_builders_1.buildImpressionPlayerEvent)(input, dependencies);
1076
1134
  return this.sendTpaasEvent(event);
1077
1135
  }
1078
1136
  /**
@@ -1081,7 +1139,7 @@ class Tracker {
1081
1139
  */
1082
1140
  async trackImpressionTeaser(input) {
1083
1141
  const dependencies = await this.prepareTpaasEvent();
1084
- const event = (0, tpaas_event_builder_1.buildImpressionTeaserEvent)(input, dependencies);
1142
+ const event = (0, tpaas_builders_1.buildImpressionTeaserEvent)(input, dependencies);
1085
1143
  return this.sendTpaasEvent(event);
1086
1144
  }
1087
1145
  /**
@@ -1090,7 +1148,7 @@ class Tracker {
1090
1148
  */
1091
1149
  async trackImpressionUIElement(input) {
1092
1150
  const dependencies = await this.prepareTpaasEvent();
1093
- const event = (0, tpaas_event_builder_1.buildImpressionUIElementEvent)(input, dependencies);
1151
+ const event = (0, tpaas_builders_1.buildImpressionUIElementEvent)(input, dependencies);
1094
1152
  return this.sendTpaasEvent(event);
1095
1153
  }
1096
1154
  /**
@@ -1100,23 +1158,19 @@ class Tracker {
1100
1158
  */
1101
1159
  async trackViewFrontpage(input, options) {
1102
1160
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
1103
- this.setCurrentPage(input.object.objectId, tpaas_schemas_1.ViewFrontpage.object.objectType);
1161
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewFrontpage.object.objectType, input.page?.referrer);
1104
1162
  const dependencies = await this.prepareTpaasEvent();
1105
- const event = (0, tpaas_event_builder_1.buildViewFrontpageEvent)(input, dependencies);
1163
+ const event = (0, tpaas_builders_1.buildViewFrontpageEvent)(input, dependencies);
1106
1164
  const result = this.sendTpaasEvent(event);
1107
1165
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1108
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
1109
- const leaveFrontpageCallback = (leave) => {
1110
- this.trackLeaveFrontpage({
1166
+ const leaveFrontpageCallback = async (leave) => {
1167
+ await this.trackLeaveFrontpage({
1111
1168
  leave,
1112
1169
  ...input,
1113
1170
  });
1114
1171
  };
1115
1172
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1116
- objectElement,
1117
- pageElement,
1118
- objectResizable,
1119
- heightBuilder,
1173
+ ...options.leaveTracking,
1120
1174
  schema: tpaas_schemas_1.LeaveFrontpage.object.objectType,
1121
1175
  trackMethod: leaveFrontpageCallback,
1122
1176
  });
@@ -1130,23 +1184,19 @@ class Tracker {
1130
1184
  */
1131
1185
  async trackViewLandingpage(input, options) {
1132
1186
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
1133
- this.setCurrentPage(input.object.objectId, 'LandingPage' /* TODO: ViewLandingpage.object.type once the schema is fixed */);
1187
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewLandingpage.object.objectType, input.page?.referrer);
1134
1188
  const dependencies = await this.prepareTpaasEvent();
1135
- const event = (0, tpaas_event_builder_1.buildViewLandingpageEvent)(input, dependencies);
1189
+ const event = (0, tpaas_builders_1.buildViewLandingpageEvent)(input, dependencies);
1136
1190
  const result = this.sendTpaasEvent(event);
1137
1191
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1138
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
1139
- const leaveLandingpageCallback = (leave) => {
1140
- this.trackLeaveLandingpage({
1192
+ const leaveLandingpageCallback = async (leave) => {
1193
+ await this.trackLeaveLandingpage({
1141
1194
  leave,
1142
1195
  ...input,
1143
1196
  });
1144
1197
  };
1145
1198
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1146
- objectElement,
1147
- pageElement,
1148
- heightBuilder,
1149
- objectResizable,
1199
+ ...options.leaveTracking,
1150
1200
  schema: tpaas_schemas_1.LeaveLandingpage.object.objectType,
1151
1201
  trackMethod: leaveLandingpageCallback,
1152
1202
  });
@@ -1160,23 +1210,19 @@ class Tracker {
1160
1210
  */
1161
1211
  async trackViewListing(input, options) {
1162
1212
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
1163
- this.setCurrentPage(input.object.objectId, tpaas_schemas_1.ViewListing.object.objectType);
1213
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewListing.object.objectType, input.page?.referrer);
1164
1214
  const dependencies = await this.prepareTpaasEvent();
1165
- const event = (0, tpaas_event_builder_1.buildViewListingEvent)(input, dependencies);
1215
+ const event = (0, tpaas_builders_1.buildViewListingEvent)(input, dependencies);
1166
1216
  const result = this.sendTpaasEvent(event);
1167
1217
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1168
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
1169
- const leaveListingCallback = (leave) => {
1170
- this.trackLeaveListing({
1218
+ const leaveListingCallback = async (leave) => {
1219
+ await this.trackLeaveListing({
1171
1220
  leave,
1172
1221
  ...input,
1173
1222
  });
1174
1223
  };
1175
1224
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1176
- objectElement,
1177
- pageElement,
1178
- heightBuilder,
1179
- objectResizable,
1225
+ ...options.leaveTracking,
1180
1226
  schema: tpaas_schemas_1.LeaveListing.object.objectType,
1181
1227
  trackMethod: leaveListingCallback,
1182
1228
  });
@@ -1190,41 +1236,25 @@ class Tracker {
1190
1236
  */
1191
1237
  async trackViewLockedArticle(input, options) {
1192
1238
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
1193
- this.setCurrentPage(input.object.objectId, tpaas_schemas_1.ViewLockedArticle.object.objectType);
1239
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewLockedArticle.object.objectType, input.page?.referrer);
1194
1240
  const dependencies = await this.prepareTpaasEvent();
1195
- const event = (0, tpaas_event_builder_1.buildViewLockedArticleEvent)(input, dependencies);
1241
+ const event = (0, tpaas_builders_1.buildViewLockedArticleEvent)(input, dependencies);
1196
1242
  const result = this.sendTpaasEvent(event);
1197
1243
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1198
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
1199
- const leaveLockedArticleCallback = (leave) => {
1200
- this.trackLeaveLockedArticle({
1244
+ const leaveLockedArticleCallback = async (leave) => {
1245
+ await this.trackLeaveLockedArticle({
1201
1246
  leave,
1202
1247
  ...input,
1203
1248
  });
1204
1249
  };
1205
1250
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1206
- objectElement,
1207
- pageElement,
1208
- objectResizable,
1209
- heightBuilder,
1251
+ ...options.leaveTracking,
1210
1252
  schema: tpaas_schemas_1.LeaveLockedArticle.object.objectType,
1211
1253
  trackMethod: leaveLockedArticleCallback,
1212
1254
  });
1213
1255
  }
1214
1256
  return result;
1215
1257
  }
1216
- /**
1217
- * @param input
1218
- * @param options
1219
- * @category TPaaS Tracking
1220
- */
1221
- async trackViewLockedAudio(input) {
1222
- // despite the View event type, this is not a page view event, but rather a media object view event
1223
- // so we shouldn't reset the page view ID here or enable leave tracking
1224
- const dependencies = await this.prepareTpaasEvent();
1225
- const event = (0, tpaas_event_builder_1.buildViewLockedAudioEvent)(input, dependencies);
1226
- return this.sendTpaasEvent(event);
1227
- }
1228
1258
  /**
1229
1259
  * @param input
1230
1260
  * @param options
@@ -1232,40 +1262,25 @@ class Tracker {
1232
1262
  */
1233
1263
  async trackViewLockedAudioPage(input, options) {
1234
1264
  this.newPageView();
1235
- this.setCurrentPage(input.object.objectId, 'Audio'); // ViewLockedAudioPage.object.objectType is AudioPage, which is not allowed as a pageType
1265
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewLockedAudioPage.object.objectType, input.page?.referrer);
1236
1266
  const dependencies = await this.prepareTpaasEvent();
1237
- const event = (0, tpaas_event_builder_1.buildViewLockedAudioPageEvent)(input, dependencies);
1267
+ const event = (0, tpaas_builders_1.buildViewLockedAudioPageEvent)(input, dependencies);
1238
1268
  const result = this.sendTpaasEvent(event);
1239
1269
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1240
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
1241
- const leaveLockedAudioPageCallback = (leave) => {
1242
- this.trackLeaveLockedAudioPage({
1270
+ const leaveLockedAudioPageCallback = async (leave) => {
1271
+ await this.trackLeaveLockedAudioPage({
1243
1272
  leave,
1244
1273
  ...input,
1245
1274
  });
1246
1275
  };
1247
1276
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1248
- objectElement,
1249
- pageElement,
1250
- heightBuilder,
1251
- objectResizable,
1277
+ ...options.leaveTracking,
1252
1278
  schema: tpaas_schemas_1.LeaveLockedAudioPage.object.objectType,
1253
1279
  trackMethod: leaveLockedAudioPageCallback,
1254
1280
  });
1255
1281
  }
1256
1282
  return result;
1257
1283
  }
1258
- /**
1259
- * @param input
1260
- * @category TPaaS Tracking
1261
- */
1262
- async trackViewLockedVideo(input) {
1263
- // despite the name, this is not a page-level event. trackViewLockedVideoPage is a page-level event
1264
- // as such, we don't support (yet) automatic leave event enabling
1265
- const dependencies = await this.prepareTpaasEvent();
1266
- const event = (0, tpaas_event_builder_1.buildViewLockedVideoEvent)(input, dependencies);
1267
- return this.sendTpaasEvent(event);
1268
- }
1269
1284
  /**
1270
1285
  * @param input
1271
1286
  * @param options
@@ -1273,40 +1288,25 @@ class Tracker {
1273
1288
  */
1274
1289
  async trackViewLockedVideoPage(input, options) {
1275
1290
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
1276
- this.setCurrentPage(input.object.objectId, tpaas_schemas_1.ViewLockedVideo.object.objectType);
1291
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewLockedVideoPage.object.objectType, input.page?.referrer);
1277
1292
  const dependencies = await this.prepareTpaasEvent();
1278
- const event = (0, tpaas_event_builder_1.buildViewLockedVideoPageEvent)(input, dependencies);
1293
+ const event = (0, tpaas_builders_1.buildViewLockedVideoPageEvent)(input, dependencies);
1279
1294
  const result = this.sendTpaasEvent(event);
1280
1295
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1281
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
1282
- const leaveLockedVideoPageCallback = (leave) => {
1283
- this.trackLeaveLockedVideoPage({
1296
+ const leaveLockedVideoPageCallback = async (leave) => {
1297
+ await this.trackLeaveLockedVideoPage({
1284
1298
  leave,
1285
1299
  ...input,
1286
1300
  });
1287
1301
  };
1288
1302
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1289
- objectElement,
1290
- pageElement,
1291
- heightBuilder,
1292
- objectResizable,
1303
+ ...options.leaveTracking,
1293
1304
  schema: tpaas_schemas_1.LeaveLockedVideoPage.object.objectType,
1294
1305
  trackMethod: leaveLockedVideoPageCallback,
1295
1306
  });
1296
1307
  }
1297
1308
  return result;
1298
1309
  }
1299
- /**
1300
- * @param input
1301
- * @category TPaaS Tracking
1302
- */
1303
- async trackViewVideo(input) {
1304
- // despite the View event type, this is not a page view event, but rather a media object view event
1305
- // so we shouldn't reset the page view ID here or enable leave tracking
1306
- const dependencies = await this.prepareTpaasEvent();
1307
- const event = (0, tpaas_event_builder_1.buildViewVideoEvent)(input, dependencies);
1308
- return this.sendTpaasEvent(event);
1309
- }
1310
1310
  /**
1311
1311
  * Tracks a View VideoPage event and automatically fires a Leave VideoPage event when the user
1312
1312
  * navigates away.
@@ -1351,15 +1351,15 @@ class Tracker {
1351
1351
  */
1352
1352
  async trackViewVideoPage(input, options) {
1353
1353
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
1354
- this.setCurrentPage(input.object.objectId, 'Video'); // ViewVideoPage.object.type is VideoPage, which is not allowed as a pageType
1354
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewVideoPage.object.objectType, input.page?.referrer);
1355
1355
  const dependencies = await this.prepareTpaasEvent();
1356
- const event = (0, tpaas_event_builder_1.buildViewVideoPageEvent)(input, dependencies);
1356
+ const event = (0, tpaas_builders_1.buildViewVideoPageEvent)(input, dependencies);
1357
1357
  const result = this.sendTpaasEvent(event);
1358
1358
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1359
- const { objectElement, pageElement, heightBuilder, objectResizable, leaveStoriesBuilder } = options.leaveTracking;
1360
- const leaveVideoCallback = (leave) => {
1359
+ const { leaveStoriesBuilder, ...restLeaveTrackingOptions } = options.leaveTracking;
1360
+ const leaveVideoCallback = async (leave) => {
1361
1361
  const leaveStoriesInput = leaveStoriesBuilder?.();
1362
- this.trackLeaveVideoPage({
1362
+ await this.trackLeaveVideoPage({
1363
1363
  leave,
1364
1364
  leaveStories: leaveStoriesInput && {
1365
1365
  ...leaveStoriesInput,
@@ -1370,10 +1370,7 @@ class Tracker {
1370
1370
  });
1371
1371
  };
1372
1372
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1373
- objectElement,
1374
- pageElement,
1375
- heightBuilder,
1376
- objectResizable,
1373
+ ...restLeaveTrackingOptions,
1377
1374
  schema: tpaas_schemas_1.LeaveVideoPage.object.objectType,
1378
1375
  trackMethod: leaveVideoCallback,
1379
1376
  });
@@ -1387,23 +1384,19 @@ class Tracker {
1387
1384
  */
1388
1385
  async trackViewWeather(input, options) {
1389
1386
  this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
1390
- this.setCurrentPage(input.object.objectId, 'Page' /* TODO: ViewWeather.object.type once the schema is fixed */);
1387
+ this.setCurrentTpaasPageData(input.object.objectId, tpaas_schemas_1.ViewWeather.object.objectType, input.page?.referrer);
1391
1388
  const dependencies = await this.prepareTpaasEvent();
1392
- const event = (0, tpaas_event_builder_1.buildViewWeatherEvent)(input, dependencies);
1389
+ const event = (0, tpaas_builders_1.buildViewWeatherEvent)(input, dependencies);
1393
1390
  const result = this.sendTpaasEvent(event);
1394
1391
  if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
1395
- const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
1396
- const leaveWeatherCallback = (leave) => {
1397
- this.trackLeaveWeather({
1392
+ const leaveWeatherCallback = async (leave) => {
1393
+ await this.trackLeaveWeather({
1398
1394
  leave,
1399
1395
  ...input,
1400
1396
  });
1401
1397
  };
1402
1398
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
1403
- objectElement,
1404
- pageElement,
1405
- heightBuilder,
1406
- objectResizable,
1399
+ ...options.leaveTracking,
1407
1400
  schema: tpaas_schemas_1.LeaveWeather.object.objectType,
1408
1401
  trackMethod: leaveWeatherCallback,
1409
1402
  });
@@ -1416,7 +1409,7 @@ class Tracker {
1416
1409
  */
1417
1410
  async trackLeaveArticle(input) {
1418
1411
  const dependencies = await this.prepareTpaasEvent();
1419
- const event = (0, tpaas_event_builder_1.buildLeaveArticleEvent)(input, dependencies);
1412
+ const event = (0, tpaas_builders_1.buildLeaveArticleEvent)(input, dependencies);
1420
1413
  return this.sendTpaasEvent(event);
1421
1414
  }
1422
1415
  /**
@@ -1425,7 +1418,7 @@ class Tracker {
1425
1418
  */
1426
1419
  async trackLeaveAudioPage(input) {
1427
1420
  const dependencies = await this.prepareTpaasEvent();
1428
- const event = (0, tpaas_event_builder_1.buildLeaveAudioPageEvent)(input, dependencies);
1421
+ const event = (0, tpaas_builders_1.buildLeaveAudioPageEvent)(input, dependencies);
1429
1422
  return this.sendTpaasEvent(event);
1430
1423
  }
1431
1424
  /**
@@ -1434,7 +1427,7 @@ class Tracker {
1434
1427
  */
1435
1428
  async trackLeaveError(input) {
1436
1429
  const dependencies = await this.prepareTpaasEvent();
1437
- const event = (0, tpaas_event_builder_1.buildLeaveErrorEvent)(input, dependencies);
1430
+ const event = (0, tpaas_builders_1.buildLeaveErrorEvent)(input, dependencies);
1438
1431
  return this.sendTpaasEvent(event);
1439
1432
  }
1440
1433
  /**
@@ -1443,7 +1436,7 @@ class Tracker {
1443
1436
  */
1444
1437
  async trackLeaveFrontpage(input) {
1445
1438
  const dependencies = await this.prepareTpaasEvent();
1446
- const event = (0, tpaas_event_builder_1.buildLeaveFrontpageEvent)(input, dependencies);
1439
+ const event = (0, tpaas_builders_1.buildLeaveFrontpageEvent)(input, dependencies);
1447
1440
  return this.sendTpaasEvent(event);
1448
1441
  }
1449
1442
  /**
@@ -1452,7 +1445,7 @@ class Tracker {
1452
1445
  */
1453
1446
  async trackLeaveLandingpage(input) {
1454
1447
  const dependencies = await this.prepareTpaasEvent();
1455
- const event = (0, tpaas_event_builder_1.buildLeaveLandingpageEvent)(input, dependencies);
1448
+ const event = (0, tpaas_builders_1.buildLeaveLandingpageEvent)(input, dependencies);
1456
1449
  return this.sendTpaasEvent(event);
1457
1450
  }
1458
1451
  /**
@@ -1461,7 +1454,7 @@ class Tracker {
1461
1454
  */
1462
1455
  async trackLeaveListing(input) {
1463
1456
  const dependencies = await this.prepareTpaasEvent();
1464
- const event = (0, tpaas_event_builder_1.buildLeaveListingEvent)(input, dependencies);
1457
+ const event = (0, tpaas_builders_1.buildLeaveListingEvent)(input, dependencies);
1465
1458
  return this.sendTpaasEvent(event);
1466
1459
  }
1467
1460
  /**
@@ -1470,16 +1463,7 @@ class Tracker {
1470
1463
  */
1471
1464
  async trackLeaveLockedArticle(input) {
1472
1465
  const dependencies = await this.prepareTpaasEvent();
1473
- const event = (0, tpaas_event_builder_1.buildLeaveLockedArticleEvent)(input, dependencies);
1474
- return this.sendTpaasEvent(event);
1475
- }
1476
- /**
1477
- * @param input
1478
- * @category TPaaS Tracking
1479
- */
1480
- async trackLeaveLockedAudio(input) {
1481
- const dependencies = await this.prepareTpaasEvent();
1482
- const event = (0, tpaas_event_builder_1.buildLeaveLockedAudioEvent)(input, dependencies);
1466
+ const event = (0, tpaas_builders_1.buildLeaveLockedArticleEvent)(input, dependencies);
1483
1467
  return this.sendTpaasEvent(event);
1484
1468
  }
1485
1469
  /**
@@ -1488,16 +1472,7 @@ class Tracker {
1488
1472
  */
1489
1473
  async trackLeaveLockedAudioPage(input) {
1490
1474
  const dependencies = await this.prepareTpaasEvent();
1491
- const event = (0, tpaas_event_builder_1.buildLeaveLockedAudioPageEvent)(input, dependencies);
1492
- return this.sendTpaasEvent(event);
1493
- }
1494
- /**
1495
- * @param input
1496
- * @category TPaaS Tracking
1497
- */
1498
- async trackLeaveLockedVideo(input) {
1499
- const dependencies = await this.prepareTpaasEvent();
1500
- const event = (0, tpaas_event_builder_1.buildLeaveLockedVideoEvent)(input, dependencies);
1475
+ const event = (0, tpaas_builders_1.buildLeaveLockedAudioPageEvent)(input, dependencies);
1501
1476
  return this.sendTpaasEvent(event);
1502
1477
  }
1503
1478
  /**
@@ -1506,7 +1481,7 @@ class Tracker {
1506
1481
  */
1507
1482
  async trackLeaveLockedVideoPage(input) {
1508
1483
  const dependencies = await this.prepareTpaasEvent();
1509
- const event = (0, tpaas_event_builder_1.buildLeaveLockedVideoPageEvent)(input, dependencies);
1484
+ const event = (0, tpaas_builders_1.buildLeaveLockedVideoPageEvent)(input, dependencies);
1510
1485
  return this.sendTpaasEvent(event);
1511
1486
  }
1512
1487
  /**
@@ -1515,7 +1490,7 @@ class Tracker {
1515
1490
  */
1516
1491
  async trackLeavePage(input) {
1517
1492
  const dependencies = await this.prepareTpaasEvent();
1518
- const event = (0, tpaas_event_builder_1.buildLeavePageEvent)(input, dependencies);
1493
+ const event = (0, tpaas_builders_1.buildLeavePageEvent)(input, dependencies);
1519
1494
  return this.sendTpaasEvent(event);
1520
1495
  }
1521
1496
  /**
@@ -1524,7 +1499,7 @@ class Tracker {
1524
1499
  */
1525
1500
  async trackLeaveSportsPage(input) {
1526
1501
  const dependencies = await this.prepareTpaasEvent();
1527
- const event = (0, tpaas_event_builder_1.buildLeaveSportsPageEvent)(input, dependencies);
1502
+ const event = (0, tpaas_builders_1.buildLeaveSportsPageEvent)(input, dependencies);
1528
1503
  return this.sendTpaasEvent(event);
1529
1504
  }
1530
1505
  /**
@@ -1533,7 +1508,7 @@ class Tracker {
1533
1508
  */
1534
1509
  async trackLeaveVideoPage(input) {
1535
1510
  const dependencies = await this.prepareTpaasEvent();
1536
- const event = (0, tpaas_event_builder_1.buildLeaveVideoPageEvent)(input, dependencies);
1511
+ const event = (0, tpaas_builders_1.buildLeaveVideoPageEvent)(input, dependencies);
1537
1512
  return this.sendTpaasEvent(event);
1538
1513
  }
1539
1514
  /**
@@ -1542,7 +1517,7 @@ class Tracker {
1542
1517
  */
1543
1518
  async trackLeaveWeather(input) {
1544
1519
  const dependencies = await this.prepareTpaasEvent();
1545
- const event = (0, tpaas_event_builder_1.buildLeaveWeatherEvent)(input, dependencies);
1520
+ const event = (0, tpaas_builders_1.buildLeaveWeatherEvent)(input, dependencies);
1546
1521
  return this.sendTpaasEvent(event);
1547
1522
  }
1548
1523
  /**
@@ -1551,7 +1526,7 @@ class Tracker {
1551
1526
  */
1552
1527
  async trackEngagementAudio(input) {
1553
1528
  const dependencies = await this.prepareTpaasEvent();
1554
- const event = (0, tpaas_event_builder_1.buildEngagementAudioEvent)(input, dependencies);
1529
+ const event = (0, tpaas_builders_1.buildEngagementAudioEvent)(input, dependencies);
1555
1530
  return this.sendTpaasEvent(event);
1556
1531
  }
1557
1532
  /**
@@ -1560,7 +1535,7 @@ class Tracker {
1560
1535
  */
1561
1536
  async trackEngagementForm(input) {
1562
1537
  const dependencies = await this.prepareTpaasEvent();
1563
- const event = (0, tpaas_event_builder_1.buildEngagementFormEvent)(input, dependencies);
1538
+ const event = (0, tpaas_builders_1.buildEngagementFormEvent)(input, dependencies);
1564
1539
  return this.sendTpaasEvent(event);
1565
1540
  }
1566
1541
  /**
@@ -1569,7 +1544,7 @@ class Tracker {
1569
1544
  */
1570
1545
  async trackEngagementOffer(input) {
1571
1546
  const dependencies = await this.prepareTpaasEvent();
1572
- const event = (0, tpaas_event_builder_1.buildEngagementOfferEvent)(input, dependencies);
1547
+ const event = (0, tpaas_builders_1.buildEngagementOfferEvent)(input, dependencies);
1573
1548
  return this.sendTpaasEvent(event);
1574
1549
  }
1575
1550
  /**
@@ -1578,7 +1553,7 @@ class Tracker {
1578
1553
  */
1579
1554
  async trackEngagementTeaser(input) {
1580
1555
  const dependencies = await this.prepareTpaasEvent();
1581
- const event = (0, tpaas_event_builder_1.buildEngagementTeaserEvent)(input, dependencies);
1556
+ const event = (0, tpaas_builders_1.buildEngagementTeaserEvent)(input, dependencies);
1582
1557
  return this.sendTpaasEvent(event);
1583
1558
  }
1584
1559
  /**
@@ -1587,7 +1562,7 @@ class Tracker {
1587
1562
  */
1588
1563
  async trackEngagementUIElement(input) {
1589
1564
  const dependencies = await this.prepareTpaasEvent();
1590
- const event = (0, tpaas_event_builder_1.buildEngagementUIElementEvent)(input, dependencies);
1565
+ const event = (0, tpaas_builders_1.buildEngagementUIElementEvent)(input, dependencies);
1591
1566
  return this.sendTpaasEvent(event);
1592
1567
  }
1593
1568
  /**
@@ -1596,7 +1571,7 @@ class Tracker {
1596
1571
  */
1597
1572
  async trackEngagementVideo(input) {
1598
1573
  const dependencies = await this.prepareTpaasEvent();
1599
- const event = (0, tpaas_event_builder_1.buildEngagementVideoEvent)(input, dependencies);
1574
+ const event = (0, tpaas_builders_1.buildEngagementVideoEvent)(input, dependencies);
1600
1575
  return this.sendTpaasEvent(event);
1601
1576
  }
1602
1577
  /**
@@ -1605,7 +1580,7 @@ class Tracker {
1605
1580
  */
1606
1581
  async trackEngagementVideoAd(input) {
1607
1582
  const dependencies = await this.prepareTpaasEvent();
1608
- const event = (0, tpaas_event_builder_1.buildEngagementVideoAdEvent)(input, dependencies);
1583
+ const event = (0, tpaas_builders_1.buildEngagementVideoAdEvent)(input, dependencies);
1609
1584
  return this.sendTpaasEvent(event);
1610
1585
  }
1611
1586
  /**
@@ -1614,7 +1589,7 @@ class Tracker {
1614
1589
  */
1615
1590
  async trackEngagementWidget(input) {
1616
1591
  const dependencies = await this.prepareTpaasEvent();
1617
- const event = (0, tpaas_event_builder_1.buildEngagementWidgetEvent)(input, dependencies);
1592
+ const event = (0, tpaas_builders_1.buildEngagementWidgetEvent)(input, dependencies);
1618
1593
  return this.sendTpaasEvent(event);
1619
1594
  }
1620
1595
  /**
@@ -1628,7 +1603,7 @@ class Tracker {
1628
1603
  this.resolveSessionIdPromise();
1629
1604
  // The Hybrid use case implements a "bridged" event method, injected into the window scope,
1630
1605
  // which is used to send events through the native app.
1631
- if ((0, pulse_utils_1.isFunction)(this.state.altEventHandler)) {
1606
+ if ((0, utils_1.isFunction)(this.state.altEventHandler)) {
1632
1607
  this.state.altEventHandler(JSON.stringify(event));
1633
1608
  return event;
1634
1609
  }
@@ -1711,7 +1686,7 @@ class Tracker {
1711
1686
  eventInput: evaluatedInput,
1712
1687
  sdkConfig: this.state,
1713
1688
  });
1714
- return (0, pulse_utils_1.evaluateAndFlatten)(data);
1689
+ return (0, utils_1.evaluateAndFlatten)(data);
1715
1690
  });
1716
1691
  }
1717
1692
  /**
@@ -1723,8 +1698,8 @@ class Tracker {
1723
1698
  * @category Legacy Tracking
1724
1699
  */
1725
1700
  async evaluateEventInputs(eventType, eventInput, builders = this.builders, options) {
1726
- const buildersOutput = await Promise.all([(0, pulse_utils_1.evaluateAndFlatten)(builders), (0, pulse_utils_1.evaluateAndFlatten)(eventInput)]);
1727
- let eventOutput = buildersOutput.reduce((acc, p) => (0, pulse_utils_1.pulseMerge)(acc, p), {});
1701
+ const buildersOutput = await Promise.all([(0, utils_1.evaluateAndFlatten)(builders), (0, utils_1.evaluateAndFlatten)(eventInput)]);
1702
+ let eventOutput = buildersOutput.reduce((acc, p) => (0, utils_1.pulseMerge)(acc, p), {});
1728
1703
  eventOutput = this.applyEventTypeDefaults(eventOutput, eventType);
1729
1704
  eventOutput = this.applyBookmarkedEvent(eventOutput, options?.applyBookmarkKey);
1730
1705
  eventOutput = await this.applyConsents(eventOutput);
@@ -1792,7 +1767,7 @@ class Tracker {
1792
1767
  */
1793
1768
  update(builder, mergeBuilder = false) {
1794
1769
  if (mergeBuilder) {
1795
- this.builders = (0, pulse_utils_1.pulseMerge)({}, this.builders, builder);
1770
+ this.builders = (0, utils_1.pulseMerge)({}, this.builders, builder);
1796
1771
  }
1797
1772
  else {
1798
1773
  this.builders = Object.assign({}, this.builders, builder);
@@ -2260,8 +2235,8 @@ class Tracker {
2260
2235
  * with the added guarantee that a second Leave event will not be triggered if one already has been sent.
2261
2236
  * @category TPaaS Leave Tracking
2262
2237
  */
2263
- trackTpaasActiveLeave() {
2264
- (0, leaveTrackingTpaas_1.trackTpaasActiveLeave)();
2238
+ async trackTpaasActiveLeave() {
2239
+ await (0, leaveTrackingTpaas_1.trackTpaasActiveLeave)();
2265
2240
  }
2266
2241
  /**
2267
2242
  * Check if leave tracking is enabled (if an event will be sent when the user leaves the page)
@@ -2285,13 +2260,13 @@ class Tracker {
2285
2260
  * @private
2286
2261
  */
2287
2262
  async resolveTrackInput(input) {
2288
- return (0, pulse_utils_1.evaluateAndFlatten)(input);
2263
+ return (0, utils_1.evaluateAndFlatten)(input);
2289
2264
  }
2290
2265
  /**
2291
2266
  * @private
2292
2267
  */
2293
2268
  async resolveTrackGlobals() {
2294
- return (0, pulse_utils_1.evaluateAndFlatten)({ ...this.builders });
2269
+ return (0, utils_1.evaluateAndFlatten)({ ...this.builders });
2295
2270
  }
2296
2271
  /**
2297
2272
  * Send all anonymous events that are in the internal anonymous event queue.
@@ -2397,7 +2372,7 @@ class Tracker {
2397
2372
  const session = (0, builders_1.session)({}, creationDate);
2398
2373
  // Resolve any pending session ID promises
2399
2374
  this.resolveSessionIdPromise();
2400
- return (0, pulse_utils_1.pulseMerge)({}, eventInput, {
2375
+ return (0, utils_1.pulseMerge)({}, eventInput, {
2401
2376
  '@id': (0, uuid_1.v4)(),
2402
2377
  creationDate: creationDate.toISOString(),
2403
2378
  session,
@@ -2426,7 +2401,7 @@ class Tracker {
2426
2401
  */
2427
2402
  createAnonymousEvent(eventInput) {
2428
2403
  const creationDate = new Date();
2429
- return (0, pulse_utils_1.pulseMerge)({}, eventInput, {
2404
+ return (0, utils_1.pulseMerge)({}, eventInput, {
2430
2405
  '@id': (0, uuid_1.v4)(),
2431
2406
  creationDate: creationDate.toISOString(),
2432
2407
  });
@@ -2439,7 +2414,7 @@ class Tracker {
2439
2414
  */
2440
2415
  applyEventTypeDefaults(eventInput, eventType) {
2441
2416
  const eventDefaults = getEventBuilder(eventType).defaults;
2442
- return (0, pulse_utils_1.pulseMerge)({}, eventDefaults(), eventInput);
2417
+ return (0, utils_1.pulseMerge)({}, eventDefaults(), eventInput);
2443
2418
  }
2444
2419
  /**
2445
2420
  * @param eventInput
@@ -2448,7 +2423,7 @@ class Tracker {
2448
2423
  */
2449
2424
  applyAnonymousEventTypeDefaults(eventInput, eventType) {
2450
2425
  const eventDefaults = getAnonymousEventBuilder(eventType).defaults;
2451
- return (0, pulse_utils_1.pulseMerge)({}, eventDefaults(), eventInput);
2426
+ return (0, utils_1.pulseMerge)({}, eventDefaults(), eventInput);
2452
2427
  }
2453
2428
  /**
2454
2429
  * applyBookmarkedEvent
@@ -2463,7 +2438,7 @@ class Tracker {
2463
2438
  const eventOutput = Object.assign({}, eventInput);
2464
2439
  const bookmarkedPageViewEvent = this.bookmark.get(bookmarkKey) ?? {};
2465
2440
  const { '@id': _id, '@type': _type, creationDate: _creationDate, ...coreEvent } = bookmarkedPageViewEvent;
2466
- return (0, pulse_utils_1.pulseMerge)({}, eventOutput, coreEvent);
2441
+ return (0, utils_1.pulseMerge)({}, eventOutput, coreEvent);
2467
2442
  }
2468
2443
  /**
2469
2444
  * applyConsents
@@ -2471,7 +2446,7 @@ class Tracker {
2471
2446
  * @private
2472
2447
  */
2473
2448
  async applyConsents(eventInput) {
2474
- return (0, pulse_utils_1.pulseMerge)({}, eventInput, await this.evaluateConsents());
2449
+ return (0, utils_1.pulseMerge)({}, eventInput, await this.evaluateConsents());
2475
2450
  }
2476
2451
  /**
2477
2452
  * applyConsentsAnonymous
@@ -2479,7 +2454,7 @@ class Tracker {
2479
2454
  * @private
2480
2455
  */
2481
2456
  applyConsentsAnonymous(eventInput) {
2482
- return (0, pulse_utils_1.pulseMerge)({}, eventInput, this.evaluateConsentsAnonymous());
2457
+ return (0, utils_1.pulseMerge)({}, eventInput, this.evaluateConsentsAnonymous());
2483
2458
  }
2484
2459
  /**
2485
2460
  * Enriches the event with consent data saved in state.
@@ -2501,7 +2476,7 @@ class Tracker {
2501
2476
  * @category Consents
2502
2477
  */
2503
2478
  evaluateConsentsAnonymous() {
2504
- const consents = (0, pulse_utils_1.isPromise)(this.state.consents) ? (0, consent_manager_1.getFallbackConsents)() : this.state.consents;
2479
+ const consents = (0, utils_1.isPromise)(this.state.consents) ? (0, consent_manager_1.getFallbackConsents)() : this.state.consents;
2505
2480
  return {
2506
2481
  ...(consents && { consents }),
2507
2482
  };