iureiure 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1410) hide show
  1. package/.editorconfig +21 -0
  2. package/.env.example +8 -0
  3. package/.eslintignore +19 -0
  4. package/.eslintrc.json +155 -0
  5. package/.github/ISSUE_TEMPLATE/bug_report.md +50 -0
  6. package/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
  7. package/.github/dependabot.yml +6 -0
  8. package/.github/pull_request_template.md +23 -0
  9. package/.github/workflows/build-and-quality-checks-v3.yml +51 -0
  10. package/.github/workflows/check_pr_title.yml +17 -0
  11. package/.github/workflows/codeql-analysis.yml +70 -0
  12. package/.github/workflows/create-hotfix-branch-v3.yml +21 -0
  13. package/.github/workflows/deploy-beta-v3.yml +82 -0
  14. package/.github/workflows/deploy-dev-v3.yml +71 -0
  15. package/.github/workflows/deploy-npm-v3.yml +169 -0
  16. package/.github/workflows/deploy-prod-v3.yml +194 -0
  17. package/.github/workflows/deploy-sanity-suite.yml +80 -0
  18. package/.github/workflows/deploy-staging-v3.yml +99 -0
  19. package/.github/workflows/draft-new-release-v3.yml +103 -0
  20. package/.github/workflows/housekeeping.yaml +40 -0
  21. package/.github/workflows/publish-new-release-v3.yml +136 -0
  22. package/.github/workflows/rollback-v3.yml +190 -0
  23. package/.github/workflows/test-v3.yml +60 -0
  24. package/.husky/commit-msg +1 -0
  25. package/.husky/pre-commit +1 -0
  26. package/.jscpd.json +17 -0
  27. package/.nvmrc +1 -0
  28. package/.nxignore +3 -0
  29. package/.prettierignore +18 -0
  30. package/.prettierrc +13 -0
  31. package/.versionrc +8 -0
  32. package/CODEOWNERS +2 -0
  33. package/__mocks__/BraveBrowser.js +9 -0
  34. package/assets/integrations/AdobeAnalytics/adobe-analytics-js-heartbeat.js +193 -0
  35. package/assets/integrations/AdobeAnalytics/adobe-analytics-js.js +116 -0
  36. package/assets/rs-logo-full-light.jpg +0 -0
  37. package/babel.config.json +14 -0
  38. package/commitlint.config.js +27 -0
  39. package/examples/angular/sample-app/.editorconfig +16 -0
  40. package/examples/angular/sample-app/README.md +27 -0
  41. package/examples/angular/sample-app/angular.json +83 -0
  42. package/examples/angular/sample-app/package-lock.json +12552 -0
  43. package/examples/angular/sample-app/package.json +39 -0
  44. package/examples/angular/sample-app/src/app/app-routing.module.ts +10 -0
  45. package/examples/angular/sample-app/src/app/app.component.css +0 -0
  46. package/examples/angular/sample-app/src/app/app.component.html +508 -0
  47. package/examples/angular/sample-app/src/app/app.component.spec.ts +33 -0
  48. package/examples/angular/sample-app/src/app/app.component.ts +104 -0
  49. package/examples/angular/sample-app/src/app/app.module.ts +12 -0
  50. package/examples/angular/sample-app/src/assets/.gitkeep +0 -0
  51. package/examples/angular/sample-app/src/favicon.ico +0 -0
  52. package/examples/angular/sample-app/src/index.html +45 -0
  53. package/examples/angular/sample-app/src/main.ts +7 -0
  54. package/examples/angular/sample-app/src/styles.css +1 -0
  55. package/examples/angular/sample-app/tsconfig.app.json +10 -0
  56. package/examples/angular/sample-app/tsconfig.json +30 -0
  57. package/examples/angular/sample-app/tsconfig.spec.json +9 -0
  58. package/examples/chrome-extension/USAGE.md +140 -0
  59. package/examples/chrome-extension/background-script/LICENSE +21 -0
  60. package/examples/chrome-extension/background-script/README.md +105 -0
  61. package/examples/chrome-extension/background-script/foreground.js +7 -0
  62. package/examples/chrome-extension/background-script/logo/logo-128.png +0 -0
  63. package/examples/chrome-extension/background-script/logo/logo-16.png +0 -0
  64. package/examples/chrome-extension/background-script/logo/logo-48.png +0 -0
  65. package/examples/chrome-extension/background-script/logo/logo.svg +138 -0
  66. package/examples/chrome-extension/background-script/manifest.json +36 -0
  67. package/examples/chrome-extension/background-script/popup/popup.css +11 -0
  68. package/examples/chrome-extension/background-script/popup/popup.html +11 -0
  69. package/examples/chrome-extension/background-script/rudderAnalytics.js +5133 -0
  70. package/examples/chrome-extension/background-script/service-worker.js +28 -0
  71. package/examples/chrome-extension/background-script/settings/settings.css +8 -0
  72. package/examples/chrome-extension/background-script/settings/settings.html +12 -0
  73. package/examples/chrome-extension/background-script-websockets/LICENSE +21 -0
  74. package/examples/chrome-extension/background-script-websockets/README.md +101 -0
  75. package/examples/chrome-extension/background-script-websockets/foreground.js +7 -0
  76. package/examples/chrome-extension/background-script-websockets/logo/logo-128.png +0 -0
  77. package/examples/chrome-extension/background-script-websockets/logo/logo-16.png +0 -0
  78. package/examples/chrome-extension/background-script-websockets/logo/logo-48.png +0 -0
  79. package/examples/chrome-extension/background-script-websockets/logo/logo.svg +138 -0
  80. package/examples/chrome-extension/background-script-websockets/manifest.json +37 -0
  81. package/examples/chrome-extension/background-script-websockets/popup/popup.css +11 -0
  82. package/examples/chrome-extension/background-script-websockets/popup/popup.html +11 -0
  83. package/examples/chrome-extension/background-script-websockets/rudderAnalytics.js +5133 -0
  84. package/examples/chrome-extension/background-script-websockets/service-worker.js +60 -0
  85. package/examples/chrome-extension/background-script-websockets/settings/settings.css +8 -0
  86. package/examples/chrome-extension/background-script-websockets/settings/settings.html +12 -0
  87. package/examples/chrome-extension/content-script-v1.1/LICENSE +21 -0
  88. package/examples/chrome-extension/content-script-v1.1/README.md +105 -0
  89. package/examples/chrome-extension/content-script-v1.1/foreground.js +65 -0
  90. package/examples/chrome-extension/content-script-v1.1/logo/logo-128.png +0 -0
  91. package/examples/chrome-extension/content-script-v1.1/logo/logo-16.png +0 -0
  92. package/examples/chrome-extension/content-script-v1.1/logo/logo-48.png +0 -0
  93. package/examples/chrome-extension/content-script-v1.1/logo/logo.svg +138 -0
  94. package/examples/chrome-extension/content-script-v1.1/manifest.json +35 -0
  95. package/examples/chrome-extension/content-script-v1.1/popup/popup.css +11 -0
  96. package/examples/chrome-extension/content-script-v1.1/popup/popup.html +11 -0
  97. package/examples/chrome-extension/content-script-v1.1/service-worker-utils.js +17 -0
  98. package/examples/chrome-extension/content-script-v1.1/service-worker.js +12 -0
  99. package/examples/chrome-extension/content-script-v1.1/settings/settings.css +8 -0
  100. package/examples/chrome-extension/content-script-v1.1/settings/settings.html +12 -0
  101. package/examples/chrome-extension/content-script-v3/LICENSE +21 -0
  102. package/examples/chrome-extension/content-script-v3/README.md +105 -0
  103. package/examples/chrome-extension/content-script-v3/foreground.js +3875 -0
  104. package/examples/chrome-extension/content-script-v3/logo/logo-128.png +0 -0
  105. package/examples/chrome-extension/content-script-v3/logo/logo-16.png +0 -0
  106. package/examples/chrome-extension/content-script-v3/logo/logo-48.png +0 -0
  107. package/examples/chrome-extension/content-script-v3/logo/logo.svg +138 -0
  108. package/examples/chrome-extension/content-script-v3/manifest.json +35 -0
  109. package/examples/chrome-extension/content-script-v3/popup/popup.css +11 -0
  110. package/examples/chrome-extension/content-script-v3/popup/popup.html +11 -0
  111. package/examples/chrome-extension/content-script-v3/service-worker-utils.js +17 -0
  112. package/examples/chrome-extension/content-script-v3/service-worker.js +12 -0
  113. package/examples/chrome-extension/content-script-v3/settings/settings.css +8 -0
  114. package/examples/chrome-extension/content-script-v3/settings/settings.html +12 -0
  115. package/examples/chrome-extension/websocket-server/server.mjs +19 -0
  116. package/examples/gatsby/sample-gatsby-plugin-usage/README.md +49 -0
  117. package/examples/gatsby/sample-gatsby-plugin-usage/gatsby-config.ts +27 -0
  118. package/examples/gatsby/sample-gatsby-plugin-usage/package-lock.json +16070 -0
  119. package/examples/gatsby/sample-gatsby-plugin-usage/package.json +31 -0
  120. package/examples/gatsby/sample-gatsby-plugin-usage/src/images/icon.png +0 -0
  121. package/examples/gatsby/sample-gatsby-plugin-usage/src/pages/404.tsx +49 -0
  122. package/examples/gatsby/sample-gatsby-plugin-usage/src/pages/index.tsx +193 -0
  123. package/examples/gatsby/sample-gatsby-plugin-usage/tsconfig.json +105 -0
  124. package/examples/gatsby/sample-gatsby-site/README.md +49 -0
  125. package/examples/gatsby/sample-gatsby-site/gatsby-config.ts +15 -0
  126. package/examples/gatsby/sample-gatsby-site/package-lock.json +15916 -0
  127. package/examples/gatsby/sample-gatsby-site/package.json +37 -0
  128. package/examples/gatsby/sample-gatsby-site/src/images/icon.png +0 -0
  129. package/examples/gatsby/sample-gatsby-site/src/pages/404.tsx +49 -0
  130. package/examples/gatsby/sample-gatsby-site/src/pages/index.tsx +209 -0
  131. package/examples/gatsby/sample-gatsby-site/tsconfig.json +105 -0
  132. package/examples/html/autotrack-test.html +94 -0
  133. package/examples/html/ecomm_test.html +358 -0
  134. package/examples/html/script-test.html +968 -0
  135. package/examples/html/segment.html +177 -0
  136. package/examples/html/test_poster.jpg +0 -0
  137. package/examples/nextjs/hooks/sample-app/.eslintrc.json +3 -0
  138. package/examples/nextjs/hooks/sample-app/README.md +36 -0
  139. package/examples/nextjs/hooks/sample-app/next.config.js +4 -0
  140. package/examples/nextjs/hooks/sample-app/package-lock.json +4766 -0
  141. package/examples/nextjs/hooks/sample-app/package.json +28 -0
  142. package/examples/nextjs/hooks/sample-app/postcss.config.js +6 -0
  143. package/examples/nextjs/hooks/sample-app/public/next.svg +1 -0
  144. package/examples/nextjs/hooks/sample-app/public/vercel.svg +1 -0
  145. package/examples/nextjs/hooks/sample-app/src/app/favicon.ico +0 -0
  146. package/examples/nextjs/hooks/sample-app/src/app/globals.css +27 -0
  147. package/examples/nextjs/hooks/sample-app/src/app/layout.tsx +55 -0
  148. package/examples/nextjs/hooks/sample-app/src/app/page.tsx +137 -0
  149. package/examples/nextjs/hooks/sample-app/src/app/useRudderAnalytics.ts +29 -0
  150. package/examples/nextjs/hooks/sample-app/tailwind.config.ts +19 -0
  151. package/examples/nextjs/hooks/sample-app/tsconfig.json +27 -0
  152. package/examples/nextjs/js/sample-app/.eslintrc.json +3 -0
  153. package/examples/nextjs/js/sample-app/README.md +36 -0
  154. package/examples/nextjs/js/sample-app/jsconfig.json +7 -0
  155. package/examples/nextjs/js/sample-app/next.config.js +4 -0
  156. package/examples/nextjs/js/sample-app/package-lock.json +4710 -0
  157. package/examples/nextjs/js/sample-app/package.json +24 -0
  158. package/examples/nextjs/js/sample-app/postcss.config.js +6 -0
  159. package/examples/nextjs/js/sample-app/public/next.svg +1 -0
  160. package/examples/nextjs/js/sample-app/public/vercel.svg +1 -0
  161. package/examples/nextjs/js/sample-app/src/app/favicon.ico +0 -0
  162. package/examples/nextjs/js/sample-app/src/app/globals.css +27 -0
  163. package/examples/nextjs/js/sample-app/src/app/layout.js +54 -0
  164. package/examples/nextjs/js/sample-app/src/app/page.js +146 -0
  165. package/examples/nextjs/js/sample-app/tailwind.config.js +17 -0
  166. package/examples/nextjs/page-router/sample-app/.eslintrc.json +3 -0
  167. package/examples/nextjs/page-router/sample-app/README.md +40 -0
  168. package/examples/nextjs/page-router/sample-app/next.config.js +6 -0
  169. package/examples/nextjs/page-router/sample-app/package-lock.json +4270 -0
  170. package/examples/nextjs/page-router/sample-app/package.json +28 -0
  171. package/examples/nextjs/page-router/sample-app/postcss.config.js +6 -0
  172. package/examples/nextjs/page-router/sample-app/public/favicon.ico +0 -0
  173. package/examples/nextjs/page-router/sample-app/public/next.svg +1 -0
  174. package/examples/nextjs/page-router/sample-app/public/vercel.svg +1 -0
  175. package/examples/nextjs/page-router/sample-app/src/pages/_app.tsx +35 -0
  176. package/examples/nextjs/page-router/sample-app/src/pages/_document.tsx +49 -0
  177. package/examples/nextjs/page-router/sample-app/src/pages/api/hello.ts +10 -0
  178. package/examples/nextjs/page-router/sample-app/src/pages/index.tsx +138 -0
  179. package/examples/nextjs/page-router/sample-app/src/pages/page2.tsx +18 -0
  180. package/examples/nextjs/page-router/sample-app/src/styles/globals.css +27 -0
  181. package/examples/nextjs/page-router/sample-app/src/useRudderAnalytics.ts +29 -0
  182. package/examples/nextjs/page-router/sample-app/tailwind.config.ts +19 -0
  183. package/examples/nextjs/page-router/sample-app/tsconfig.json +22 -0
  184. package/examples/nextjs/ts/sample-app/.eslintrc.json +3 -0
  185. package/examples/nextjs/ts/sample-app/README.md +36 -0
  186. package/examples/nextjs/ts/sample-app/next.config.js +4 -0
  187. package/examples/nextjs/ts/sample-app/package-lock.json +4766 -0
  188. package/examples/nextjs/ts/sample-app/package.json +28 -0
  189. package/examples/nextjs/ts/sample-app/postcss.config.js +6 -0
  190. package/examples/nextjs/ts/sample-app/public/next.svg +1 -0
  191. package/examples/nextjs/ts/sample-app/public/vercel.svg +1 -0
  192. package/examples/nextjs/ts/sample-app/src/app/favicon.ico +0 -0
  193. package/examples/nextjs/ts/sample-app/src/app/globals.css +27 -0
  194. package/examples/nextjs/ts/sample-app/src/app/layout.tsx +55 -0
  195. package/examples/nextjs/ts/sample-app/src/app/page.tsx +147 -0
  196. package/examples/nextjs/ts/sample-app/tailwind.config.ts +19 -0
  197. package/examples/nextjs/ts/sample-app/tsconfig.json +27 -0
  198. package/examples/reactjs/hooks/sample-app/README.md +46 -0
  199. package/examples/reactjs/hooks/sample-app/package-lock.json +16203 -0
  200. package/examples/reactjs/hooks/sample-app/package.json +47 -0
  201. package/examples/reactjs/hooks/sample-app/public/favicon.ico +0 -0
  202. package/examples/reactjs/hooks/sample-app/public/index.html +75 -0
  203. package/examples/reactjs/hooks/sample-app/public/logo192.png +0 -0
  204. package/examples/reactjs/hooks/sample-app/public/logo512.png +0 -0
  205. package/examples/reactjs/hooks/sample-app/public/manifest.json +25 -0
  206. package/examples/reactjs/hooks/sample-app/public/robots.txt +3 -0
  207. package/examples/reactjs/hooks/sample-app/src/App.css +38 -0
  208. package/examples/reactjs/hooks/sample-app/src/App.test.tsx +9 -0
  209. package/examples/reactjs/hooks/sample-app/src/App.tsx +95 -0
  210. package/examples/reactjs/hooks/sample-app/src/index.css +32 -0
  211. package/examples/reactjs/hooks/sample-app/src/index.tsx +19 -0
  212. package/examples/reactjs/hooks/sample-app/src/logo.svg +1 -0
  213. package/examples/reactjs/hooks/sample-app/src/react-app-env.d.ts +1 -0
  214. package/examples/reactjs/hooks/sample-app/src/reportWebVitals.ts +15 -0
  215. package/examples/reactjs/hooks/sample-app/src/setupTests.ts +5 -0
  216. package/examples/reactjs/hooks/sample-app/src/useRudderAnalytics.ts +23 -0
  217. package/examples/reactjs/hooks/sample-app/tsconfig.json +20 -0
  218. package/examples/reactjs/js/sample-app/README.md +70 -0
  219. package/examples/reactjs/js/sample-app/package-lock.json +17665 -0
  220. package/examples/reactjs/js/sample-app/package.json +42 -0
  221. package/examples/reactjs/js/sample-app/public/favicon.ico +0 -0
  222. package/examples/reactjs/js/sample-app/public/index.html +75 -0
  223. package/examples/reactjs/js/sample-app/public/logo192.png +0 -0
  224. package/examples/reactjs/js/sample-app/public/logo512.png +0 -0
  225. package/examples/reactjs/js/sample-app/public/manifest.json +25 -0
  226. package/examples/reactjs/js/sample-app/public/robots.txt +3 -0
  227. package/examples/reactjs/js/sample-app/src/App.css +38 -0
  228. package/examples/reactjs/js/sample-app/src/App.js +101 -0
  229. package/examples/reactjs/js/sample-app/src/App.test.js +8 -0
  230. package/examples/reactjs/js/sample-app/src/index.css +34 -0
  231. package/examples/reactjs/js/sample-app/src/index.js +17 -0
  232. package/examples/reactjs/js/sample-app/src/logo.svg +1 -0
  233. package/examples/reactjs/js/sample-app/src/reportWebVitals.js +13 -0
  234. package/examples/reactjs/js/sample-app/src/setupTests.js +5 -0
  235. package/examples/reactjs/ts/sample-app/README.md +46 -0
  236. package/examples/reactjs/ts/sample-app/package-lock.json +17653 -0
  237. package/examples/reactjs/ts/sample-app/package.json +47 -0
  238. package/examples/reactjs/ts/sample-app/public/favicon.ico +0 -0
  239. package/examples/reactjs/ts/sample-app/public/index.html +75 -0
  240. package/examples/reactjs/ts/sample-app/public/logo192.png +0 -0
  241. package/examples/reactjs/ts/sample-app/public/logo512.png +0 -0
  242. package/examples/reactjs/ts/sample-app/public/manifest.json +25 -0
  243. package/examples/reactjs/ts/sample-app/public/robots.txt +3 -0
  244. package/examples/reactjs/ts/sample-app/src/App.css +38 -0
  245. package/examples/reactjs/ts/sample-app/src/App.test.tsx +9 -0
  246. package/examples/reactjs/ts/sample-app/src/App.tsx +101 -0
  247. package/examples/reactjs/ts/sample-app/src/index.css +34 -0
  248. package/examples/reactjs/ts/sample-app/src/index.tsx +19 -0
  249. package/examples/reactjs/ts/sample-app/src/logo.svg +1 -0
  250. package/examples/reactjs/ts/sample-app/src/react-app-env.d.ts +1 -0
  251. package/examples/reactjs/ts/sample-app/src/reportWebVitals.ts +15 -0
  252. package/examples/reactjs/ts/sample-app/src/setupTests.ts +5 -0
  253. package/examples/reactjs/ts/sample-app/tsconfig.json +20 -0
  254. package/examples/reactjs/vite/sample-app/.eslintrc.cjs +18 -0
  255. package/examples/reactjs/vite/sample-app/README.md +27 -0
  256. package/examples/reactjs/vite/sample-app/index.html +45 -0
  257. package/examples/reactjs/vite/sample-app/package-lock.json +3427 -0
  258. package/examples/reactjs/vite/sample-app/package.json +29 -0
  259. package/examples/reactjs/vite/sample-app/public/vite.svg +1 -0
  260. package/examples/reactjs/vite/sample-app/src/App.css +42 -0
  261. package/examples/reactjs/vite/sample-app/src/App.tsx +105 -0
  262. package/examples/reactjs/vite/sample-app/src/assets/react.svg +1 -0
  263. package/examples/reactjs/vite/sample-app/src/index.css +70 -0
  264. package/examples/reactjs/vite/sample-app/src/main.tsx +10 -0
  265. package/examples/reactjs/vite/sample-app/src/vite-env.d.ts +1 -0
  266. package/examples/reactjs/vite/sample-app/tsconfig.json +25 -0
  267. package/examples/reactjs/vite/sample-app/tsconfig.node.json +10 -0
  268. package/examples/reactjs/vite/sample-app/vite.config.ts +7 -0
  269. package/examples/serverless/USAGE.md +85 -0
  270. package/examples/serverless/cloudflare-worker/.editorconfig +13 -0
  271. package/examples/serverless/cloudflare-worker/.prettierrc +6 -0
  272. package/examples/serverless/cloudflare-worker/package-lock.json +2646 -0
  273. package/examples/serverless/cloudflare-worker/package.json +18 -0
  274. package/examples/serverless/cloudflare-worker/src/worker.js +54 -0
  275. package/examples/serverless/cloudflare-worker/wrangler.toml +52 -0
  276. package/examples/serverless/vercel-edge/.eslintrc.json +3 -0
  277. package/examples/serverless/vercel-edge/README.md +34 -0
  278. package/examples/serverless/vercel-edge/app/api/edge-function-example/route.ts +32 -0
  279. package/examples/serverless/vercel-edge/app/favicon.ico +0 -0
  280. package/examples/serverless/vercel-edge/app/globals.css +27 -0
  281. package/examples/serverless/vercel-edge/app/layout.tsx +22 -0
  282. package/examples/serverless/vercel-edge/app/page.tsx +113 -0
  283. package/examples/serverless/vercel-edge/next.config.js +4 -0
  284. package/examples/serverless/vercel-edge/package-lock.json +5351 -0
  285. package/examples/serverless/vercel-edge/package.json +26 -0
  286. package/examples/serverless/vercel-edge/postcss.config.js +6 -0
  287. package/examples/serverless/vercel-edge/public/next.svg +1 -0
  288. package/examples/serverless/vercel-edge/public/vercel.svg +1 -0
  289. package/examples/serverless/vercel-edge/tailwind.config.ts +19 -0
  290. package/examples/serverless/vercel-edge/tsconfig.json +27 -0
  291. package/examples/symfony/USAGE.md +57 -0
  292. package/examples/symfony/sample/.env.test +6 -0
  293. package/examples/symfony/sample/assets/app.js +15 -0
  294. package/examples/symfony/sample/assets/styles/app.css +3 -0
  295. package/examples/symfony/sample/compose.override.yaml +14 -0
  296. package/examples/symfony/sample/compose.yaml +21 -0
  297. package/examples/symfony/sample/composer.json +104 -0
  298. package/examples/symfony/sample/composer.lock +9921 -0
  299. package/examples/symfony/sample/config/bundles.php +15 -0
  300. package/examples/symfony/sample/config/packages/cache.yaml +19 -0
  301. package/examples/symfony/sample/config/packages/debug.yaml +5 -0
  302. package/examples/symfony/sample/config/packages/doctrine.yaml +43 -0
  303. package/examples/symfony/sample/config/packages/doctrine_migrations.yaml +6 -0
  304. package/examples/symfony/sample/config/packages/framework.yaml +24 -0
  305. package/examples/symfony/sample/config/packages/mailer.yaml +3 -0
  306. package/examples/symfony/sample/config/packages/messenger.yaml +24 -0
  307. package/examples/symfony/sample/config/packages/monolog.yaml +61 -0
  308. package/examples/symfony/sample/config/packages/notifier.yaml +12 -0
  309. package/examples/symfony/sample/config/packages/routing.yaml +12 -0
  310. package/examples/symfony/sample/config/packages/security.yaml +40 -0
  311. package/examples/symfony/sample/config/packages/translation.yaml +13 -0
  312. package/examples/symfony/sample/config/packages/twig.yaml +6 -0
  313. package/examples/symfony/sample/config/packages/validator.yaml +13 -0
  314. package/examples/symfony/sample/config/packages/web_profiler.yaml +15 -0
  315. package/examples/symfony/sample/config/packages/webpack_encore.yaml +45 -0
  316. package/examples/symfony/sample/config/preload.php +5 -0
  317. package/examples/symfony/sample/config/routes/framework.yaml +4 -0
  318. package/examples/symfony/sample/config/routes/web_profiler.yaml +8 -0
  319. package/examples/symfony/sample/config/routes.yaml +7 -0
  320. package/examples/symfony/sample/config/services.yaml +24 -0
  321. package/examples/symfony/sample/package-lock.json +8082 -0
  322. package/examples/symfony/sample/package.json +23 -0
  323. package/examples/symfony/sample/phpunit.xml.dist +38 -0
  324. package/examples/symfony/sample/public/index.php +9 -0
  325. package/examples/symfony/sample/src/Controller/LuckyController.php +18 -0
  326. package/examples/symfony/sample/src/Kernel.php +11 -0
  327. package/examples/symfony/sample/symfony.lock +277 -0
  328. package/examples/symfony/sample/templates/base.html.twig +19 -0
  329. package/examples/symfony/sample/templates/lucky/number.html.twig +20 -0
  330. package/examples/symfony/sample/tests/bootstrap.php +11 -0
  331. package/examples/symfony/sample/webpack.config.js +72 -0
  332. package/examples/v1/index.html +229 -0
  333. package/examples/v1.1/index.html +229 -0
  334. package/examples/v2-beacon/index.html +229 -0
  335. package/examples/v3/index.html +266 -0
  336. package/examples/v3-beacon/index.html +270 -0
  337. package/examples/v3-legacy/index.html +266 -0
  338. package/examples/v3-legacy-minimum-plugins/index.html +270 -0
  339. package/examples/v3-minimum-plugins/index.html +270 -0
  340. package/jest/jest.global-setup.js +3 -0
  341. package/jest/jest.polyfills.js +18 -0
  342. package/jest/jest.setup-dom.js +54 -0
  343. package/jest/jsdom-extended.js +26 -0
  344. package/jest.config.ts +5 -0
  345. package/jest.preset.js +83 -0
  346. package/migrations.json +34 -0
  347. package/nx.json +69 -0
  348. package/package.json +170 -0
  349. package/packages/analytics-js/.env.example +9 -0
  350. package/packages/analytics-js/.jscpd.json +17 -0
  351. package/packages/analytics-js/.size-limit.js +31 -0
  352. package/packages/analytics-js/CHANGELOG.md +283 -0
  353. package/packages/analytics-js/CHANGELOG_LATEST.md +2 -0
  354. package/packages/analytics-js/LICENSE +21 -0
  355. package/packages/analytics-js/README.md +100 -0
  356. package/packages/analytics-js/__fixtures__/fixtures.ts +765 -0
  357. package/packages/analytics-js/__fixtures__/msw.handlers.ts +82 -0
  358. package/packages/analytics-js/__fixtures__/msw.server.ts +6 -0
  359. package/packages/analytics-js/__mocks__/remotePlugins/BeaconQueue.ts +9 -0
  360. package/packages/analytics-js/__mocks__/remotePlugins/Bugsnag.ts +10 -0
  361. package/packages/analytics-js/__mocks__/remotePlugins/CustomConsentManager.ts +10 -0
  362. package/packages/analytics-js/__mocks__/remotePlugins/DeviceModeDestinations.ts +9 -0
  363. package/packages/analytics-js/__mocks__/remotePlugins/DeviceModeTransformation.ts +9 -0
  364. package/packages/analytics-js/__mocks__/remotePlugins/ErrorReporting.ts +10 -0
  365. package/packages/analytics-js/__mocks__/remotePlugins/ExternalAnonymousId.ts +10 -0
  366. package/packages/analytics-js/__mocks__/remotePlugins/GoogleLinker.ts +8 -0
  367. package/packages/analytics-js/__mocks__/remotePlugins/KetchConsentManager.ts +10 -0
  368. package/packages/analytics-js/__mocks__/remotePlugins/NativeDestinationQueue.ts +10 -0
  369. package/packages/analytics-js/__mocks__/remotePlugins/OneTrustConsentManager.ts +10 -0
  370. package/packages/analytics-js/__mocks__/remotePlugins/StorageEncryption.ts +9 -0
  371. package/packages/analytics-js/__mocks__/remotePlugins/StorageEncryptionLegacy.ts +9 -0
  372. package/packages/analytics-js/__mocks__/remotePlugins/StorageMigrator.ts +8 -0
  373. package/packages/analytics-js/__mocks__/remotePlugins/XhrQueue.ts +9 -0
  374. package/packages/analytics-js/__tests__/app/RudderAnalytics.test.ts +286 -0
  375. package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/adBlockers.test.ts +78 -0
  376. package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/browser.test.ts +24 -0
  377. package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/clientHint.test.ts +87 -0
  378. package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/dom.test.ts +13 -0
  379. package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/screen.test.ts +13 -0
  380. package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/storage.test.ts +27 -0
  381. package/packages/analytics-js/__tests__/components/configManager/ConfigManager.test.ts +222 -0
  382. package/packages/analytics-js/__tests__/components/configManager/cdnPaths.test.ts +70 -0
  383. package/packages/analytics-js/__tests__/components/configManager/commonUtil.test.ts +531 -0
  384. package/packages/analytics-js/__tests__/components/configManager/dataPlaneResolver.test.ts +163 -0
  385. package/packages/analytics-js/__tests__/components/configManager/validate.test.ts +31 -0
  386. package/packages/analytics-js/__tests__/components/core/Analytics.test.ts +628 -0
  387. package/packages/analytics-js/__tests__/components/eventManager/EventManager.test.ts +78 -0
  388. package/packages/analytics-js/__tests__/components/eventManager/RudderEventFactory.test.ts +514 -0
  389. package/packages/analytics-js/__tests__/components/eventManager/utilities.test.ts +1043 -0
  390. package/packages/analytics-js/__tests__/components/eventRepository/EventRepository.test.ts +324 -0
  391. package/packages/analytics-js/__tests__/components/pluginsManager/.gitkeep +0 -0
  392. package/packages/analytics-js/__tests__/components/preloadBuffer/index.test.ts +130 -0
  393. package/packages/analytics-js/__tests__/components/userSessionManager/UserSessionManager.test.ts +1386 -0
  394. package/packages/analytics-js/__tests__/components/userSessionManager/utils.test.ts +103 -0
  395. package/packages/analytics-js/__tests__/components/utilities/consent.test.ts +192 -0
  396. package/packages/analytics-js/__tests__/components/utilities/destinations.test.ts +201 -0
  397. package/packages/analytics-js/__tests__/components/utilities/event.test.ts +8 -0
  398. package/packages/analytics-js/__tests__/components/utilities/globals.test.ts +42 -0
  399. package/packages/analytics-js/__tests__/components/utilities/page.test.ts +235 -0
  400. package/packages/analytics-js/__tests__/components/utilities/sort.test.ts +17 -0
  401. package/packages/analytics-js/__tests__/components/utilities/statsCollection.test.ts +84 -0
  402. package/packages/analytics-js/__tests__/components/utilities/url.test.ts +51 -0
  403. package/packages/analytics-js/__tests__/services/ErrorHandler/ErrorHandler.test.ts +272 -0
  404. package/packages/analytics-js/__tests__/services/ErrorHandler/processError.test.ts +33 -0
  405. package/packages/analytics-js/__tests__/services/HttpClient/HttpClient.test.ts +255 -0
  406. package/packages/analytics-js/__tests__/services/Logger/Logger.test.ts +204 -0
  407. package/packages/analytics-js/__tests__/services/PluginEngine/PluginEngine.test.ts +206 -0
  408. package/packages/analytics-js/__tests__/services/StoreManager/Store.test.ts +152 -0
  409. package/packages/analytics-js/__tests__/services/StoreManager/StoreManager.test.ts +272 -0
  410. package/packages/analytics-js/__tests__/services/StoreManager/component-cookie/index.test.ts +65 -0
  411. package/packages/analytics-js/__tests__/services/StoreManager/storages/CookieStorage.test.ts +42 -0
  412. package/packages/analytics-js/__tests__/services/StoreManager/storages/InMemoryStorage.test.ts +26 -0
  413. package/packages/analytics-js/__tests__/services/StoreManager/storages/LocalStorage.test.ts +26 -0
  414. package/packages/analytics-js/__tests__/services/StoreManager/storages/sessionStorage.test.ts +26 -0
  415. package/packages/analytics-js/__tests__/services/StoreManager/top-domain/index.test.ts +60 -0
  416. package/packages/analytics-js/babel.config.json +15 -0
  417. package/packages/analytics-js/jest.config.mjs +14 -0
  418. package/packages/analytics-js/package.json +114 -0
  419. package/packages/analytics-js/project.json +138 -0
  420. package/packages/analytics-js/public/index-legacy-only.html +308 -0
  421. package/packages/analytics-js/public/index.html +324 -0
  422. package/packages/analytics-js/public/list_integration_sdks.html +408 -0
  423. package/packages/analytics-js/rollup.config.mjs +387 -0
  424. package/packages/analytics-js/src/app/IRudderStackGlobals.ts +21 -0
  425. package/packages/analytics-js/src/app/RudderAnalytics.ts +296 -0
  426. package/packages/analytics-js/src/browser.ts +55 -0
  427. package/packages/analytics-js/src/components/capabilitiesManager/CapabilitiesManager.ts +199 -0
  428. package/packages/analytics-js/src/components/capabilitiesManager/detection/adBlockers.ts +38 -0
  429. package/packages/analytics-js/src/components/capabilitiesManager/detection/browser.ts +24 -0
  430. package/packages/analytics-js/src/components/capabilitiesManager/detection/clientHint.ts +31 -0
  431. package/packages/analytics-js/src/components/capabilitiesManager/detection/dom.ts +54 -0
  432. package/packages/analytics-js/src/components/capabilitiesManager/detection/index.ts +6 -0
  433. package/packages/analytics-js/src/components/capabilitiesManager/detection/screen.ts +23 -0
  434. package/packages/analytics-js/src/components/capabilitiesManager/detection/storage.ts +77 -0
  435. package/packages/analytics-js/src/components/capabilitiesManager/index.ts +1 -0
  436. package/packages/analytics-js/src/components/capabilitiesManager/polyfill/index.ts +14 -0
  437. package/packages/analytics-js/src/components/capabilitiesManager/types.ts +14 -0
  438. package/packages/analytics-js/src/components/configManager/ConfigManager.ts +218 -0
  439. package/packages/analytics-js/src/components/configManager/constants.ts +21 -0
  440. package/packages/analytics-js/src/components/configManager/index.ts +1 -0
  441. package/packages/analytics-js/src/components/configManager/types.ts +90 -0
  442. package/packages/analytics-js/src/components/configManager/util/cdnPaths.ts +80 -0
  443. package/packages/analytics-js/src/components/configManager/util/commonUtil.ts +262 -0
  444. package/packages/analytics-js/src/components/configManager/util/dataPlaneResolver.ts +79 -0
  445. package/packages/analytics-js/src/components/configManager/util/validate.ts +46 -0
  446. package/packages/analytics-js/src/components/core/Analytics.ts +824 -0
  447. package/packages/analytics-js/src/components/core/IAnalytics.ts +218 -0
  448. package/packages/analytics-js/src/components/core/utilities.ts +12 -0
  449. package/packages/analytics-js/src/components/eventManager/EventManager.ts +80 -0
  450. package/packages/analytics-js/src/components/eventManager/RudderEventFactory.ts +171 -0
  451. package/packages/analytics-js/src/components/eventManager/constants.ts +29 -0
  452. package/packages/analytics-js/src/components/eventManager/index.ts +1 -0
  453. package/packages/analytics-js/src/components/eventManager/types.ts +7 -0
  454. package/packages/analytics-js/src/components/eventManager/utilities.ts +341 -0
  455. package/packages/analytics-js/src/components/eventRepository/EventRepository.ts +225 -0
  456. package/packages/analytics-js/src/components/eventRepository/constants.ts +9 -0
  457. package/packages/analytics-js/src/components/eventRepository/index.ts +1 -0
  458. package/packages/analytics-js/src/components/eventRepository/types.ts +10 -0
  459. package/packages/analytics-js/src/components/eventRepository/utils.ts +53 -0
  460. package/packages/analytics-js/src/components/pluginsManager/PluginsManager.ts +332 -0
  461. package/packages/analytics-js/src/components/pluginsManager/bundledBuildPluginImports.ts +39 -0
  462. package/packages/analytics-js/src/components/pluginsManager/defaultPluginsList.ts +24 -0
  463. package/packages/analytics-js/src/components/pluginsManager/federatedModulesBuildPluginImports.ts +68 -0
  464. package/packages/analytics-js/src/components/pluginsManager/index.ts +1 -0
  465. package/packages/analytics-js/src/components/pluginsManager/pluginNames.ts +29 -0
  466. package/packages/analytics-js/src/components/pluginsManager/pluginsInventory.ts +47 -0
  467. package/packages/analytics-js/src/components/pluginsManager/types.ts +4 -0
  468. package/packages/analytics-js/src/components/preloadBuffer/index.ts +187 -0
  469. package/packages/analytics-js/src/components/preloadBuffer/types.ts +5 -0
  470. package/packages/analytics-js/src/components/userSessionManager/UserSessionManager.ts +642 -0
  471. package/packages/analytics-js/src/components/userSessionManager/constants.ts +25 -0
  472. package/packages/analytics-js/src/components/userSessionManager/index.ts +1 -0
  473. package/packages/analytics-js/src/components/userSessionManager/types.ts +29 -0
  474. package/packages/analytics-js/src/components/userSessionManager/utils.ts +109 -0
  475. package/packages/analytics-js/src/components/utilities/consent.ts +163 -0
  476. package/packages/analytics-js/src/components/utilities/destinations.ts +31 -0
  477. package/packages/analytics-js/src/components/utilities/event.ts +3 -0
  478. package/packages/analytics-js/src/components/utilities/globals.ts +54 -0
  479. package/packages/analytics-js/src/components/utilities/loadOptions.ts +176 -0
  480. package/packages/analytics-js/src/components/utilities/number.ts +23 -0
  481. package/packages/analytics-js/src/components/utilities/page.ts +103 -0
  482. package/packages/analytics-js/src/components/utilities/sort.ts +15 -0
  483. package/packages/analytics-js/src/components/utilities/statsCollection.ts +16 -0
  484. package/packages/analytics-js/src/components/utilities/url.ts +90 -0
  485. package/packages/analytics-js/src/constants/app.ts +24 -0
  486. package/packages/analytics-js/src/constants/encryption.ts +6 -0
  487. package/packages/analytics-js/src/constants/errors.ts +4 -0
  488. package/packages/analytics-js/src/constants/logMessages.ts +282 -0
  489. package/packages/analytics-js/src/constants/queryParams.ts +13 -0
  490. package/packages/analytics-js/src/constants/storage.ts +40 -0
  491. package/packages/analytics-js/src/constants/timeouts.ts +15 -0
  492. package/packages/analytics-js/src/constants/urls.ts +21 -0
  493. package/packages/analytics-js/src/index.ts +40 -0
  494. package/packages/analytics-js/src/services/ErrorHandler/ErrorHandler.ts +204 -0
  495. package/packages/analytics-js/src/services/ErrorHandler/constant.ts +3 -0
  496. package/packages/analytics-js/src/services/ErrorHandler/index.ts +1 -0
  497. package/packages/analytics-js/src/services/ErrorHandler/processError.ts +61 -0
  498. package/packages/analytics-js/src/services/HttpClient/HttpClient.ts +112 -0
  499. package/packages/analytics-js/src/services/HttpClient/index.ts +7 -0
  500. package/packages/analytics-js/src/services/HttpClient/xhr/xhrRequestHandler.ts +140 -0
  501. package/packages/analytics-js/src/services/HttpClient/xhr/xhrResponseHandler.ts +25 -0
  502. package/packages/analytics-js/src/services/Logger/Logger.ts +123 -0
  503. package/packages/analytics-js/src/services/Logger/index.ts +1 -0
  504. package/packages/analytics-js/src/services/Logger/types.ts +6 -0
  505. package/packages/analytics-js/src/services/PluginEngine/PluginEngine.ts +200 -0
  506. package/packages/analytics-js/src/services/PluginEngine/README.md +152 -0
  507. package/packages/analytics-js/src/services/PluginEngine/index.ts +1 -0
  508. package/packages/analytics-js/src/services/StoreManager/Store.ts +218 -0
  509. package/packages/analytics-js/src/services/StoreManager/StoreManager.ts +231 -0
  510. package/packages/analytics-js/src/services/StoreManager/component-cookie/README.md +23 -0
  511. package/packages/analytics-js/src/services/StoreManager/component-cookie/index.ts +138 -0
  512. package/packages/analytics-js/src/services/StoreManager/index.ts +2 -0
  513. package/packages/analytics-js/src/services/StoreManager/storages/CookieStorage.ts +80 -0
  514. package/packages/analytics-js/src/services/StoreManager/storages/InMemoryStorage.ts +66 -0
  515. package/packages/analytics-js/src/services/StoreManager/storages/LocalStorage.ts +68 -0
  516. package/packages/analytics-js/src/services/StoreManager/storages/defaultOptions.ts +39 -0
  517. package/packages/analytics-js/src/services/StoreManager/storages/index.ts +18 -0
  518. package/packages/analytics-js/src/services/StoreManager/storages/sessionStorage.ts +64 -0
  519. package/packages/analytics-js/src/services/StoreManager/storages/storageEngine.ts +91 -0
  520. package/packages/analytics-js/src/services/StoreManager/top-domain/README.md +21 -0
  521. package/packages/analytics-js/src/services/StoreManager/top-domain/index.ts +83 -0
  522. package/packages/analytics-js/src/services/StoreManager/types.ts +32 -0
  523. package/packages/analytics-js/src/services/StoreManager/utils.ts +33 -0
  524. package/packages/analytics-js/src/state/index.ts +53 -0
  525. package/packages/analytics-js/src/state/slices/capabilities.ts +19 -0
  526. package/packages/analytics-js/src/state/slices/consents.ts +16 -0
  527. package/packages/analytics-js/src/state/slices/context.ts +36 -0
  528. package/packages/analytics-js/src/state/slices/eventBuffer.ts +9 -0
  529. package/packages/analytics-js/src/state/slices/lifecycle.ts +19 -0
  530. package/packages/analytics-js/src/state/slices/loadOptions.ts +44 -0
  531. package/packages/analytics-js/src/state/slices/metrics.ts +12 -0
  532. package/packages/analytics-js/src/state/slices/nativeDestinations.ts +15 -0
  533. package/packages/analytics-js/src/state/slices/plugins.ts +13 -0
  534. package/packages/analytics-js/src/state/slices/reporting.ts +11 -0
  535. package/packages/analytics-js/src/state/slices/session.ts +24 -0
  536. package/packages/analytics-js/src/state/slices/source.ts +6 -0
  537. package/packages/analytics-js/src/state/slices/storage.ts +13 -0
  538. package/packages/analytics-js/src/types/index.ts +1 -0
  539. package/packages/analytics-js/src/types/remote-plugins.d.ts +15 -0
  540. package/packages/analytics-js/src/types/rudderanalytics.d.ts +16 -0
  541. package/packages/analytics-js/tsconfig.json +14 -0
  542. package/packages/analytics-js/tsconfig.spec.json +26 -0
  543. package/packages/analytics-js-common/.jscpd.json +17 -0
  544. package/packages/analytics-js-common/.size-limit.js +11 -0
  545. package/packages/analytics-js-common/CHANGELOG.md +180 -0
  546. package/packages/analytics-js-common/CHANGELOG_LATEST.md +7 -0
  547. package/packages/analytics-js-common/LICENSE +21 -0
  548. package/packages/analytics-js-common/README.md +42 -0
  549. package/packages/analytics-js-common/__fixtures__/fixtures.ts +161 -0
  550. package/packages/analytics-js-common/__fixtures__/msw.handlers.ts +82 -0
  551. package/packages/analytics-js-common/__fixtures__/msw.server.ts +6 -0
  552. package/packages/analytics-js-common/__mocks__/.gitkeep +0 -0
  553. package/packages/analytics-js-common/__tests__/services/BufferQueue/BufferQueue.test.ts +55 -0
  554. package/packages/analytics-js-common/__tests__/services/ExternalSrcLoader/ExternalSrcLoader.test.ts +170 -0
  555. package/packages/analytics-js-common/__tests__/utilities/checks.test.ts +95 -0
  556. package/packages/analytics-js-common/__tests__/utilities/destinations.test.ts +44 -0
  557. package/packages/analytics-js-common/__tests__/utilities/detect.test.ts +22 -0
  558. package/packages/analytics-js-common/__tests__/utilities/eventMethodOverloads.test.ts +260 -0
  559. package/packages/analytics-js-common/__tests__/utilities/json.test.ts +155 -0
  560. package/packages/analytics-js-common/__tests__/utilities/object.test.ts +287 -0
  561. package/packages/analytics-js-common/__tests__/utilities/string.test.ts +104 -0
  562. package/packages/analytics-js-common/__tests__/utilities/timezone.test.ts +9 -0
  563. package/packages/analytics-js-common/__tests__/utilities/uuid.test.ts +35 -0
  564. package/packages/analytics-js-common/__tests__/v1.1/utils/ObjectUtils.test.js +113 -0
  565. package/packages/analytics-js-common/__tests__/v1.1/utils/errorHandler.test.js +60 -0
  566. package/packages/analytics-js-common/babel.config.json +14 -0
  567. package/packages/analytics-js-common/jest.config.mjs +14 -0
  568. package/packages/analytics-js-common/package.json +92 -0
  569. package/packages/analytics-js-common/project.json +107 -0
  570. package/packages/analytics-js-common/src/constants/QueueStatuses.ts +10 -0
  571. package/packages/analytics-js-common/src/constants/consent.ts +6 -0
  572. package/packages/analytics-js-common/src/constants/destDisplayNamesToFileNamesMap.ts +243 -0
  573. package/packages/analytics-js-common/src/constants/destinationNames.ts +312 -0
  574. package/packages/analytics-js-common/src/constants/htmlAttributes.ts +3 -0
  575. package/packages/analytics-js-common/src/constants/index.ts +11 -0
  576. package/packages/analytics-js-common/src/constants/integrations/ActiveCampaign/constants.js +18 -0
  577. package/packages/analytics-js-common/src/constants/integrations/AdobeAnalytics/constants.ts +18 -0
  578. package/packages/analytics-js-common/src/constants/integrations/Adroll/constants.ts +14 -0
  579. package/packages/analytics-js-common/src/constants/integrations/Amplitude/constants.ts +13 -0
  580. package/packages/analytics-js-common/src/constants/integrations/Appcues/constants.ts +13 -0
  581. package/packages/analytics-js-common/src/constants/integrations/Axeptio/constants.ts +12 -0
  582. package/packages/analytics-js-common/src/constants/integrations/BingAds/constants.ts +16 -0
  583. package/packages/analytics-js-common/src/constants/integrations/Braze/constants.ts +22 -0
  584. package/packages/analytics-js-common/src/constants/integrations/Bugsnag/constants.ts +12 -0
  585. package/packages/analytics-js-common/src/constants/integrations/Chartbeat/constants.ts +14 -0
  586. package/packages/analytics-js-common/src/constants/integrations/Clevertap/constants.ts +12 -0
  587. package/packages/analytics-js-common/src/constants/integrations/CommandBar/constants.ts +21 -0
  588. package/packages/analytics-js-common/src/constants/integrations/CommonIntegrationsConstant/constants.ts +194 -0
  589. package/packages/analytics-js-common/src/constants/integrations/Comscore/constants.ts +15 -0
  590. package/packages/analytics-js-common/src/constants/integrations/ConvertFlow/constants.ts +19 -0
  591. package/packages/analytics-js-common/src/constants/integrations/Criteo/constants.ts +22 -0
  592. package/packages/analytics-js-common/src/constants/integrations/CustomerIO/constants.ts +14 -0
  593. package/packages/analytics-js-common/src/constants/integrations/DCMFloodlight/constants.ts +19 -0
  594. package/packages/analytics-js-common/src/constants/integrations/Drip/constants.ts +12 -0
  595. package/packages/analytics-js-common/src/constants/integrations/Engage/constants.ts +27 -0
  596. package/packages/analytics-js-common/src/constants/integrations/FacebookPixel/constants.ts +89 -0
  597. package/packages/analytics-js-common/src/constants/integrations/Fullstory/constants.ts +17 -0
  598. package/packages/analytics-js-common/src/constants/integrations/GA/constants.ts +14 -0
  599. package/packages/analytics-js-common/src/constants/integrations/GA360/constants.ts +18 -0
  600. package/packages/analytics-js-common/src/constants/integrations/GA4/constants.ts +19 -0
  601. package/packages/analytics-js-common/src/constants/integrations/GoogleAds/constants.ts +15 -0
  602. package/packages/analytics-js-common/src/constants/integrations/GoogleOptimize/constants.ts +17 -0
  603. package/packages/analytics-js-common/src/constants/integrations/GoogleTagManager/constants.ts +14 -0
  604. package/packages/analytics-js-common/src/constants/integrations/Heap/constants.ts +13 -0
  605. package/packages/analytics-js-common/src/constants/integrations/Hotjar/constants.ts +14 -0
  606. package/packages/analytics-js-common/src/constants/integrations/HubSpot/constants.ts +15 -0
  607. package/packages/analytics-js-common/src/constants/integrations/INTERCOM/constants.ts +12 -0
  608. package/packages/analytics-js-common/src/constants/integrations/Iterable/constants.ts +12 -0
  609. package/packages/analytics-js-common/src/constants/integrations/June/constants.ts +12 -0
  610. package/packages/analytics-js-common/src/constants/integrations/Keen/constants.ts +14 -0
  611. package/packages/analytics-js-common/src/constants/integrations/Kissmetrics/constants.ts +12 -0
  612. package/packages/analytics-js-common/src/constants/integrations/Klaviyo/constants.ts +12 -0
  613. package/packages/analytics-js-common/src/constants/integrations/LaunchDarkly/constants.ts +15 -0
  614. package/packages/analytics-js-common/src/constants/integrations/Lemnisk/constants.ts +17 -0
  615. package/packages/analytics-js-common/src/constants/integrations/LinkedInInsightTag/constants.ts +20 -0
  616. package/packages/analytics-js-common/src/constants/integrations/LiveChat/constants.ts +16 -0
  617. package/packages/analytics-js-common/src/constants/integrations/Lotame/constants.ts +12 -0
  618. package/packages/analytics-js-common/src/constants/integrations/Lytics/constants.ts +12 -0
  619. package/packages/analytics-js-common/src/constants/integrations/Matomo/constants.ts +12 -0
  620. package/packages/analytics-js-common/src/constants/integrations/MicrosoftClarity/constants.ts +18 -0
  621. package/packages/analytics-js-common/src/constants/integrations/Mixpanel/constants.ts +15 -0
  622. package/packages/analytics-js-common/src/constants/integrations/MoEngage/constants.ts +16 -0
  623. package/packages/analytics-js-common/src/constants/integrations/Mouseflow/constants.ts +18 -0
  624. package/packages/analytics-js-common/src/constants/integrations/Ninetailed/constants.ts +13 -0
  625. package/packages/analytics-js-common/src/constants/integrations/Olark/constants.ts +12 -0
  626. package/packages/analytics-js-common/src/constants/integrations/Optimizely/constants.ts +12 -0
  627. package/packages/analytics-js-common/src/constants/integrations/Pendo/constants.ts +12 -0
  628. package/packages/analytics-js-common/src/constants/integrations/PinterestTag/constants.ts +23 -0
  629. package/packages/analytics-js-common/src/constants/integrations/Podsights/constants.ts +24 -0
  630. package/packages/analytics-js-common/src/constants/integrations/PostAffiliatePro/constants.ts +17 -0
  631. package/packages/analytics-js-common/src/constants/integrations/Posthog/constants.ts +16 -0
  632. package/packages/analytics-js-common/src/constants/integrations/ProfitWell/constants.ts +16 -0
  633. package/packages/analytics-js-common/src/constants/integrations/Qualaroo/constants.ts +12 -0
  634. package/packages/analytics-js-common/src/constants/integrations/Qualtrics/constants.ts +12 -0
  635. package/packages/analytics-js-common/src/constants/integrations/QuantumMetric/constants.ts +17 -0
  636. package/packages/analytics-js-common/src/constants/integrations/QuoraPixel/constants.ts +19 -0
  637. package/packages/analytics-js-common/src/constants/integrations/RedditPixel/constants.ts +17 -0
  638. package/packages/analytics-js-common/src/constants/integrations/Refiner/constants.ts +12 -0
  639. package/packages/analytics-js-common/src/constants/integrations/Rockerbox/constants.ts +16 -0
  640. package/packages/analytics-js-common/src/constants/integrations/RollBar/constants.ts +17 -0
  641. package/packages/analytics-js-common/src/constants/integrations/Satismeter/constants.ts +12 -0
  642. package/packages/analytics-js-common/src/constants/integrations/Sendinblue/constants.ts +37 -0
  643. package/packages/analytics-js-common/src/constants/integrations/Sentry/constants.ts +12 -0
  644. package/packages/analytics-js-common/src/constants/integrations/Shynet/constants.ts +18 -0
  645. package/packages/analytics-js-common/src/constants/integrations/SnapEngage/constants.ts +16 -0
  646. package/packages/analytics-js-common/src/constants/integrations/SnapPixel/constants.ts +17 -0
  647. package/packages/analytics-js-common/src/constants/integrations/SpotifyPixel/constants.ts +20 -0
  648. package/packages/analytics-js-common/src/constants/integrations/Sprig/constants.ts +12 -0
  649. package/packages/analytics-js-common/src/constants/integrations/TVSquared/constants.ts +18 -0
  650. package/packages/analytics-js-common/src/constants/integrations/TiktokAds/constants.ts +97 -0
  651. package/packages/analytics-js-common/src/constants/integrations/VWO/constants.ts +17 -0
  652. package/packages/analytics-js-common/src/constants/integrations/Vero/constants.ts +12 -0
  653. package/packages/analytics-js-common/src/constants/integrations/Woopra/constants.ts +12 -0
  654. package/packages/analytics-js-common/src/constants/integrations/YandexMetrica/constants.ts +14 -0
  655. package/packages/analytics-js-common/src/constants/integrationsConfig.ts +5 -0
  656. package/packages/analytics-js-common/src/constants/logMessages.ts +24 -0
  657. package/packages/analytics-js-common/src/constants/loggerContexts.ts +33 -0
  658. package/packages/analytics-js-common/src/constants/storages.ts +9 -0
  659. package/packages/analytics-js-common/src/constants/timeouts.ts +3 -0
  660. package/packages/analytics-js-common/src/constants/urls.ts +4 -0
  661. package/packages/analytics-js-common/src/index.ts +4 -0
  662. package/packages/analytics-js-common/src/services/BufferQueue/BufferQueue.ts +37 -0
  663. package/packages/analytics-js-common/src/services/ExternalSrcLoader/ExternalSrcLoader.ts +63 -0
  664. package/packages/analytics-js-common/src/services/ExternalSrcLoader/index.ts +1 -0
  665. package/packages/analytics-js-common/src/services/ExternalSrcLoader/jsFileLoader.ts +124 -0
  666. package/packages/analytics-js-common/src/services/ExternalSrcLoader/types.ts +26 -0
  667. package/packages/analytics-js-common/src/types/ApiObject.ts +14 -0
  668. package/packages/analytics-js-common/src/types/ApplicationLifecycle.ts +12 -0
  669. package/packages/analytics-js-common/src/types/ApplicationState.ts +172 -0
  670. package/packages/analytics-js-common/src/types/Consent.ts +47 -0
  671. package/packages/analytics-js-common/src/types/DataResidency.ts +9 -0
  672. package/packages/analytics-js-common/src/types/Destination.ts +85 -0
  673. package/packages/analytics-js-common/src/types/ErrorHandler.ts +39 -0
  674. package/packages/analytics-js-common/src/types/Event.ts +54 -0
  675. package/packages/analytics-js-common/src/types/EventApi.ts +45 -0
  676. package/packages/analytics-js-common/src/types/EventContext.ts +26 -0
  677. package/packages/analytics-js-common/src/types/HttpClient.ts +63 -0
  678. package/packages/analytics-js-common/src/types/IRudderAnalytics.ts +204 -0
  679. package/packages/analytics-js-common/src/types/Integration.ts +18 -0
  680. package/packages/analytics-js-common/src/types/LoadOptions.ts +159 -0
  681. package/packages/analytics-js-common/src/types/Logger.ts +19 -0
  682. package/packages/analytics-js-common/src/types/Nullable.ts +1 -0
  683. package/packages/analytics-js-common/src/types/PluginEngine.ts +41 -0
  684. package/packages/analytics-js-common/src/types/PluginsManager.ts +29 -0
  685. package/packages/analytics-js-common/src/types/Session.ts +8 -0
  686. package/packages/analytics-js-common/src/types/Source.ts +21 -0
  687. package/packages/analytics-js-common/src/types/Storage.ts +49 -0
  688. package/packages/analytics-js-common/src/types/Store.ts +82 -0
  689. package/packages/analytics-js-common/src/types/UserSessionStorage.ts +10 -0
  690. package/packages/analytics-js-common/src/types/traits.ts +91 -0
  691. package/packages/analytics-js-common/src/utilities/checks.ts +77 -0
  692. package/packages/analytics-js-common/src/utilities/crypto.ts +6 -0
  693. package/packages/analytics-js-common/src/utilities/destinations.ts +31 -0
  694. package/packages/analytics-js-common/src/utilities/detect.ts +8 -0
  695. package/packages/analytics-js-common/src/utilities/errors.ts +20 -0
  696. package/packages/analytics-js-common/src/utilities/eventMethodOverloads.ts +407 -0
  697. package/packages/analytics-js-common/src/utilities/http.ts +13 -0
  698. package/packages/analytics-js-common/src/utilities/index.ts +14 -0
  699. package/packages/analytics-js-common/src/utilities/json.ts +69 -0
  700. package/packages/analytics-js-common/src/utilities/object.ts +119 -0
  701. package/packages/analytics-js-common/src/utilities/string.ts +64 -0
  702. package/packages/analytics-js-common/src/utilities/timestamp.ts +10 -0
  703. package/packages/analytics-js-common/src/utilities/timezone.ts +11 -0
  704. package/packages/analytics-js-common/src/utilities/url.ts +3 -0
  705. package/packages/analytics-js-common/src/utilities/uuId.ts +13 -0
  706. package/packages/analytics-js-common/src/v1.1/utils/ObjectUtils.js +54 -0
  707. package/packages/analytics-js-common/src/v1.1/utils/ScriptLoader.js +51 -0
  708. package/packages/analytics-js-common/src/v1.1/utils/client_server_name.js +82 -0
  709. package/packages/analytics-js-common/src/v1.1/utils/config_to_integration_names.js +83 -0
  710. package/packages/analytics-js-common/src/v1.1/utils/constants.js +15 -0
  711. package/packages/analytics-js-common/src/v1.1/utils/errorHandler.js +88 -0
  712. package/packages/analytics-js-common/src/v1.1/utils/index.ts +10 -0
  713. package/packages/analytics-js-common/src/v1.1/utils/integration_cname.js +164 -0
  714. package/packages/analytics-js-common/src/v1.1/utils/logUtil.js +51 -0
  715. package/packages/analytics-js-common/src/v1.1/utils/notifyError.js +16 -0
  716. package/packages/analytics-js-common/src/v1.1/utils/storage/cookie.js +98 -0
  717. package/packages/analytics-js-common/src/v1.1/utils/storage/index.js +5 -0
  718. package/packages/analytics-js-common/src/v1.1/utils/storage/storage.js +384 -0
  719. package/packages/analytics-js-common/src/v1.1/utils/storage/store.js +79 -0
  720. package/packages/analytics-js-common/src/v1.1/utils/storage/v3DecryptionUtils.js +19 -0
  721. package/packages/analytics-js-common/tsconfig.json +14 -0
  722. package/packages/analytics-js-common/tsconfig.spec.json +23 -0
  723. package/packages/analytics-js-common/types/rudderanalytics.d.ts +16 -0
  724. package/packages/analytics-js-integrations/.jscpd.json +17 -0
  725. package/packages/analytics-js-integrations/.size-limit.js +11 -0
  726. package/packages/analytics-js-integrations/CHANGELOG.md +241 -0
  727. package/packages/analytics-js-integrations/CHANGELOG_LATEST.md +12 -0
  728. package/packages/analytics-js-integrations/LICENSE +21 -0
  729. package/packages/analytics-js-integrations/README.md +35 -0
  730. package/packages/analytics-js-integrations/__fixtures__/.gitkeep +0 -0
  731. package/packages/analytics-js-integrations/__mocks__/.gitkeep +0 -0
  732. package/packages/analytics-js-integrations/__tests__/common/common.test.js +49 -0
  733. package/packages/analytics-js-integrations/__tests__/integrations/Amplitude/browser.test.js +926 -0
  734. package/packages/analytics-js-integrations/__tests__/integrations/Amplitude/util.test.js +190 -0
  735. package/packages/analytics-js-integrations/__tests__/integrations/Appcues/appcues.test.js +163 -0
  736. package/packages/analytics-js-integrations/__tests__/integrations/BingAds/__fixtures__/data.js +17 -0
  737. package/packages/analytics-js-integrations/__tests__/integrations/BingAds/browser.test.js +166 -0
  738. package/packages/analytics-js-integrations/__tests__/integrations/BingAds/utils.test.js +138 -0
  739. package/packages/analytics-js-integrations/__tests__/integrations/Braze/browser.test.js +1077 -0
  740. package/packages/analytics-js-integrations/__tests__/integrations/Clevertap/browser.test.js +43 -0
  741. package/packages/analytics-js-integrations/__tests__/integrations/CommandBar/browser.test.js +115 -0
  742. package/packages/analytics-js-integrations/__tests__/integrations/FacebookPixel/browser.test.js +410 -0
  743. package/packages/analytics-js-integrations/__tests__/integrations/FacebookPixel/utils.test.js +775 -0
  744. package/packages/analytics-js-integrations/__tests__/integrations/Fullstory/browser.test.js +173 -0
  745. package/packages/analytics-js-integrations/__tests__/integrations/GA/browser.test.js +179 -0
  746. package/packages/analytics-js-integrations/__tests__/integrations/GA4/__mocks__/data.js +1563 -0
  747. package/packages/analytics-js-integrations/__tests__/integrations/GA4/browser.test.js +212 -0
  748. package/packages/analytics-js-integrations/__tests__/integrations/GA4/utils.test.js +380 -0
  749. package/packages/analytics-js-integrations/__tests__/integrations/GoogleAds/__fixtures__/data.js +256 -0
  750. package/packages/analytics-js-integrations/__tests__/integrations/GoogleAds/browser.test.js +372 -0
  751. package/packages/analytics-js-integrations/__tests__/integrations/GoogleAds/utils.test.js +121 -0
  752. package/packages/analytics-js-integrations/__tests__/integrations/Hotjar/browser.test.js +108 -0
  753. package/packages/analytics-js-integrations/__tests__/integrations/Intercom/browser.test.js +135 -0
  754. package/packages/analytics-js-integrations/__tests__/integrations/Intercom/util.test.js +69 -0
  755. package/packages/analytics-js-integrations/__tests__/integrations/LaunchDarkly/__fixtures__/data.js +61 -0
  756. package/packages/analytics-js-integrations/__tests__/integrations/LaunchDarkly/browser.test.js +151 -0
  757. package/packages/analytics-js-integrations/__tests__/integrations/LaunchDarkly/utils.test.js +36 -0
  758. package/packages/analytics-js-integrations/__tests__/integrations/Lemnisk/browser.test.js +172 -0
  759. package/packages/analytics-js-integrations/__tests__/integrations/Matomo/browser.test.js +208 -0
  760. package/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js +117 -0
  761. package/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/util.test.js +504 -0
  762. package/packages/analytics-js-integrations/__tests__/integrations/Ninetailed/browser.test.js +148 -0
  763. package/packages/analytics-js-integrations/__tests__/integrations/PinterestTag/__fixtures__/data.js +24 -0
  764. package/packages/analytics-js-integrations/__tests__/integrations/PinterestTag/utils.test.js +19 -0
  765. package/packages/analytics-js-integrations/__tests__/integrations/Podsights/utils.test.js +394 -0
  766. package/packages/analytics-js-integrations/__tests__/integrations/Posthog/browser.test.js +420 -0
  767. package/packages/analytics-js-integrations/__tests__/integrations/Posthog/utils.test.js +111 -0
  768. package/packages/analytics-js-integrations/__tests__/integrations/SpotifyPixel/browser.test.js +630 -0
  769. package/packages/analytics-js-integrations/__tests__/integrations/Sprig/browser.test.js +85 -0
  770. package/packages/analytics-js-integrations/__tests__/integrations/TikTokAds/browser.test.js +421 -0
  771. package/packages/analytics-js-integrations/__tests__/integrations/VWO/browser.test.js +143 -0
  772. package/packages/analytics-js-integrations/__tests__/integrations/VWO/utils.test.js +36 -0
  773. package/packages/analytics-js-integrations/__tests__/utils/camelcase.test.js +29 -0
  774. package/packages/analytics-js-integrations/__tests__/utils/commonUtils.test.js +347 -0
  775. package/packages/analytics-js-integrations/__tests__/utils/utils.test.js +337 -0
  776. package/packages/analytics-js-integrations/babel.config.json +14 -0
  777. package/packages/analytics-js-integrations/jest.config.mjs +21 -0
  778. package/packages/analytics-js-integrations/package.json +143 -0
  779. package/packages/analytics-js-integrations/project.json +106 -0
  780. package/packages/analytics-js-integrations/public/list_integration_sdks.html +408 -0
  781. package/packages/analytics-js-integrations/rollup.config.mjs +151 -0
  782. package/packages/analytics-js-integrations/scripts/integrationBuildScript.js +79 -0
  783. package/packages/analytics-js-integrations/src/integrations/ActiveCampaign/browser.js +53 -0
  784. package/packages/analytics-js-integrations/src/integrations/ActiveCampaign/index.js +1 -0
  785. package/packages/analytics-js-integrations/src/integrations/ActiveCampaign/nativeSdkLoader.js +24 -0
  786. package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/browser.js +279 -0
  787. package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/eCommHandle.js +56 -0
  788. package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/heartbeatHandle.js +268 -0
  789. package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/index.js +1 -0
  790. package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/util.js +681 -0
  791. package/packages/analytics-js-integrations/src/integrations/Adroll/browser.js +123 -0
  792. package/packages/analytics-js-integrations/src/integrations/Adroll/index.js +1 -0
  793. package/packages/analytics-js-integrations/src/integrations/Adroll/util.js +48 -0
  794. package/packages/analytics-js-integrations/src/integrations/Amplitude/browser.js +374 -0
  795. package/packages/analytics-js-integrations/src/integrations/Amplitude/index.js +1 -0
  796. package/packages/analytics-js-integrations/src/integrations/Amplitude/nativeSdkLoader.js +114 -0
  797. package/packages/analytics-js-integrations/src/integrations/Amplitude/test/test_amplitude.html +157 -0
  798. package/packages/analytics-js-integrations/src/integrations/Amplitude/utils.js +67 -0
  799. package/packages/analytics-js-integrations/src/integrations/Appcues/browser.js +89 -0
  800. package/packages/analytics-js-integrations/src/integrations/Appcues/index.js +1 -0
  801. package/packages/analytics-js-integrations/src/integrations/Axeptio/browser.js +61 -0
  802. package/packages/analytics-js-integrations/src/integrations/Axeptio/index.js +1 -0
  803. package/packages/analytics-js-integrations/src/integrations/Axeptio/nativeSdkLoader.js +14 -0
  804. package/packages/analytics-js-integrations/src/integrations/Axeptio/utils.js +16 -0
  805. package/packages/analytics-js-integrations/src/integrations/BingAds/browser.js +81 -0
  806. package/packages/analytics-js-integrations/src/integrations/BingAds/index.js +1 -0
  807. package/packages/analytics-js-integrations/src/integrations/BingAds/nativeSdkLoader.js +30 -0
  808. package/packages/analytics-js-integrations/src/integrations/BingAds/utils.js +100 -0
  809. package/packages/analytics-js-integrations/src/integrations/Braze/browser.js +297 -0
  810. package/packages/analytics-js-integrations/src/integrations/Braze/index.js +1 -0
  811. package/packages/analytics-js-integrations/src/integrations/Braze/nativeSdkLoader.js +35 -0
  812. package/packages/analytics-js-integrations/src/integrations/Braze/utils.js +51 -0
  813. package/packages/analytics-js-integrations/src/integrations/Bugsnag/browser.js +62 -0
  814. package/packages/analytics-js-integrations/src/integrations/Bugsnag/index.js +1 -0
  815. package/packages/analytics-js-integrations/src/integrations/Chartbeat/browser.js +143 -0
  816. package/packages/analytics-js-integrations/src/integrations/Chartbeat/index.js +1 -0
  817. package/packages/analytics-js-integrations/src/integrations/Chartbeat/nativeSdkLoader.js +7 -0
  818. package/packages/analytics-js-integrations/src/integrations/Clevertap/browser.js +202 -0
  819. package/packages/analytics-js-integrations/src/integrations/Clevertap/index.js +1 -0
  820. package/packages/analytics-js-integrations/src/integrations/Clevertap/utils.js +17 -0
  821. package/packages/analytics-js-integrations/src/integrations/CommandBar/browser.js +78 -0
  822. package/packages/analytics-js-integrations/src/integrations/CommandBar/index.js +1 -0
  823. package/packages/analytics-js-integrations/src/integrations/CommandBar/nativeSdkLoader.js +85 -0
  824. package/packages/analytics-js-integrations/src/integrations/Comscore/browser.js +126 -0
  825. package/packages/analytics-js-integrations/src/integrations/Comscore/index.js +1 -0
  826. package/packages/analytics-js-integrations/src/integrations/Comscore/nativeSdkLoader.js +10 -0
  827. package/packages/analytics-js-integrations/src/integrations/ConvertFlow/browser.js +60 -0
  828. package/packages/analytics-js-integrations/src/integrations/ConvertFlow/index.js +1 -0
  829. package/packages/analytics-js-integrations/src/integrations/ConvertFlow/utils.js +107 -0
  830. package/packages/analytics-js-integrations/src/integrations/Criteo/browser.js +144 -0
  831. package/packages/analytics-js-integrations/src/integrations/Criteo/index.js +1 -0
  832. package/packages/analytics-js-integrations/src/integrations/Criteo/utils.js +346 -0
  833. package/packages/analytics-js-integrations/src/integrations/CustomerIO/browser.js +85 -0
  834. package/packages/analytics-js-integrations/src/integrations/CustomerIO/index.js +1 -0
  835. package/packages/analytics-js-integrations/src/integrations/CustomerIO/nativeSdkLoader.js +33 -0
  836. package/packages/analytics-js-integrations/src/integrations/DCMFloodlight/browser.js +228 -0
  837. package/packages/analytics-js-integrations/src/integrations/DCMFloodlight/index.js +1 -0
  838. package/packages/analytics-js-integrations/src/integrations/DCMFloodlight/utils.js +353 -0
  839. package/packages/analytics-js-integrations/src/integrations/Drip/browser.js +165 -0
  840. package/packages/analytics-js-integrations/src/integrations/Drip/index.js +1 -0
  841. package/packages/analytics-js-integrations/src/integrations/Drip/nativeSdkLoader.js +10 -0
  842. package/packages/analytics-js-integrations/src/integrations/Drip/utils.js +29 -0
  843. package/packages/analytics-js-integrations/src/integrations/Engage/browser.js +119 -0
  844. package/packages/analytics-js-integrations/src/integrations/Engage/index.js +1 -0
  845. package/packages/analytics-js-integrations/src/integrations/Engage/nativeSdkLoader.js +25 -0
  846. package/packages/analytics-js-integrations/src/integrations/Engage/utils.js +69 -0
  847. package/packages/analytics-js-integrations/src/integrations/FacebookPixel/browser.js +326 -0
  848. package/packages/analytics-js-integrations/src/integrations/FacebookPixel/index.js +1 -0
  849. package/packages/analytics-js-integrations/src/integrations/FacebookPixel/utils.js +332 -0
  850. package/packages/analytics-js-integrations/src/integrations/Fullstory/browser.js +175 -0
  851. package/packages/analytics-js-integrations/src/integrations/Fullstory/index.js +1 -0
  852. package/packages/analytics-js-integrations/src/integrations/Fullstory/nativeSdkLoader.js +69 -0
  853. package/packages/analytics-js-integrations/src/integrations/Fullstory/utils.js +17 -0
  854. package/packages/analytics-js-integrations/src/integrations/GA/browser.js +817 -0
  855. package/packages/analytics-js-integrations/src/integrations/GA/index.js +1 -0
  856. package/packages/analytics-js-integrations/src/integrations/GA360/browser.js +58 -0
  857. package/packages/analytics-js-integrations/src/integrations/GA360/index.js +1 -0
  858. package/packages/analytics-js-integrations/src/integrations/GA4/browser.js +264 -0
  859. package/packages/analytics-js-integrations/src/integrations/GA4/config.js +296 -0
  860. package/packages/analytics-js-integrations/src/integrations/GA4/index.js +1 -0
  861. package/packages/analytics-js-integrations/src/integrations/GA4/utils.js +374 -0
  862. package/packages/analytics-js-integrations/src/integrations/GoogleAds/browser.js +219 -0
  863. package/packages/analytics-js-integrations/src/integrations/GoogleAds/browser.test.js +16 -0
  864. package/packages/analytics-js-integrations/src/integrations/GoogleAds/index.js +1 -0
  865. package/packages/analytics-js-integrations/src/integrations/GoogleAds/nativeSdkLoader.js +28 -0
  866. package/packages/analytics-js-integrations/src/integrations/GoogleAds/utils.js +135 -0
  867. package/packages/analytics-js-integrations/src/integrations/GoogleOptimize/browser.js +81 -0
  868. package/packages/analytics-js-integrations/src/integrations/GoogleOptimize/index.js +1 -0
  869. package/packages/analytics-js-integrations/src/integrations/GoogleTagManager/browser.js +96 -0
  870. package/packages/analytics-js-integrations/src/integrations/GoogleTagManager/index.js +1 -0
  871. package/packages/analytics-js-integrations/src/integrations/GoogleTagManager/nativeSdkLoader.js +21 -0
  872. package/packages/analytics-js-integrations/src/integrations/Heap/browser.js +64 -0
  873. package/packages/analytics-js-integrations/src/integrations/Heap/index.js +1 -0
  874. package/packages/analytics-js-integrations/src/integrations/Heap/nativeSdkLoader.js +40 -0
  875. package/packages/analytics-js-integrations/src/integrations/Heap/util.js +23 -0
  876. package/packages/analytics-js-integrations/src/integrations/Hotjar/browser.js +79 -0
  877. package/packages/analytics-js-integrations/src/integrations/Hotjar/index.js +1 -0
  878. package/packages/analytics-js-integrations/src/integrations/Hotjar/nativeSdkLoader.js +21 -0
  879. package/packages/analytics-js-integrations/src/integrations/HubSpot/browser.js +91 -0
  880. package/packages/analytics-js-integrations/src/integrations/HubSpot/index.js +1 -0
  881. package/packages/analytics-js-integrations/src/integrations/INTERCOM/browser.js +112 -0
  882. package/packages/analytics-js-integrations/src/integrations/INTERCOM/index.js +1 -0
  883. package/packages/analytics-js-integrations/src/integrations/INTERCOM/nativeSdkLoader.js +46 -0
  884. package/packages/analytics-js-integrations/src/integrations/INTERCOM/utils.js +68 -0
  885. package/packages/analytics-js-integrations/src/integrations/Iterable/browser.js +179 -0
  886. package/packages/analytics-js-integrations/src/integrations/Iterable/index.js +1 -0
  887. package/packages/analytics-js-integrations/src/integrations/Iterable/utils.js +127 -0
  888. package/packages/analytics-js-integrations/src/integrations/June/browser.js +96 -0
  889. package/packages/analytics-js-integrations/src/integrations/June/index.js +1 -0
  890. package/packages/analytics-js-integrations/src/integrations/Keen/browser.js +150 -0
  891. package/packages/analytics-js-integrations/src/integrations/Keen/index.js +1 -0
  892. package/packages/analytics-js-integrations/src/integrations/Kissmetrics/browser.js +245 -0
  893. package/packages/analytics-js-integrations/src/integrations/Kissmetrics/index.js +1 -0
  894. package/packages/analytics-js-integrations/src/integrations/Kissmetrics/nativeSdkLoader.js +23 -0
  895. package/packages/analytics-js-integrations/src/integrations/Klaviyo/browser.js +197 -0
  896. package/packages/analytics-js-integrations/src/integrations/Klaviyo/index.js +1 -0
  897. package/packages/analytics-js-integrations/src/integrations/Klaviyo/util.js +91 -0
  898. package/packages/analytics-js-integrations/src/integrations/LaunchDarkly/browser.js +75 -0
  899. package/packages/analytics-js-integrations/src/integrations/LaunchDarkly/index.js +1 -0
  900. package/packages/analytics-js-integrations/src/integrations/LaunchDarkly/utils.js +40 -0
  901. package/packages/analytics-js-integrations/src/integrations/Lemnisk/browser.js +81 -0
  902. package/packages/analytics-js-integrations/src/integrations/Lemnisk/index.js +1 -0
  903. package/packages/analytics-js-integrations/src/integrations/Lemnisk/nativeSdkLoader.js +34 -0
  904. package/packages/analytics-js-integrations/src/integrations/LinkedInInsightTag/browser.js +79 -0
  905. package/packages/analytics-js-integrations/src/integrations/LinkedInInsightTag/index.js +1 -0
  906. package/packages/analytics-js-integrations/src/integrations/LiveChat/browser.js +81 -0
  907. package/packages/analytics-js-integrations/src/integrations/LiveChat/index.js +1 -0
  908. package/packages/analytics-js-integrations/src/integrations/LiveChat/nativeSdkLoader.js +40 -0
  909. package/packages/analytics-js-integrations/src/integrations/LiveChat/util.js +71 -0
  910. package/packages/analytics-js-integrations/src/integrations/Lotame/LotameStorage.js +21 -0
  911. package/packages/analytics-js-integrations/src/integrations/Lotame/browser.js +152 -0
  912. package/packages/analytics-js-integrations/src/integrations/Lotame/index.js +1 -0
  913. package/packages/analytics-js-integrations/src/integrations/Lytics/browser.js +103 -0
  914. package/packages/analytics-js-integrations/src/integrations/Lytics/index.js +1 -0
  915. package/packages/analytics-js-integrations/src/integrations/Lytics/nativeSdkLoader.js +77 -0
  916. package/packages/analytics-js-integrations/src/integrations/Lytics/test/script-test-lytics.html +250 -0
  917. package/packages/analytics-js-integrations/src/integrations/Matomo/browser.js +184 -0
  918. package/packages/analytics-js-integrations/src/integrations/Matomo/index.js +1 -0
  919. package/packages/analytics-js-integrations/src/integrations/Matomo/nativeSdkLoader.js +20 -0
  920. package/packages/analytics-js-integrations/src/integrations/Matomo/util.js +433 -0
  921. package/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/browser.js +69 -0
  922. package/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/index.js +1 -0
  923. package/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/nativeSdkLoader.js +22 -0
  924. package/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js +353 -0
  925. package/packages/analytics-js-integrations/src/integrations/Mixpanel/index.js +1 -0
  926. package/packages/analytics-js-integrations/src/integrations/Mixpanel/nativeSdkLoader.js +71 -0
  927. package/packages/analytics-js-integrations/src/integrations/Mixpanel/util.js +288 -0
  928. package/packages/analytics-js-integrations/src/integrations/MoEngage/browser.js +131 -0
  929. package/packages/analytics-js-integrations/src/integrations/MoEngage/index.js +1 -0
  930. package/packages/analytics-js-integrations/src/integrations/MoEngage/nativeSdkLoader.js +65 -0
  931. package/packages/analytics-js-integrations/src/integrations/MoEngage/test/script-test-moengage.html +216 -0
  932. package/packages/analytics-js-integrations/src/integrations/Mouseflow/browser.js +97 -0
  933. package/packages/analytics-js-integrations/src/integrations/Mouseflow/index.js +1 -0
  934. package/packages/analytics-js-integrations/src/integrations/Mouseflow/utils.js +41 -0
  935. package/packages/analytics-js-integrations/src/integrations/Ninetailed/browser.js +65 -0
  936. package/packages/analytics-js-integrations/src/integrations/Ninetailed/index.js +1 -0
  937. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/README.md +70 -0
  938. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/package-lock.json +17843 -0
  939. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/package.json +43 -0
  940. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/favicon.ico +0 -0
  941. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/index.html +75 -0
  942. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/logo192.png +0 -0
  943. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/logo512.png +0 -0
  944. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/manifest.json +25 -0
  945. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/robots.txt +3 -0
  946. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/App.css +38 -0
  947. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/App.js +108 -0
  948. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/index.css +34 -0
  949. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/index.js +17 -0
  950. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/logo.svg +1 -0
  951. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/reportWebVitals.js +13 -0
  952. package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/setupTests.js +5 -0
  953. package/packages/analytics-js-integrations/src/integrations/Olark/browser.js +92 -0
  954. package/packages/analytics-js-integrations/src/integrations/Olark/index.js +1 -0
  955. package/packages/analytics-js-integrations/src/integrations/Olark/nativeSdkLoader.js +31 -0
  956. package/packages/analytics-js-integrations/src/integrations/Olark/utils.js +51 -0
  957. package/packages/analytics-js-integrations/src/integrations/Optimizely/browser.js +244 -0
  958. package/packages/analytics-js-integrations/src/integrations/Optimizely/index.js +1 -0
  959. package/packages/analytics-js-integrations/src/integrations/Optimizely/utils.js +23 -0
  960. package/packages/analytics-js-integrations/src/integrations/Pendo/browser.js +123 -0
  961. package/packages/analytics-js-integrations/src/integrations/Pendo/index.js +1 -0
  962. package/packages/analytics-js-integrations/src/integrations/Pendo/nativeSdkLoader.js +32 -0
  963. package/packages/analytics-js-integrations/src/integrations/PinterestTag/browser.js +240 -0
  964. package/packages/analytics-js-integrations/src/integrations/PinterestTag/index.js +1 -0
  965. package/packages/analytics-js-integrations/src/integrations/PinterestTag/nativeSdkLoader.js +19 -0
  966. package/packages/analytics-js-integrations/src/integrations/PinterestTag/propertyMappingConfig.js +57 -0
  967. package/packages/analytics-js-integrations/src/integrations/PinterestTag/test/input.js +180 -0
  968. package/packages/analytics-js-integrations/src/integrations/PinterestTag/test/output.js +129 -0
  969. package/packages/analytics-js-integrations/src/integrations/PinterestTag/utils.js +50 -0
  970. package/packages/analytics-js-integrations/src/integrations/Podsights/browser.js +179 -0
  971. package/packages/analytics-js-integrations/src/integrations/Podsights/index.js +1 -0
  972. package/packages/analytics-js-integrations/src/integrations/Podsights/utils.js +64 -0
  973. package/packages/analytics-js-integrations/src/integrations/PostAffiliatePro/browser.js +132 -0
  974. package/packages/analytics-js-integrations/src/integrations/PostAffiliatePro/index.js +1 -0
  975. package/packages/analytics-js-integrations/src/integrations/PostAffiliatePro/utils.js +40 -0
  976. package/packages/analytics-js-integrations/src/integrations/Posthog/browser.js +147 -0
  977. package/packages/analytics-js-integrations/src/integrations/Posthog/index.js +1 -0
  978. package/packages/analytics-js-integrations/src/integrations/Posthog/nativeSdkLoader.js +48 -0
  979. package/packages/analytics-js-integrations/src/integrations/Posthog/test/test_posthog.html +77 -0
  980. package/packages/analytics-js-integrations/src/integrations/Posthog/utils.js +52 -0
  981. package/packages/analytics-js-integrations/src/integrations/ProfitWell/browser.js +71 -0
  982. package/packages/analytics-js-integrations/src/integrations/ProfitWell/index.js +1 -0
  983. package/packages/analytics-js-integrations/src/integrations/ProfitWell/nativeSdkLoader.js +25 -0
  984. package/packages/analytics-js-integrations/src/integrations/Qualaroo/browser.js +116 -0
  985. package/packages/analytics-js-integrations/src/integrations/Qualaroo/index.js +1 -0
  986. package/packages/analytics-js-integrations/src/integrations/Qualaroo/utils.js +83 -0
  987. package/packages/analytics-js-integrations/src/integrations/Qualtrics/browser.js +92 -0
  988. package/packages/analytics-js-integrations/src/integrations/Qualtrics/index.js +1 -0
  989. package/packages/analytics-js-integrations/src/integrations/Qualtrics/nativeSdkLoader.js +79 -0
  990. package/packages/analytics-js-integrations/src/integrations/QuantumMetric/browser.js +54 -0
  991. package/packages/analytics-js-integrations/src/integrations/QuantumMetric/index.js +1 -0
  992. package/packages/analytics-js-integrations/src/integrations/QuoraPixel/browser.js +77 -0
  993. package/packages/analytics-js-integrations/src/integrations/QuoraPixel/index.js +1 -0
  994. package/packages/analytics-js-integrations/src/integrations/QuoraPixel/nativeSdkLoader.js +21 -0
  995. package/packages/analytics-js-integrations/src/integrations/RedditPixel/browser.js +103 -0
  996. package/packages/analytics-js-integrations/src/integrations/RedditPixel/index.js +1 -0
  997. package/packages/analytics-js-integrations/src/integrations/RedditPixel/nativeSdkLoader.js +21 -0
  998. package/packages/analytics-js-integrations/src/integrations/Refiner/browser.js +117 -0
  999. package/packages/analytics-js-integrations/src/integrations/Refiner/index.js +1 -0
  1000. package/packages/analytics-js-integrations/src/integrations/Refiner/nativeSdkLoader.js +20 -0
  1001. package/packages/analytics-js-integrations/src/integrations/Refiner/utils.js +44 -0
  1002. package/packages/analytics-js-integrations/src/integrations/Rockerbox/browser.js +90 -0
  1003. package/packages/analytics-js-integrations/src/integrations/Rockerbox/index.js +1 -0
  1004. package/packages/analytics-js-integrations/src/integrations/Rockerbox/nativeSdkLoader.js +32 -0
  1005. package/packages/analytics-js-integrations/src/integrations/RollBar/browser.js +93 -0
  1006. package/packages/analytics-js-integrations/src/integrations/RollBar/index.js +1 -0
  1007. package/packages/analytics-js-integrations/src/integrations/RollBar/nativeSdkLoader.js +383 -0
  1008. package/packages/analytics-js-integrations/src/integrations/Satismeter/browser.js +92 -0
  1009. package/packages/analytics-js-integrations/src/integrations/Satismeter/index.js +1 -0
  1010. package/packages/analytics-js-integrations/src/integrations/Satismeter/nativeSdkLoader.js +23 -0
  1011. package/packages/analytics-js-integrations/src/integrations/Satismeter/util.js +54 -0
  1012. package/packages/analytics-js-integrations/src/integrations/Sendinblue/browser.js +111 -0
  1013. package/packages/analytics-js-integrations/src/integrations/Sendinblue/index.js +1 -0
  1014. package/packages/analytics-js-integrations/src/integrations/Sendinblue/nativeSdkLoader.js +36 -0
  1015. package/packages/analytics-js-integrations/src/integrations/Sendinblue/utils.js +129 -0
  1016. package/packages/analytics-js-integrations/src/integrations/Sentry/browser.js +120 -0
  1017. package/packages/analytics-js-integrations/src/integrations/Sentry/index.js +1 -0
  1018. package/packages/analytics-js-integrations/src/integrations/Sentry/utils.js +84 -0
  1019. package/packages/analytics-js-integrations/src/integrations/Shynet/browser.js +99 -0
  1020. package/packages/analytics-js-integrations/src/integrations/Shynet/index.js +1 -0
  1021. package/packages/analytics-js-integrations/src/integrations/SnapEngage/browser.js +74 -0
  1022. package/packages/analytics-js-integrations/src/integrations/SnapEngage/index.js +1 -0
  1023. package/packages/analytics-js-integrations/src/integrations/SnapEngage/nativeSdkLoader.js +24 -0
  1024. package/packages/analytics-js-integrations/src/integrations/SnapEngage/util.js +63 -0
  1025. package/packages/analytics-js-integrations/src/integrations/SnapPixel/browser.js +226 -0
  1026. package/packages/analytics-js-integrations/src/integrations/SnapPixel/index.js +1 -0
  1027. package/packages/analytics-js-integrations/src/integrations/SnapPixel/nativeSdkLoader.js +20 -0
  1028. package/packages/analytics-js-integrations/src/integrations/SnapPixel/util.js +214 -0
  1029. package/packages/analytics-js-integrations/src/integrations/SpotifyPixel/browser.js +180 -0
  1030. package/packages/analytics-js-integrations/src/integrations/SpotifyPixel/index.js +1 -0
  1031. package/packages/analytics-js-integrations/src/integrations/Sprig/browser.js +89 -0
  1032. package/packages/analytics-js-integrations/src/integrations/Sprig/index.js +1 -0
  1033. package/packages/analytics-js-integrations/src/integrations/Sprig/nativeSdkLoader.js +19 -0
  1034. package/packages/analytics-js-integrations/src/integrations/TVSquared/browser.js +99 -0
  1035. package/packages/analytics-js-integrations/src/integrations/TVSquared/index.js +1 -0
  1036. package/packages/analytics-js-integrations/src/integrations/TVSquared/utils.js +41 -0
  1037. package/packages/analytics-js-integrations/src/integrations/TiktokAds/browser.js +111 -0
  1038. package/packages/analytics-js-integrations/src/integrations/TiktokAds/index.js +1 -0
  1039. package/packages/analytics-js-integrations/src/integrations/TiktokAds/nativeSdkLoader.js +52 -0
  1040. package/packages/analytics-js-integrations/src/integrations/TiktokAds/util.js +70 -0
  1041. package/packages/analytics-js-integrations/src/integrations/VWO/browser.js +155 -0
  1042. package/packages/analytics-js-integrations/src/integrations/VWO/index.js +1 -0
  1043. package/packages/analytics-js-integrations/src/integrations/VWO/nativeSdkLoader.js +64 -0
  1044. package/packages/analytics-js-integrations/src/integrations/VWO/utils.js +42 -0
  1045. package/packages/analytics-js-integrations/src/integrations/Vero/browser.js +166 -0
  1046. package/packages/analytics-js-integrations/src/integrations/Vero/index.js +1 -0
  1047. package/packages/analytics-js-integrations/src/integrations/Vero/utils.js +17 -0
  1048. package/packages/analytics-js-integrations/src/integrations/Woopra/browser.js +82 -0
  1049. package/packages/analytics-js-integrations/src/integrations/Woopra/index.js +1 -0
  1050. package/packages/analytics-js-integrations/src/integrations/Woopra/nativeSdkLoader.js +43 -0
  1051. package/packages/analytics-js-integrations/src/integrations/YandexMetrica/browser.js +139 -0
  1052. package/packages/analytics-js-integrations/src/integrations/YandexMetrica/index.js +1 -0
  1053. package/packages/analytics-js-integrations/src/integrations/YandexMetrica/nativeSdkLoader.js +35 -0
  1054. package/packages/analytics-js-integrations/src/integrations/YandexMetrica/utils.js +140 -0
  1055. package/packages/analytics-js-integrations/src/integrations/index.js +163 -0
  1056. package/packages/analytics-js-integrations/src/utils/camelcase.js +48 -0
  1057. package/packages/analytics-js-integrations/src/utils/commonUtils.js +214 -0
  1058. package/packages/analytics-js-integrations/src/utils/constants.js +4 -0
  1059. package/packages/analytics-js-integrations/src/utils/logger.js +106 -0
  1060. package/packages/analytics-js-integrations/src/utils/utils.js +585 -0
  1061. package/packages/analytics-js-integrations/tsconfig.json +8 -0
  1062. package/packages/analytics-js-integrations/tsconfig.spec.json +26 -0
  1063. package/packages/analytics-js-plugins/.jscpd.json +17 -0
  1064. package/packages/analytics-js-plugins/.size-limit.js +16 -0
  1065. package/packages/analytics-js-plugins/CHANGELOG.md +212 -0
  1066. package/packages/analytics-js-plugins/CHANGELOG_LATEST.md +7 -0
  1067. package/packages/analytics-js-plugins/LICENSE +21 -0
  1068. package/packages/analytics-js-plugins/README.md +57 -0
  1069. package/packages/analytics-js-plugins/__fixtures__/.gitkeep +0 -0
  1070. package/packages/analytics-js-plugins/__fixtures__/fixtures.ts +174 -0
  1071. package/packages/analytics-js-plugins/__fixtures__/msw.handlers.js +45 -0
  1072. package/packages/analytics-js-plugins/__fixtures__/msw.server.js +6 -0
  1073. package/packages/analytics-js-plugins/__mocks__/.gitkeep +0 -0
  1074. package/packages/analytics-js-plugins/__tests__/beaconQueue/.gitkeep +0 -0
  1075. package/packages/analytics-js-plugins/__tests__/bugsnag/index.test.ts +116 -0
  1076. package/packages/analytics-js-plugins/__tests__/bugsnag/utils.test.ts +555 -0
  1077. package/packages/analytics-js-plugins/__tests__/customConsentManager/index.test.ts +264 -0
  1078. package/packages/analytics-js-plugins/__tests__/deviceModeDestinations/utils.test.ts +260 -0
  1079. package/packages/analytics-js-plugins/__tests__/deviceModeTransformation/.gitkeep +0 -0
  1080. package/packages/analytics-js-plugins/__tests__/deviceModeTransformation/index.test.ts +287 -0
  1081. package/packages/analytics-js-plugins/__tests__/deviceModeTransformation/utilities.test.ts +22 -0
  1082. package/packages/analytics-js-plugins/__tests__/errorReporting/index.test.ts +102 -0
  1083. package/packages/analytics-js-plugins/__tests__/externalAnonymousId/.gitkeep +0 -0
  1084. package/packages/analytics-js-plugins/__tests__/googleLinker/.gitkeep +0 -0
  1085. package/packages/analytics-js-plugins/__tests__/ketchConsentManager/index.test.ts +498 -0
  1086. package/packages/analytics-js-plugins/__tests__/ketchConsentManager/utils.test.ts +189 -0
  1087. package/packages/analytics-js-plugins/__tests__/nativeDestinationQueue/utilities.test.ts +98 -0
  1088. package/packages/analytics-js-plugins/__tests__/oneTrustConsentManager/index.test.ts +395 -0
  1089. package/packages/analytics-js-plugins/__tests__/storageEncryption/index.test.ts +37 -0
  1090. package/packages/analytics-js-plugins/__tests__/storageEncryptionLegacy/index.test.ts +41 -0
  1091. package/packages/analytics-js-plugins/__tests__/storageMigrator/.gitkeep +0 -0
  1092. package/packages/analytics-js-plugins/__tests__/storageMigrator/index.test.ts +144 -0
  1093. package/packages/analytics-js-plugins/__tests__/utilities/destination.test.ts +133 -0
  1094. package/packages/analytics-js-plugins/__tests__/utilities/queue.test.ts +327 -0
  1095. package/packages/analytics-js-plugins/__tests__/utilities/retryQueue/RetryQueue.test.ts +1077 -0
  1096. package/packages/analytics-js-plugins/__tests__/utilities/retryQueue/Schedule.test.ts +78 -0
  1097. package/packages/analytics-js-plugins/__tests__/xhrQueue/index.test.ts +320 -0
  1098. package/packages/analytics-js-plugins/__tests__/xhrQueue/utilities.test.ts +388 -0
  1099. package/packages/analytics-js-plugins/babel.config.json +14 -0
  1100. package/packages/analytics-js-plugins/jest.config.mjs +14 -0
  1101. package/packages/analytics-js-plugins/package.json +106 -0
  1102. package/packages/analytics-js-plugins/project.json +131 -0
  1103. package/packages/analytics-js-plugins/public/.gitkeep +0 -0
  1104. package/packages/analytics-js-plugins/rollup.config.mjs +245 -0
  1105. package/packages/analytics-js-plugins/src/beaconQueue/constants.ts +27 -0
  1106. package/packages/analytics-js-plugins/src/beaconQueue/index.ts +146 -0
  1107. package/packages/analytics-js-plugins/src/beaconQueue/logMessages.ts +24 -0
  1108. package/packages/analytics-js-plugins/src/beaconQueue/types.ts +12 -0
  1109. package/packages/analytics-js-plugins/src/beaconQueue/utilities.ts +68 -0
  1110. package/packages/analytics-js-plugins/src/bugsnag/constants.ts +52 -0
  1111. package/packages/analytics-js-plugins/src/bugsnag/index.ts +65 -0
  1112. package/packages/analytics-js-plugins/src/bugsnag/logMessages.ts +19 -0
  1113. package/packages/analytics-js-plugins/src/bugsnag/utils.ts +214 -0
  1114. package/packages/analytics-js-plugins/src/customConsentManager/constants.ts +3 -0
  1115. package/packages/analytics-js-plugins/src/customConsentManager/index.ts +86 -0
  1116. package/packages/analytics-js-plugins/src/customConsentManager/logMessages.ts +3 -0
  1117. package/packages/analytics-js-plugins/src/deviceModeDestinations/constants.ts +6 -0
  1118. package/packages/analytics-js-plugins/src/deviceModeDestinations/index.ts +138 -0
  1119. package/packages/analytics-js-plugins/src/deviceModeDestinations/logMessages.ts +24 -0
  1120. package/packages/analytics-js-plugins/src/deviceModeDestinations/types.ts +28 -0
  1121. package/packages/analytics-js-plugins/src/deviceModeDestinations/utils.ts +249 -0
  1122. package/packages/analytics-js-plugins/src/deviceModeTransformation/constants.ts +12 -0
  1123. package/packages/analytics-js-plugins/src/deviceModeTransformation/index.ts +111 -0
  1124. package/packages/analytics-js-plugins/src/deviceModeTransformation/logMessages.ts +28 -0
  1125. package/packages/analytics-js-plugins/src/deviceModeTransformation/types.ts +38 -0
  1126. package/packages/analytics-js-plugins/src/deviceModeTransformation/utilities.ts +155 -0
  1127. package/packages/analytics-js-plugins/src/errorReporting/index.ts +62 -0
  1128. package/packages/analytics-js-plugins/src/errorReporting/logMessages.ts +3 -0
  1129. package/packages/analytics-js-plugins/src/externalAnonymousId/constants.ts +5 -0
  1130. package/packages/analytics-js-plugins/src/externalAnonymousId/index.ts +47 -0
  1131. package/packages/analytics-js-plugins/src/externalAnonymousId/util.ts +25 -0
  1132. package/packages/analytics-js-plugins/src/googleLinker/base64Decoder.ts +33 -0
  1133. package/packages/analytics-js-plugins/src/googleLinker/constants.ts +1 -0
  1134. package/packages/analytics-js-plugins/src/googleLinker/crc32.ts +44 -0
  1135. package/packages/analytics-js-plugins/src/googleLinker/index.ts +30 -0
  1136. package/packages/analytics-js-plugins/src/googleLinker/userLib.ts +16 -0
  1137. package/packages/analytics-js-plugins/src/googleLinker/utils.ts +156 -0
  1138. package/packages/analytics-js-plugins/src/index.ts +15 -0
  1139. package/packages/analytics-js-plugins/src/ketchConsentManager/constants.ts +4 -0
  1140. package/packages/analytics-js-plugins/src/ketchConsentManager/index.ts +120 -0
  1141. package/packages/analytics-js-plugins/src/ketchConsentManager/logMessages.ts +15 -0
  1142. package/packages/analytics-js-plugins/src/ketchConsentManager/types.ts +11 -0
  1143. package/packages/analytics-js-plugins/src/ketchConsentManager/utils.ts +95 -0
  1144. package/packages/analytics-js-plugins/src/nativeDestinationQueue/constants.ts +9 -0
  1145. package/packages/analytics-js-plugins/src/nativeDestinationQueue/index.ts +159 -0
  1146. package/packages/analytics-js-plugins/src/nativeDestinationQueue/logMessages.ts +14 -0
  1147. package/packages/analytics-js-plugins/src/nativeDestinationQueue/utilities.ts +81 -0
  1148. package/packages/analytics-js-plugins/src/oneTrustConsentManager/constants.ts +3 -0
  1149. package/packages/analytics-js-plugins/src/oneTrustConsentManager/index.ts +131 -0
  1150. package/packages/analytics-js-plugins/src/oneTrustConsentManager/logMessages.ts +8 -0
  1151. package/packages/analytics-js-plugins/src/oneTrustConsentManager/types.ts +4 -0
  1152. package/packages/analytics-js-plugins/src/shared-chunks/common.ts +13 -0
  1153. package/packages/analytics-js-plugins/src/shared-chunks/deviceModeDestinations.ts +3 -0
  1154. package/packages/analytics-js-plugins/src/storageEncryption/constants.ts +1 -0
  1155. package/packages/analytics-js-plugins/src/storageEncryption/encryptionUtils.ts +14 -0
  1156. package/packages/analytics-js-plugins/src/storageEncryption/index.ts +26 -0
  1157. package/packages/analytics-js-plugins/src/storageEncryptionLegacy/constants.ts +2 -0
  1158. package/packages/analytics-js-plugins/src/storageEncryptionLegacy/index.ts +26 -0
  1159. package/packages/analytics-js-plugins/src/storageEncryptionLegacy/legacyEncryptionUtils.ts +18 -0
  1160. package/packages/analytics-js-plugins/src/storageMigrator/constants.ts +3 -0
  1161. package/packages/analytics-js-plugins/src/storageMigrator/index.ts +59 -0
  1162. package/packages/analytics-js-plugins/src/storageMigrator/logMessages.ts +4 -0
  1163. package/packages/analytics-js-plugins/src/types/plugins.ts +69 -0
  1164. package/packages/analytics-js-plugins/src/utilities/constants.ts +3 -0
  1165. package/packages/analytics-js-plugins/src/utilities/destination.ts +40 -0
  1166. package/packages/analytics-js-plugins/src/utilities/eventsDelivery.ts +85 -0
  1167. package/packages/analytics-js-plugins/src/utilities/retryQueue/README.md +135 -0
  1168. package/packages/analytics-js-plugins/src/utilities/retryQueue/RetryQueue.ts +736 -0
  1169. package/packages/analytics-js-plugins/src/utilities/retryQueue/Schedule.ts +101 -0
  1170. package/packages/analytics-js-plugins/src/utilities/retryQueue/constants.ts +32 -0
  1171. package/packages/analytics-js-plugins/src/utilities/retryQueue/logMessages.ts +9 -0
  1172. package/packages/analytics-js-plugins/src/utilities/retryQueue/types.ts +21 -0
  1173. package/packages/analytics-js-plugins/src/xhrQueue/constants.ts +23 -0
  1174. package/packages/analytics-js-plugins/src/xhrQueue/index.ts +158 -0
  1175. package/packages/analytics-js-plugins/src/xhrQueue/logMessages.ts +6 -0
  1176. package/packages/analytics-js-plugins/src/xhrQueue/types.ts +16 -0
  1177. package/packages/analytics-js-plugins/src/xhrQueue/utilities.ts +103 -0
  1178. package/packages/analytics-js-plugins/tsconfig.json +14 -0
  1179. package/packages/analytics-js-plugins/tsconfig.spec.json +24 -0
  1180. package/packages/analytics-js-service-worker/.env.example +8 -0
  1181. package/packages/analytics-js-service-worker/.jscpd.json +17 -0
  1182. package/packages/analytics-js-service-worker/.size-limit.js +11 -0
  1183. package/packages/analytics-js-service-worker/CHANGELOG.md +91 -0
  1184. package/packages/analytics-js-service-worker/CHANGELOG_LATEST.md +7 -0
  1185. package/packages/analytics-js-service-worker/LICENSE +21 -0
  1186. package/packages/analytics-js-service-worker/README.md +74 -0
  1187. package/packages/analytics-js-service-worker/__fixtures__/fixtures.ts +79 -0
  1188. package/packages/analytics-js-service-worker/__fixtures__/msw.server.ts +13 -0
  1189. package/packages/analytics-js-service-worker/__mocks__/.gitkeep +0 -0
  1190. package/packages/analytics-js-service-worker/__tests__/Analytics.test.ts +120 -0
  1191. package/packages/analytics-js-service-worker/__tests__/loosely-validate-event/index.test.ts +140 -0
  1192. package/packages/analytics-js-service-worker/babel.config.json +15 -0
  1193. package/packages/analytics-js-service-worker/jest.config.mjs +14 -0
  1194. package/packages/analytics-js-service-worker/package.json +103 -0
  1195. package/packages/analytics-js-service-worker/project.json +104 -0
  1196. package/packages/analytics-js-service-worker/public/.gitkeep +0 -0
  1197. package/packages/analytics-js-service-worker/rollup.config.mjs +140 -0
  1198. package/packages/analytics-js-service-worker/src/Analytics.ts +564 -0
  1199. package/packages/analytics-js-service-worker/src/IAnalytics.ts +141 -0
  1200. package/packages/analytics-js-service-worker/src/index.ts +9 -0
  1201. package/packages/analytics-js-service-worker/src/loosely-validate-event/index.ts +136 -0
  1202. package/packages/analytics-js-service-worker/src/types.ts +67 -0
  1203. package/packages/analytics-js-service-worker/tsconfig.json +8 -0
  1204. package/packages/analytics-js-service-worker/tsconfig.spec.json +22 -0
  1205. package/packages/analytics-v1.1/.env.example +8 -0
  1206. package/packages/analytics-v1.1/.jscpd.json +17 -0
  1207. package/packages/analytics-v1.1/.size-limit.js +16 -0
  1208. package/packages/analytics-v1.1/.versionrc +12 -0
  1209. package/packages/analytics-v1.1/CHANGELOG.md +3859 -0
  1210. package/packages/analytics-v1.1/CHANGELOG_LATEST.md +5 -0
  1211. package/packages/analytics-v1.1/LICENSE +21 -0
  1212. package/packages/analytics-v1.1/README.md +321 -0
  1213. package/packages/analytics-v1.1/__fixtures__/fixtures.js +130 -0
  1214. package/packages/analytics-v1.1/__fixtures__/msw.handlers.js +51 -0
  1215. package/packages/analytics-v1.1/__fixtures__/msw.server.js +6 -0
  1216. package/packages/analytics-v1.1/__mocks__/.gitkeep +0 -0
  1217. package/packages/analytics-v1.1/__tests__/data-residency.test.js +236 -0
  1218. package/packages/analytics-v1.1/__tests__/features/core/metrics/errorReporting/ErrorReportingService.test.js +80 -0
  1219. package/packages/analytics-v1.1/__tests__/ketchConsent.test.js +49 -0
  1220. package/packages/analytics-v1.1/__tests__/oneTrustCookieConsent.test.js +89 -0
  1221. package/packages/analytics-v1.1/__tests__/script.test.js +167 -0
  1222. package/packages/analytics-v1.1/__tests__/transformationHandler.test.js +179 -0
  1223. package/packages/analytics-v1.1/__tests__/utils/IntegrationsData.test.js +105 -0
  1224. package/packages/analytics-v1.1/__tests__/utils/cdnPaths.test.js +63 -0
  1225. package/packages/analytics-v1.1/__tests__/utils/clientHint.test.js +87 -0
  1226. package/packages/analytics-v1.1/__tests__/utils/eventProcessorUtils.test.js +264 -0
  1227. package/packages/analytics-v1.1/__tests__/utils/navigator.test.js +38 -0
  1228. package/packages/analytics-v1.1/__tests__/utils/preProcessQueue.test.js +78 -0
  1229. package/packages/analytics-v1.1/__tests__/utils/screenDetails.test.js +19 -0
  1230. package/packages/analytics-v1.1/__tests__/utils/utils.test.js +69 -0
  1231. package/packages/analytics-v1.1/babel.config.json +14 -0
  1232. package/packages/analytics-v1.1/jest.config.mjs +14 -0
  1233. package/packages/analytics-v1.1/package.json +115 -0
  1234. package/packages/analytics-v1.1/project.json +119 -0
  1235. package/packages/analytics-v1.1/public/index.html +137 -0
  1236. package/packages/analytics-v1.1/rollup-configs/rollup.sdk.browser.mjs +32 -0
  1237. package/packages/analytics-v1.1/rollup-configs/rollup.sdk.npm.mjs +53 -0
  1238. package/packages/analytics-v1.1/rollup-configs/rollup.utilities.mjs +160 -0
  1239. package/packages/analytics-v1.1/src/core/analytics.js +1669 -0
  1240. package/packages/analytics-v1.1/src/features/core/cookieConsent/CookieConsentFactory.js +32 -0
  1241. package/packages/analytics-v1.1/src/features/core/cookieConsent/OneTrust/browser.js +102 -0
  1242. package/packages/analytics-v1.1/src/features/core/cookieConsent/OneTrust/index.js +1 -0
  1243. package/packages/analytics-v1.1/src/features/core/cookieConsent/ketch/browser.js +114 -0
  1244. package/packages/analytics-v1.1/src/features/core/cookieConsent/ketch/index.js +1 -0
  1245. package/packages/analytics-v1.1/src/features/core/deviceModeTransformation/transformationHandler.js +196 -0
  1246. package/packages/analytics-v1.1/src/features/core/deviceModeTransformation/util.js +23 -0
  1247. package/packages/analytics-v1.1/src/features/core/metrics/errorReporting/ErrorReportingService.js +116 -0
  1248. package/packages/analytics-v1.1/src/features/core/metrics/errorReporting/providers/Bugsnag.js +247 -0
  1249. package/packages/analytics-v1.1/src/features/core/session/index.js +207 -0
  1250. package/packages/analytics-v1.1/src/utils/EventRepository.js +79 -0
  1251. package/packages/analytics-v1.1/src/utils/IntegrationsData.js +56 -0
  1252. package/packages/analytics-v1.1/src/utils/JSFileLoader.js +66 -0
  1253. package/packages/analytics-v1.1/src/utils/PreProcessQueue.js +66 -0
  1254. package/packages/analytics-v1.1/src/utils/RudderApp.js +9 -0
  1255. package/packages/analytics-v1.1/src/utils/RudderContext.js +23 -0
  1256. package/packages/analytics-v1.1/src/utils/RudderElement.js +33 -0
  1257. package/packages/analytics-v1.1/src/utils/RudderElementBuilder.js +29 -0
  1258. package/packages/analytics-v1.1/src/utils/RudderInfo.js +41 -0
  1259. package/packages/analytics-v1.1/src/utils/RudderMessage.js +28 -0
  1260. package/packages/analytics-v1.1/src/utils/beaconQueue.js +140 -0
  1261. package/packages/analytics-v1.1/src/utils/cdnPaths.js +43 -0
  1262. package/packages/analytics-v1.1/src/utils/clientHint.js +28 -0
  1263. package/packages/analytics-v1.1/src/utils/constants.js +70 -0
  1264. package/packages/analytics-v1.1/src/utils/eventProcessorUtils.js +53 -0
  1265. package/packages/analytics-v1.1/src/utils/linker/base64decoder.js +29 -0
  1266. package/packages/analytics-v1.1/src/utils/linker/crc32.js +42 -0
  1267. package/packages/analytics-v1.1/src/utils/linker/index.js +134 -0
  1268. package/packages/analytics-v1.1/src/utils/linker/userLib.js +20 -0
  1269. package/packages/analytics-v1.1/src/utils/navigator.js +32 -0
  1270. package/packages/analytics-v1.1/src/utils/pageProperties.js +74 -0
  1271. package/packages/analytics-v1.1/src/utils/screenDetails.js +23 -0
  1272. package/packages/analytics-v1.1/src/utils/utils.js +423 -0
  1273. package/packages/analytics-v1.1/src/utils/xhrModule.js +117 -0
  1274. package/packages/analytics-v1.1/tsconfig.json +8 -0
  1275. package/packages/analytics-v1.1/tsconfig.spec.json +26 -0
  1276. package/packages/analytics-v1.1/types/index.d.ts +472 -0
  1277. package/packages/analytics-v1.1/types/service-worker/index.d.ts +220 -0
  1278. package/packages/loading-scripts/.env.example +11 -0
  1279. package/packages/loading-scripts/.jscpd.json +17 -0
  1280. package/packages/loading-scripts/CHANGELOG.md +130 -0
  1281. package/packages/loading-scripts/CHANGELOG_LATEST.md +2 -0
  1282. package/packages/loading-scripts/LICENSE +21 -0
  1283. package/packages/loading-scripts/README.md +26 -0
  1284. package/packages/loading-scripts/__fixtures__/.gitkeep +0 -0
  1285. package/packages/loading-scripts/__mocks__/.gitkeep +0 -0
  1286. package/packages/loading-scripts/__tests__/.gitkeep +0 -0
  1287. package/packages/loading-scripts/babel.config.json +14 -0
  1288. package/packages/loading-scripts/jest.config.mjs +14 -0
  1289. package/packages/loading-scripts/package.json +62 -0
  1290. package/packages/loading-scripts/project.json +101 -0
  1291. package/packages/loading-scripts/public/index.html +180 -0
  1292. package/packages/loading-scripts/rollup.config.mjs +112 -0
  1293. package/packages/loading-scripts/src/index.ts +106 -0
  1294. package/packages/loading-scripts/src/types/rudderanalytics.d.ts +16 -0
  1295. package/packages/loading-scripts/tsconfig.json +15 -0
  1296. package/packages/loading-scripts/tsconfig.spec.json +22 -0
  1297. package/packages/sanity-suite/.env.example +39 -0
  1298. package/packages/sanity-suite/.jscpd.json +17 -0
  1299. package/packages/sanity-suite/CHANGELOG.md +154 -0
  1300. package/packages/sanity-suite/LICENSE +21 -0
  1301. package/packages/sanity-suite/README.md +37 -0
  1302. package/packages/sanity-suite/__fixtures__/alias1.json +141 -0
  1303. package/packages/sanity-suite/__fixtures__/alias2.json +101 -0
  1304. package/packages/sanity-suite/__fixtures__/alias3.json +101 -0
  1305. package/packages/sanity-suite/__fixtures__/alias4.json +101 -0
  1306. package/packages/sanity-suite/__fixtures__/alias5.json +107 -0
  1307. package/packages/sanity-suite/__fixtures__/alias6.json +141 -0
  1308. package/packages/sanity-suite/__fixtures__/eventFiltering1.json +69 -0
  1309. package/packages/sanity-suite/__fixtures__/eventFiltering2.json +69 -0
  1310. package/packages/sanity-suite/__fixtures__/eventFiltering3.json +69 -0
  1311. package/packages/sanity-suite/__fixtures__/group1.json +124 -0
  1312. package/packages/sanity-suite/__fixtures__/group2.json +90 -0
  1313. package/packages/sanity-suite/__fixtures__/group3.json +90 -0
  1314. package/packages/sanity-suite/__fixtures__/group4.json +105 -0
  1315. package/packages/sanity-suite/__fixtures__/group5.json +71 -0
  1316. package/packages/sanity-suite/__fixtures__/group6.json +70 -0
  1317. package/packages/sanity-suite/__fixtures__/identify1.json +140 -0
  1318. package/packages/sanity-suite/__fixtures__/identify2.json +106 -0
  1319. package/packages/sanity-suite/__fixtures__/identify3.json +103 -0
  1320. package/packages/sanity-suite/__fixtures__/identify4.json +69 -0
  1321. package/packages/sanity-suite/__fixtures__/identify5.json +106 -0
  1322. package/packages/sanity-suite/__fixtures__/identify6.json +107 -0
  1323. package/packages/sanity-suite/__fixtures__/identify7.json +106 -0
  1324. package/packages/sanity-suite/__fixtures__/identify8.json +107 -0
  1325. package/packages/sanity-suite/__fixtures__/page1.json +123 -0
  1326. package/packages/sanity-suite/__fixtures__/page2.json +90 -0
  1327. package/packages/sanity-suite/__fixtures__/page3.json +90 -0
  1328. package/packages/sanity-suite/__fixtures__/page4.json +116 -0
  1329. package/packages/sanity-suite/__fixtures__/page5.json +83 -0
  1330. package/packages/sanity-suite/__fixtures__/page6.json +81 -0
  1331. package/packages/sanity-suite/__fixtures__/page7.json +81 -0
  1332. package/packages/sanity-suite/__fixtures__/page8.json +79 -0
  1333. package/packages/sanity-suite/__fixtures__/sourceConfig1.json +1536 -0
  1334. package/packages/sanity-suite/__fixtures__/sourceConfigDMT1.json +665 -0
  1335. package/packages/sanity-suite/__fixtures__/sourceConfigDev1.json +892 -0
  1336. package/packages/sanity-suite/__fixtures__/track1.json +154 -0
  1337. package/packages/sanity-suite/__fixtures__/track2.json +122 -0
  1338. package/packages/sanity-suite/__fixtures__/track3.json +122 -0
  1339. package/packages/sanity-suite/__fixtures__/track4.json +138 -0
  1340. package/packages/sanity-suite/__fixtures__/track5.json +106 -0
  1341. package/packages/sanity-suite/__fixtures__/track6.json +85 -0
  1342. package/packages/sanity-suite/__fixtures__/track7.json +85 -0
  1343. package/packages/sanity-suite/babel.config.json +14 -0
  1344. package/packages/sanity-suite/jest.config.mjs +14 -0
  1345. package/packages/sanity-suite/package.json +83 -0
  1346. package/packages/sanity-suite/project.json +55 -0
  1347. package/packages/sanity-suite/public/v1.1/index-cdn.html +135 -0
  1348. package/packages/sanity-suite/public/v1.1/index-local.html +141 -0
  1349. package/packages/sanity-suite/public/v1.1/index-npm.html +107 -0
  1350. package/packages/sanity-suite/public/v1.1/integrations/index-cdn.html +172 -0
  1351. package/packages/sanity-suite/public/v1.1/integrations/index-local.html +171 -0
  1352. package/packages/sanity-suite/public/v1.1/integrations/index-npm.html +140 -0
  1353. package/packages/sanity-suite/public/v1.1/manualLoadCall/index-cdn.html +172 -0
  1354. package/packages/sanity-suite/public/v1.1/manualLoadCall/index-local.html +171 -0
  1355. package/packages/sanity-suite/public/v1.1/manualLoadCall/index-npm.html +140 -0
  1356. package/packages/sanity-suite/public/v3/index-cdn.html +165 -0
  1357. package/packages/sanity-suite/public/v3/index-local.html +169 -0
  1358. package/packages/sanity-suite/public/v3/index-npm.html +99 -0
  1359. package/packages/sanity-suite/public/v3/integrations/index-cdn.html +196 -0
  1360. package/packages/sanity-suite/public/v3/integrations/index-local.html +198 -0
  1361. package/packages/sanity-suite/public/v3/integrations/index-npm.html +138 -0
  1362. package/packages/sanity-suite/public/v3/manualLoadCall/index-cdn.html +196 -0
  1363. package/packages/sanity-suite/public/v3/manualLoadCall/index-local.html +198 -0
  1364. package/packages/sanity-suite/public/v3/manualLoadCall/index-npm.html +138 -0
  1365. package/packages/sanity-suite/rollup.config.mjs +247 -0
  1366. package/packages/sanity-suite/serve.json +4 -0
  1367. package/packages/sanity-suite/src/ignoredProperties/ignoredProperties.js +183 -0
  1368. package/packages/sanity-suite/src/ignoredProperties/sourceConfigIgnoredProperties.js +144 -0
  1369. package/packages/sanity-suite/src/index-npm-v1.1.ts +53 -0
  1370. package/packages/sanity-suite/src/index-npm.ts +57 -0
  1371. package/packages/sanity-suite/src/index.ts +6 -0
  1372. package/packages/sanity-suite/src/testBook/ResultAssertions.js +77 -0
  1373. package/packages/sanity-suite/src/testBook/TestBook.js +360 -0
  1374. package/packages/sanity-suite/src/testBook/index.js +13 -0
  1375. package/packages/sanity-suite/src/testBookSuites/alias.js +289 -0
  1376. package/packages/sanity-suite/src/testBookSuites/eventFiltering.js +77 -0
  1377. package/packages/sanity-suite/src/testBookSuites/group.js +241 -0
  1378. package/packages/sanity-suite/src/testBookSuites/identify.js +455 -0
  1379. package/packages/sanity-suite/src/testBookSuites/index.js +40 -0
  1380. package/packages/sanity-suite/src/testBookSuites/page.js +259 -0
  1381. package/packages/sanity-suite/src/testBookSuites/sourceConfig.js +89 -0
  1382. package/packages/sanity-suite/src/testBookSuites/sourceConfigDev.js +20 -0
  1383. package/packages/sanity-suite/src/testBookSuites/track.js +448 -0
  1384. package/packages/sanity-suite/src/types/global.d.ts +2 -0
  1385. package/packages/sanity-suite/src/types/rudderanalytics.d.ts +16 -0
  1386. package/packages/sanity-suite/tsconfig.json +14 -0
  1387. package/packages/sanity-suite/tsconfig.spec.json +22 -0
  1388. package/patches/@originjs+vite-plugin-federation+1.3.5.patch +170 -0
  1389. package/patches/@segment+localstorage-retry+1.3.0.patch +123 -0
  1390. package/patches/@segment+top-domain+3.0.1.patch +34 -0
  1391. package/patches/@vespaiach+axios-fetch-adapter+0.3.1.patch +43 -0
  1392. package/patches/crypto-es+2.1.0.patch +103 -0
  1393. package/patches/nx+18.0.5.patch +83 -0
  1394. package/patches/rollup-plugin-generate-html-template+1.7.0.patch +46 -0
  1395. package/scripts/commitizen.js +26 -0
  1396. package/scripts/fix-reports-path-in-github-runner.sh +16 -0
  1397. package/scripts/generate-last-release-changelog.sh +32 -0
  1398. package/scripts/sync-tags-in-nx-projects.sh +24 -0
  1399. package/sonar-project.properties +37 -0
  1400. package/tsconfig.build.json +12 -0
  1401. package/tsconfig.json +49 -0
  1402. package/tsconfig.paths.json +27 -0
  1403. package/types/clipboardJs.d.ts +1 -0
  1404. package/types/component-querystring.d.ts +1 -0
  1405. package/types/component-type.d.ts +1 -0
  1406. package/types/global.d.ts +18 -0
  1407. package/types/join-component.d.ts +1 -0
  1408. package/types/localstorage-retry.d.ts +1 -0
  1409. package/types/loosely-validate-event.d.ts +1 -0
  1410. package/types/user-agent-data-types.d.ts +3 -0
@@ -0,0 +1,1669 @@
1
+ /* eslint-disable prefer-rest-params */
2
+ /* eslint-disable no-use-before-define */
3
+ /* eslint-disable new-cap */
4
+ /* eslint-disable func-names */
5
+ /* eslint-disable eqeqeq */
6
+ /* eslint-disable no-prototype-builtins */
7
+ /* eslint-disable class-methods-use-this */
8
+ /* eslint-disable no-restricted-syntax */
9
+ /* eslint-disable guard-for-in */
10
+ /* eslint-disable no-sequences */
11
+ /* eslint-disable no-multi-assign */
12
+ /* eslint-disable no-unused-expressions */
13
+ /* eslint-disable import/extensions */
14
+ /* eslint-disable no-param-reassign */
15
+ /* eslint-disable sonarjs/cognitive-complexity */
16
+ import Emitter from 'component-emitter';
17
+ import * as R from 'ramda';
18
+ import { configToIntNames } from '@rudderstack/analytics-js-common/v1.1/utils/config_to_integration_names';
19
+ import { commonNames } from '@rudderstack/analytics-js-common/v1.1/utils/integration_cname';
20
+ import { handleError } from '@rudderstack/analytics-js-common/v1.1/utils/errorHandler';
21
+ import {
22
+ MAX_WAIT_FOR_INTEGRATION_LOAD,
23
+ INTEGRATION_LOAD_CHECK_INTERVAL,
24
+ } from '@rudderstack/analytics-js-common/v1.1/utils/constants';
25
+ import { Storage } from '@rudderstack/analytics-js-common/v1.1/utils/storage';
26
+ import { logger } from '@rudderstack/analytics-js-common/v1.1/utils/logUtil';
27
+ import { ScriptLoader } from '@rudderstack/analytics-js-common/v1.1/utils/ScriptLoader';
28
+ import { isNonEmptyObject } from '@rudderstack/analytics-js-common/utilities/object';
29
+ import { isSDKRunningInChromeExtension } from '@rudderstack/analytics-js-common/utilities/detect';
30
+ import {
31
+ getJSONTrimmed,
32
+ generateUUID,
33
+ getUserProvidedConfigUrl,
34
+ findAllEnabledDestinations,
35
+ transformToRudderNames,
36
+ transformToServerNames,
37
+ checkReservedKeywords,
38
+ getConfigUrl,
39
+ getStringId,
40
+ resolveDataPlaneUrl,
41
+ fetchCookieConsentState,
42
+ parseQueryString,
43
+ } from '../utils/utils';
44
+ import { getReferrer, getReferringDomain, getDefaultPageProperties } from '../utils/pageProperties';
45
+ import {
46
+ DEST_SDK_BASE_URL,
47
+ INTG_SUFFIX,
48
+ POLYFILL_URL,
49
+ SAMESITE_COOKIE_OPTS,
50
+ UA_CH_LEVELS,
51
+ DEFAULT_INTEGRATIONS_CONFIG,
52
+ DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS,
53
+ } from '../utils/constants';
54
+ import RudderElementBuilder from '../utils/RudderElementBuilder';
55
+ import { EventRepository } from '../utils/EventRepository';
56
+ import PreProcessQueue from '../utils/PreProcessQueue';
57
+ import parseLinker from '../utils/linker';
58
+ import CookieConsentFactory from '../features/core/cookieConsent/CookieConsentFactory';
59
+ import { UserSession } from '../features/core/session';
60
+ import { mergeContext, mergeTopLevelElementsMutator } from '../utils/eventProcessorUtils';
61
+ import {
62
+ getMergedClientSuppliedIntegrations,
63
+ constructMessageIntegrationsObj,
64
+ } from '../utils/IntegrationsData';
65
+ import { getIntegrationsCDNPath } from '../utils/cdnPaths';
66
+ import { ErrorReportingService } from '../features/core/metrics/errorReporting/ErrorReportingService';
67
+ import { getUserAgentClientHint } from '../utils/clientHint';
68
+ import { DeviceModeTransformations } from '../features/core/deviceModeTransformation/transformationHandler';
69
+
70
+ /**
71
+ * class responsible for handling core
72
+ * event tracking functionalities
73
+ */
74
+ class Analytics {
75
+ /**
76
+ * Creates an instance of Analytics.
77
+ * @memberof Analytics
78
+ */
79
+ constructor() {
80
+ this.initialized = false;
81
+ this.clientIntegrations = [];
82
+ this.loadOnlyIntegrations = {};
83
+ this.clientIntegrationObjects = undefined;
84
+ this.successfullyLoadedIntegration = [];
85
+ this.failedToBeLoadedIntegration = [];
86
+ this.toBeProcessedArray = [];
87
+ this.toBeProcessedByIntegrationArray = [];
88
+ this.storage = Storage;
89
+ this.eventRepository = EventRepository;
90
+ this.preProcessQueue = new PreProcessQueue();
91
+ this.sendAdblockPage = false;
92
+ this.sendAdblockPageOptions = {};
93
+ this.clientSuppliedCallbacks = {};
94
+ // Array to store the callback functions registered in the ready API
95
+ this.readyCallbacks = [];
96
+ this.methodToCallbackMapping = {
97
+ syncPixel: 'syncPixelCallback',
98
+ };
99
+ this.loaded = false;
100
+ this.loadIntegration = true;
101
+ this.bufferDataPlaneEventsUntilReady = false;
102
+ this.dataPlaneEventsBufferTimeout = DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS;
103
+ this.integrationsData = {};
104
+ this.dynamicallyLoadedIntegrations = {};
105
+ this.destSDKBaseURL = DEST_SDK_BASE_URL;
106
+ this.cookieConsentOptions = {};
107
+ this.logLevel = undefined;
108
+ // flag to indicate client integrations` ready status
109
+ this.clientIntegrationsReady = false;
110
+ this.uSession = UserSession;
111
+ this.version = '__PACKAGE_VERSION__';
112
+ this.lockIntegrationsVersion = false;
113
+ this.errorReporting = new ErrorReportingService(logger);
114
+ this.deniedConsentIds = [];
115
+ this.transformationHandler = DeviceModeTransformations;
116
+ }
117
+
118
+ /**
119
+ * initialize the user after load config
120
+ */
121
+ initializeUser(anonymousIdOptions) {
122
+ // save once for storing older values to encrypted
123
+ this.userId = this.storage.getUserId() || '';
124
+ this.storage.setUserId(this.userId);
125
+
126
+ this.userTraits = this.storage.getUserTraits() || {};
127
+ this.storage.setUserTraits(this.userTraits);
128
+
129
+ this.groupId = this.storage.getGroupId() || '';
130
+ this.storage.setGroupId(this.groupId);
131
+
132
+ this.groupTraits = this.storage.getGroupTraits() || {};
133
+ this.storage.setGroupTraits(this.groupTraits);
134
+
135
+ this.anonymousId = this.getAnonymousId(anonymousIdOptions);
136
+ this.storage.setAnonymousId(this.anonymousId);
137
+ }
138
+
139
+ setInitialPageProperties() {
140
+ if (
141
+ this.storage.getInitialReferrer() == null &&
142
+ this.storage.getInitialReferringDomain() == null
143
+ ) {
144
+ const initialReferrer = getReferrer();
145
+ this.storage.setInitialReferrer(initialReferrer);
146
+ this.storage.setInitialReferringDomain(getReferringDomain(initialReferrer));
147
+ }
148
+ }
149
+
150
+ allModulesInitialized(time = 0) {
151
+ return new Promise(resolve => {
152
+ if (
153
+ this.clientIntegrations.every(
154
+ intg =>
155
+ this.dynamicallyLoadedIntegrations[`${configToIntNames[intg.name]}${INTG_SUFFIX}`] !=
156
+ undefined,
157
+ )
158
+ ) {
159
+ // logger.debug(
160
+ // "All integrations loaded dynamically",
161
+ // this.initialisedIntegrations
162
+ // );
163
+ resolve(this);
164
+ } else if (time >= 2 * MAX_WAIT_FOR_INTEGRATION_LOAD) {
165
+ // logger.debug("Max wait for dynamically loaded integrations over")
166
+ resolve(this);
167
+ } else {
168
+ this.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(() =>
169
+ // logger.debug("Check if all integration SDKs are loaded after pause")
170
+ this.allModulesInitialized(time + INTEGRATION_LOAD_CHECK_INTERVAL).then(resolve),
171
+ );
172
+ }
173
+ });
174
+ }
175
+
176
+ /**
177
+ * Function to execute the ready method callbacks
178
+ * @param {Analytics} self
179
+ */
180
+ executeReadyCallback() {
181
+ this.readyCallbacks.forEach(callback => callback());
182
+ }
183
+
184
+ /**
185
+ * A function to validate integration SDK is available in window
186
+ * and integration constructor is not undefined
187
+ * @param {string} pluginName
188
+ * @param {string} modName
189
+ * @returns boolean
190
+ */
191
+ integrationSDKLoaded(pluginName, modName) {
192
+ return (
193
+ window[pluginName] &&
194
+ window[pluginName][modName] &&
195
+ window[pluginName][modName].prototype &&
196
+ typeof window[pluginName][modName].prototype.constructor !== 'undefined'
197
+ );
198
+ }
199
+
200
+ /**
201
+ * Process the response from control plane and
202
+ * call initialize for integrations
203
+ *
204
+ * @param {*} status
205
+ * @param {*} responseVal
206
+ * @memberof Analytics
207
+ */
208
+ processResponse(status, responseVal) {
209
+ try {
210
+ // logger.debug(`===in process response=== ${status}`);
211
+
212
+ let response = responseVal;
213
+ try {
214
+ if (typeof responseVal === 'string') {
215
+ response = JSON.parse(responseVal);
216
+ }
217
+
218
+ // Do not proceed if the ultimate response value is not an object
219
+ if (!response || typeof response !== 'object' || Array.isArray(response)) {
220
+ logger.error('Invalid source configuration');
221
+ return;
222
+ }
223
+ } catch (err) {
224
+ handleError(err);
225
+ return;
226
+ }
227
+
228
+ // Initialize error reporting provider if set in source config
229
+ try {
230
+ // Initialize error reporting provider only if SDK is not running inside chrome extension
231
+ if (!isSDKRunningInChromeExtension()) {
232
+ this.errorReporting.init(response.source.config, response.source.id, this.writeKey);
233
+ }
234
+ } catch (err) {
235
+ handleError(err);
236
+ }
237
+
238
+ // determine the dataPlaneUrl
239
+ this.serverUrl = resolveDataPlaneUrl(response, this.serverUrl, this.options);
240
+
241
+ // Initialize event repository
242
+ this.eventRepository.initialize(this.writeKey, this.serverUrl, this.options);
243
+
244
+ // Initialize transformation handler once we determine the dataPlaneUrl
245
+ this.transformationHandler.init(this.writeKey, this.serverUrl, this.storage.getAuthToken());
246
+
247
+ response.source.destinations.forEach(function (destination) {
248
+ // logger.debug(
249
+ // `Destination ${index} Enabled? ${destination.enabled} Type: ${destination.destinationDefinition.name} Use Native SDK? true`
250
+ // );
251
+ if (destination.enabled) {
252
+ this.clientIntegrations.push({
253
+ name: destination.destinationDefinition.name,
254
+ config: destination.config,
255
+ destinationInfo: {
256
+ shouldApplyDeviceModeTransformation:
257
+ destination.shouldApplyDeviceModeTransformation || false,
258
+ propagateEventsUntransformedOnError:
259
+ destination.propagateEventsUntransformedOnError || false,
260
+ destinationId: destination.id,
261
+ },
262
+ });
263
+ }
264
+ }, this);
265
+
266
+ // intersection of config-plane native sdk destinations with sdk load time destination list
267
+ this.clientIntegrations = findAllEnabledDestinations(
268
+ this.loadOnlyIntegrations,
269
+ this.clientIntegrations,
270
+ );
271
+ // Check if cookie consent manager is being set through load options
272
+ if (Object.keys(this.cookieConsentOptions).length > 0) {
273
+ // Call the cookie consent factory to initialise and return the type of cookie
274
+ // consent being set. For now we only support OneTrust.
275
+ try {
276
+ const cookieConsent = CookieConsentFactory.initialize(this.cookieConsentOptions);
277
+ // Fetch denied consent group Ids and pass it to cloud mode
278
+ this.deniedConsentIds = cookieConsent && cookieConsent.getDeniedList();
279
+ // If cookie consent object is return we filter according to consents given by user
280
+ // else we do not consider any filtering for cookie consent.
281
+ this.clientIntegrations = this.clientIntegrations.filter(
282
+ intg =>
283
+ !cookieConsent || // check if cookieconsent object is present and then do filtering
284
+ (cookieConsent && cookieConsent.isEnabled(intg.config)),
285
+ );
286
+ } catch (e) {
287
+ handleError(e);
288
+ }
289
+ }
290
+
291
+ // set loaded flag to true
292
+ this.loaded = true;
293
+
294
+ // Execute onLoaded callback if provided in load options
295
+ if (this.options && typeof this.options.onLoaded === 'function') {
296
+ this.options.onLoaded(this);
297
+ }
298
+
299
+ // Execute any pending buffered requests
300
+ // (needed if the load call was not previously buffered)
301
+ processDataInAnalyticsArray(this);
302
+
303
+ // filter destination that doesn't have mapping config-->Integration names
304
+ this.clientIntegrations = this.clientIntegrations.filter(intg => {
305
+ if (configToIntNames[intg.name]) {
306
+ return true;
307
+ }
308
+ logger.error(`[Analytics] Integration:: ${intg.name} not available for initialization`);
309
+ return false;
310
+ });
311
+
312
+ if (this.bufferDataPlaneEventsUntilReady) {
313
+ // Fallback logic to process buffered cloud mode events if integrations are failed to load in given interval
314
+ setTimeout(() => {
315
+ this.processBufferedCloudModeEvents();
316
+ }, this.dataPlaneEventsBufferTimeout);
317
+ }
318
+
319
+ this.errorReporting.leaveBreadcrumb('Starting device-mode initialization');
320
+ // logger.debug("this.activeIntegrations: ", this.activeIntegrations)
321
+ // Load all the client integrations dynamically
322
+ this.clientIntegrations.forEach(intg => {
323
+ const modName = configToIntNames[intg.name]; // script URL can be constructed from this
324
+ const pluginName = `${modName}${INTG_SUFFIX}`; // this is the name of the object loaded on the window
325
+ const modURL = `${this.destSDKBaseURL}/${modName}.min.js`;
326
+
327
+ if (!window.hasOwnProperty(pluginName)) {
328
+ ScriptLoader(pluginName, modURL, { isNonNativeSDK: true });
329
+ }
330
+
331
+ const self = this;
332
+ const interval = setInterval(() => {
333
+ if (self.integrationSDKLoaded(pluginName, modName)) {
334
+ const intMod = window[pluginName];
335
+ clearInterval(interval);
336
+
337
+ // logger.debug(pluginName, " dynamically loaded integration SDK");
338
+
339
+ let intgInstance;
340
+ try {
341
+ const msg = `[Analytics] processResponse :: trying to initialize integration name:: ${pluginName}`;
342
+ // logger.debug(msg);
343
+ this.errorReporting.leaveBreadcrumb(msg);
344
+ intgInstance = new intMod[modName](intg.config, self, intg.destinationInfo);
345
+ intgInstance.init();
346
+
347
+ // logger.debug(pluginName, " initializing destination");
348
+
349
+ self.isInitialized(intgInstance).then(() => {
350
+ // logger.debug(pluginName, " module init sequence complete");
351
+ self.dynamicallyLoadedIntegrations[pluginName] = intMod[modName];
352
+ });
353
+ } catch (e) {
354
+ const message = `[Analytics] 'integration.init()' failed :: ${pluginName} :: ${e.message}`;
355
+ handleError(e, message);
356
+ self.failedToBeLoadedIntegration.push(intgInstance);
357
+ }
358
+ }
359
+ }, 100);
360
+
361
+ setTimeout(() => {
362
+ clearInterval(interval);
363
+ }, MAX_WAIT_FOR_INTEGRATION_LOAD);
364
+ });
365
+
366
+ const self = this;
367
+ this.allModulesInitialized().then(() => {
368
+ if (!self.clientIntegrations || self.clientIntegrations.length === 0) {
369
+ // If no integrations are there to be loaded
370
+ // set clientIntegrationsReady to be true
371
+ this.clientIntegrationsReady = true;
372
+ // Execute the callbacks if any
373
+ this.executeReadyCallback();
374
+ this.toBeProcessedByIntegrationArray = [];
375
+ return;
376
+ }
377
+
378
+ self.replayEvents(self);
379
+ });
380
+ } catch (error) {
381
+ handleError(error);
382
+ }
383
+ }
384
+
385
+ /**
386
+ * A function to send single event to a destination
387
+ * @param {instance} destination
388
+ * @param {Object} rudderElement
389
+ * @param {String} methodName
390
+ */
391
+ sendDataToDestination(destination, rudderElement, methodName) {
392
+ try {
393
+ if (destination[methodName]) {
394
+ const clonedRudderElement = R.clone(rudderElement);
395
+ destination[methodName](clonedRudderElement);
396
+ }
397
+ } catch (err) {
398
+ const message = `[sendToNative]:: [Destination: ${destination.name}]:: `;
399
+ handleError(err, message);
400
+ }
401
+ }
402
+
403
+ /**
404
+ * A function that gets the transformed event and
405
+ * depending on the response either send the transformed/untransformed event to destination or just log error.
406
+ * @param {Array} destWithTransformation List of device mode destination that has transformation connected
407
+ * @param {Object} rudderElement Rudder event
408
+ * @param {string} methodName Type of event page/track/identify etc.
409
+ */
410
+ sendTransformedDataToDestination(destWithTransformation, rudderElement, methodName) {
411
+ try {
412
+ // convert integrations object to server identified names, kind of hack now!
413
+ transformToServerNames(rudderElement.message.integrations);
414
+ const destinationIds = destWithTransformation.map(e => e.destinationId);
415
+ // Process Transformation
416
+ this.transformationHandler.enqueue(
417
+ rudderElement,
418
+ destinationIds,
419
+ ({ status, transformedPayload, errorMessage }) => {
420
+ destWithTransformation.forEach(intg => {
421
+ try {
422
+ switch (status) {
423
+ // The transformation request is successful
424
+ case 200: {
425
+ // filter destination specific transformed payload
426
+ const destTransformedResult = transformedPayload.find(
427
+ e => e.id === intg.destinationId,
428
+ );
429
+ const eventsToSend = [];
430
+ destTransformedResult?.payload.forEach(tEvent => {
431
+ // Transformation successful
432
+ // event level status is 200
433
+ if (tEvent.status === '200') {
434
+ // push transformed event to the queue
435
+ eventsToSend.push(tEvent);
436
+ } else {
437
+ const msgPrefix = `[DMT]:: Event transformation unsuccessful for destination "${intg.name}". Reason: `;
438
+
439
+ let reason = 'Unknown';
440
+ if (tEvent.status === '410') {
441
+ reason = 'Transformation is not available';
442
+ }
443
+
444
+ let action = 'Dropping the event';
445
+ let logMethod = logger.error;
446
+ if (intg.propagateEventsUntransformedOnError === true) {
447
+ action = 'Sending untransformed event to the destination';
448
+ logMethod = logger.warn;
449
+ eventsToSend.push({ event: rudderElement.message });
450
+ }
451
+
452
+ const logMsg = `${msgPrefix} ${reason}. ${action}.`;
453
+ logMethod(logMsg);
454
+ }
455
+ });
456
+ // send events to destination
457
+ eventsToSend?.forEach(tEvent => {
458
+ // send only if the event is not null/undefined/empty object
459
+ if (isNonEmptyObject(tEvent.event)) {
460
+ this.sendDataToDestination(intg, { message: tEvent.event }, methodName);
461
+ }
462
+ });
463
+ break;
464
+ }
465
+
466
+ // Transformation server access denied
467
+ case 404: {
468
+ logger.warn(
469
+ `[DMT]:: Transformation server access is denied. The configuration data seems to be out of sync. Sending untransformed event to the destination.`,
470
+ );
471
+ // send untransformed event to destination
472
+ this.sendDataToDestination(intg, rudderElement, methodName);
473
+ break;
474
+ }
475
+ // For any other cases
476
+ default: {
477
+ if (intg.propagateEventsUntransformedOnError === true) {
478
+ logger.warn(
479
+ `[DMT]::[Destination: ${intg.name}] :: Transformation request failed with status: ${status} ${errorMessage}. Sending untransformed event.`,
480
+ );
481
+ // send untransformed event to destination
482
+ this.sendDataToDestination(intg, rudderElement, methodName);
483
+ } else {
484
+ logger.error(
485
+ `[DMT]::[Destination: ${intg.name}] :: Transformation request failed with status: ${status} ${errorMessage}. Dropping the event.`,
486
+ );
487
+ }
488
+ break;
489
+ }
490
+ }
491
+ } catch (e) {
492
+ if (e instanceof Error) {
493
+ e.message = `[DMT]::[Destination:${intg.name}]:: ${e.message}`;
494
+ }
495
+ handleError(e);
496
+ }
497
+ });
498
+ },
499
+ );
500
+ } catch (e) {
501
+ if (e instanceof Error) {
502
+ e.message = `[DMT]:: ${e.message}`;
503
+ }
504
+ handleError(e);
505
+ }
506
+ }
507
+
508
+ /**
509
+ * A function to process and send events to device mode destinations
510
+ * @param {instance} destinations
511
+ * @param {Object} rudderElement
512
+ * @param {String} methodName
513
+ */
514
+ processAndSendEventsToDeviceMode(destinations, rudderElement, methodName) {
515
+ const destWithoutTransformation = [];
516
+ const destWithTransformation = [];
517
+
518
+ // Depending on transformation is connected or not
519
+ // create two sets of destinations
520
+ destinations.forEach(intg => {
521
+ try {
522
+ const sendEvent = !this.IsEventBlackListed(rudderElement.message.event, intg.name);
523
+
524
+ // Block the event if it is blacklisted for the device-mode destination
525
+ if (sendEvent) {
526
+ if (intg.shouldApplyDeviceModeTransformation) {
527
+ destWithTransformation.push(intg);
528
+ } else {
529
+ destWithoutTransformation.push(intg);
530
+ }
531
+ }
532
+ } catch (e) {
533
+ handleError(e);
534
+ }
535
+ });
536
+ // loop through destinations that doesn't have
537
+ // transformation connected with it and send events
538
+ destWithoutTransformation.forEach(intg => {
539
+ this.sendDataToDestination(intg, rudderElement, methodName);
540
+ });
541
+
542
+ if (destWithTransformation.length > 0) {
543
+ this.sendTransformedDataToDestination(destWithTransformation, rudderElement, methodName);
544
+ }
545
+ }
546
+
547
+ /**
548
+ *
549
+ * @param {*} type
550
+ * @param {*} rudderElement
551
+ * Sends cloud mode events to server
552
+ */
553
+ queueEventForDataPlane(type, rudderElement) {
554
+ // if not specified at event level, All: true is default
555
+ const clientSuppliedIntegrations = rudderElement.message.integrations || { All: true };
556
+ rudderElement.message.integrations = getMergedClientSuppliedIntegrations(
557
+ this.integrationsData,
558
+ clientSuppliedIntegrations,
559
+ );
560
+ // self analytics process, send to rudder
561
+ this.eventRepository.enqueue(rudderElement, type);
562
+ }
563
+
564
+ /**
565
+ * Processes the buffered cloud mode events and sends it to server
566
+ */
567
+ processBufferedCloudModeEvents() {
568
+ if (this.bufferDataPlaneEventsUntilReady) {
569
+ this.preProcessQueue.activateProcessor();
570
+ }
571
+ }
572
+
573
+ // eslint-disable-next-line class-methods-use-this
574
+ replayEvents(object) {
575
+ // logger.debug(
576
+ // "===replay events called====",
577
+ // " successfully loaded count: ",
578
+ // object.loadedIntegrationScripts.length,
579
+ // " failed loaded count: ",
580
+ // object.failedIntegrationScripts.length
581
+ // );
582
+ this.errorReporting.leaveBreadcrumb(`Started replaying buffered events`);
583
+ // eslint-disable-next-line no-param-reassign
584
+ object.clientIntegrationObjects = [];
585
+ // eslint-disable-next-line no-param-reassign
586
+ object.clientIntegrationObjects = object.successfullyLoadedIntegration;
587
+
588
+ // logger.debug(
589
+ // "==registering after callback===",
590
+ // " after to be called after count : ",
591
+ // object.clientIntegrationObjects.length
592
+ // );
593
+
594
+ try {
595
+ if (object.clientIntegrationObjects.every(intg => !intg.isReady || intg.isReady())) {
596
+ // Integrations are ready
597
+ // set clientIntegrationsReady to be true
598
+ this.integrationsData = constructMessageIntegrationsObj(
599
+ this.integrationsData,
600
+ object.clientIntegrationObjects,
601
+ );
602
+ object.clientIntegrationsReady = true;
603
+ // Execute the callbacks if any
604
+ object.executeReadyCallback();
605
+ }
606
+ } catch (e) {
607
+ handleError(e, `Replay buffered cloud mode events`);
608
+ }
609
+
610
+ this.processBufferedCloudModeEvents();
611
+
612
+ // send the queued events to the fetched integration
613
+ object.toBeProcessedByIntegrationArray.forEach(event => {
614
+ const methodName = event[0];
615
+ event.shift();
616
+
617
+ // convert common names to sdk identified name
618
+ if (Object.keys(event[0].message.integrations).length > 0) {
619
+ transformToRudderNames(event[0].message.integrations);
620
+ }
621
+
622
+ // if not specified at event level, All: true is default
623
+ const clientSuppliedIntegrations = event[0].message.integrations;
624
+
625
+ // get intersection between config plane native enabled destinations
626
+ // (which were able to successfully load on the page) vs user supplied integrations
627
+ const successfulLoadedIntersectClientSuppliedIntegrations = findAllEnabledDestinations(
628
+ clientSuppliedIntegrations,
629
+ object.clientIntegrationObjects,
630
+ );
631
+
632
+ // send to all integrations now from the 'toBeProcessedByIntegrationArray' replay queue
633
+ this.processAndSendEventsToDeviceMode(
634
+ successfulLoadedIntersectClientSuppliedIntegrations,
635
+ event[0],
636
+ methodName,
637
+ );
638
+ });
639
+ object.toBeProcessedByIntegrationArray = [];
640
+ }
641
+
642
+ pause(time) {
643
+ return new Promise(resolve => {
644
+ setTimeout(resolve, time);
645
+ });
646
+ }
647
+
648
+ isInitialized(instance, time = 0) {
649
+ return new Promise(resolve => {
650
+ if (instance.isLoaded()) {
651
+ // logger.debug("===integration loaded successfully====", instance.name)
652
+ this.successfullyLoadedIntegration.push(instance);
653
+ resolve(this);
654
+ } else if (time >= MAX_WAIT_FOR_INTEGRATION_LOAD) {
655
+ // logger.debug("====max wait over====")
656
+ this.failedToBeLoadedIntegration.push(instance);
657
+ resolve(this);
658
+ } else {
659
+ this.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(() =>
660
+ // logger.debug("====after pause, again checking====")
661
+ this.isInitialized(instance, time + INTEGRATION_LOAD_CHECK_INTERVAL).then(resolve),
662
+ );
663
+ }
664
+ });
665
+ }
666
+
667
+ /**
668
+ * Process page params and forward to page call
669
+ *
670
+ * @param {*} category
671
+ * @param {*} name
672
+ * @param {*} properties
673
+ * @param {*} options
674
+ * @param {*} callback
675
+ * @memberof Analytics
676
+ */
677
+ page(category, name, properties, options, callback) {
678
+ this.errorReporting.leaveBreadcrumb(`Page event`);
679
+ if (!this.loaded) {
680
+ this.toBeProcessedArray.push(['page', ...arguments]);
681
+ return;
682
+ }
683
+ if (typeof options === 'function') (callback = options), (options = null);
684
+ if (typeof properties === 'function') (callback = properties), (options = properties = null);
685
+ if (typeof name === 'function') (callback = name), (options = properties = name = null);
686
+ if (typeof category === 'function')
687
+ (callback = category), (options = properties = name = category = null);
688
+ if (typeof category === 'object' && category != null && category != undefined)
689
+ (options = name), (properties = category), (name = category = null);
690
+ if (typeof name === 'object' && name != null && name != undefined)
691
+ (options = properties), (properties = name), (name = null);
692
+ if (typeof category === 'string' && typeof name !== 'string')
693
+ (name = category), (category = null);
694
+ if (this.sendAdblockPage && category !== 'RudderJS-Initiated') {
695
+ this.sendSampleRequest();
696
+ }
697
+ let clonedProperties = R.clone(properties);
698
+ const clonedOptions = R.clone(options);
699
+
700
+ const rudderElement = new RudderElementBuilder().setType('page').build();
701
+ if (!clonedProperties) {
702
+ clonedProperties = {};
703
+ }
704
+ if (name) {
705
+ rudderElement.message.name = clonedProperties.name = name;
706
+ }
707
+ if (category) {
708
+ rudderElement.message.category = clonedProperties.category = category;
709
+ }
710
+
711
+ rudderElement.message.properties = this.getPageProperties(clonedProperties);
712
+
713
+ this.processAndSendDataToDestinations('page', rudderElement, clonedOptions, callback);
714
+ }
715
+
716
+ /**
717
+ * Process track params and forward to track call
718
+ *
719
+ * @param {*} event
720
+ * @param {*} properties
721
+ * @param {*} options
722
+ * @param {*} callback
723
+ * @memberof Analytics
724
+ */
725
+ track(event, properties, options, callback) {
726
+ this.errorReporting.leaveBreadcrumb(`Track event`);
727
+ if (!this.loaded) {
728
+ this.toBeProcessedArray.push(['track', ...arguments]);
729
+ return;
730
+ }
731
+ if (typeof options === 'function') (callback = options), (options = null);
732
+ if (typeof properties === 'function')
733
+ (callback = properties), (options = null), (properties = null);
734
+
735
+ const clonedProperties = R.clone(properties);
736
+ const clonedOptions = R.clone(options);
737
+
738
+ const rudderElement = new RudderElementBuilder().setType('track').build();
739
+ if (event) {
740
+ rudderElement.setEventName(event);
741
+ }
742
+ rudderElement.setProperty(clonedProperties || {});
743
+
744
+ this.processAndSendDataToDestinations('track', rudderElement, clonedOptions, callback);
745
+ }
746
+
747
+ /**
748
+ * Process identify params and forward to identify call
749
+ *
750
+ * @param {*} userId
751
+ * @param {*} traits
752
+ * @param {*} options
753
+ * @param {*} callback
754
+ * @memberof Analytics
755
+ */
756
+ identify(userId, traits, options, callback) {
757
+ this.errorReporting.leaveBreadcrumb(`Identify event`);
758
+ if (!this.loaded) {
759
+ this.toBeProcessedArray.push(['identify', ...arguments]);
760
+ return;
761
+ }
762
+ if (typeof options === 'function') (callback = options), (options = null);
763
+ if (typeof traits === 'function') (callback = traits), (options = null), (traits = null);
764
+ if (typeof userId === 'object') (options = traits), (traits = userId), (userId = this.userId);
765
+
766
+ const normalisedUserId = getStringId(userId);
767
+ if (normalisedUserId && this.userId && normalisedUserId !== this.userId) {
768
+ this.reset();
769
+ }
770
+ this.userId = normalisedUserId;
771
+ this.storage.setUserId(this.userId);
772
+
773
+ const clonedTraits = R.clone(traits);
774
+ const clonedOptions = R.clone(options);
775
+
776
+ if (clonedTraits) {
777
+ for (const key in clonedTraits) {
778
+ this.userTraits[key] = clonedTraits[key];
779
+ }
780
+ this.storage.setUserTraits(this.userTraits);
781
+ }
782
+ const rudderElement = new RudderElementBuilder().setType('identify').build();
783
+
784
+ this.processAndSendDataToDestinations('identify', rudderElement, clonedOptions, callback);
785
+ }
786
+
787
+ /**
788
+ *
789
+ * @param {*} to
790
+ * @param {*} from
791
+ * @param {*} options
792
+ * @param {*} callback
793
+ */
794
+ alias(to, from, options, callback) {
795
+ this.errorReporting.leaveBreadcrumb(`Alias event`);
796
+ if (!this.loaded) {
797
+ this.toBeProcessedArray.push(['alias', ...arguments]);
798
+ return;
799
+ }
800
+ if (typeof options === 'function') (callback = options), (options = null);
801
+ if (typeof from === 'function') (callback = from), (options = null), (from = null);
802
+ if (typeof to === 'function') (callback = to), (options = null), (from = null), (to = null);
803
+ if (typeof from === 'object') (options = from), (from = null);
804
+ if (typeof to === 'object') (options = to), (from = null), (to = null);
805
+
806
+ const rudderElement = new RudderElementBuilder().setType('alias').build();
807
+
808
+ rudderElement.message.previousId =
809
+ getStringId(from) || (this.userId ? this.userId : this.getAnonymousId());
810
+ rudderElement.message.userId = getStringId(to);
811
+ const clonedOptions = R.clone(options);
812
+
813
+ this.processAndSendDataToDestinations('alias', rudderElement, clonedOptions, callback);
814
+ }
815
+
816
+ /**
817
+ *
818
+ * @param {*} to
819
+ * @param {*} from
820
+ * @param {*} options
821
+ * @param {*} callback
822
+ */
823
+ group(groupId, traits, options, callback) {
824
+ this.errorReporting.leaveBreadcrumb(`Group event`);
825
+ if (!this.loaded) {
826
+ this.toBeProcessedArray.push(['group', ...arguments]);
827
+ return;
828
+ }
829
+ if (arguments.length === 0) return;
830
+
831
+ if (typeof options === 'function') (callback = options), (options = null);
832
+ if (typeof traits === 'function') (callback = traits), (options = null), (traits = null);
833
+ if (typeof groupId === 'object')
834
+ (options = traits), (traits = groupId), (groupId = this.groupId);
835
+ if (typeof groupId === 'function')
836
+ (callback = groupId), (options = null), (traits = null), (groupId = this.groupId);
837
+
838
+ this.groupId = getStringId(groupId);
839
+ this.storage.setGroupId(this.groupId);
840
+ const clonedTraits = R.clone(traits);
841
+ const clonedOptions = R.clone(options);
842
+
843
+ const rudderElement = new RudderElementBuilder().setType('group').build();
844
+
845
+ if (clonedTraits) {
846
+ for (const key in clonedTraits) {
847
+ this.groupTraits[key] = clonedTraits[key];
848
+ }
849
+ } else {
850
+ this.groupTraits = {};
851
+ }
852
+ this.storage.setGroupTraits(this.groupTraits);
853
+
854
+ this.processAndSendDataToDestinations('group', rudderElement, clonedOptions, callback);
855
+ }
856
+
857
+ IsEventBlackListed(eventName, intgName) {
858
+ if (!eventName || !(typeof eventName === 'string')) {
859
+ return false;
860
+ }
861
+ const sdkIntgName = commonNames[intgName];
862
+ const intg = this.clientIntegrations.find(
863
+ clientIntegration => clientIntegration.name === sdkIntgName,
864
+ );
865
+
866
+ const { blacklistedEvents, whitelistedEvents, eventFilteringOption } = intg.config;
867
+
868
+ if (!eventFilteringOption) {
869
+ return false;
870
+ }
871
+
872
+ const formattedEventName = eventName.trim().toUpperCase();
873
+ switch (eventFilteringOption) {
874
+ // disabled filtering
875
+ case 'disable':
876
+ return false;
877
+ // Blacklist is chosen for filtering events
878
+ case 'blacklistedEvents':
879
+ if (Array.isArray(blacklistedEvents)) {
880
+ return blacklistedEvents.some(
881
+ eventObj => eventObj.eventName.trim().toUpperCase() === formattedEventName,
882
+ );
883
+ }
884
+ return false;
885
+
886
+ // Whitelist is chosen for filtering events
887
+ case 'whitelistedEvents':
888
+ if (Array.isArray(whitelistedEvents)) {
889
+ return !whitelistedEvents.some(
890
+ eventObj => eventObj.eventName.trim().toUpperCase() === formattedEventName,
891
+ );
892
+ }
893
+ return true;
894
+
895
+ default:
896
+ return false;
897
+ }
898
+ }
899
+
900
+ /**
901
+ * A function to determine whether SDK should use the integration option provided in load call
902
+ * @returns boolean
903
+ */
904
+ shouldUseGlobalIntegrationsConfigInEvents() {
905
+ return (
906
+ this.useGlobalIntegrationsConfigInEvents &&
907
+ this.loadOnlyIntegrations &&
908
+ Object.keys(this.loadOnlyIntegrations).length > 0
909
+ );
910
+ }
911
+
912
+ /**
913
+ * Process and send data to destinations along with rudder BE
914
+ *
915
+ * @param {*} type
916
+ * @param {*} rudderElement
917
+ * @param {*} callback
918
+ * @memberof Analytics
919
+ */
920
+ processAndSendDataToDestinations(type, rudderElement, options, callback) {
921
+ try {
922
+ if (!this.anonymousId) {
923
+ this.setAnonymousId();
924
+ }
925
+
926
+ // assign page properties to context
927
+ // rudderElement.message.context.page = getDefaultPageProperties();
928
+ this.errorReporting.leaveBreadcrumb('Started sending data to destinations');
929
+ rudderElement.message.context.traits = {
930
+ ...this.userTraits,
931
+ };
932
+
933
+ // logger.debug("anonymousId: ", this.anonymousId)
934
+ rudderElement.message.anonymousId = this.anonymousId;
935
+ rudderElement.message.userId = rudderElement.message.userId
936
+ ? rudderElement.message.userId
937
+ : this.userId;
938
+
939
+ if (type == 'group') {
940
+ if (this.groupId) {
941
+ rudderElement.message.groupId = this.groupId;
942
+ }
943
+ if (this.groupTraits) {
944
+ rudderElement.message.traits = {
945
+ ...this.groupTraits,
946
+ };
947
+ }
948
+ }
949
+ // If auto/manual session tracking is enabled sessionId will be sent in the context
950
+ try {
951
+ const { sessionId, sessionStart } = this.uSession.getSessionInfo();
952
+ rudderElement.message.context.sessionId = sessionId;
953
+ if (sessionStart) rudderElement.message.context.sessionStart = true;
954
+ } catch (e) {
955
+ handleError(e);
956
+ }
957
+ // If cookie consent is enabled attach the denied consent group Ids to the context
958
+ if (fetchCookieConsentState(this.cookieConsentOptions)) {
959
+ rudderElement.message.context.consentManagement = {
960
+ deniedConsentIds: this.deniedConsentIds || [],
961
+ };
962
+ }
963
+
964
+ this.processOptionsParam(rudderElement, options);
965
+ // logger.debug(JSON.stringify(rudderElement))
966
+
967
+ // check for reserved keys and log
968
+ checkReservedKeywords(rudderElement.message, type);
969
+
970
+ let clientSuppliedIntegrations = rudderElement.message.integrations;
971
+
972
+ if (clientSuppliedIntegrations) {
973
+ // structure user supplied integrations object to rudder format
974
+ transformToRudderNames(clientSuppliedIntegrations);
975
+ } else if (this.shouldUseGlobalIntegrationsConfigInEvents()) {
976
+ // when useGlobalIntegrationsConfigInEvents load option is set to true and integration object provided in load
977
+ // is not empty use it at event level
978
+ clientSuppliedIntegrations = this.loadOnlyIntegrations;
979
+ } else {
980
+ // if not specified at event level, use default integration option
981
+ clientSuppliedIntegrations = DEFAULT_INTEGRATIONS_CONFIG;
982
+ }
983
+
984
+ rudderElement.message.integrations = clientSuppliedIntegrations;
985
+
986
+ try {
987
+ rudderElement.message.context['ua-ch'] = this.uach;
988
+ } catch (err) {
989
+ handleError(err);
990
+ }
991
+ try {
992
+ // config plane native enabled destinations, still not completely loaded
993
+ // in the page, add the events to a queue and process later
994
+ if (!this.clientIntegrationObjects) {
995
+ // logger.debug("pushing in replay queue")
996
+ // new event processing after analytics initialized but integrations not fetched from BE
997
+ this.toBeProcessedByIntegrationArray.push([type, rudderElement]);
998
+ } else {
999
+ // get intersection between config plane native enabled destinations
1000
+ // (which were able to successfully load on the page) vs user supplied integrations
1001
+ const successfulLoadedIntersectClientSuppliedIntegrations = findAllEnabledDestinations(
1002
+ clientSuppliedIntegrations,
1003
+ this.clientIntegrationObjects,
1004
+ );
1005
+
1006
+ // try to first send to all integrations, if list populated from BE
1007
+ this.processAndSendEventsToDeviceMode(
1008
+ successfulLoadedIntersectClientSuppliedIntegrations,
1009
+ rudderElement,
1010
+ type,
1011
+ );
1012
+ }
1013
+ } catch (err) {
1014
+ handleError(err, `processAndSendEventsToDeviceMode::`);
1015
+ }
1016
+
1017
+ const clonedRudderElement = R.clone(rudderElement);
1018
+ // convert integrations object to server identified names, kind of hack now!
1019
+ transformToServerNames(clonedRudderElement.message.integrations);
1020
+
1021
+ // Holding the cloud mode events based on flag and integrations load check
1022
+ const shouldNotBufferDataPlaneEvents =
1023
+ !this.bufferDataPlaneEventsUntilReady || this.clientIntegrationObjects;
1024
+ if (shouldNotBufferDataPlaneEvents) {
1025
+ this.queueEventForDataPlane(type, clonedRudderElement);
1026
+ } else {
1027
+ this.preProcessQueue.enqueue(type, clonedRudderElement);
1028
+ }
1029
+
1030
+ // logger.debug(`${type} is called `)
1031
+ if (callback && typeof callback === 'function') {
1032
+ callback(clonedRudderElement);
1033
+ }
1034
+ } catch (error) {
1035
+ handleError(error);
1036
+ }
1037
+ }
1038
+
1039
+ utm(url) {
1040
+ const result = {};
1041
+ try {
1042
+ const urlObj = new URL(url);
1043
+ const UTM_PREFIX = 'utm_';
1044
+ urlObj.searchParams.forEach((value, sParam) => {
1045
+ if (sParam.startsWith(UTM_PREFIX)) {
1046
+ let utmParam = sParam.substring(UTM_PREFIX.length);
1047
+ // Not sure why we're doing this
1048
+ if (utmParam === 'campaign') {
1049
+ utmParam = 'name';
1050
+ }
1051
+ result[utmParam] = value;
1052
+ }
1053
+ });
1054
+ } catch (error) {
1055
+ // Do nothing
1056
+ }
1057
+ return result;
1058
+ }
1059
+
1060
+ /**
1061
+ * add campaign parsed details under context
1062
+ * @param {*} rudderElement
1063
+ */
1064
+ addCampaignInfo(rudderElement) {
1065
+ const msgContext = rudderElement.message.context;
1066
+ if (msgContext && typeof msgContext === 'object') {
1067
+ rudderElement.message.context.campaign = this.utm(window.location.href);
1068
+ }
1069
+ }
1070
+
1071
+ /**
1072
+ * process options parameter
1073
+ * Apart from top level keys merge everything under context
1074
+ * context.page's default properties are overridden by same keys of
1075
+ * provided properties in case of page call
1076
+ *
1077
+ * @param {*} rudderElement
1078
+ * @param {*} options
1079
+ * @memberof Analytics
1080
+ */
1081
+ processOptionsParam(rudderElement, options) {
1082
+ const { type, properties } = rudderElement.message;
1083
+
1084
+ this.addCampaignInfo(rudderElement);
1085
+
1086
+ // assign page properties to context.page
1087
+ // eslint-disable-next-line unicorn/consistent-destructuring
1088
+ rudderElement.message.context.page = this.getContextPageProperties(
1089
+ type === 'page' ? properties : undefined,
1090
+ );
1091
+ mergeTopLevelElementsMutator(rudderElement.message, options);
1092
+ rudderElement.message.context = mergeContext(rudderElement.message, options);
1093
+ }
1094
+
1095
+ getPageProperties(properties, options) {
1096
+ const defaultPageProperties = getDefaultPageProperties();
1097
+ const optionPageProperties = (options && options.page) || {};
1098
+ for (const key in defaultPageProperties) {
1099
+ if (properties[key] === undefined) {
1100
+ properties[key] = optionPageProperties[key] || defaultPageProperties[key];
1101
+ }
1102
+ }
1103
+ return properties;
1104
+ }
1105
+
1106
+ // Assign page properties to context.page if the same property is not provided under context.page
1107
+ getContextPageProperties(properties) {
1108
+ const defaultPageProperties = getDefaultPageProperties();
1109
+ const contextPageProperties = {};
1110
+ for (const key in defaultPageProperties) {
1111
+ contextPageProperties[key] =
1112
+ properties && properties[key] ? properties[key] : defaultPageProperties[key];
1113
+ }
1114
+ return contextPageProperties;
1115
+ }
1116
+
1117
+ /**
1118
+ * Clear user information
1119
+ *
1120
+ * @memberof Analytics
1121
+ */
1122
+ reset(flag) {
1123
+ this.errorReporting.leaveBreadcrumb(`reset API :: flag: ${flag}`);
1124
+
1125
+ if (!this.loaded) {
1126
+ this.toBeProcessedArray.push(['reset', flag]);
1127
+ return;
1128
+ }
1129
+ if (flag) {
1130
+ this.anonymousId = '';
1131
+ }
1132
+ this.userId = '';
1133
+ this.userTraits = {};
1134
+ this.groupId = '';
1135
+ this.groupTraits = {};
1136
+ this.uSession.reset();
1137
+ this.storage.clear(flag);
1138
+ }
1139
+
1140
+ getAnonymousId(anonymousIdOptions) {
1141
+ // if (!this.loaded) return;
1142
+ this.anonymousId = this.storage.getAnonymousId(anonymousIdOptions);
1143
+ if (!this.anonymousId) {
1144
+ this.setAnonymousId();
1145
+ }
1146
+ return this.anonymousId;
1147
+ }
1148
+
1149
+ getUserId() {
1150
+ return this.userId;
1151
+ }
1152
+
1153
+ getSessionId() {
1154
+ return this.uSession.getSessionId();
1155
+ }
1156
+
1157
+ getUserTraits() {
1158
+ return this.userTraits;
1159
+ }
1160
+
1161
+ getGroupId() {
1162
+ return this.groupId;
1163
+ }
1164
+
1165
+ getGroupTraits() {
1166
+ return this.groupTraits;
1167
+ }
1168
+
1169
+ /**
1170
+ * Sets anonymous id in the following precedence:
1171
+ * 1. anonymousId: Id directly provided to the function.
1172
+ * 2. rudderAmpLinkerParm: value generated from linker query parm (rudderstack)
1173
+ * using praseLinker util.
1174
+ * 3. generateUUID: A new unique id is generated and assigned.
1175
+ *
1176
+ * @param {string} anonymousId
1177
+ * @param {string} rudderAmpLinkerParm
1178
+ */
1179
+ setAnonymousId(anonymousId, rudderAmpLinkerParm) {
1180
+ // if (!this.loaded) return;
1181
+ const parsedAnonymousIdObj = rudderAmpLinkerParm ? parseLinker(rudderAmpLinkerParm) : null;
1182
+ const parsedAnonymousId = parsedAnonymousIdObj ? parsedAnonymousIdObj.rs_amp_id : null;
1183
+ this.anonymousId = anonymousId || parsedAnonymousId || generateUUID();
1184
+ this.storage.setAnonymousId(this.anonymousId);
1185
+ }
1186
+
1187
+ isValidWriteKey(writeKey) {
1188
+ return writeKey && typeof writeKey === 'string' && writeKey.trim().length > 0;
1189
+ }
1190
+
1191
+ isValidServerUrl(serverUrl) {
1192
+ return serverUrl && typeof serverUrl === 'string' && serverUrl.trim().length > 0;
1193
+ }
1194
+
1195
+ isDatasetAvailable() {
1196
+ const t = document.createElement('div');
1197
+ return t.setAttribute('data-a-b', 'c'), t.dataset ? t.dataset.aB === 'c' : false;
1198
+ }
1199
+
1200
+ /**
1201
+ * Load after polyfills are loaded
1202
+ * @param {*} writeKey
1203
+ * @param {*} serverUrl
1204
+ * @param {*} options
1205
+ * @returns
1206
+ */
1207
+ loadAfterPolyfill(writeKey, serverUrl, options) {
1208
+ if (typeof serverUrl === 'object' && serverUrl !== null) {
1209
+ options = serverUrl;
1210
+ serverUrl = null;
1211
+ }
1212
+ if (options && options.logLevel) {
1213
+ this.logLevel = options.logLevel;
1214
+ logger.setLogLevel(options.logLevel);
1215
+ }
1216
+ if (!this.isValidWriteKey(writeKey)) {
1217
+ throw Error('Unable to load the SDK due to invalid writeKey');
1218
+ }
1219
+ if (!this.storage || Object.keys(this.storage).length === 0) {
1220
+ throw Error('Cannot proceed as no storage is available');
1221
+ }
1222
+ if (options && options.cookieConsentManager)
1223
+ this.cookieConsentOptions = options.cookieConsentManager;
1224
+
1225
+ this.writeKey = writeKey;
1226
+ this.serverUrl = serverUrl;
1227
+ this.options = options;
1228
+
1229
+ let storageOptions = {};
1230
+
1231
+ if (options && options.setCookieDomain) {
1232
+ storageOptions = { ...storageOptions, domain: options.setCookieDomain };
1233
+ }
1234
+
1235
+ if (options && typeof options.secureCookie === 'boolean') {
1236
+ storageOptions = { ...storageOptions, secure: options.secureCookie };
1237
+ }
1238
+
1239
+ if (options && typeof options.sameDomainCookiesOnly === 'boolean') {
1240
+ storageOptions = { ...storageOptions, sameDomainCookiesOnly: options.sameDomainCookiesOnly };
1241
+ }
1242
+
1243
+ if (options && SAMESITE_COOKIE_OPTS.indexOf(options.sameSiteCookie) !== -1) {
1244
+ storageOptions = { ...storageOptions, samesite: options.sameSiteCookie };
1245
+ }
1246
+ this.storage.options(storageOptions);
1247
+
1248
+ const isUACHOptionAvailable =
1249
+ options &&
1250
+ typeof options.uaChTrackLevel === 'string' &&
1251
+ UA_CH_LEVELS.includes(options.uaChTrackLevel);
1252
+
1253
+ if (isUACHOptionAvailable) {
1254
+ this.uaChTrackLevel = options.uaChTrackLevel;
1255
+ }
1256
+
1257
+ if (navigator.userAgentData) {
1258
+ getUserAgentClientHint(uach => {
1259
+ this.uach = uach;
1260
+ }, this.uaChTrackLevel);
1261
+ }
1262
+
1263
+ if (options && options.integrations) {
1264
+ Object.assign(this.loadOnlyIntegrations, options.integrations);
1265
+ transformToRudderNames(this.loadOnlyIntegrations);
1266
+ }
1267
+
1268
+ this.useGlobalIntegrationsConfigInEvents =
1269
+ options && options.useGlobalIntegrationsConfigInEvents === true;
1270
+
1271
+ if (options && options.sendAdblockPage) {
1272
+ this.sendAdblockPage = true;
1273
+ }
1274
+ if (
1275
+ options &&
1276
+ options.sendAdblockPageOptions &&
1277
+ typeof options.sendAdblockPageOptions === 'object'
1278
+ ) {
1279
+ this.sendAdblockPageOptions = options.sendAdblockPageOptions;
1280
+ }
1281
+ // Session initialization
1282
+ this.uSession.initialize(options);
1283
+
1284
+ if (options && options.clientSuppliedCallbacks) {
1285
+ // convert to rudder recognized method names
1286
+ const transformedCallbackMapping = {};
1287
+ Object.keys(this.methodToCallbackMapping).forEach(methodName => {
1288
+ if (
1289
+ this.methodToCallbackMapping.hasOwnProperty(methodName) &&
1290
+ options.clientSuppliedCallbacks[this.methodToCallbackMapping[methodName]]
1291
+ ) {
1292
+ transformedCallbackMapping[methodName] =
1293
+ options.clientSuppliedCallbacks[this.methodToCallbackMapping[methodName]];
1294
+ }
1295
+ });
1296
+ Object.assign(this.clientSuppliedCallbacks, transformedCallbackMapping);
1297
+ this.registerCallbacks(true);
1298
+ }
1299
+
1300
+ if (options && options.loadIntegration != undefined) {
1301
+ this.loadIntegration = !!options.loadIntegration;
1302
+ }
1303
+
1304
+ if (options && typeof options.bufferDataPlaneEventsUntilReady === 'boolean') {
1305
+ this.bufferDataPlaneEventsUntilReady = options.bufferDataPlaneEventsUntilReady === true;
1306
+ if (this.bufferDataPlaneEventsUntilReady) {
1307
+ this.preProcessQueue.init(this.options, this.queueEventForDataPlane.bind(this));
1308
+ }
1309
+ }
1310
+
1311
+ if (options && typeof options.dataPlaneEventsBufferTimeout === 'number') {
1312
+ this.dataPlaneEventsBufferTimeout = options.dataPlaneEventsBufferTimeout;
1313
+ }
1314
+
1315
+ if (options && options.lockIntegrationsVersion !== undefined) {
1316
+ this.lockIntegrationsVersion = options.lockIntegrationsVersion === true;
1317
+ }
1318
+
1319
+ this.initializeUser(options ? options.anonymousIdOptions : undefined);
1320
+ this.setInitialPageProperties();
1321
+
1322
+ this.destSDKBaseURL = getIntegrationsCDNPath(
1323
+ this.version,
1324
+ this.lockIntegrationsVersion,
1325
+ options && options.destSDKBaseURL,
1326
+ );
1327
+
1328
+ if (options && options.getSourceConfig) {
1329
+ if (typeof options.getSourceConfig !== 'function') {
1330
+ handleError(new Error('option "getSourceConfig" must be a function'));
1331
+ } else {
1332
+ const res = options.getSourceConfig();
1333
+
1334
+ if (res instanceof Promise) {
1335
+ res.then(pRes => this.processResponse(200, pRes)).catch(handleError);
1336
+ } else {
1337
+ this.processResponse(200, res);
1338
+ }
1339
+ }
1340
+ return;
1341
+ }
1342
+
1343
+ let configUrl = getConfigUrl(writeKey, this.lockIntegrationsVersion);
1344
+ if (options && options.configUrl) {
1345
+ configUrl = getUserProvidedConfigUrl(options.configUrl, configUrl);
1346
+ }
1347
+
1348
+ try {
1349
+ getJSONTrimmed(this, configUrl, writeKey, this.processResponse);
1350
+ } catch (error) {
1351
+ handleError(error);
1352
+ }
1353
+ }
1354
+
1355
+ arePolyfillsRequired(options) {
1356
+ // check if the below features are available in the browser or not
1357
+ // If not present dynamically load from the polyfill cdn, unless
1358
+ // the options are configured not to.
1359
+ const polyfillIfRequired =
1360
+ options && typeof options.polyfillIfRequired === 'boolean'
1361
+ ? options.polyfillIfRequired
1362
+ : true;
1363
+ return (
1364
+ polyfillIfRequired &&
1365
+ (!String.prototype.endsWith ||
1366
+ !String.prototype.startsWith ||
1367
+ !String.prototype.includes ||
1368
+ !Array.prototype.find ||
1369
+ !Array.prototype.includes ||
1370
+ typeof window.URL !== 'function' ||
1371
+ typeof Promise === 'undefined' ||
1372
+ !Object.entries ||
1373
+ !Object.values ||
1374
+ !String.prototype.replaceAll ||
1375
+ !this.isDatasetAvailable() ||
1376
+ typeof TextDecoder !== 'function' ||
1377
+ typeof TextEncoder !== 'function')
1378
+ );
1379
+ }
1380
+
1381
+ /**
1382
+ * Call control pane to get client configs
1383
+ *
1384
+ * @param {*} writeKey
1385
+ * @memberof Analytics
1386
+ */
1387
+ load(writeKey, serverUrl, options) {
1388
+ // logger.debug("inside load ");
1389
+ if (this.loaded) return;
1390
+
1391
+ // clone options
1392
+ const clonedOptions = R.clone(options);
1393
+ if (this.arePolyfillsRequired(clonedOptions) && POLYFILL_URL) {
1394
+ const id = 'polyfill';
1395
+ ScriptLoader(id, POLYFILL_URL, { skipDatasetAttributes: true });
1396
+ const self = this;
1397
+ const interval = setInterval(() => {
1398
+ // check if the polyfill is loaded
1399
+ // In chrome 83 and below versions ID of a script is not part of window's scope
1400
+ // even though it is loaded and returns false for <window.hasOwnProperty("polyfill")> this.
1401
+ // So, added another checking to fulfill that purpose.
1402
+ if (
1403
+ (window.hasOwnProperty(id) || document.getElementById(id) !== null) &&
1404
+ typeof Promise !== 'undefined'
1405
+ ) {
1406
+ clearInterval(interval);
1407
+ self.loadAfterPolyfill(writeKey, serverUrl, clonedOptions);
1408
+ }
1409
+ }, 100);
1410
+
1411
+ setTimeout(() => {
1412
+ clearInterval(interval);
1413
+ }, MAX_WAIT_FOR_INTEGRATION_LOAD);
1414
+ } else {
1415
+ this.loadAfterPolyfill(writeKey, serverUrl, clonedOptions);
1416
+ }
1417
+ }
1418
+
1419
+ ready(callback) {
1420
+ if (!this.loaded) {
1421
+ this.toBeProcessedArray.push(['ready', callback]);
1422
+ return;
1423
+ }
1424
+ if (typeof callback === 'function') {
1425
+ /**
1426
+ * If integrations are loaded or no integration is available for loading
1427
+ * execute the callback immediately
1428
+ * else push the callbacks to a queue that will be executed after loading completes
1429
+ */
1430
+ if (this.clientIntegrationsReady) {
1431
+ callback();
1432
+ } else {
1433
+ this.readyCallbacks.push(callback);
1434
+ }
1435
+ return;
1436
+ }
1437
+ logger.error('ready callback is not a function');
1438
+ }
1439
+
1440
+ initializeCallbacks() {
1441
+ Object.keys(this.methodToCallbackMapping).forEach(methodName => {
1442
+ if (this.methodToCallbackMapping.hasOwnProperty(methodName)) {
1443
+ this.on(methodName, () => {});
1444
+ }
1445
+ });
1446
+ }
1447
+
1448
+ registerCallbacks(calledFromLoad) {
1449
+ if (!calledFromLoad) {
1450
+ Object.keys(this.methodToCallbackMapping).forEach(methodName => {
1451
+ if (
1452
+ this.methodToCallbackMapping.hasOwnProperty(methodName) &&
1453
+ window.rudderanalytics &&
1454
+ typeof window.rudderanalytics[this.methodToCallbackMapping[methodName]] === 'function'
1455
+ ) {
1456
+ this.clientSuppliedCallbacks[methodName] =
1457
+ window.rudderanalytics[this.methodToCallbackMapping[methodName]];
1458
+ }
1459
+ // let callback =
1460
+ // ? typeof window.rudderanalytics[
1461
+ // this.methodToCallbackMapping[methodName]
1462
+ // ] == "function"
1463
+ // ? window.rudderanalytics[this.methodToCallbackMapping[methodName]]
1464
+ // : () => {}
1465
+ // : () => {};
1466
+
1467
+ // logger.debug("registerCallbacks", methodName, callback);
1468
+
1469
+ // this.on(methodName, callback);
1470
+ });
1471
+ }
1472
+
1473
+ Object.keys(this.clientSuppliedCallbacks).forEach(methodName => {
1474
+ if (this.clientSuppliedCallbacks.hasOwnProperty(methodName)) {
1475
+ // logger.debug(
1476
+ // "registerCallbacks",
1477
+ // methodName,
1478
+ // this.clientSuppliedCallbacks[methodName]
1479
+ // );
1480
+ this.on(methodName, this.clientSuppliedCallbacks[methodName]);
1481
+ }
1482
+ });
1483
+ }
1484
+
1485
+ sendSampleRequest() {
1486
+ // eslint-disable-next-line no-constant-condition
1487
+ if (!'__RS_GOOGLE_ADS_SDK_URL__') {
1488
+ return;
1489
+ }
1490
+
1491
+ ScriptLoader('ad-block', '__RS_GOOGLE_ADS_SDK_URL__', {
1492
+ isNonNativeSDK: true,
1493
+ });
1494
+ }
1495
+
1496
+ /**
1497
+ * A public method to start a session
1498
+ * @param {string} sessionId session identifier
1499
+ * @returns
1500
+ */
1501
+ startSession(sessionId) {
1502
+ this.uSession.start(sessionId);
1503
+ }
1504
+
1505
+ /**
1506
+ * A public method to end an ongoing session.
1507
+ */
1508
+ endSession() {
1509
+ this.uSession.end();
1510
+ }
1511
+
1512
+ setAuthToken(token) {
1513
+ if (typeof token !== 'string') {
1514
+ logger.error('Provided input should be in string format');
1515
+ return;
1516
+ }
1517
+ this.storage.setAuthToken(token);
1518
+ this.transformationHandler.setAuthToken(token);
1519
+ }
1520
+ }
1521
+
1522
+ const instance = new Analytics();
1523
+
1524
+ function processDataInAnalyticsArray(analytics) {
1525
+ if (analytics.toBeProcessedArray.length > 0) {
1526
+ while (analytics.toBeProcessedArray.length > 0) {
1527
+ const event = [...analytics.toBeProcessedArray[0]];
1528
+
1529
+ // remove the element from the queue
1530
+ analytics.toBeProcessedArray.shift();
1531
+
1532
+ const method = event[0];
1533
+ event.shift();
1534
+ // logger.debug("=====from analytics array, calling method:: ", method)
1535
+ analytics[method](...event);
1536
+ }
1537
+ }
1538
+ }
1539
+
1540
+ /**
1541
+ * parse the given url into usable Rudder object
1542
+ * @param {*} url
1543
+ */
1544
+ function retrieveEventsFromQueryString(url) {
1545
+ const queryDefaults = {
1546
+ trait: 'ajs_trait_',
1547
+ prop: 'ajs_prop_',
1548
+ };
1549
+
1550
+ function getDataFromQueryObj(qObj, dataType) {
1551
+ const data = {};
1552
+ Object.keys(qObj).forEach(key => {
1553
+ if (key.startsWith(dataType)) {
1554
+ data[key.substr(dataType.length)] = qObj[key];
1555
+ }
1556
+ });
1557
+ return data;
1558
+ }
1559
+
1560
+ const queryObject = parseQueryString(url);
1561
+ if (queryObject.ajs_aid) {
1562
+ instance.toBeProcessedArray.push(['setAnonymousId', queryObject.ajs_aid]);
1563
+ }
1564
+
1565
+ if (queryObject.ajs_uid) {
1566
+ instance.toBeProcessedArray.push([
1567
+ 'identify',
1568
+ queryObject.ajs_uid,
1569
+ getDataFromQueryObj(queryObject, queryDefaults.trait),
1570
+ ]);
1571
+ }
1572
+
1573
+ if (queryObject.ajs_event) {
1574
+ instance.toBeProcessedArray.push([
1575
+ 'track',
1576
+ queryObject.ajs_event,
1577
+ getDataFromQueryObj(queryObject, queryDefaults.prop),
1578
+ ]);
1579
+ }
1580
+ }
1581
+
1582
+ Emitter(instance);
1583
+
1584
+ window.addEventListener(
1585
+ 'error',
1586
+ e => {
1587
+ handleError(e, undefined, instance);
1588
+ },
1589
+ true,
1590
+ );
1591
+
1592
+ // initialize supported callbacks
1593
+ instance.initializeCallbacks();
1594
+
1595
+ // register supported callbacks
1596
+ instance.registerCallbacks(false);
1597
+
1598
+ const defaultMethod = 'load';
1599
+ const argumentsArray = window.rudderanalytics;
1600
+ const isValidArgsArray = Array.isArray(argumentsArray);
1601
+ let defaultEvent;
1602
+ if (isValidArgsArray) {
1603
+ /**
1604
+ * Iterate the buffered API calls until we find load call and
1605
+ * queue it first for processing
1606
+ */
1607
+ let i = 0;
1608
+ while (i < argumentsArray.length) {
1609
+ if (argumentsArray[i] && argumentsArray[i][0] === defaultMethod) {
1610
+ defaultEvent = argumentsArray[i];
1611
+ argumentsArray.splice(i, 1);
1612
+ break;
1613
+ }
1614
+ i += 1;
1615
+ }
1616
+ }
1617
+
1618
+ // parse querystring of the page url to send events
1619
+ retrieveEventsFromQueryString(window.location.href);
1620
+
1621
+ if (isValidArgsArray) argumentsArray.forEach(x => instance.toBeProcessedArray.push(x));
1622
+
1623
+ // Process load method if present in the buffered requests
1624
+ if (defaultEvent && defaultEvent.length > 0) {
1625
+ defaultEvent.shift();
1626
+ instance[defaultMethod](...defaultEvent);
1627
+ }
1628
+
1629
+ const ready = instance.ready.bind(instance);
1630
+ const identify = instance.identify.bind(instance);
1631
+ const page = instance.page.bind(instance);
1632
+ const track = instance.track.bind(instance);
1633
+ const alias = instance.alias.bind(instance);
1634
+ const group = instance.group.bind(instance);
1635
+ const reset = instance.reset.bind(instance);
1636
+ const load = instance.load.bind(instance);
1637
+ const initialized = (instance.initialized = true);
1638
+ const getUserId = instance.getUserId.bind(instance);
1639
+ const getSessionId = instance.getSessionId.bind(instance);
1640
+ const getUserTraits = instance.getUserTraits.bind(instance);
1641
+ const getAnonymousId = instance.getAnonymousId.bind(instance);
1642
+ const setAnonymousId = instance.setAnonymousId.bind(instance);
1643
+ const getGroupId = instance.getGroupId.bind(instance);
1644
+ const getGroupTraits = instance.getGroupTraits.bind(instance);
1645
+ const startSession = instance.startSession.bind(instance);
1646
+ const endSession = instance.endSession.bind(instance);
1647
+ const setAuthToken = instance.setAuthToken.bind(instance);
1648
+
1649
+ export {
1650
+ initialized,
1651
+ ready,
1652
+ page,
1653
+ track,
1654
+ load,
1655
+ identify,
1656
+ reset,
1657
+ alias,
1658
+ group,
1659
+ getUserId,
1660
+ getSessionId,
1661
+ getUserTraits,
1662
+ getAnonymousId,
1663
+ setAnonymousId,
1664
+ getGroupId,
1665
+ getGroupTraits,
1666
+ startSession,
1667
+ endSession,
1668
+ setAuthToken,
1669
+ };