@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,50 @@
1
+ import * as storage from './storage';
2
+ const pulseStorageKeys = {
3
+ PULSE_PPID_STORAGE_KEY: '_pulse.internal.identity.ppid',
4
+ PULSE_CIS_CACHE_STORAGE_KEY: '_pulse.internal.identity.cis',
5
+ };
6
+ const getPPIDsFromStorage = () => {
7
+ try {
8
+ const webStorage = storage.getStorage();
9
+ return JSON.parse(webStorage.getItem(pulseStorageKeys.PULSE_PPID_STORAGE_KEY) ?? '');
10
+ }
11
+ catch (_err) {
12
+ return {};
13
+ }
14
+ };
15
+ const setPPIDsToStorage = (ppid) => {
16
+ try {
17
+ const webStorage = storage.getStorage();
18
+ webStorage.setItem(pulseStorageKeys.PULSE_PPID_STORAGE_KEY, JSON.stringify(ppid));
19
+ return true;
20
+ }
21
+ catch (_err) {
22
+ return false;
23
+ }
24
+ };
25
+ const getCisCacheFromStorage = () => {
26
+ try {
27
+ const webStorage = storage.getStorage();
28
+ return JSON.parse(webStorage.getItem(pulseStorageKeys.PULSE_CIS_CACHE_STORAGE_KEY) ?? '');
29
+ }
30
+ catch (_err) {
31
+ return {};
32
+ }
33
+ };
34
+ const setCisCacheToStorage = (cisPayload) => {
35
+ try {
36
+ const webStorage = storage.getStorage();
37
+ webStorage.setItem(pulseStorageKeys.PULSE_CIS_CACHE_STORAGE_KEY, JSON.stringify(cisPayload));
38
+ return true;
39
+ }
40
+ catch (_err) {
41
+ return false;
42
+ }
43
+ };
44
+ export default {
45
+ getCisCacheFromStorage,
46
+ setCisCacheToStorage,
47
+ getPPIDsFromStorage,
48
+ setPPIDsToStorage,
49
+ };
50
+ //# sourceMappingURL=pulseStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulseStorage.js","sourceRoot":"","sources":["../../../src/storage/pulseStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAkCrC,MAAM,gBAAgB,GAAG;IACvB,sBAAsB,EAAE,+BAA+B;IACvD,2BAA2B,EAAE,8BAA8B;CAC5D,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAA2B,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC;IACvF,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAA4B,EAAW,EAAE;IAClE,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,GAAa,EAAE;IAC5C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5F,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,UAAoB,EAAW,EAAE;IAC7D,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,2BAA2B,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,eAAe;IACb,sBAAsB;IACtB,oBAAoB;IACpB,mBAAmB;IACnB,iBAAiB;CAClB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type StorageType } from '@schibsted/pulse-utils';
2
+ declare const getStorage: (storageType?: StorageType) => {
3
+ getItem: (key: string) => string | null | undefined;
4
+ setItem: (key: string, value: string) => void;
5
+ };
6
+ export { getStorage };
@@ -0,0 +1,17 @@
1
+ import { isBrowser, webApi } from '@schibsted/pulse-utils';
2
+ const getStorage = (storageType = 'localStorage') => {
3
+ const storage = webApi[storageType];
4
+ const getItem = (key) => {
5
+ return isBrowser && storage ? storage.getItem(key) : undefined;
6
+ };
7
+ const setItem = (key, value) => {
8
+ if (isBrowser && storage)
9
+ storage.setItem(key, value);
10
+ };
11
+ return {
12
+ getItem,
13
+ setItem,
14
+ };
15
+ };
16
+ export { getStorage };
17
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/storage/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE7E,MAAM,UAAU,GAAG,CAAC,cAA2B,cAAc,EAAE,EAAE;IAC/D,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IAEpC,MAAM,OAAO,GAAG,CAAC,GAAW,EAA6B,EAAE;QACzD,OAAO,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,KAAa,EAAQ,EAAE;QACnD,IAAI,SAAS,IAAI,OAAO;YAAE,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF,OAAO;QACL,OAAO;QACP,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
3
+ */
4
+ export type AdvertisingVendor = 'xandr' | 'delta' | 'adform' | (string & {});
5
+ /**
6
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
7
+ */
8
+ type PPIDs = {
9
+ ppId1?: string;
10
+ ppId2: string;
11
+ };
12
+ /**
13
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
14
+ */
15
+ export type PPIDsByVendor = Partial<Record<AdvertisingVendor, PPIDs>>;
16
+ /**
17
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
18
+ */
19
+ export type AdvertisingIdentifiers = PPIDsByVendor & {
20
+ xandr?: PPIDs & {
21
+ adId?: string;
22
+ };
23
+ };
24
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import type { PulseStorage } from './storage/pulseStorage';
2
+ import type { AdvertisingVendor } from './types';
3
+ /**
4
+ * Sync with CIS
5
+ *
6
+ * This method deals with all communication and communication with dependent systems (currently AppNexus and Norstat).
7
+ *
8
+ * An optional user id should be provided if a tracker have received a logged in state. Providing a new user id
9
+ * (different from a previous user id, serialized to the pulse cookie) will cause a "blocking call" to CIS (the
10
+ * returned promise will not resolve before the communication is done). This is done because CIS could provide new data
11
+ * regarding opt-out.
12
+ *
13
+ * The returned promise will also be blocking if no pulse cookie is found. Pulse requires environmentIds generated
14
+ * server side so one have to wait to be allocated to one.
15
+ *
16
+ * In other context CIS could or could not be called but the returned promise will resolve immediately. If CIS have
17
+ * been called recently there is no point in calling it again. In a different case, if a refresh call to CIS is required
18
+ * it doesn't mean that other systems have to wait of it. Both cases will return a promise that resolves more or less
19
+ * immediately.
20
+ */
21
+ export declare function syncWithCis(shortUserId?: string, nativeJwe?: string, userServiceLocation?: string, realm?: string, clientId?: string, trackerType?: string, trackerVersion?: string, options?: {
22
+ forceSync: boolean;
23
+ includeAdvertising: boolean;
24
+ trackerId: string;
25
+ vendors?: AdvertisingVendor[];
26
+ }): Promise<PulseStorage>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Entry point to module on Node.js
3
+ *
4
+ * This **have not been implemented** on Node.js because CIS expects a normal
5
+ * browser environment with cookies.
6
+ *
7
+ * @returns rejected promise
8
+ */
9
+ import type { PulseStorage } from './storage/pulseStorage';
10
+ export declare function syncWithCis(): Promise<PulseStorage>;
@@ -0,0 +1,14 @@
1
+ type EventType = 'environmentIdSet' | 'jweSet';
2
+ type EventCallback = (event: string) => void;
3
+ export default class EventEmitter {
4
+ events: {
5
+ [key: string]: unknown[];
6
+ };
7
+ constructor();
8
+ on(event: EventType, callback: EventCallback): void;
9
+ off(event: EventType, callback: EventCallback): void;
10
+ removeListener(event: EventType, callback: EventCallback): void;
11
+ removeAllListeners(): void;
12
+ emit(event: EventType, value: string): void;
13
+ }
14
+ export {};
@@ -0,0 +1,4 @@
1
+ export { syncWithCis } from './cis';
2
+ export { clearCookieAdvertisingIds, clearCookieJweIfStale, eventEmitter, parsePulseCookies, resetRefreshAfter, } from './pulse-cookie';
3
+ export type { PulseCookie, PulseStorage } from './storage/pulseStorage';
4
+ export type { AdvertisingIdentifiers, AdvertisingVendor, PPIDsByVendor } from './types';
@@ -0,0 +1,55 @@
1
+ import EventEmitter from './eventEmitter';
2
+ import type { PulseStorage } from './storage/pulseStorage';
3
+ import type { AdvertisingVendor } from './types';
4
+ /**
5
+ * Responsible for subscribing to, and emitting events.
6
+ */
7
+ export declare const eventEmitter: EventEmitter;
8
+ export declare function cacheOldEnvironmentId(id: string): void;
9
+ export declare function parsePulseCookies(cookie?: string): PulseStorage;
10
+ export declare function serializePulseCookie(input?: PulseStorage): void;
11
+ export declare enum CisSyncReason {
12
+ Initialise = "initialise",
13
+ Login = "login",
14
+ Logout = "logout",
15
+ Refresh = "refresh",
16
+ includeAdvertisingChange = "includeAdvertisingChange"
17
+ }
18
+ export type SyncState = {
19
+ syncWithCis: boolean;
20
+ waitForCis?: boolean;
21
+ syncWithCisReason?: CisSyncReason;
22
+ };
23
+ /**
24
+ * Clears all relevant advertisement identifiers from cookie storage, returning the new storage state
25
+ * @returns {PulseCookie}
26
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
27
+ */
28
+ export declare function clearCookieAdvertisingIds(): PulseStorage;
29
+ /**
30
+ * Runs actions related to a new JWE, divergent from the one persisted in the browser storage
31
+ * @param jwe
32
+ *
33
+ * @privateRemarks
34
+ * if there is no jwe, or in other words, no nativeJwe was provided in config, no action will be taken. That's the
35
+ * behaviour with plain Web applications. The scenario not covered here is when we do have a hybrid app, and they don't
36
+ * send any nativeJwe in config.
37
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
38
+ */
39
+ export declare function clearCookieJweIfStale(jwe?: string): void;
40
+ /**
41
+ * Runs actions related to a new JWE, divergent from the one persisted in the browser storage
42
+ * @param refreshAfterDateTime
43
+ */
44
+ export declare function resetRefreshAfter(refreshAfterDateTime?: Date): PulseStorage;
45
+ /**
46
+ * Determines whether CIS should be called to update identity values.
47
+ * @param userId
48
+ * @param options
49
+ * @returns {SyncState}
50
+ */
51
+ export declare function getSyncState(userId?: string | number, options?: {
52
+ cookie?: string;
53
+ includeAdvertising?: boolean;
54
+ vendors?: AdvertisingVendor[];
55
+ }): SyncState;
@@ -0,0 +1,36 @@
1
+ import type { AdvertisingIdentifiers, PPIDsByVendor } from '../types';
2
+ export type PulseCookie = {
3
+ environmentId: string;
4
+ prevUserId?: string;
5
+ refreshAfterTimestamp?: number;
6
+ jwe: string;
7
+ anId?: string;
8
+ syncWithAppNexus?: number;
9
+ doTracking?: boolean;
10
+ pixelInjected?: boolean;
11
+ adId: string;
12
+ altEnvIds?: string[];
13
+ visitorIdPlaceholder?: string;
14
+ };
15
+ type PPID = {
16
+ ppId: PPIDsByVendor;
17
+ };
18
+ /**
19
+ * Defines properties from the CIS response that are persisted as state/cache in the browser.
20
+ *
21
+ * @privateRemarks
22
+ * Only "includeAdvertising" is considered now for this increment. Some work needs to be done to redefine the role of
23
+ * "_pulse2data" cookie, and the impact of caching more things to "avoid state mismatch between components" (namely CIS,
24
+ * PulseSDK, SchibstedAccount and CMP).
25
+ */
26
+ export type CisCache = {
27
+ includeAdvertising?: boolean;
28
+ };
29
+ export type PulseStorage = PulseCookie & PPID & CisCache;
30
+ declare const _default: {
31
+ getCisCacheFromStorage: () => CisCache;
32
+ setCisCacheToStorage: (cisPayload: CisCache) => boolean;
33
+ getPPIDsFromStorage: () => AdvertisingIdentifiers;
34
+ setPPIDsToStorage: (ppid: AdvertisingIdentifiers) => boolean;
35
+ };
36
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { type StorageType } from '@schibsted/pulse-utils';
2
+ declare const getStorage: (storageType?: StorageType) => {
3
+ getItem: (key: string) => string | null | undefined;
4
+ setItem: (key: string, value: string) => void;
5
+ };
6
+ export { getStorage };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
3
+ */
4
+ export type AdvertisingVendor = 'xandr' | 'delta' | 'adform' | (string & {});
5
+ /**
6
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
7
+ */
8
+ type PPIDs = {
9
+ ppId1?: string;
10
+ ppId2: string;
11
+ };
12
+ /**
13
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
14
+ */
15
+ export type PPIDsByVendor = Partial<Record<AdvertisingVendor, PPIDs>>;
16
+ /**
17
+ * @deprecated Advertising Identifiers methods will be removed in the next major version.
18
+ */
19
+ export type AdvertisingIdentifiers = PPIDsByVendor & {
20
+ xandr?: PPIDs & {
21
+ adId?: string;
22
+ };
23
+ };
24
+ export {};
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@schibsted/pulse-cis-sync",
3
+ "version": "2.0.18",
4
+ "author": "Schibsted Data&Tech",
5
+ "license": "UNLICENSED",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://schibsted.ghe.com/data-platform/pulse-sdk-js.git",
9
+ "directory": "workspaces/cis-sync"
10
+ },
11
+ "main": "dist/cjs/index.js",
12
+ "module": "dist/ejs/index.js",
13
+ "types": "./dist/types/index.d.ts",
14
+ "browser": {
15
+ "./dist/cjs/cis.js": "./dist/cjs/cis-browser.js",
16
+ "./dist/ejs/cis.js": "./dist/ejs/cis-browser.js"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "dependencies": {
22
+ "@schibsted/pulse-utils": "workspace:*",
23
+ "loglevel": "1.9.2"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "24.10.13",
27
+ "typescript": "5.9.3"
28
+ },
29
+ "bundledDependencies": [
30
+ "@schibsted/pulse-utils"
31
+ ],
32
+ "scripts": {
33
+ "build": "pnpm run build:ejs && pnpm run build:cjs && pnpm run build:types",
34
+ "build:clean": "rm -rf dist/",
35
+ "build:ejs": "tsc --project tsconfig.ejs.json",
36
+ "build:cjs": "tsc",
37
+ "build:types": "tsc --project tsconfig.types.json",
38
+ "dev": "tsc --watch",
39
+ "test": "pnpm run test:lint && pnpm run test:unit",
40
+ "test:lint": "biome check",
41
+ "test:lint:fix": "biome check --write",
42
+ "test:unit": "vitest run"
43
+ }
44
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cookieConfig = void 0;
4
+ exports.cookieConfig = {
5
+ PULSE_COOKIE_KEY: '_pulse2data',
6
+ TEST_COOKIE_KEY: '_pulse2test',
7
+ ENV_COOKIE_KEY: '_pulse2env',
8
+ USE_SECURE_COOKIES: true,
9
+ USE_LOCALSTORAGE: false,
10
+ };
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readCookie = readCookie;
4
+ exports.writeCookie = writeCookie;
5
+ exports.deleteCookie = deleteCookie;
6
+ const cookie_config_1 = require("./cookie-config");
7
+ const webApi_1 = require("./webApi");
8
+ const { USE_SECURE_COOKIES, USE_LOCALSTORAGE } = cookie_config_1.cookieConfig;
9
+ /**
10
+ * @private
11
+ */
12
+ function getExpiryDate(expiresInDays = 1) {
13
+ const expireTimestamp = Date.now() + expiresInDays * 1000 * 60 * 60 * 24;
14
+ return new Date(expireTimestamp);
15
+ }
16
+ /**
17
+ * Read a cookie from localStorage or document.cookie.
18
+ */
19
+ function readCookie(key, useLocalStorage = USE_LOCALSTORAGE) {
20
+ if (!webApi_1.isBrowser) {
21
+ return '';
22
+ }
23
+ if (useLocalStorage) {
24
+ const fromLocalStorage = localStorage.getItem(key) || '';
25
+ if (fromLocalStorage) {
26
+ return fromLocalStorage;
27
+ }
28
+ }
29
+ return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(key).replace(/[-.+*]/g, '\\$&')}\\s*\\=\\s*([^;]*).*$)|^.*$`), '$1'));
30
+ }
31
+ /**
32
+ * Write a cookie to document.cookie and/or localStorage
33
+ *
34
+ * @param key The key for the cookie
35
+ * @param value The value for the cookie
36
+ * @param domain The domain for the cookie. You might want to use `getRootDomain()`
37
+ * for this to set the cookie at the "best" domain.
38
+ * @param expiresInDays The number of days until the cookie should expire. Defaults to 1.
39
+ * @param useLocalStorage Whether to use localStorage *in addition* to setting a cookie.
40
+ * Note that localStorage has the specific origin of the current window.location, so
41
+ * if you set `domain` to something more general, then other subdomains will not be able
42
+ * to read back from the same localStorage, but will be able to read back the cookie only.
43
+ * @param useSecureCookies Whether to write that have SameSite=None and Secure set. You usually want this.
44
+ */
45
+ function writeCookie(key, value, domain, expiresInDays = 1, useLocalStorage = USE_LOCALSTORAGE, useSecureCookies = USE_SECURE_COOKIES) {
46
+ if (webApi_1.isBrowser) {
47
+ const expires = getExpiryDate(expiresInDays).toUTCString();
48
+ let cookieString;
49
+ cookieString = `${key}=${encodeURIComponent(value)}`;
50
+ cookieString += ';path=/';
51
+ if (domain) {
52
+ cookieString += `;domain=${domain}`;
53
+ }
54
+ if (expiresInDays) {
55
+ cookieString += `;expires=${expires}`;
56
+ }
57
+ if (useSecureCookies &&
58
+ window.location.protocol === 'https:' &&
59
+ // 20200303
60
+ // This only detects safari on desktop
61
+ // (already fixed)
62
+ // https://bugs.webkit.org/show_bug.cgi?id=198181
63
+ // TODO: Remove this when market share with this
64
+ // bug is low.. maybe 2020-08-ish.
65
+ // biome-ignore lint/suspicious/noExplicitAny: -
66
+ window.safari === undefined) {
67
+ cookieString += ';SameSite=None;Secure';
68
+ }
69
+ // biome-ignore lint/suspicious/noDocumentCookie: -
70
+ document.cookie = cookieString;
71
+ if (useLocalStorage) {
72
+ if (value === '') {
73
+ localStorage.removeItem(key);
74
+ }
75
+ else {
76
+ localStorage.setItem(key, value);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ /**
82
+ * Delete a cookie
83
+ */
84
+ function deleteCookie(key, domain) {
85
+ writeCookie(key, '', domain, -1);
86
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.evaluateEventInput = evaluateEventInput;
4
+ exports.evaluateAndFlatten = evaluateAndFlatten;
5
+ exports.deviceType = deviceType;
6
+ exports.dateTime = dateTime;
7
+ const merge_1 = require("./merge");
8
+ const objects_1 = require("./objects");
9
+ /**
10
+ * @recursive
11
+ * @param eventInput
12
+ */
13
+ async function evaluateEventInput(eventInput) {
14
+ if ((0, objects_1.isPromise)(eventInput)) {
15
+ return evaluateEventInput(await eventInput);
16
+ }
17
+ if (Array.isArray(eventInput)) {
18
+ return Promise.all(eventInput.map(evaluateEventInput));
19
+ }
20
+ if ((0, objects_1.isFunction)(eventInput)) {
21
+ return evaluateEventInput(eventInput());
22
+ }
23
+ if ((0, objects_1.isObject)(eventInput)) {
24
+ const eventKeys = Object.getOwnPropertyNames(eventInput);
25
+ const evaluatedEventKeys = eventKeys.reduce((acc, key) => {
26
+ const eventInputProperty = eventInput[key];
27
+ if ((0, objects_1.isObject)(eventInputProperty) || (0, objects_1.isFunction)(eventInputProperty) || (0, objects_1.isPromise)(eventInputProperty)) {
28
+ return acc.concat(evaluateEventInput(eventInputProperty));
29
+ }
30
+ return acc.concat([eventInputProperty]);
31
+ }, []);
32
+ const resolvedEventKeys = await Promise.all(evaluatedEventKeys);
33
+ return resolvedEventKeys.reduce((evaluatedEventInput, resolvedEventKey, index) => (0, merge_1.pulseMerge)(evaluatedEventInput, { [eventKeys[index]]: resolvedEventKey }), {});
34
+ }
35
+ return eventInput;
36
+ }
37
+ async function evaluateAndFlatten(builder) {
38
+ const builders = Array.isArray(builder) ? builder : [builder];
39
+ const results = await Promise.all(builders.map(evaluateEventInput));
40
+ return (0, merge_1.pulseMerge)({}, ...results.filter(objects_1.isObject));
41
+ }
42
+ /**
43
+ * Function for getting device type taken from the old SDK. It performs as well
44
+ * as one could expect from the size. It could be replaced with 'ua-parser-js'
45
+ * at the cost of 11kb minimized.
46
+ *
47
+ * @param {string} userAgent
48
+ *
49
+ * @returns {string} the device type the user is using
50
+ */
51
+ function deviceType(userAgent) {
52
+ const knownDevices = {
53
+ mobile: [
54
+ /iPhone;/,
55
+ /iPod;/,
56
+ /iPod touch;/,
57
+ /^HTC/,
58
+ /Fennec/,
59
+ /IEMobile/,
60
+ /BB10;/,
61
+ /BlackBerry/,
62
+ /SymbianOS.*AppleWebKit/,
63
+ /^Mozilla.*Mobile.*Firefox/,
64
+ /^Mozilla.*Chrome.*Mobile/,
65
+ /Opera Mobi/,
66
+ /Android.*Mobile/,
67
+ /Android.*Mini/,
68
+ /Symbian/,
69
+ /^SonyEricsson/,
70
+ /^Nokia/,
71
+ /^SAMSUNG/,
72
+ /^LG/,
73
+ ],
74
+ tablet: [/iPad/, /Android/],
75
+ };
76
+ /**
77
+ * Hermes' apps (Shared app-platform for media) return "Hermes"&"_app_" as part of the user-agent
78
+ * Example UA: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6)
79
+ * AppleWebKit/605.1.15 (KHTML, like Gecko) iOS AP Hermes/64.0.0 _app_`
80
+ * @returns {boolean} Returns true if the user is inside the app.
81
+ */
82
+ function isHermesApp() {
83
+ return userAgent.search(/Hermes.*_app_/) !== -1;
84
+ }
85
+ function isDeviceIn(devicesList) {
86
+ for (let i = 0; i < devicesList.length; i += 1) {
87
+ if (devicesList[i].test(userAgent)) {
88
+ return true;
89
+ }
90
+ }
91
+ return false;
92
+ }
93
+ if (userAgent) {
94
+ if (isDeviceIn(knownDevices.mobile)) {
95
+ return 'mobile';
96
+ }
97
+ if (isDeviceIn(knownDevices.tablet)) {
98
+ return 'tablet';
99
+ }
100
+ if (isHermesApp()) {
101
+ // If not a detected device but inside app it's most likely a tablet masking itself as desktop
102
+ return 'tablet';
103
+ }
104
+ }
105
+ return 'desktop';
106
+ }
107
+ function dateTime() {
108
+ return new Date().toISOString();
109
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.get = get;
4
+ const objects_1 = require("./objects");
5
+ // biome-ignore lint/suspicious/noExplicitAny: -
6
+ function get(object, path, defaultValue) {
7
+ if (!path || !(0, objects_1.isString)(path)) {
8
+ return defaultValue;
9
+ }
10
+ const parts = path.split('.');
11
+ for (const part of parts) {
12
+ if (!object)
13
+ return defaultValue;
14
+ // biome-ignore lint/style/noParameterAssign: -
15
+ object = object[part];
16
+ }
17
+ return object ?? defaultValue;
18
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRootDomain = exports.resetGetRootDomain = void 0;
4
+ exports.makeGetRootDomainCached = makeGetRootDomainCached;
5
+ const cookie_1 = require("./cookie");
6
+ const cookie_config_1 = require("./cookie-config");
7
+ const randomString_1 = require("./randomString");
8
+ const webApi_1 = require("./webApi");
9
+ const { TEST_COOKIE_KEY } = cookie_config_1.cookieConfig;
10
+ // Exported for testing
11
+ function makeGetRootDomainCached() {
12
+ let cache;
13
+ return () => {
14
+ if (!webApi_1.isBrowser) {
15
+ return '';
16
+ }
17
+ if (cache) {
18
+ return cache;
19
+ }
20
+ const parts = `${window.location.hostname}`.split('.');
21
+ const testValue = (0, randomString_1.randomString)();
22
+ let domain = window.location.hostname;
23
+ let test = '';
24
+ for (let i = 0; i < parts.length; i += 1) {
25
+ try {
26
+ domain = parts.slice(-(i + 1)).join('.');
27
+ (0, cookie_1.writeCookie)(TEST_COOKIE_KEY, testValue, domain, 1);
28
+ test = (0, cookie_1.readCookie)(TEST_COOKIE_KEY);
29
+ (0, cookie_1.deleteCookie)(TEST_COOKIE_KEY, domain);
30
+ if (test === testValue) {
31
+ break;
32
+ }
33
+ }
34
+ catch (_e) { }
35
+ }
36
+ cache = domain;
37
+ return domain;
38
+ };
39
+ }
40
+ const resetGetRootDomain = () => {
41
+ exports.getRootDomain = makeGetRootDomainCached();
42
+ };
43
+ exports.resetGetRootDomain = resetGetRootDomain;
44
+ /**
45
+ * Function for getting the highest cookie domain where a cookie can be placed.
46
+ * This is done by trying to set and then read back a cookie at the tld, and
47
+ * then working downwards.
48
+ *
49
+ * This function is memoized as `window.location.hostname` is supposed to be
50
+ * immutable during the lifetime of the code.
51
+ *
52
+ * @returns {string} the top domain for setting cookies. Example: aftonbladet.se
53
+ */
54
+ exports.getRootDomain = makeGetRootDomainCached();