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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/dist/cjs/EventBus/EventBus.js +146 -0
  2. package/dist/cjs/Tracker.js +2499 -0
  3. package/dist/cjs/Tracker.test-d.js +76 -0
  4. package/dist/cjs/app-integration.js +40 -0
  5. package/dist/cjs/builders/actor.js +60 -0
  6. package/dist/cjs/builders/consent-manager.js +134 -0
  7. package/dist/cjs/builders/consents.js +149 -0
  8. package/dist/cjs/builders/device-browser.js +89 -0
  9. package/dist/cjs/builders/device-node.js +63 -0
  10. package/dist/cjs/builders/device.js +23 -0
  11. package/dist/cjs/builders/events-anonymous-browser.js +6 -0
  12. package/dist/cjs/builders/events-anonymous-node.js +88 -0
  13. package/dist/cjs/builders/events-anonymous.js +17 -0
  14. package/dist/cjs/builders/events-browser.js +8 -0
  15. package/dist/cjs/builders/events-node.js +127 -0
  16. package/dist/cjs/builders/events.js +17 -0
  17. package/dist/cjs/builders/experimentMetadata.js +25 -0
  18. package/dist/cjs/builders/experiments.js +32 -0
  19. package/dist/cjs/builders/index.js +52 -0
  20. package/dist/cjs/builders/location.js +38 -0
  21. package/dist/cjs/builders/objects/objects-anonymous-browser.js +36 -0
  22. package/dist/cjs/builders/objects/objects-anonymous-node.js +95 -0
  23. package/dist/cjs/builders/objects/objects-anonymous.js +23 -0
  24. package/dist/cjs/builders/objects/objects-browser.js +36 -0
  25. package/dist/cjs/builders/objects/objects-node.js +126 -0
  26. package/dist/cjs/builders/objects/objects.js +23 -0
  27. package/dist/cjs/builders/objects/utils.js +23 -0
  28. package/dist/cjs/builders/origin-browser.js +28 -0
  29. package/dist/cjs/builders/origin-node.js +29 -0
  30. package/dist/cjs/builders/origin.js +23 -0
  31. package/dist/cjs/builders/provider.js +24 -0
  32. package/dist/cjs/builders/session-browser.js +97 -0
  33. package/dist/cjs/builders/session-node.js +9 -0
  34. package/dist/cjs/builders/session.js +23 -0
  35. package/dist/cjs/builders/tracker-browser.js +34 -0
  36. package/dist/cjs/builders/tracker-node.js +22 -0
  37. package/dist/cjs/builders/trackerBuilder.js +23 -0
  38. package/dist/cjs/config-browser.js +26 -0
  39. package/dist/cjs/config.js +9 -0
  40. package/dist/cjs/createPulseTracker.js +50 -0
  41. package/dist/cjs/defer.js +20 -0
  42. package/dist/cjs/getPulseTracker.js +74 -0
  43. package/dist/cjs/identity/actor.js +60 -0
  44. package/dist/cjs/identity/advertising.js +62 -0
  45. package/dist/cjs/identity/cis.js +66 -0
  46. package/dist/cjs/identity/device.js +20 -0
  47. package/dist/cjs/identity/index.js +20 -0
  48. package/dist/cjs/index.js +57 -0
  49. package/dist/cjs/leaveTracking/constants.js +26 -0
  50. package/dist/cjs/leaveTracking/index.js +368 -0
  51. package/dist/cjs/leaveTracking/types.js +19 -0
  52. package/dist/cjs/leaveTrackingTpaas/constants.js +18 -0
  53. package/dist/cjs/leaveTrackingTpaas/index.js +341 -0
  54. package/dist/cjs/leaveTrackingTpaas/types.js +19 -0
  55. package/dist/cjs/network-browser.js +35 -0
  56. package/dist/cjs/network.js +15 -0
  57. package/dist/cjs/remoteConfig/index.js +124 -0
  58. package/dist/cjs/tracker-proxy/consts.js +72 -0
  59. package/dist/cjs/tracker-proxy/proxy-provider.js +68 -0
  60. package/dist/cjs/types.js +2 -0
  61. package/dist/cjs/version.json +1 -0
  62. package/dist/cjs/visibility-observer/index.js +101 -0
  63. package/dist/cjs/warnOnce.js +11 -0
  64. package/dist/cjs/wrapper/engagement/ui-element/event-builder.js +21 -0
  65. package/dist/cjs/wrapper/engagement/ui-element/types.js +2 -0
  66. package/dist/cjs/wrapper/types/base-event.js +2 -0
  67. package/dist/cjs/wrapper/types/engagement-event.js +2 -0
  68. package/dist/cjs/wrapper/types/event.js +2 -0
  69. package/dist/cjs/wrapper/types/index.js +19 -0
  70. package/dist/cjs/wrapper/types/utils.js +2 -0
  71. package/dist/cjs/wrapper/utils/get-navigation-type.js +32 -0
  72. package/dist/cjs/wrapper/utils/page-from-page-view.js +9 -0
  73. package/dist/cjs/wrapper/view/article/event-builder.js +19 -0
  74. package/dist/cjs/wrapper/view/article/types.js +2 -0
  75. package/dist/cjs/wrapper/view/frontpage/event-builder.js +16 -0
  76. package/dist/cjs/wrapper/view/frontpage/types.js +2 -0
  77. package/dist/cjs/wrapper/view/listing/event-builder.js +14 -0
  78. package/dist/cjs/wrapper/view/listing/types.js +2 -0
  79. package/dist/cjs/wrapper/view/loginposter/event-builder.js +11 -0
  80. package/dist/cjs/wrapper/view/loginposter/types.js +2 -0
  81. package/dist/cjs/wrapper/view/page/event-builder.js +18 -0
  82. package/dist/cjs/wrapper/view/page/types.js +2 -0
  83. package/dist/cjs/wrapper/view/salesposter/event-builder.js +18 -0
  84. package/dist/cjs/wrapper/view/salesposter/types.js +2 -0
  85. package/dist/cjs/wrapper/view/ui-element/event-builder.js +15 -0
  86. package/dist/cjs/wrapper/view/ui-element/types.js +2 -0
  87. package/dist/ejs/EventBus/EventBus.js +140 -0
  88. package/dist/ejs/Tracker.js +2455 -0
  89. package/dist/ejs/Tracker.test-d.js +71 -0
  90. package/dist/ejs/app-integration.js +33 -0
  91. package/dist/ejs/builders/actor.js +53 -0
  92. package/dist/ejs/builders/consent-manager.js +125 -0
  93. package/dist/ejs/builders/consents.js +138 -0
  94. package/dist/ejs/builders/device-browser.js +69 -0
  95. package/dist/ejs/builders/device-node.js +57 -0
  96. package/dist/ejs/builders/device.js +2 -0
  97. package/dist/ejs/builders/events-anonymous-browser.js +1 -0
  98. package/dist/ejs/builders/events-anonymous-node.js +48 -0
  99. package/dist/ejs/builders/events-anonymous.js +1 -0
  100. package/dist/ejs/builders/events-browser.js +1 -0
  101. package/dist/ejs/builders/events-node.js +84 -0
  102. package/dist/ejs/builders/events.js +1 -0
  103. package/dist/ejs/builders/experimentMetadata.js +21 -0
  104. package/dist/ejs/builders/experiments.js +27 -0
  105. package/dist/ejs/builders/index.js +12 -0
  106. package/dist/ejs/builders/location.js +34 -0
  107. package/dist/ejs/builders/objects/objects-anonymous-browser.js +14 -0
  108. package/dist/ejs/builders/objects/objects-anonymous-node.js +90 -0
  109. package/dist/ejs/builders/objects/objects-anonymous.js +2 -0
  110. package/dist/ejs/builders/objects/objects-browser.js +14 -0
  111. package/dist/ejs/builders/objects/objects-node.js +121 -0
  112. package/dist/ejs/builders/objects/objects.js +2 -0
  113. package/dist/ejs/builders/objects/utils.js +20 -0
  114. package/dist/ejs/builders/origin-browser.js +6 -0
  115. package/dist/ejs/builders/origin-node.js +24 -0
  116. package/dist/ejs/builders/origin.js +2 -0
  117. package/dist/ejs/builders/provider.js +18 -0
  118. package/dist/ejs/builders/session-browser.js +90 -0
  119. package/dist/ejs/builders/session-node.js +4 -0
  120. package/dist/ejs/builders/session.js +2 -0
  121. package/dist/ejs/builders/tracker-browser.js +13 -0
  122. package/dist/ejs/builders/tracker-node.js +14 -0
  123. package/dist/ejs/builders/trackerBuilder.js +2 -0
  124. package/dist/ejs/config-browser.js +23 -0
  125. package/dist/ejs/config.js +6 -0
  126. package/dist/ejs/createPulseTracker.js +44 -0
  127. package/dist/ejs/defer.js +17 -0
  128. package/dist/ejs/getPulseTracker.js +71 -0
  129. package/dist/ejs/identity/actor.js +51 -0
  130. package/dist/ejs/identity/advertising.js +57 -0
  131. package/dist/ejs/identity/cis.js +58 -0
  132. package/dist/ejs/identity/device.js +17 -0
  133. package/dist/ejs/identity/index.js +4 -0
  134. package/dist/ejs/index.js +9 -0
  135. package/dist/ejs/leaveTracking/constants.js +19 -0
  136. package/dist/ejs/leaveTracking/index.js +319 -0
  137. package/dist/ejs/leaveTracking/types.js +16 -0
  138. package/dist/ejs/leaveTrackingTpaas/constants.js +13 -0
  139. package/dist/ejs/leaveTrackingTpaas/index.js +291 -0
  140. package/dist/ejs/leaveTrackingTpaas/types.js +16 -0
  141. package/dist/ejs/network-browser.js +32 -0
  142. package/dist/ejs/network.js +12 -0
  143. package/dist/ejs/remoteConfig/index.js +111 -0
  144. package/dist/ejs/tracker-proxy/consts.js +68 -0
  145. package/dist/ejs/tracker-proxy/proxy-provider.js +62 -0
  146. package/dist/ejs/types.js +1 -0
  147. package/dist/ejs/version.json +1 -0
  148. package/dist/ejs/visibility-observer/index.js +97 -0
  149. package/dist/ejs/warnOnce.js +9 -0
  150. package/dist/ejs/wrapper/engagement/ui-element/event-builder.js +17 -0
  151. package/dist/ejs/wrapper/engagement/ui-element/types.js +1 -0
  152. package/dist/ejs/wrapper/types/base-event.js +1 -0
  153. package/dist/ejs/wrapper/types/engagement-event.js +1 -0
  154. package/dist/ejs/wrapper/types/event.js +1 -0
  155. package/dist/ejs/wrapper/types/index.js +3 -0
  156. package/dist/ejs/wrapper/types/utils.js +1 -0
  157. package/dist/ejs/wrapper/utils/get-navigation-type.js +29 -0
  158. package/dist/ejs/wrapper/utils/page-from-page-view.js +6 -0
  159. package/dist/ejs/wrapper/view/article/event-builder.js +15 -0
  160. package/dist/ejs/wrapper/view/article/types.js +1 -0
  161. package/dist/ejs/wrapper/view/frontpage/event-builder.js +12 -0
  162. package/dist/ejs/wrapper/view/frontpage/types.js +1 -0
  163. package/dist/ejs/wrapper/view/listing/event-builder.js +10 -0
  164. package/dist/ejs/wrapper/view/listing/types.js +1 -0
  165. package/dist/ejs/wrapper/view/loginposter/event-builder.js +7 -0
  166. package/dist/ejs/wrapper/view/loginposter/types.js +1 -0
  167. package/dist/ejs/wrapper/view/page/event-builder.js +14 -0
  168. package/dist/ejs/wrapper/view/page/types.js +1 -0
  169. package/dist/ejs/wrapper/view/salesposter/event-builder.js +14 -0
  170. package/dist/ejs/wrapper/view/salesposter/types.js +1 -0
  171. package/dist/ejs/wrapper/view/ui-element/event-builder.js +11 -0
  172. package/dist/ejs/wrapper/view/ui-element/types.js +1 -0
  173. package/dist/types/EventBus/EventBus.d.ts +106 -0
  174. package/dist/types/Tracker.d.ts +1418 -0
  175. package/dist/types/Tracker.test-d.d.ts +1 -0
  176. package/dist/types/app-integration.d.ts +10 -0
  177. package/dist/types/builders/actor.d.ts +39 -0
  178. package/dist/types/builders/consent-manager.d.ts +49 -0
  179. package/dist/types/builders/consents.d.ts +107 -0
  180. package/dist/types/builders/device-browser.d.ts +6 -0
  181. package/dist/types/builders/device-node.d.ts +65 -0
  182. package/dist/types/builders/device.d.ts +2 -0
  183. package/dist/types/builders/events-anonymous-browser.d.ts +1 -0
  184. package/dist/types/builders/events-anonymous-node.d.ts +82 -0
  185. package/dist/types/builders/events-anonymous.d.ts +1 -0
  186. package/dist/types/builders/events-browser.d.ts +1 -0
  187. package/dist/types/builders/events-node.d.ts +130 -0
  188. package/dist/types/builders/events.d.ts +1 -0
  189. package/dist/types/builders/experimentMetadata.d.ts +25 -0
  190. package/dist/types/builders/experiments.d.ts +24 -0
  191. package/dist/types/builders/index.d.ts +23 -0
  192. package/dist/types/builders/location.d.ts +34 -0
  193. package/dist/types/builders/objects/objects-anonymous-browser.d.ts +11 -0
  194. package/dist/types/builders/objects/objects-anonymous-node.d.ts +52 -0
  195. package/dist/types/builders/objects/objects-anonymous.d.ts +2 -0
  196. package/dist/types/builders/objects/objects-browser.d.ts +11 -0
  197. package/dist/types/builders/objects/objects-node.d.ts +60 -0
  198. package/dist/types/builders/objects/objects.d.ts +2 -0
  199. package/dist/types/builders/objects/utils.d.ts +1 -0
  200. package/dist/types/builders/origin-browser.d.ts +5 -0
  201. package/dist/types/builders/origin-node.d.ts +18 -0
  202. package/dist/types/builders/origin.d.ts +2 -0
  203. package/dist/types/builders/provider.d.ts +14 -0
  204. package/dist/types/builders/session-browser.d.ts +20 -0
  205. package/dist/types/builders/session-node.d.ts +3 -0
  206. package/dist/types/builders/session.d.ts +2 -0
  207. package/dist/types/builders/tracker-browser.d.ts +2 -0
  208. package/dist/types/builders/tracker-node.d.ts +14 -0
  209. package/dist/types/builders/trackerBuilder.d.ts +2 -0
  210. package/dist/types/config-browser.d.ts +23 -0
  211. package/dist/types/config.d.ts +6 -0
  212. package/dist/types/createPulseTracker.d.ts +21 -0
  213. package/dist/types/defer.d.ts +28 -0
  214. package/dist/types/getPulseTracker.d.ts +59 -0
  215. package/dist/types/identity/actor.d.ts +28 -0
  216. package/dist/types/identity/advertising.d.ts +30 -0
  217. package/dist/types/identity/cis.d.ts +21 -0
  218. package/dist/types/identity/device.d.ts +12 -0
  219. package/dist/types/identity/index.d.ts +4 -0
  220. package/dist/types/index.d.ts +31 -0
  221. package/dist/types/leaveTracking/constants.d.ts +26 -0
  222. package/dist/types/leaveTracking/index.d.ts +23 -0
  223. package/dist/types/leaveTracking/types.d.ts +78 -0
  224. package/dist/types/leaveTrackingTpaas/constants.d.ts +13 -0
  225. package/dist/types/leaveTrackingTpaas/index.d.ts +28 -0
  226. package/dist/types/leaveTrackingTpaas/types.d.ts +45 -0
  227. package/dist/types/network-browser.d.ts +5 -0
  228. package/dist/types/network.d.ts +4 -0
  229. package/dist/types/remoteConfig/index.d.ts +32 -0
  230. package/dist/types/tracker-proxy/consts.d.ts +45 -0
  231. package/dist/types/tracker-proxy/proxy-provider.d.ts +2 -0
  232. package/dist/types/types.d.ts +93 -0
  233. package/dist/types/visibility-observer/index.d.ts +38 -0
  234. package/dist/types/warnOnce.d.ts +2 -0
  235. package/dist/types/wrapper/engagement/ui-element/event-builder.d.ts +3 -0
  236. package/dist/types/wrapper/engagement/ui-element/types.d.ts +29 -0
  237. package/dist/types/wrapper/types/base-event.d.ts +74 -0
  238. package/dist/types/wrapper/types/engagement-event.d.ts +5 -0
  239. package/dist/types/wrapper/types/event.d.ts +41 -0
  240. package/dist/types/wrapper/types/index.d.ts +3 -0
  241. package/dist/types/wrapper/types/utils.d.ts +5 -0
  242. package/dist/types/wrapper/utils/get-navigation-type.d.ts +3 -0
  243. package/dist/types/wrapper/utils/page-from-page-view.d.ts +3 -0
  244. package/dist/types/wrapper/view/article/event-builder.d.ts +2 -0
  245. package/dist/types/wrapper/view/article/types.d.ts +27 -0
  246. package/dist/types/wrapper/view/frontpage/event-builder.d.ts +2 -0
  247. package/dist/types/wrapper/view/frontpage/types.d.ts +18 -0
  248. package/dist/types/wrapper/view/listing/event-builder.d.ts +2 -0
  249. package/dist/types/wrapper/view/listing/types.d.ts +27 -0
  250. package/dist/types/wrapper/view/loginposter/event-builder.d.ts +2 -0
  251. package/dist/types/wrapper/view/loginposter/types.d.ts +14 -0
  252. package/dist/types/wrapper/view/page/event-builder.d.ts +2 -0
  253. package/dist/types/wrapper/view/page/types.d.ts +16 -0
  254. package/dist/types/wrapper/view/salesposter/event-builder.d.ts +2 -0
  255. package/dist/types/wrapper/view/salesposter/types.d.ts +15 -0
  256. package/dist/types/wrapper/view/ui-element/event-builder.d.ts +3 -0
  257. package/dist/types/wrapper/view/ui-element/types.d.ts +28 -0
  258. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.d.ts +26 -0
  259. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js +273 -0
  260. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js.map +1 -0
  261. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.d.ts +10 -0
  262. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js +7 -0
  263. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js.map +1 -0
  264. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.d.ts +14 -0
  265. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js +39 -0
  266. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js.map +1 -0
  267. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.d.ts +4 -0
  268. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js +12 -0
  269. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js.map +1 -0
  270. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.d.ts +55 -0
  271. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js +276 -0
  272. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js.map +1 -0
  273. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.d.ts +36 -0
  274. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js +87 -0
  275. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js.map +1 -0
  276. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.d.ts +6 -0
  277. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js +21 -0
  278. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js.map +1 -0
  279. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.d.ts +24 -0
  280. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js +3 -0
  281. package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js.map +1 -0
  282. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.d.ts +26 -0
  283. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js +203 -0
  284. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js.map +1 -0
  285. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.d.ts +10 -0
  286. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js +4 -0
  287. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js.map +1 -0
  288. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.d.ts +14 -0
  289. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js +35 -0
  290. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js.map +1 -0
  291. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.d.ts +4 -0
  292. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js +3 -0
  293. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js.map +1 -0
  294. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.d.ts +55 -0
  295. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js +254 -0
  296. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js.map +1 -0
  297. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.d.ts +36 -0
  298. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js +50 -0
  299. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js.map +1 -0
  300. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.d.ts +6 -0
  301. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js +17 -0
  302. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js.map +1 -0
  303. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.d.ts +24 -0
  304. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js +2 -0
  305. package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js.map +1 -0
  306. package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis-browser.d.ts +26 -0
  307. package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis.d.ts +10 -0
  308. package/node_modules/@schibsted/pulse-cis-sync/dist/types/eventEmitter.d.ts +14 -0
  309. package/node_modules/@schibsted/pulse-cis-sync/dist/types/index.d.ts +4 -0
  310. package/node_modules/@schibsted/pulse-cis-sync/dist/types/pulse-cookie.d.ts +55 -0
  311. package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/pulseStorage.d.ts +36 -0
  312. package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/storage.d.ts +6 -0
  313. package/node_modules/@schibsted/pulse-cis-sync/dist/types/types.d.ts +24 -0
  314. package/node_modules/@schibsted/pulse-cis-sync/package.json +44 -0
  315. package/node_modules/@schibsted/pulse-utils/dist/cjs/cookie-config.js +10 -0
  316. package/node_modules/@schibsted/pulse-utils/dist/cjs/cookie.js +86 -0
  317. package/node_modules/@schibsted/pulse-utils/dist/cjs/events.js +109 -0
  318. package/node_modules/@schibsted/pulse-utils/dist/cjs/get.js +18 -0
  319. package/node_modules/@schibsted/pulse-utils/dist/cjs/getRootDomain.js +54 -0
  320. package/node_modules/@schibsted/pulse-utils/dist/cjs/index.js +38 -0
  321. package/node_modules/@schibsted/pulse-utils/dist/cjs/merge.js +38 -0
  322. package/node_modules/@schibsted/pulse-utils/dist/cjs/objects.js +34 -0
  323. package/node_modules/@schibsted/pulse-utils/dist/cjs/omit.js +9 -0
  324. package/node_modules/@schibsted/pulse-utils/dist/cjs/randomString.js +18 -0
  325. package/node_modules/@schibsted/pulse-utils/dist/cjs/throttle.js +34 -0
  326. package/node_modules/@schibsted/pulse-utils/dist/cjs/webApi.js +21 -0
  327. package/node_modules/@schibsted/pulse-utils/dist/ejs/cookie-config.js +7 -0
  328. package/node_modules/@schibsted/pulse-utils/dist/ejs/cookie.js +81 -0
  329. package/node_modules/@schibsted/pulse-utils/dist/ejs/events.js +103 -0
  330. package/node_modules/@schibsted/pulse-utils/dist/ejs/get.js +15 -0
  331. package/node_modules/@schibsted/pulse-utils/dist/ejs/getRootDomain.js +49 -0
  332. package/node_modules/@schibsted/pulse-utils/dist/ejs/index.js +11 -0
  333. package/node_modules/@schibsted/pulse-utils/dist/ejs/merge.js +35 -0
  334. package/node_modules/@schibsted/pulse-utils/dist/ejs/objects.js +26 -0
  335. package/node_modules/@schibsted/pulse-utils/dist/ejs/omit.js +6 -0
  336. package/node_modules/@schibsted/pulse-utils/dist/ejs/randomString.js +15 -0
  337. package/node_modules/@schibsted/pulse-utils/dist/ejs/throttle.js +31 -0
  338. package/node_modules/@schibsted/pulse-utils/dist/ejs/webApi.js +17 -0
  339. package/node_modules/@schibsted/pulse-utils/dist/types/cookie-config.d.ts +7 -0
  340. package/node_modules/@schibsted/pulse-utils/dist/types/cookie.d.ts +23 -0
  341. package/node_modules/@schibsted/pulse-utils/dist/types/events.d.ts +17 -0
  342. package/node_modules/@schibsted/pulse-utils/dist/types/get.d.ts +1 -0
  343. package/node_modules/@schibsted/pulse-utils/dist/types/getRootDomain.d.ts +13 -0
  344. package/node_modules/@schibsted/pulse-utils/dist/types/index.d.ts +11 -0
  345. package/node_modules/@schibsted/pulse-utils/dist/types/merge.d.ts +4 -0
  346. package/node_modules/@schibsted/pulse-utils/dist/types/objects.d.ts +6 -0
  347. package/node_modules/@schibsted/pulse-utils/dist/types/omit.d.ts +3 -0
  348. package/node_modules/@schibsted/pulse-utils/dist/types/randomString.d.ts +1 -0
  349. package/node_modules/@schibsted/pulse-utils/dist/types/throttle.d.ts +3 -0
  350. package/node_modules/@schibsted/pulse-utils/dist/types/webApi.d.ts +10 -0
  351. package/node_modules/@schibsted/pulse-utils/package.json +36 -0
  352. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/anonymous.js +8 -0
  353. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/baseEvent.js +9 -0
  354. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/consents.js +15 -0
  355. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/device.js +211 -0
  356. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/experiments.js +11 -0
  357. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/navigationType.js +52 -0
  358. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/pageInfo.js +24 -0
  359. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/pageviewId.js +11 -0
  360. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/provider.js +12 -0
  361. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/referrer.js +19 -0
  362. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/session.js +114 -0
  363. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/time.js +15 -0
  364. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/trackerBuilder.js +15 -0
  365. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/user.js +26 -0
  366. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/utm.js +35 -0
  367. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders.js +264 -0
  368. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/index.js +17 -0
  369. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/types.js +2 -0
  370. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/anonymous.js +5 -0
  371. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/baseEvent.js +6 -0
  372. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/consents.js +12 -0
  373. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/device.js +174 -0
  374. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/experiments.js +7 -0
  375. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/navigationType.js +48 -0
  376. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/pageInfo.js +20 -0
  377. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/pageviewId.js +7 -0
  378. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/provider.js +9 -0
  379. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/referrer.js +15 -0
  380. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/session.js +108 -0
  381. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/time.js +11 -0
  382. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/trackerBuilder.js +11 -0
  383. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/user.js +22 -0
  384. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/utm.js +31 -0
  385. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders.js +209 -0
  386. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/index.js +1 -0
  387. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/types.js +1 -0
  388. package/node_modules/@schibsted/tpaas-event-builder/dist/index.d.ts +5171 -0
  389. package/node_modules/@schibsted/tpaas-event-builder/package.json +40 -0
  390. package/node_modules/@schibsted/tpaas-schemas/dist/cjs/constants.js +62 -1
  391. package/node_modules/@schibsted/tpaas-schemas/dist/ejs/constants.js +61 -0
  392. package/node_modules/@schibsted/tpaas-schemas/dist/index.d.ts +128 -0
  393. package/package.json +58 -13
  394. package/CHANGELOG.md +0 -1035
  395. package/dist/index.d.ts +0 -13
  396. package/dist/index.d.ts.map +0 -1
  397. package/dist/index.js +0 -47
  398. package/dist/index.js.map +0 -1
@@ -0,0 +1,12 @@
1
+ export default function send(url, data, state) {
2
+ const { username, password } = state;
3
+ const headers = {
4
+ 'Content-Type': 'application/json',
5
+ Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
6
+ };
7
+ return fetch(url, {
8
+ headers,
9
+ method: 'POST',
10
+ body: JSON.stringify(data),
11
+ });
12
+ }
@@ -0,0 +1,111 @@
1
+ import { isString, webApi } from '@schibsted/pulse-utils';
2
+ import logger from 'loglevel';
3
+ const CIS_KEY = 'cis';
4
+ const COLLECTOR_KEY = 'collector';
5
+ const getRemoteConfigStorageKey = '_pulse.internal.remote.config';
6
+ let inMemoryConfig = null;
7
+ export async function fetchRemoteConfig(url) {
8
+ const response = await fetch(url, {
9
+ method: 'GET',
10
+ });
11
+ return response.json();
12
+ }
13
+ export async function fetchRemoteConfigWithRetry(url, retries = 3) {
14
+ try {
15
+ return await fetchRemoteConfig(url);
16
+ }
17
+ catch (err) {
18
+ if (retries > 1) {
19
+ return fetchRemoteConfigWithRetry(url, retries - 1);
20
+ }
21
+ throw err;
22
+ }
23
+ }
24
+ export function readConfigFromStorage() {
25
+ try {
26
+ return JSON.parse(webApi.localStorage?.getItem(getRemoteConfigStorageKey) ?? '');
27
+ }
28
+ catch (_err) {
29
+ return null;
30
+ }
31
+ }
32
+ function writeConfigToStorage(config, url) {
33
+ try {
34
+ const configPersistence = {
35
+ config,
36
+ metadata: {
37
+ remoteConfigUrl: url,
38
+ updatedAt: new Date().toISOString(),
39
+ },
40
+ };
41
+ webApi.localStorage?.setItem(getRemoteConfigStorageKey, JSON.stringify(configPersistence));
42
+ return configPersistence;
43
+ }
44
+ catch (_err) {
45
+ return null;
46
+ }
47
+ }
48
+ export function clearConfigFromStorage() {
49
+ try {
50
+ webApi.localStorage?.removeItem(getRemoteConfigStorageKey);
51
+ return true;
52
+ }
53
+ catch (_err) {
54
+ return false;
55
+ }
56
+ }
57
+ export function clearInMemoryConfig() {
58
+ inMemoryConfig = null;
59
+ }
60
+ function isConfigValid(config) {
61
+ const isConfigValid = !!config;
62
+ logger.debug(`RemoteConfig: isConfigValid: ${isConfigValid}`);
63
+ return isConfigValid;
64
+ }
65
+ function isConfigExpired(updatedAt, ttlMinutes) {
66
+ const isConfigExpired = !updatedAt || !ttlMinutes || new Date(updatedAt).getTime() + Math.min(ttlMinutes, 10080) * 60000 <= Date.now();
67
+ logger.debug(`RemoteConfig: isConfigExpired: ${isConfigExpired}`);
68
+ return isConfigExpired;
69
+ }
70
+ export function shouldSyncRemoteConfig(url, config, metadata) {
71
+ return (!isConfigValid(config) ||
72
+ isConfigExpired(metadata?.updatedAt, config?.['ttl-minutes']) ||
73
+ url !== metadata?.remoteConfigUrl);
74
+ }
75
+ export function resolveConfigServicesByTag(tag, config) {
76
+ if (isString(tag) && config) {
77
+ let services = config.scopes?.[tag]?.services || null;
78
+ if (!services && tag !== 'default') {
79
+ services = config.scopes.default.services;
80
+ }
81
+ return services;
82
+ }
83
+ return null;
84
+ }
85
+ let onGoingSync = null;
86
+ // biome-ignore lint/style/useDefaultParameterLast: -
87
+ export async function syncRemoteConfig(tag = 'default', url) {
88
+ try {
89
+ if (!inMemoryConfig) {
90
+ inMemoryConfig = readConfigFromStorage();
91
+ }
92
+ if (!inMemoryConfig || shouldSyncRemoteConfig(url, inMemoryConfig.config, inMemoryConfig.metadata)) {
93
+ let remoteConfig;
94
+ if (onGoingSync) {
95
+ remoteConfig = await onGoingSync;
96
+ }
97
+ else {
98
+ onGoingSync = fetchRemoteConfigWithRetry(url);
99
+ remoteConfig = await onGoingSync;
100
+ onGoingSync = null;
101
+ }
102
+ inMemoryConfig = writeConfigToStorage(remoteConfig, url);
103
+ }
104
+ return resolveConfigServicesByTag(tag, inMemoryConfig?.config);
105
+ }
106
+ catch (err) {
107
+ logger.debug(err);
108
+ onGoingSync = null;
109
+ return null;
110
+ }
111
+ }
@@ -0,0 +1,68 @@
1
+ // Sync the content between files below this line:
2
+ export const MESSAGE_PREFIX = 'pulse-tracker-proxy';
3
+ export const MESSAGE_TYPE_REQUEST = `${MESSAGE_PREFIX}:request`;
4
+ export const MESSAGE_TYPE_ACK = `${MESSAGE_PREFIX}:ack`;
5
+ export const MESSAGE_TYPE_INVOKE = `${MESSAGE_PREFIX}:invoke`;
6
+ export const MESSAGE_TYPE_RETURN = `${MESSAGE_PREFIX}:return`;
7
+ export const MESSAGE_TYPE_RETURN_ERROR = `${MESSAGE_PREFIX}:return-error`;
8
+ export const ALLOWED_METHODS = ['track'];
9
+ export const TPAAS_ALLOWED_METHODS = [
10
+ 'trackAnonymousViewUIElement',
11
+ 'trackEngagementAudio',
12
+ 'trackEngagementForm',
13
+ 'trackEngagementHealthUIElement',
14
+ 'trackEngagementOffer',
15
+ 'trackEngagementTeaser',
16
+ 'trackEngagementUIElement',
17
+ 'trackEngagementVideo',
18
+ 'trackEngagementVideoAd',
19
+ 'trackEngagementWidget',
20
+ 'trackCompletedHealthAction',
21
+ 'trackImpressionAdSlot',
22
+ 'trackImpressionForm',
23
+ 'trackImpressionHealthUIElement',
24
+ 'trackImpressionOffer',
25
+ 'trackImpressionPlayer',
26
+ 'trackImpressionTeaser',
27
+ 'trackImpressionUIElement',
28
+ 'trackImpressionWidget',
29
+ 'trackLeaveArticle',
30
+ 'trackLeaveAudioPage',
31
+ 'trackLeaveError',
32
+ 'trackLeaveFrontpage',
33
+ 'trackLeaveLandingpage',
34
+ 'trackLeaveListing',
35
+ 'trackLeaveLockedArticle',
36
+ 'trackLeaveLockedAudio',
37
+ 'trackLeaveLockedAudioPage',
38
+ 'trackLeaveLockedVideo',
39
+ 'trackLeaveLockedVideoPage',
40
+ 'trackLeavePage',
41
+ 'trackLeaveVideoPage',
42
+ 'trackLeaveWeather',
43
+ 'trackViewArticle',
44
+ 'trackViewAudio',
45
+ 'trackViewAudioPage',
46
+ 'trackViewError',
47
+ 'trackViewFrontpage',
48
+ 'trackViewHealthPage',
49
+ 'trackViewLandingpage',
50
+ 'trackViewListing',
51
+ 'trackViewLockedArticle',
52
+ 'trackViewLockedAudio',
53
+ 'trackViewLockedAudioPage',
54
+ 'trackViewLockedVideo',
55
+ 'trackViewLockedVideoPage',
56
+ 'trackViewPage',
57
+ 'trackViewTitle',
58
+ 'trackViewVideo',
59
+ 'trackViewVideoPage',
60
+ 'trackViewWeather',
61
+ ];
62
+ export function isPulseProxyMessage(message) {
63
+ return (message !== null &&
64
+ typeof message === 'object' &&
65
+ 'type' in message &&
66
+ typeof message.type === 'string' &&
67
+ message.type.startsWith(MESSAGE_PREFIX));
68
+ }
@@ -0,0 +1,62 @@
1
+ import { isBrowser } from '@schibsted/pulse-utils';
2
+ import logger from 'loglevel';
3
+ import { ALLOWED_METHODS, isPulseProxyMessage, MESSAGE_TYPE_ACK, MESSAGE_TYPE_INVOKE, MESSAGE_TYPE_REQUEST, MESSAGE_TYPE_RETURN, MESSAGE_TYPE_RETURN_ERROR, TPAAS_ALLOWED_METHODS, } from './consts';
4
+ const ALLOWED_METHODS_SET = new Set([...ALLOWED_METHODS, ...TPAAS_ALLOWED_METHODS]);
5
+ export function startProxyProviderListener(tracker) {
6
+ if (!isBrowser) {
7
+ logger.debug('Proxy Provider - Not in browser environment, skipping message listener');
8
+ return () => { };
9
+ }
10
+ logger.debug('Proxy Provider - Added message listener for proxy provider');
11
+ const listener = async (event) => {
12
+ logger.debug('Proxy Provider - message received', event.data);
13
+ if (!event.ports.length || !isPulseProxyMessage(event.data)) {
14
+ logger.debug('Proxy Provider - message is not for us, skipping. Data:', event.data, 'Ports:', event.ports);
15
+ return;
16
+ }
17
+ const respond = (message) => {
18
+ logger.debug(`Proxy Provider - response to (${event.origin}): `, message);
19
+ event.ports[0].postMessage(message);
20
+ };
21
+ if (event.data.type === MESSAGE_TYPE_REQUEST) {
22
+ respond({ type: MESSAGE_TYPE_ACK });
23
+ }
24
+ else if (event.data.type === MESSAGE_TYPE_INVOKE) {
25
+ /**
26
+ * @privateRemarks This is where the polymorphism between .track and tpaas methods break,
27
+ * because args can be an array with 2 or 3 arguments, and it cannot be spread in the call
28
+ * when the callee interface does not spread the arguments itself.
29
+ * In the end, almost all the implementation would have to be forked between TrackInvocation and TpaasInvocation,
30
+ * and it was best to stick with am undesired casting, knowing that until this point we are
31
+ * satisfying both implementations.
32
+ * @see TrackInvocation
33
+ * @see TpaasInvocation
34
+ */
35
+ const { method, args } = event.data.payload;
36
+ try {
37
+ if (!ALLOWED_METHODS_SET.has(method)) {
38
+ respond({
39
+ type: MESSAGE_TYPE_RETURN_ERROR,
40
+ error: `Method ${method} is not allowed`,
41
+ });
42
+ return;
43
+ }
44
+ const result = await tracker[method](...args);
45
+ respond({
46
+ type: MESSAGE_TYPE_RETURN,
47
+ payload: result,
48
+ });
49
+ }
50
+ catch (error) {
51
+ respond({
52
+ type: MESSAGE_TYPE_RETURN_ERROR,
53
+ error: `${error}`,
54
+ });
55
+ }
56
+ }
57
+ };
58
+ window.addEventListener('message', listener);
59
+ return () => {
60
+ window.removeEventListener('message', listener);
61
+ };
62
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ { "SDK_VERSION": "8.0.0-alpha.18", "GIT_COMMIT": "beb7e832" }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Observes visibility of elements matching a selector using MutationObserver and IntersectionObserver.
3
+ */
4
+ export class VisibilityObserver {
5
+ /**
6
+ * @param callback The callback function to be executed when an element becomes visible.
7
+ */
8
+ constructor(callback) {
9
+ this.callback = callback;
10
+ }
11
+ /**
12
+ * Tracks visibility of elements matching {@link selector}, triggering {@link callback} when an element is over 2/3 visible.
13
+ * Uses {@link https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver | MutationObserver} to monitor the DOM for dynamically loaded content.
14
+ * Callback is invoked only once per element.
15
+ * @param selector The CSS selector for elements to track.
16
+ * @throws Error if called more than once.
17
+ */
18
+ observe(selector) {
19
+ if (this.selector) {
20
+ throw new Error(`Cannot observe selector ${selector}. A visibility observer has already been set up for selector ${this.selector}.`);
21
+ }
22
+ this.selector = selector;
23
+ this.setupObservers();
24
+ // biome-ignore lint/suspicious/useIterableCallbackReturn: -
25
+ this.elements().forEach((elementToTrack) => this.observeIntersection(elementToTrack));
26
+ }
27
+ /**
28
+ * @returns {HTMLElement[]} An array of elements that match the selector in the document.
29
+ */
30
+ elements() {
31
+ return Array.from(document.querySelectorAll(this.selector));
32
+ }
33
+ // Initialize both observers and start watching for DOM changes
34
+ setupObservers() {
35
+ this.setupIntersectionObserver();
36
+ this.setupMutationObserver();
37
+ this.observeMutations();
38
+ }
39
+ // Create observer to detect when elements become visible in the viewport
40
+ setupIntersectionObserver() {
41
+ this.intersectionObserver = new IntersectionObserver((entries) => {
42
+ entries.forEach((entry) => {
43
+ if (entry.isIntersecting) {
44
+ const node = entry.target;
45
+ this.callback(node);
46
+ this.intersectionObserver.unobserve(node);
47
+ }
48
+ });
49
+ }, { threshold: 2 / 3 });
50
+ }
51
+ // Create observer to detect DOM changes that may add/remove tracked elements
52
+ setupMutationObserver() {
53
+ this.mutationObserver = new MutationObserver((mutations) => {
54
+ mutations.forEach((mutation) => {
55
+ this.handleAddedNodes(mutation.addedNodes);
56
+ this.handleRemovedNodes(mutation.removedNodes);
57
+ });
58
+ });
59
+ }
60
+ handleAddedNodes(nodes) {
61
+ this.processHtmlNodes(nodes, (element) => this.observeIntersection(element));
62
+ }
63
+ handleRemovedNodes(nodes) {
64
+ this.processHtmlNodes(nodes, (element) => this.intersectionObserver.unobserve(element));
65
+ }
66
+ processHtmlNodes(nodes, action) {
67
+ nodes.forEach((node) => {
68
+ if (node instanceof HTMLElement && this.nodeMatchesOrContainsSelector(node)) {
69
+ this.processMatchingElements(node, action);
70
+ }
71
+ });
72
+ }
73
+ processMatchingElements(node, action) {
74
+ const elementsToTrack = this.extractElementsToTrack(node);
75
+ elementsToTrack.forEach(action);
76
+ }
77
+ nodeMatchesOrContainsSelector(node) {
78
+ return node.matches(this.selector) || node.querySelector(this.selector) !== null;
79
+ }
80
+ // Get matching descendants and the node itself if it matches the selector
81
+ extractElementsToTrack(node) {
82
+ const elements = Array.from(node.querySelectorAll(this.selector));
83
+ if (node.matches(this.selector)) {
84
+ elements.push(node);
85
+ }
86
+ return elements;
87
+ }
88
+ observeIntersection(node) {
89
+ this.intersectionObserver.observe(node);
90
+ }
91
+ observeMutations() {
92
+ this.mutationObserver.observe(document.body, {
93
+ childList: true,
94
+ subtree: true,
95
+ });
96
+ }
97
+ }
@@ -0,0 +1,9 @@
1
+ const warned = {};
2
+ const warnOnce = (id, ...data) => {
3
+ if (warned[id]) {
4
+ return;
5
+ }
6
+ warned[id] = true;
7
+ console.warn(...data);
8
+ };
9
+ export default warnOnce;
@@ -0,0 +1,17 @@
1
+ import { getNavigationType } from '../../utils/get-navigation-type.js';
2
+ export const buildClickUIElementEvent = (inputProperties, currentPage) => ({
3
+ ...inputProperties,
4
+ type: 'Engagement',
5
+ action: 'Click',
6
+ object: Promise.resolve(currentPage).then((page) => ({
7
+ page,
8
+ ...inputProperties.object,
9
+ navigationType: getNavigationType(),
10
+ type: 'UIElement',
11
+ url: window.location.href,
12
+ })),
13
+ ...(inputProperties.metrics && { metrics: inputProperties.metrics }),
14
+ ...(inputProperties.experiments && {
15
+ experiments: inputProperties.experiments,
16
+ }),
17
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './base-event.js';
2
+ export * from './event.js';
3
+ export * from './utils.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ // implementation "copy-pasted" from the wrapper
2
+ const modernNavigationMap = {
3
+ navigate: 'navigation',
4
+ reload: 'refresh',
5
+ };
6
+ const legacyNavigationMap = {
7
+ 0: 'navigation',
8
+ 1: 'refresh',
9
+ };
10
+ const getModernNavigationType = (entryType) => {
11
+ return modernNavigationMap[entryType] || 'alternative';
12
+ };
13
+ const getLegacyNavigationType = (entryType) => {
14
+ return legacyNavigationMap[entryType] || 'alternative';
15
+ };
16
+ const getNavigationType = () => {
17
+ if (typeof window === 'undefined' || typeof window.performance === 'undefined') {
18
+ return 'unknown';
19
+ }
20
+ const [navigationEntry] = window.performance.getEntriesByType('navigation');
21
+ if (navigationEntry) {
22
+ return getModernNavigationType(navigationEntry.type);
23
+ }
24
+ if (performance.navigation?.type !== undefined) {
25
+ return getLegacyNavigationType(performance.navigation.type);
26
+ }
27
+ return 'unknown';
28
+ };
29
+ export { getNavigationType };
@@ -0,0 +1,6 @@
1
+ const pageFromPageView = (pageView) => Promise.resolve(pageView.object).then((objectProperties) => ({
2
+ id: objectProperties.id,
3
+ type: (objectProperties.type || 'Page'),
4
+ url: objectProperties.url || window.location.href,
5
+ }));
6
+ export { pageFromPageView };
@@ -0,0 +1,15 @@
1
+ import { getNavigationType } from '../../utils/get-navigation-type.js';
2
+ export const buildLegacyViewArticleEvent = (inputProperties) => ({
3
+ ...inputProperties,
4
+ object: Promise.resolve(inputProperties.object).then((objectProperties) => {
5
+ const { articleId, ...rest } = objectProperties;
6
+ return {
7
+ ...rest,
8
+ id: articleId,
9
+ navigationType: getNavigationType(),
10
+ type: 'Article',
11
+ contentId: articleId,
12
+ url: window.location.href,
13
+ };
14
+ }),
15
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { getNavigationType } from '../../utils/get-navigation-type.js';
2
+ export const buildLegacyViewFrontpageEvent = (inputProperties) => ({
3
+ ...inputProperties,
4
+ object: Promise.resolve(inputProperties.object).then((objectProperties) => {
5
+ return {
6
+ ...objectProperties,
7
+ navigationType: getNavigationType(),
8
+ type: 'Frontpage',
9
+ url: window.location.href,
10
+ };
11
+ }),
12
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { getNavigationType } from '../../utils/get-navigation-type.js';
2
+ export const buildLegacyViewListingEvent = (inputProperties) => ({
3
+ ...inputProperties,
4
+ object: Promise.resolve(inputProperties.object).then((objectProperties) => ({
5
+ ...objectProperties,
6
+ navigationType: getNavigationType(),
7
+ type: 'Listing',
8
+ url: window.location.href,
9
+ })),
10
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export const buildViewLoginPosterEvent = (inputProperties) => ({
2
+ ...inputProperties,
3
+ object: Promise.resolve(inputProperties.object).then((objectProperties) => ({
4
+ ...objectProperties,
5
+ type: 'LoginPoster',
6
+ })),
7
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { getNavigationType } from '../../utils/get-navigation-type.js';
2
+ export const buildLegacyViewPageEvent = (inputProperties) => ({
3
+ ...inputProperties,
4
+ object: Promise.resolve(inputProperties.object).then((objectProperties) => {
5
+ const { pageId, ...rest } = objectProperties;
6
+ return {
7
+ ...rest,
8
+ id: pageId,
9
+ navigationType: getNavigationType(),
10
+ type: 'Page',
11
+ url: window.location.href,
12
+ };
13
+ }),
14
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { getNavigationType } from '../../utils/get-navigation-type.js';
2
+ export const buildViewSalesPosterEvent = (inputProperties) => ({
3
+ ...inputProperties,
4
+ object: Promise.resolve(inputProperties.object).then((objectProperties) => {
5
+ const { articleId, ...rest } = objectProperties;
6
+ return {
7
+ ...rest,
8
+ id: articleId,
9
+ navigationType: getNavigationType(),
10
+ type: 'SalesPoster',
11
+ url: window.location.href,
12
+ };
13
+ }),
14
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { getNavigationType } from '../../utils/get-navigation-type.js';
2
+ export const buildLegacyViewUIElementEvent = (inputProperties, currentPage) => ({
3
+ ...inputProperties,
4
+ object: Promise.all([inputProperties.object, currentPage]).then(([objectProperties, page]) => ({
5
+ page,
6
+ ...objectProperties,
7
+ navigationType: getNavigationType(),
8
+ type: 'UIElement',
9
+ url: window.location.href,
10
+ })),
11
+ });
@@ -0,0 +1 @@
1
+ export {};