iureiure 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.editorconfig +21 -0
- package/.env.example +8 -0
- package/.eslintignore +19 -0
- package/.eslintrc.json +155 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +50 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- package/.github/dependabot.yml +6 -0
- package/.github/pull_request_template.md +23 -0
- package/.github/workflows/build-and-quality-checks-v3.yml +51 -0
- package/.github/workflows/check_pr_title.yml +17 -0
- package/.github/workflows/codeql-analysis.yml +70 -0
- package/.github/workflows/create-hotfix-branch-v3.yml +21 -0
- package/.github/workflows/deploy-beta-v3.yml +82 -0
- package/.github/workflows/deploy-dev-v3.yml +71 -0
- package/.github/workflows/deploy-npm-v3.yml +169 -0
- package/.github/workflows/deploy-prod-v3.yml +194 -0
- package/.github/workflows/deploy-sanity-suite.yml +80 -0
- package/.github/workflows/deploy-staging-v3.yml +99 -0
- package/.github/workflows/draft-new-release-v3.yml +103 -0
- package/.github/workflows/housekeeping.yaml +40 -0
- package/.github/workflows/publish-new-release-v3.yml +136 -0
- package/.github/workflows/rollback-v3.yml +190 -0
- package/.github/workflows/test-v3.yml +60 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.jscpd.json +17 -0
- package/.nvmrc +1 -0
- package/.nxignore +3 -0
- package/.prettierignore +18 -0
- package/.prettierrc +13 -0
- package/.versionrc +8 -0
- package/CODEOWNERS +2 -0
- package/__mocks__/BraveBrowser.js +9 -0
- package/assets/integrations/AdobeAnalytics/adobe-analytics-js-heartbeat.js +193 -0
- package/assets/integrations/AdobeAnalytics/adobe-analytics-js.js +116 -0
- package/assets/rs-logo-full-light.jpg +0 -0
- package/babel.config.json +14 -0
- package/commitlint.config.js +27 -0
- package/examples/angular/sample-app/.editorconfig +16 -0
- package/examples/angular/sample-app/README.md +27 -0
- package/examples/angular/sample-app/angular.json +83 -0
- package/examples/angular/sample-app/package-lock.json +12552 -0
- package/examples/angular/sample-app/package.json +39 -0
- package/examples/angular/sample-app/src/app/app-routing.module.ts +10 -0
- package/examples/angular/sample-app/src/app/app.component.css +0 -0
- package/examples/angular/sample-app/src/app/app.component.html +508 -0
- package/examples/angular/sample-app/src/app/app.component.spec.ts +33 -0
- package/examples/angular/sample-app/src/app/app.component.ts +104 -0
- package/examples/angular/sample-app/src/app/app.module.ts +12 -0
- package/examples/angular/sample-app/src/assets/.gitkeep +0 -0
- package/examples/angular/sample-app/src/favicon.ico +0 -0
- package/examples/angular/sample-app/src/index.html +45 -0
- package/examples/angular/sample-app/src/main.ts +7 -0
- package/examples/angular/sample-app/src/styles.css +1 -0
- package/examples/angular/sample-app/tsconfig.app.json +10 -0
- package/examples/angular/sample-app/tsconfig.json +30 -0
- package/examples/angular/sample-app/tsconfig.spec.json +9 -0
- package/examples/chrome-extension/USAGE.md +140 -0
- package/examples/chrome-extension/background-script/LICENSE +21 -0
- package/examples/chrome-extension/background-script/README.md +105 -0
- package/examples/chrome-extension/background-script/foreground.js +7 -0
- package/examples/chrome-extension/background-script/logo/logo-128.png +0 -0
- package/examples/chrome-extension/background-script/logo/logo-16.png +0 -0
- package/examples/chrome-extension/background-script/logo/logo-48.png +0 -0
- package/examples/chrome-extension/background-script/logo/logo.svg +138 -0
- package/examples/chrome-extension/background-script/manifest.json +36 -0
- package/examples/chrome-extension/background-script/popup/popup.css +11 -0
- package/examples/chrome-extension/background-script/popup/popup.html +11 -0
- package/examples/chrome-extension/background-script/rudderAnalytics.js +5133 -0
- package/examples/chrome-extension/background-script/service-worker.js +28 -0
- package/examples/chrome-extension/background-script/settings/settings.css +8 -0
- package/examples/chrome-extension/background-script/settings/settings.html +12 -0
- package/examples/chrome-extension/background-script-websockets/LICENSE +21 -0
- package/examples/chrome-extension/background-script-websockets/README.md +101 -0
- package/examples/chrome-extension/background-script-websockets/foreground.js +7 -0
- package/examples/chrome-extension/background-script-websockets/logo/logo-128.png +0 -0
- package/examples/chrome-extension/background-script-websockets/logo/logo-16.png +0 -0
- package/examples/chrome-extension/background-script-websockets/logo/logo-48.png +0 -0
- package/examples/chrome-extension/background-script-websockets/logo/logo.svg +138 -0
- package/examples/chrome-extension/background-script-websockets/manifest.json +37 -0
- package/examples/chrome-extension/background-script-websockets/popup/popup.css +11 -0
- package/examples/chrome-extension/background-script-websockets/popup/popup.html +11 -0
- package/examples/chrome-extension/background-script-websockets/rudderAnalytics.js +5133 -0
- package/examples/chrome-extension/background-script-websockets/service-worker.js +60 -0
- package/examples/chrome-extension/background-script-websockets/settings/settings.css +8 -0
- package/examples/chrome-extension/background-script-websockets/settings/settings.html +12 -0
- package/examples/chrome-extension/content-script-v1.1/LICENSE +21 -0
- package/examples/chrome-extension/content-script-v1.1/README.md +105 -0
- package/examples/chrome-extension/content-script-v1.1/foreground.js +65 -0
- package/examples/chrome-extension/content-script-v1.1/logo/logo-128.png +0 -0
- package/examples/chrome-extension/content-script-v1.1/logo/logo-16.png +0 -0
- package/examples/chrome-extension/content-script-v1.1/logo/logo-48.png +0 -0
- package/examples/chrome-extension/content-script-v1.1/logo/logo.svg +138 -0
- package/examples/chrome-extension/content-script-v1.1/manifest.json +35 -0
- package/examples/chrome-extension/content-script-v1.1/popup/popup.css +11 -0
- package/examples/chrome-extension/content-script-v1.1/popup/popup.html +11 -0
- package/examples/chrome-extension/content-script-v1.1/service-worker-utils.js +17 -0
- package/examples/chrome-extension/content-script-v1.1/service-worker.js +12 -0
- package/examples/chrome-extension/content-script-v1.1/settings/settings.css +8 -0
- package/examples/chrome-extension/content-script-v1.1/settings/settings.html +12 -0
- package/examples/chrome-extension/content-script-v3/LICENSE +21 -0
- package/examples/chrome-extension/content-script-v3/README.md +105 -0
- package/examples/chrome-extension/content-script-v3/foreground.js +3875 -0
- package/examples/chrome-extension/content-script-v3/logo/logo-128.png +0 -0
- package/examples/chrome-extension/content-script-v3/logo/logo-16.png +0 -0
- package/examples/chrome-extension/content-script-v3/logo/logo-48.png +0 -0
- package/examples/chrome-extension/content-script-v3/logo/logo.svg +138 -0
- package/examples/chrome-extension/content-script-v3/manifest.json +35 -0
- package/examples/chrome-extension/content-script-v3/popup/popup.css +11 -0
- package/examples/chrome-extension/content-script-v3/popup/popup.html +11 -0
- package/examples/chrome-extension/content-script-v3/service-worker-utils.js +17 -0
- package/examples/chrome-extension/content-script-v3/service-worker.js +12 -0
- package/examples/chrome-extension/content-script-v3/settings/settings.css +8 -0
- package/examples/chrome-extension/content-script-v3/settings/settings.html +12 -0
- package/examples/chrome-extension/websocket-server/server.mjs +19 -0
- package/examples/gatsby/sample-gatsby-plugin-usage/README.md +49 -0
- package/examples/gatsby/sample-gatsby-plugin-usage/gatsby-config.ts +27 -0
- package/examples/gatsby/sample-gatsby-plugin-usage/package-lock.json +16070 -0
- package/examples/gatsby/sample-gatsby-plugin-usage/package.json +31 -0
- package/examples/gatsby/sample-gatsby-plugin-usage/src/images/icon.png +0 -0
- package/examples/gatsby/sample-gatsby-plugin-usage/src/pages/404.tsx +49 -0
- package/examples/gatsby/sample-gatsby-plugin-usage/src/pages/index.tsx +193 -0
- package/examples/gatsby/sample-gatsby-plugin-usage/tsconfig.json +105 -0
- package/examples/gatsby/sample-gatsby-site/README.md +49 -0
- package/examples/gatsby/sample-gatsby-site/gatsby-config.ts +15 -0
- package/examples/gatsby/sample-gatsby-site/package-lock.json +15916 -0
- package/examples/gatsby/sample-gatsby-site/package.json +37 -0
- package/examples/gatsby/sample-gatsby-site/src/images/icon.png +0 -0
- package/examples/gatsby/sample-gatsby-site/src/pages/404.tsx +49 -0
- package/examples/gatsby/sample-gatsby-site/src/pages/index.tsx +209 -0
- package/examples/gatsby/sample-gatsby-site/tsconfig.json +105 -0
- package/examples/html/autotrack-test.html +94 -0
- package/examples/html/ecomm_test.html +358 -0
- package/examples/html/script-test.html +968 -0
- package/examples/html/segment.html +177 -0
- package/examples/html/test_poster.jpg +0 -0
- package/examples/nextjs/hooks/sample-app/.eslintrc.json +3 -0
- package/examples/nextjs/hooks/sample-app/README.md +36 -0
- package/examples/nextjs/hooks/sample-app/next.config.js +4 -0
- package/examples/nextjs/hooks/sample-app/package-lock.json +4766 -0
- package/examples/nextjs/hooks/sample-app/package.json +28 -0
- package/examples/nextjs/hooks/sample-app/postcss.config.js +6 -0
- package/examples/nextjs/hooks/sample-app/public/next.svg +1 -0
- package/examples/nextjs/hooks/sample-app/public/vercel.svg +1 -0
- package/examples/nextjs/hooks/sample-app/src/app/favicon.ico +0 -0
- package/examples/nextjs/hooks/sample-app/src/app/globals.css +27 -0
- package/examples/nextjs/hooks/sample-app/src/app/layout.tsx +55 -0
- package/examples/nextjs/hooks/sample-app/src/app/page.tsx +137 -0
- package/examples/nextjs/hooks/sample-app/src/app/useRudderAnalytics.ts +29 -0
- package/examples/nextjs/hooks/sample-app/tailwind.config.ts +19 -0
- package/examples/nextjs/hooks/sample-app/tsconfig.json +27 -0
- package/examples/nextjs/js/sample-app/.eslintrc.json +3 -0
- package/examples/nextjs/js/sample-app/README.md +36 -0
- package/examples/nextjs/js/sample-app/jsconfig.json +7 -0
- package/examples/nextjs/js/sample-app/next.config.js +4 -0
- package/examples/nextjs/js/sample-app/package-lock.json +4710 -0
- package/examples/nextjs/js/sample-app/package.json +24 -0
- package/examples/nextjs/js/sample-app/postcss.config.js +6 -0
- package/examples/nextjs/js/sample-app/public/next.svg +1 -0
- package/examples/nextjs/js/sample-app/public/vercel.svg +1 -0
- package/examples/nextjs/js/sample-app/src/app/favicon.ico +0 -0
- package/examples/nextjs/js/sample-app/src/app/globals.css +27 -0
- package/examples/nextjs/js/sample-app/src/app/layout.js +54 -0
- package/examples/nextjs/js/sample-app/src/app/page.js +146 -0
- package/examples/nextjs/js/sample-app/tailwind.config.js +17 -0
- package/examples/nextjs/page-router/sample-app/.eslintrc.json +3 -0
- package/examples/nextjs/page-router/sample-app/README.md +40 -0
- package/examples/nextjs/page-router/sample-app/next.config.js +6 -0
- package/examples/nextjs/page-router/sample-app/package-lock.json +4270 -0
- package/examples/nextjs/page-router/sample-app/package.json +28 -0
- package/examples/nextjs/page-router/sample-app/postcss.config.js +6 -0
- package/examples/nextjs/page-router/sample-app/public/favicon.ico +0 -0
- package/examples/nextjs/page-router/sample-app/public/next.svg +1 -0
- package/examples/nextjs/page-router/sample-app/public/vercel.svg +1 -0
- package/examples/nextjs/page-router/sample-app/src/pages/_app.tsx +35 -0
- package/examples/nextjs/page-router/sample-app/src/pages/_document.tsx +49 -0
- package/examples/nextjs/page-router/sample-app/src/pages/api/hello.ts +10 -0
- package/examples/nextjs/page-router/sample-app/src/pages/index.tsx +138 -0
- package/examples/nextjs/page-router/sample-app/src/pages/page2.tsx +18 -0
- package/examples/nextjs/page-router/sample-app/src/styles/globals.css +27 -0
- package/examples/nextjs/page-router/sample-app/src/useRudderAnalytics.ts +29 -0
- package/examples/nextjs/page-router/sample-app/tailwind.config.ts +19 -0
- package/examples/nextjs/page-router/sample-app/tsconfig.json +22 -0
- package/examples/nextjs/ts/sample-app/.eslintrc.json +3 -0
- package/examples/nextjs/ts/sample-app/README.md +36 -0
- package/examples/nextjs/ts/sample-app/next.config.js +4 -0
- package/examples/nextjs/ts/sample-app/package-lock.json +4766 -0
- package/examples/nextjs/ts/sample-app/package.json +28 -0
- package/examples/nextjs/ts/sample-app/postcss.config.js +6 -0
- package/examples/nextjs/ts/sample-app/public/next.svg +1 -0
- package/examples/nextjs/ts/sample-app/public/vercel.svg +1 -0
- package/examples/nextjs/ts/sample-app/src/app/favicon.ico +0 -0
- package/examples/nextjs/ts/sample-app/src/app/globals.css +27 -0
- package/examples/nextjs/ts/sample-app/src/app/layout.tsx +55 -0
- package/examples/nextjs/ts/sample-app/src/app/page.tsx +147 -0
- package/examples/nextjs/ts/sample-app/tailwind.config.ts +19 -0
- package/examples/nextjs/ts/sample-app/tsconfig.json +27 -0
- package/examples/reactjs/hooks/sample-app/README.md +46 -0
- package/examples/reactjs/hooks/sample-app/package-lock.json +16203 -0
- package/examples/reactjs/hooks/sample-app/package.json +47 -0
- package/examples/reactjs/hooks/sample-app/public/favicon.ico +0 -0
- package/examples/reactjs/hooks/sample-app/public/index.html +75 -0
- package/examples/reactjs/hooks/sample-app/public/logo192.png +0 -0
- package/examples/reactjs/hooks/sample-app/public/logo512.png +0 -0
- package/examples/reactjs/hooks/sample-app/public/manifest.json +25 -0
- package/examples/reactjs/hooks/sample-app/public/robots.txt +3 -0
- package/examples/reactjs/hooks/sample-app/src/App.css +38 -0
- package/examples/reactjs/hooks/sample-app/src/App.test.tsx +9 -0
- package/examples/reactjs/hooks/sample-app/src/App.tsx +95 -0
- package/examples/reactjs/hooks/sample-app/src/index.css +32 -0
- package/examples/reactjs/hooks/sample-app/src/index.tsx +19 -0
- package/examples/reactjs/hooks/sample-app/src/logo.svg +1 -0
- package/examples/reactjs/hooks/sample-app/src/react-app-env.d.ts +1 -0
- package/examples/reactjs/hooks/sample-app/src/reportWebVitals.ts +15 -0
- package/examples/reactjs/hooks/sample-app/src/setupTests.ts +5 -0
- package/examples/reactjs/hooks/sample-app/src/useRudderAnalytics.ts +23 -0
- package/examples/reactjs/hooks/sample-app/tsconfig.json +20 -0
- package/examples/reactjs/js/sample-app/README.md +70 -0
- package/examples/reactjs/js/sample-app/package-lock.json +17665 -0
- package/examples/reactjs/js/sample-app/package.json +42 -0
- package/examples/reactjs/js/sample-app/public/favicon.ico +0 -0
- package/examples/reactjs/js/sample-app/public/index.html +75 -0
- package/examples/reactjs/js/sample-app/public/logo192.png +0 -0
- package/examples/reactjs/js/sample-app/public/logo512.png +0 -0
- package/examples/reactjs/js/sample-app/public/manifest.json +25 -0
- package/examples/reactjs/js/sample-app/public/robots.txt +3 -0
- package/examples/reactjs/js/sample-app/src/App.css +38 -0
- package/examples/reactjs/js/sample-app/src/App.js +101 -0
- package/examples/reactjs/js/sample-app/src/App.test.js +8 -0
- package/examples/reactjs/js/sample-app/src/index.css +34 -0
- package/examples/reactjs/js/sample-app/src/index.js +17 -0
- package/examples/reactjs/js/sample-app/src/logo.svg +1 -0
- package/examples/reactjs/js/sample-app/src/reportWebVitals.js +13 -0
- package/examples/reactjs/js/sample-app/src/setupTests.js +5 -0
- package/examples/reactjs/ts/sample-app/README.md +46 -0
- package/examples/reactjs/ts/sample-app/package-lock.json +17653 -0
- package/examples/reactjs/ts/sample-app/package.json +47 -0
- package/examples/reactjs/ts/sample-app/public/favicon.ico +0 -0
- package/examples/reactjs/ts/sample-app/public/index.html +75 -0
- package/examples/reactjs/ts/sample-app/public/logo192.png +0 -0
- package/examples/reactjs/ts/sample-app/public/logo512.png +0 -0
- package/examples/reactjs/ts/sample-app/public/manifest.json +25 -0
- package/examples/reactjs/ts/sample-app/public/robots.txt +3 -0
- package/examples/reactjs/ts/sample-app/src/App.css +38 -0
- package/examples/reactjs/ts/sample-app/src/App.test.tsx +9 -0
- package/examples/reactjs/ts/sample-app/src/App.tsx +101 -0
- package/examples/reactjs/ts/sample-app/src/index.css +34 -0
- package/examples/reactjs/ts/sample-app/src/index.tsx +19 -0
- package/examples/reactjs/ts/sample-app/src/logo.svg +1 -0
- package/examples/reactjs/ts/sample-app/src/react-app-env.d.ts +1 -0
- package/examples/reactjs/ts/sample-app/src/reportWebVitals.ts +15 -0
- package/examples/reactjs/ts/sample-app/src/setupTests.ts +5 -0
- package/examples/reactjs/ts/sample-app/tsconfig.json +20 -0
- package/examples/reactjs/vite/sample-app/.eslintrc.cjs +18 -0
- package/examples/reactjs/vite/sample-app/README.md +27 -0
- package/examples/reactjs/vite/sample-app/index.html +45 -0
- package/examples/reactjs/vite/sample-app/package-lock.json +3427 -0
- package/examples/reactjs/vite/sample-app/package.json +29 -0
- package/examples/reactjs/vite/sample-app/public/vite.svg +1 -0
- package/examples/reactjs/vite/sample-app/src/App.css +42 -0
- package/examples/reactjs/vite/sample-app/src/App.tsx +105 -0
- package/examples/reactjs/vite/sample-app/src/assets/react.svg +1 -0
- package/examples/reactjs/vite/sample-app/src/index.css +70 -0
- package/examples/reactjs/vite/sample-app/src/main.tsx +10 -0
- package/examples/reactjs/vite/sample-app/src/vite-env.d.ts +1 -0
- package/examples/reactjs/vite/sample-app/tsconfig.json +25 -0
- package/examples/reactjs/vite/sample-app/tsconfig.node.json +10 -0
- package/examples/reactjs/vite/sample-app/vite.config.ts +7 -0
- package/examples/serverless/USAGE.md +85 -0
- package/examples/serverless/cloudflare-worker/.editorconfig +13 -0
- package/examples/serverless/cloudflare-worker/.prettierrc +6 -0
- package/examples/serverless/cloudflare-worker/package-lock.json +2646 -0
- package/examples/serverless/cloudflare-worker/package.json +18 -0
- package/examples/serverless/cloudflare-worker/src/worker.js +54 -0
- package/examples/serverless/cloudflare-worker/wrangler.toml +52 -0
- package/examples/serverless/vercel-edge/.eslintrc.json +3 -0
- package/examples/serverless/vercel-edge/README.md +34 -0
- package/examples/serverless/vercel-edge/app/api/edge-function-example/route.ts +32 -0
- package/examples/serverless/vercel-edge/app/favicon.ico +0 -0
- package/examples/serverless/vercel-edge/app/globals.css +27 -0
- package/examples/serverless/vercel-edge/app/layout.tsx +22 -0
- package/examples/serverless/vercel-edge/app/page.tsx +113 -0
- package/examples/serverless/vercel-edge/next.config.js +4 -0
- package/examples/serverless/vercel-edge/package-lock.json +5351 -0
- package/examples/serverless/vercel-edge/package.json +26 -0
- package/examples/serverless/vercel-edge/postcss.config.js +6 -0
- package/examples/serverless/vercel-edge/public/next.svg +1 -0
- package/examples/serverless/vercel-edge/public/vercel.svg +1 -0
- package/examples/serverless/vercel-edge/tailwind.config.ts +19 -0
- package/examples/serverless/vercel-edge/tsconfig.json +27 -0
- package/examples/symfony/USAGE.md +57 -0
- package/examples/symfony/sample/.env.test +6 -0
- package/examples/symfony/sample/assets/app.js +15 -0
- package/examples/symfony/sample/assets/styles/app.css +3 -0
- package/examples/symfony/sample/compose.override.yaml +14 -0
- package/examples/symfony/sample/compose.yaml +21 -0
- package/examples/symfony/sample/composer.json +104 -0
- package/examples/symfony/sample/composer.lock +9921 -0
- package/examples/symfony/sample/config/bundles.php +15 -0
- package/examples/symfony/sample/config/packages/cache.yaml +19 -0
- package/examples/symfony/sample/config/packages/debug.yaml +5 -0
- package/examples/symfony/sample/config/packages/doctrine.yaml +43 -0
- package/examples/symfony/sample/config/packages/doctrine_migrations.yaml +6 -0
- package/examples/symfony/sample/config/packages/framework.yaml +24 -0
- package/examples/symfony/sample/config/packages/mailer.yaml +3 -0
- package/examples/symfony/sample/config/packages/messenger.yaml +24 -0
- package/examples/symfony/sample/config/packages/monolog.yaml +61 -0
- package/examples/symfony/sample/config/packages/notifier.yaml +12 -0
- package/examples/symfony/sample/config/packages/routing.yaml +12 -0
- package/examples/symfony/sample/config/packages/security.yaml +40 -0
- package/examples/symfony/sample/config/packages/translation.yaml +13 -0
- package/examples/symfony/sample/config/packages/twig.yaml +6 -0
- package/examples/symfony/sample/config/packages/validator.yaml +13 -0
- package/examples/symfony/sample/config/packages/web_profiler.yaml +15 -0
- package/examples/symfony/sample/config/packages/webpack_encore.yaml +45 -0
- package/examples/symfony/sample/config/preload.php +5 -0
- package/examples/symfony/sample/config/routes/framework.yaml +4 -0
- package/examples/symfony/sample/config/routes/web_profiler.yaml +8 -0
- package/examples/symfony/sample/config/routes.yaml +7 -0
- package/examples/symfony/sample/config/services.yaml +24 -0
- package/examples/symfony/sample/package-lock.json +8082 -0
- package/examples/symfony/sample/package.json +23 -0
- package/examples/symfony/sample/phpunit.xml.dist +38 -0
- package/examples/symfony/sample/public/index.php +9 -0
- package/examples/symfony/sample/src/Controller/LuckyController.php +18 -0
- package/examples/symfony/sample/src/Kernel.php +11 -0
- package/examples/symfony/sample/symfony.lock +277 -0
- package/examples/symfony/sample/templates/base.html.twig +19 -0
- package/examples/symfony/sample/templates/lucky/number.html.twig +20 -0
- package/examples/symfony/sample/tests/bootstrap.php +11 -0
- package/examples/symfony/sample/webpack.config.js +72 -0
- package/examples/v1/index.html +229 -0
- package/examples/v1.1/index.html +229 -0
- package/examples/v2-beacon/index.html +229 -0
- package/examples/v3/index.html +266 -0
- package/examples/v3-beacon/index.html +270 -0
- package/examples/v3-legacy/index.html +266 -0
- package/examples/v3-legacy-minimum-plugins/index.html +270 -0
- package/examples/v3-minimum-plugins/index.html +270 -0
- package/jest/jest.global-setup.js +3 -0
- package/jest/jest.polyfills.js +18 -0
- package/jest/jest.setup-dom.js +54 -0
- package/jest/jsdom-extended.js +26 -0
- package/jest.config.ts +5 -0
- package/jest.preset.js +83 -0
- package/migrations.json +34 -0
- package/nx.json +69 -0
- package/package.json +170 -0
- package/packages/analytics-js/.env.example +9 -0
- package/packages/analytics-js/.jscpd.json +17 -0
- package/packages/analytics-js/.size-limit.js +31 -0
- package/packages/analytics-js/CHANGELOG.md +283 -0
- package/packages/analytics-js/CHANGELOG_LATEST.md +2 -0
- package/packages/analytics-js/LICENSE +21 -0
- package/packages/analytics-js/README.md +100 -0
- package/packages/analytics-js/__fixtures__/fixtures.ts +765 -0
- package/packages/analytics-js/__fixtures__/msw.handlers.ts +82 -0
- package/packages/analytics-js/__fixtures__/msw.server.ts +6 -0
- package/packages/analytics-js/__mocks__/remotePlugins/BeaconQueue.ts +9 -0
- package/packages/analytics-js/__mocks__/remotePlugins/Bugsnag.ts +10 -0
- package/packages/analytics-js/__mocks__/remotePlugins/CustomConsentManager.ts +10 -0
- package/packages/analytics-js/__mocks__/remotePlugins/DeviceModeDestinations.ts +9 -0
- package/packages/analytics-js/__mocks__/remotePlugins/DeviceModeTransformation.ts +9 -0
- package/packages/analytics-js/__mocks__/remotePlugins/ErrorReporting.ts +10 -0
- package/packages/analytics-js/__mocks__/remotePlugins/ExternalAnonymousId.ts +10 -0
- package/packages/analytics-js/__mocks__/remotePlugins/GoogleLinker.ts +8 -0
- package/packages/analytics-js/__mocks__/remotePlugins/KetchConsentManager.ts +10 -0
- package/packages/analytics-js/__mocks__/remotePlugins/NativeDestinationQueue.ts +10 -0
- package/packages/analytics-js/__mocks__/remotePlugins/OneTrustConsentManager.ts +10 -0
- package/packages/analytics-js/__mocks__/remotePlugins/StorageEncryption.ts +9 -0
- package/packages/analytics-js/__mocks__/remotePlugins/StorageEncryptionLegacy.ts +9 -0
- package/packages/analytics-js/__mocks__/remotePlugins/StorageMigrator.ts +8 -0
- package/packages/analytics-js/__mocks__/remotePlugins/XhrQueue.ts +9 -0
- package/packages/analytics-js/__tests__/app/RudderAnalytics.test.ts +286 -0
- package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/adBlockers.test.ts +78 -0
- package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/browser.test.ts +24 -0
- package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/clientHint.test.ts +87 -0
- package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/dom.test.ts +13 -0
- package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/screen.test.ts +13 -0
- package/packages/analytics-js/__tests__/components/capabilitiesManager/detection/storage.test.ts +27 -0
- package/packages/analytics-js/__tests__/components/configManager/ConfigManager.test.ts +222 -0
- package/packages/analytics-js/__tests__/components/configManager/cdnPaths.test.ts +70 -0
- package/packages/analytics-js/__tests__/components/configManager/commonUtil.test.ts +531 -0
- package/packages/analytics-js/__tests__/components/configManager/dataPlaneResolver.test.ts +163 -0
- package/packages/analytics-js/__tests__/components/configManager/validate.test.ts +31 -0
- package/packages/analytics-js/__tests__/components/core/Analytics.test.ts +628 -0
- package/packages/analytics-js/__tests__/components/eventManager/EventManager.test.ts +78 -0
- package/packages/analytics-js/__tests__/components/eventManager/RudderEventFactory.test.ts +514 -0
- package/packages/analytics-js/__tests__/components/eventManager/utilities.test.ts +1043 -0
- package/packages/analytics-js/__tests__/components/eventRepository/EventRepository.test.ts +324 -0
- package/packages/analytics-js/__tests__/components/pluginsManager/.gitkeep +0 -0
- package/packages/analytics-js/__tests__/components/preloadBuffer/index.test.ts +130 -0
- package/packages/analytics-js/__tests__/components/userSessionManager/UserSessionManager.test.ts +1386 -0
- package/packages/analytics-js/__tests__/components/userSessionManager/utils.test.ts +103 -0
- package/packages/analytics-js/__tests__/components/utilities/consent.test.ts +192 -0
- package/packages/analytics-js/__tests__/components/utilities/destinations.test.ts +201 -0
- package/packages/analytics-js/__tests__/components/utilities/event.test.ts +8 -0
- package/packages/analytics-js/__tests__/components/utilities/globals.test.ts +42 -0
- package/packages/analytics-js/__tests__/components/utilities/page.test.ts +235 -0
- package/packages/analytics-js/__tests__/components/utilities/sort.test.ts +17 -0
- package/packages/analytics-js/__tests__/components/utilities/statsCollection.test.ts +84 -0
- package/packages/analytics-js/__tests__/components/utilities/url.test.ts +51 -0
- package/packages/analytics-js/__tests__/services/ErrorHandler/ErrorHandler.test.ts +272 -0
- package/packages/analytics-js/__tests__/services/ErrorHandler/processError.test.ts +33 -0
- package/packages/analytics-js/__tests__/services/HttpClient/HttpClient.test.ts +255 -0
- package/packages/analytics-js/__tests__/services/Logger/Logger.test.ts +204 -0
- package/packages/analytics-js/__tests__/services/PluginEngine/PluginEngine.test.ts +206 -0
- package/packages/analytics-js/__tests__/services/StoreManager/Store.test.ts +152 -0
- package/packages/analytics-js/__tests__/services/StoreManager/StoreManager.test.ts +272 -0
- package/packages/analytics-js/__tests__/services/StoreManager/component-cookie/index.test.ts +65 -0
- package/packages/analytics-js/__tests__/services/StoreManager/storages/CookieStorage.test.ts +42 -0
- package/packages/analytics-js/__tests__/services/StoreManager/storages/InMemoryStorage.test.ts +26 -0
- package/packages/analytics-js/__tests__/services/StoreManager/storages/LocalStorage.test.ts +26 -0
- package/packages/analytics-js/__tests__/services/StoreManager/storages/sessionStorage.test.ts +26 -0
- package/packages/analytics-js/__tests__/services/StoreManager/top-domain/index.test.ts +60 -0
- package/packages/analytics-js/babel.config.json +15 -0
- package/packages/analytics-js/jest.config.mjs +14 -0
- package/packages/analytics-js/package.json +114 -0
- package/packages/analytics-js/project.json +138 -0
- package/packages/analytics-js/public/index-legacy-only.html +308 -0
- package/packages/analytics-js/public/index.html +324 -0
- package/packages/analytics-js/public/list_integration_sdks.html +408 -0
- package/packages/analytics-js/rollup.config.mjs +387 -0
- package/packages/analytics-js/src/app/IRudderStackGlobals.ts +21 -0
- package/packages/analytics-js/src/app/RudderAnalytics.ts +296 -0
- package/packages/analytics-js/src/browser.ts +55 -0
- package/packages/analytics-js/src/components/capabilitiesManager/CapabilitiesManager.ts +199 -0
- package/packages/analytics-js/src/components/capabilitiesManager/detection/adBlockers.ts +38 -0
- package/packages/analytics-js/src/components/capabilitiesManager/detection/browser.ts +24 -0
- package/packages/analytics-js/src/components/capabilitiesManager/detection/clientHint.ts +31 -0
- package/packages/analytics-js/src/components/capabilitiesManager/detection/dom.ts +54 -0
- package/packages/analytics-js/src/components/capabilitiesManager/detection/index.ts +6 -0
- package/packages/analytics-js/src/components/capabilitiesManager/detection/screen.ts +23 -0
- package/packages/analytics-js/src/components/capabilitiesManager/detection/storage.ts +77 -0
- package/packages/analytics-js/src/components/capabilitiesManager/index.ts +1 -0
- package/packages/analytics-js/src/components/capabilitiesManager/polyfill/index.ts +14 -0
- package/packages/analytics-js/src/components/capabilitiesManager/types.ts +14 -0
- package/packages/analytics-js/src/components/configManager/ConfigManager.ts +218 -0
- package/packages/analytics-js/src/components/configManager/constants.ts +21 -0
- package/packages/analytics-js/src/components/configManager/index.ts +1 -0
- package/packages/analytics-js/src/components/configManager/types.ts +90 -0
- package/packages/analytics-js/src/components/configManager/util/cdnPaths.ts +80 -0
- package/packages/analytics-js/src/components/configManager/util/commonUtil.ts +262 -0
- package/packages/analytics-js/src/components/configManager/util/dataPlaneResolver.ts +79 -0
- package/packages/analytics-js/src/components/configManager/util/validate.ts +46 -0
- package/packages/analytics-js/src/components/core/Analytics.ts +824 -0
- package/packages/analytics-js/src/components/core/IAnalytics.ts +218 -0
- package/packages/analytics-js/src/components/core/utilities.ts +12 -0
- package/packages/analytics-js/src/components/eventManager/EventManager.ts +80 -0
- package/packages/analytics-js/src/components/eventManager/RudderEventFactory.ts +171 -0
- package/packages/analytics-js/src/components/eventManager/constants.ts +29 -0
- package/packages/analytics-js/src/components/eventManager/index.ts +1 -0
- package/packages/analytics-js/src/components/eventManager/types.ts +7 -0
- package/packages/analytics-js/src/components/eventManager/utilities.ts +341 -0
- package/packages/analytics-js/src/components/eventRepository/EventRepository.ts +225 -0
- package/packages/analytics-js/src/components/eventRepository/constants.ts +9 -0
- package/packages/analytics-js/src/components/eventRepository/index.ts +1 -0
- package/packages/analytics-js/src/components/eventRepository/types.ts +10 -0
- package/packages/analytics-js/src/components/eventRepository/utils.ts +53 -0
- package/packages/analytics-js/src/components/pluginsManager/PluginsManager.ts +332 -0
- package/packages/analytics-js/src/components/pluginsManager/bundledBuildPluginImports.ts +39 -0
- package/packages/analytics-js/src/components/pluginsManager/defaultPluginsList.ts +24 -0
- package/packages/analytics-js/src/components/pluginsManager/federatedModulesBuildPluginImports.ts +68 -0
- package/packages/analytics-js/src/components/pluginsManager/index.ts +1 -0
- package/packages/analytics-js/src/components/pluginsManager/pluginNames.ts +29 -0
- package/packages/analytics-js/src/components/pluginsManager/pluginsInventory.ts +47 -0
- package/packages/analytics-js/src/components/pluginsManager/types.ts +4 -0
- package/packages/analytics-js/src/components/preloadBuffer/index.ts +187 -0
- package/packages/analytics-js/src/components/preloadBuffer/types.ts +5 -0
- package/packages/analytics-js/src/components/userSessionManager/UserSessionManager.ts +642 -0
- package/packages/analytics-js/src/components/userSessionManager/constants.ts +25 -0
- package/packages/analytics-js/src/components/userSessionManager/index.ts +1 -0
- package/packages/analytics-js/src/components/userSessionManager/types.ts +29 -0
- package/packages/analytics-js/src/components/userSessionManager/utils.ts +109 -0
- package/packages/analytics-js/src/components/utilities/consent.ts +163 -0
- package/packages/analytics-js/src/components/utilities/destinations.ts +31 -0
- package/packages/analytics-js/src/components/utilities/event.ts +3 -0
- package/packages/analytics-js/src/components/utilities/globals.ts +54 -0
- package/packages/analytics-js/src/components/utilities/loadOptions.ts +176 -0
- package/packages/analytics-js/src/components/utilities/number.ts +23 -0
- package/packages/analytics-js/src/components/utilities/page.ts +103 -0
- package/packages/analytics-js/src/components/utilities/sort.ts +15 -0
- package/packages/analytics-js/src/components/utilities/statsCollection.ts +16 -0
- package/packages/analytics-js/src/components/utilities/url.ts +90 -0
- package/packages/analytics-js/src/constants/app.ts +24 -0
- package/packages/analytics-js/src/constants/encryption.ts +6 -0
- package/packages/analytics-js/src/constants/errors.ts +4 -0
- package/packages/analytics-js/src/constants/logMessages.ts +282 -0
- package/packages/analytics-js/src/constants/queryParams.ts +13 -0
- package/packages/analytics-js/src/constants/storage.ts +40 -0
- package/packages/analytics-js/src/constants/timeouts.ts +15 -0
- package/packages/analytics-js/src/constants/urls.ts +21 -0
- package/packages/analytics-js/src/index.ts +40 -0
- package/packages/analytics-js/src/services/ErrorHandler/ErrorHandler.ts +204 -0
- package/packages/analytics-js/src/services/ErrorHandler/constant.ts +3 -0
- package/packages/analytics-js/src/services/ErrorHandler/index.ts +1 -0
- package/packages/analytics-js/src/services/ErrorHandler/processError.ts +61 -0
- package/packages/analytics-js/src/services/HttpClient/HttpClient.ts +112 -0
- package/packages/analytics-js/src/services/HttpClient/index.ts +7 -0
- package/packages/analytics-js/src/services/HttpClient/xhr/xhrRequestHandler.ts +140 -0
- package/packages/analytics-js/src/services/HttpClient/xhr/xhrResponseHandler.ts +25 -0
- package/packages/analytics-js/src/services/Logger/Logger.ts +123 -0
- package/packages/analytics-js/src/services/Logger/index.ts +1 -0
- package/packages/analytics-js/src/services/Logger/types.ts +6 -0
- package/packages/analytics-js/src/services/PluginEngine/PluginEngine.ts +200 -0
- package/packages/analytics-js/src/services/PluginEngine/README.md +152 -0
- package/packages/analytics-js/src/services/PluginEngine/index.ts +1 -0
- package/packages/analytics-js/src/services/StoreManager/Store.ts +218 -0
- package/packages/analytics-js/src/services/StoreManager/StoreManager.ts +231 -0
- package/packages/analytics-js/src/services/StoreManager/component-cookie/README.md +23 -0
- package/packages/analytics-js/src/services/StoreManager/component-cookie/index.ts +138 -0
- package/packages/analytics-js/src/services/StoreManager/index.ts +2 -0
- package/packages/analytics-js/src/services/StoreManager/storages/CookieStorage.ts +80 -0
- package/packages/analytics-js/src/services/StoreManager/storages/InMemoryStorage.ts +66 -0
- package/packages/analytics-js/src/services/StoreManager/storages/LocalStorage.ts +68 -0
- package/packages/analytics-js/src/services/StoreManager/storages/defaultOptions.ts +39 -0
- package/packages/analytics-js/src/services/StoreManager/storages/index.ts +18 -0
- package/packages/analytics-js/src/services/StoreManager/storages/sessionStorage.ts +64 -0
- package/packages/analytics-js/src/services/StoreManager/storages/storageEngine.ts +91 -0
- package/packages/analytics-js/src/services/StoreManager/top-domain/README.md +21 -0
- package/packages/analytics-js/src/services/StoreManager/top-domain/index.ts +83 -0
- package/packages/analytics-js/src/services/StoreManager/types.ts +32 -0
- package/packages/analytics-js/src/services/StoreManager/utils.ts +33 -0
- package/packages/analytics-js/src/state/index.ts +53 -0
- package/packages/analytics-js/src/state/slices/capabilities.ts +19 -0
- package/packages/analytics-js/src/state/slices/consents.ts +16 -0
- package/packages/analytics-js/src/state/slices/context.ts +36 -0
- package/packages/analytics-js/src/state/slices/eventBuffer.ts +9 -0
- package/packages/analytics-js/src/state/slices/lifecycle.ts +19 -0
- package/packages/analytics-js/src/state/slices/loadOptions.ts +44 -0
- package/packages/analytics-js/src/state/slices/metrics.ts +12 -0
- package/packages/analytics-js/src/state/slices/nativeDestinations.ts +15 -0
- package/packages/analytics-js/src/state/slices/plugins.ts +13 -0
- package/packages/analytics-js/src/state/slices/reporting.ts +11 -0
- package/packages/analytics-js/src/state/slices/session.ts +24 -0
- package/packages/analytics-js/src/state/slices/source.ts +6 -0
- package/packages/analytics-js/src/state/slices/storage.ts +13 -0
- package/packages/analytics-js/src/types/index.ts +1 -0
- package/packages/analytics-js/src/types/remote-plugins.d.ts +15 -0
- package/packages/analytics-js/src/types/rudderanalytics.d.ts +16 -0
- package/packages/analytics-js/tsconfig.json +14 -0
- package/packages/analytics-js/tsconfig.spec.json +26 -0
- package/packages/analytics-js-common/.jscpd.json +17 -0
- package/packages/analytics-js-common/.size-limit.js +11 -0
- package/packages/analytics-js-common/CHANGELOG.md +180 -0
- package/packages/analytics-js-common/CHANGELOG_LATEST.md +7 -0
- package/packages/analytics-js-common/LICENSE +21 -0
- package/packages/analytics-js-common/README.md +42 -0
- package/packages/analytics-js-common/__fixtures__/fixtures.ts +161 -0
- package/packages/analytics-js-common/__fixtures__/msw.handlers.ts +82 -0
- package/packages/analytics-js-common/__fixtures__/msw.server.ts +6 -0
- package/packages/analytics-js-common/__mocks__/.gitkeep +0 -0
- package/packages/analytics-js-common/__tests__/services/BufferQueue/BufferQueue.test.ts +55 -0
- package/packages/analytics-js-common/__tests__/services/ExternalSrcLoader/ExternalSrcLoader.test.ts +170 -0
- package/packages/analytics-js-common/__tests__/utilities/checks.test.ts +95 -0
- package/packages/analytics-js-common/__tests__/utilities/destinations.test.ts +44 -0
- package/packages/analytics-js-common/__tests__/utilities/detect.test.ts +22 -0
- package/packages/analytics-js-common/__tests__/utilities/eventMethodOverloads.test.ts +260 -0
- package/packages/analytics-js-common/__tests__/utilities/json.test.ts +155 -0
- package/packages/analytics-js-common/__tests__/utilities/object.test.ts +287 -0
- package/packages/analytics-js-common/__tests__/utilities/string.test.ts +104 -0
- package/packages/analytics-js-common/__tests__/utilities/timezone.test.ts +9 -0
- package/packages/analytics-js-common/__tests__/utilities/uuid.test.ts +35 -0
- package/packages/analytics-js-common/__tests__/v1.1/utils/ObjectUtils.test.js +113 -0
- package/packages/analytics-js-common/__tests__/v1.1/utils/errorHandler.test.js +60 -0
- package/packages/analytics-js-common/babel.config.json +14 -0
- package/packages/analytics-js-common/jest.config.mjs +14 -0
- package/packages/analytics-js-common/package.json +92 -0
- package/packages/analytics-js-common/project.json +107 -0
- package/packages/analytics-js-common/src/constants/QueueStatuses.ts +10 -0
- package/packages/analytics-js-common/src/constants/consent.ts +6 -0
- package/packages/analytics-js-common/src/constants/destDisplayNamesToFileNamesMap.ts +243 -0
- package/packages/analytics-js-common/src/constants/destinationNames.ts +312 -0
- package/packages/analytics-js-common/src/constants/htmlAttributes.ts +3 -0
- package/packages/analytics-js-common/src/constants/index.ts +11 -0
- package/packages/analytics-js-common/src/constants/integrations/ActiveCampaign/constants.js +18 -0
- package/packages/analytics-js-common/src/constants/integrations/AdobeAnalytics/constants.ts +18 -0
- package/packages/analytics-js-common/src/constants/integrations/Adroll/constants.ts +14 -0
- package/packages/analytics-js-common/src/constants/integrations/Amplitude/constants.ts +13 -0
- package/packages/analytics-js-common/src/constants/integrations/Appcues/constants.ts +13 -0
- package/packages/analytics-js-common/src/constants/integrations/Axeptio/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/BingAds/constants.ts +16 -0
- package/packages/analytics-js-common/src/constants/integrations/Braze/constants.ts +22 -0
- package/packages/analytics-js-common/src/constants/integrations/Bugsnag/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Chartbeat/constants.ts +14 -0
- package/packages/analytics-js-common/src/constants/integrations/Clevertap/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/CommandBar/constants.ts +21 -0
- package/packages/analytics-js-common/src/constants/integrations/CommonIntegrationsConstant/constants.ts +194 -0
- package/packages/analytics-js-common/src/constants/integrations/Comscore/constants.ts +15 -0
- package/packages/analytics-js-common/src/constants/integrations/ConvertFlow/constants.ts +19 -0
- package/packages/analytics-js-common/src/constants/integrations/Criteo/constants.ts +22 -0
- package/packages/analytics-js-common/src/constants/integrations/CustomerIO/constants.ts +14 -0
- package/packages/analytics-js-common/src/constants/integrations/DCMFloodlight/constants.ts +19 -0
- package/packages/analytics-js-common/src/constants/integrations/Drip/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Engage/constants.ts +27 -0
- package/packages/analytics-js-common/src/constants/integrations/FacebookPixel/constants.ts +89 -0
- package/packages/analytics-js-common/src/constants/integrations/Fullstory/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/GA/constants.ts +14 -0
- package/packages/analytics-js-common/src/constants/integrations/GA360/constants.ts +18 -0
- package/packages/analytics-js-common/src/constants/integrations/GA4/constants.ts +19 -0
- package/packages/analytics-js-common/src/constants/integrations/GoogleAds/constants.ts +15 -0
- package/packages/analytics-js-common/src/constants/integrations/GoogleOptimize/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/GoogleTagManager/constants.ts +14 -0
- package/packages/analytics-js-common/src/constants/integrations/Heap/constants.ts +13 -0
- package/packages/analytics-js-common/src/constants/integrations/Hotjar/constants.ts +14 -0
- package/packages/analytics-js-common/src/constants/integrations/HubSpot/constants.ts +15 -0
- package/packages/analytics-js-common/src/constants/integrations/INTERCOM/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Iterable/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/June/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Keen/constants.ts +14 -0
- package/packages/analytics-js-common/src/constants/integrations/Kissmetrics/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Klaviyo/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/LaunchDarkly/constants.ts +15 -0
- package/packages/analytics-js-common/src/constants/integrations/Lemnisk/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/LinkedInInsightTag/constants.ts +20 -0
- package/packages/analytics-js-common/src/constants/integrations/LiveChat/constants.ts +16 -0
- package/packages/analytics-js-common/src/constants/integrations/Lotame/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Lytics/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Matomo/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/MicrosoftClarity/constants.ts +18 -0
- package/packages/analytics-js-common/src/constants/integrations/Mixpanel/constants.ts +15 -0
- package/packages/analytics-js-common/src/constants/integrations/MoEngage/constants.ts +16 -0
- package/packages/analytics-js-common/src/constants/integrations/Mouseflow/constants.ts +18 -0
- package/packages/analytics-js-common/src/constants/integrations/Ninetailed/constants.ts +13 -0
- package/packages/analytics-js-common/src/constants/integrations/Olark/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Optimizely/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Pendo/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/PinterestTag/constants.ts +23 -0
- package/packages/analytics-js-common/src/constants/integrations/Podsights/constants.ts +24 -0
- package/packages/analytics-js-common/src/constants/integrations/PostAffiliatePro/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/Posthog/constants.ts +16 -0
- package/packages/analytics-js-common/src/constants/integrations/ProfitWell/constants.ts +16 -0
- package/packages/analytics-js-common/src/constants/integrations/Qualaroo/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Qualtrics/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/QuantumMetric/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/QuoraPixel/constants.ts +19 -0
- package/packages/analytics-js-common/src/constants/integrations/RedditPixel/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/Refiner/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Rockerbox/constants.ts +16 -0
- package/packages/analytics-js-common/src/constants/integrations/RollBar/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/Satismeter/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Sendinblue/constants.ts +37 -0
- package/packages/analytics-js-common/src/constants/integrations/Sentry/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Shynet/constants.ts +18 -0
- package/packages/analytics-js-common/src/constants/integrations/SnapEngage/constants.ts +16 -0
- package/packages/analytics-js-common/src/constants/integrations/SnapPixel/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/SpotifyPixel/constants.ts +20 -0
- package/packages/analytics-js-common/src/constants/integrations/Sprig/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/TVSquared/constants.ts +18 -0
- package/packages/analytics-js-common/src/constants/integrations/TiktokAds/constants.ts +97 -0
- package/packages/analytics-js-common/src/constants/integrations/VWO/constants.ts +17 -0
- package/packages/analytics-js-common/src/constants/integrations/Vero/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/Woopra/constants.ts +12 -0
- package/packages/analytics-js-common/src/constants/integrations/YandexMetrica/constants.ts +14 -0
- package/packages/analytics-js-common/src/constants/integrationsConfig.ts +5 -0
- package/packages/analytics-js-common/src/constants/logMessages.ts +24 -0
- package/packages/analytics-js-common/src/constants/loggerContexts.ts +33 -0
- package/packages/analytics-js-common/src/constants/storages.ts +9 -0
- package/packages/analytics-js-common/src/constants/timeouts.ts +3 -0
- package/packages/analytics-js-common/src/constants/urls.ts +4 -0
- package/packages/analytics-js-common/src/index.ts +4 -0
- package/packages/analytics-js-common/src/services/BufferQueue/BufferQueue.ts +37 -0
- package/packages/analytics-js-common/src/services/ExternalSrcLoader/ExternalSrcLoader.ts +63 -0
- package/packages/analytics-js-common/src/services/ExternalSrcLoader/index.ts +1 -0
- package/packages/analytics-js-common/src/services/ExternalSrcLoader/jsFileLoader.ts +124 -0
- package/packages/analytics-js-common/src/services/ExternalSrcLoader/types.ts +26 -0
- package/packages/analytics-js-common/src/types/ApiObject.ts +14 -0
- package/packages/analytics-js-common/src/types/ApplicationLifecycle.ts +12 -0
- package/packages/analytics-js-common/src/types/ApplicationState.ts +172 -0
- package/packages/analytics-js-common/src/types/Consent.ts +47 -0
- package/packages/analytics-js-common/src/types/DataResidency.ts +9 -0
- package/packages/analytics-js-common/src/types/Destination.ts +85 -0
- package/packages/analytics-js-common/src/types/ErrorHandler.ts +39 -0
- package/packages/analytics-js-common/src/types/Event.ts +54 -0
- package/packages/analytics-js-common/src/types/EventApi.ts +45 -0
- package/packages/analytics-js-common/src/types/EventContext.ts +26 -0
- package/packages/analytics-js-common/src/types/HttpClient.ts +63 -0
- package/packages/analytics-js-common/src/types/IRudderAnalytics.ts +204 -0
- package/packages/analytics-js-common/src/types/Integration.ts +18 -0
- package/packages/analytics-js-common/src/types/LoadOptions.ts +159 -0
- package/packages/analytics-js-common/src/types/Logger.ts +19 -0
- package/packages/analytics-js-common/src/types/Nullable.ts +1 -0
- package/packages/analytics-js-common/src/types/PluginEngine.ts +41 -0
- package/packages/analytics-js-common/src/types/PluginsManager.ts +29 -0
- package/packages/analytics-js-common/src/types/Session.ts +8 -0
- package/packages/analytics-js-common/src/types/Source.ts +21 -0
- package/packages/analytics-js-common/src/types/Storage.ts +49 -0
- package/packages/analytics-js-common/src/types/Store.ts +82 -0
- package/packages/analytics-js-common/src/types/UserSessionStorage.ts +10 -0
- package/packages/analytics-js-common/src/types/traits.ts +91 -0
- package/packages/analytics-js-common/src/utilities/checks.ts +77 -0
- package/packages/analytics-js-common/src/utilities/crypto.ts +6 -0
- package/packages/analytics-js-common/src/utilities/destinations.ts +31 -0
- package/packages/analytics-js-common/src/utilities/detect.ts +8 -0
- package/packages/analytics-js-common/src/utilities/errors.ts +20 -0
- package/packages/analytics-js-common/src/utilities/eventMethodOverloads.ts +407 -0
- package/packages/analytics-js-common/src/utilities/http.ts +13 -0
- package/packages/analytics-js-common/src/utilities/index.ts +14 -0
- package/packages/analytics-js-common/src/utilities/json.ts +69 -0
- package/packages/analytics-js-common/src/utilities/object.ts +119 -0
- package/packages/analytics-js-common/src/utilities/string.ts +64 -0
- package/packages/analytics-js-common/src/utilities/timestamp.ts +10 -0
- package/packages/analytics-js-common/src/utilities/timezone.ts +11 -0
- package/packages/analytics-js-common/src/utilities/url.ts +3 -0
- package/packages/analytics-js-common/src/utilities/uuId.ts +13 -0
- package/packages/analytics-js-common/src/v1.1/utils/ObjectUtils.js +54 -0
- package/packages/analytics-js-common/src/v1.1/utils/ScriptLoader.js +51 -0
- package/packages/analytics-js-common/src/v1.1/utils/client_server_name.js +82 -0
- package/packages/analytics-js-common/src/v1.1/utils/config_to_integration_names.js +83 -0
- package/packages/analytics-js-common/src/v1.1/utils/constants.js +15 -0
- package/packages/analytics-js-common/src/v1.1/utils/errorHandler.js +88 -0
- package/packages/analytics-js-common/src/v1.1/utils/index.ts +10 -0
- package/packages/analytics-js-common/src/v1.1/utils/integration_cname.js +164 -0
- package/packages/analytics-js-common/src/v1.1/utils/logUtil.js +51 -0
- package/packages/analytics-js-common/src/v1.1/utils/notifyError.js +16 -0
- package/packages/analytics-js-common/src/v1.1/utils/storage/cookie.js +98 -0
- package/packages/analytics-js-common/src/v1.1/utils/storage/index.js +5 -0
- package/packages/analytics-js-common/src/v1.1/utils/storage/storage.js +384 -0
- package/packages/analytics-js-common/src/v1.1/utils/storage/store.js +79 -0
- package/packages/analytics-js-common/src/v1.1/utils/storage/v3DecryptionUtils.js +19 -0
- package/packages/analytics-js-common/tsconfig.json +14 -0
- package/packages/analytics-js-common/tsconfig.spec.json +23 -0
- package/packages/analytics-js-common/types/rudderanalytics.d.ts +16 -0
- package/packages/analytics-js-integrations/.jscpd.json +17 -0
- package/packages/analytics-js-integrations/.size-limit.js +11 -0
- package/packages/analytics-js-integrations/CHANGELOG.md +241 -0
- package/packages/analytics-js-integrations/CHANGELOG_LATEST.md +12 -0
- package/packages/analytics-js-integrations/LICENSE +21 -0
- package/packages/analytics-js-integrations/README.md +35 -0
- package/packages/analytics-js-integrations/__fixtures__/.gitkeep +0 -0
- package/packages/analytics-js-integrations/__mocks__/.gitkeep +0 -0
- package/packages/analytics-js-integrations/__tests__/common/common.test.js +49 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Amplitude/browser.test.js +926 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Amplitude/util.test.js +190 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Appcues/appcues.test.js +163 -0
- package/packages/analytics-js-integrations/__tests__/integrations/BingAds/__fixtures__/data.js +17 -0
- package/packages/analytics-js-integrations/__tests__/integrations/BingAds/browser.test.js +166 -0
- package/packages/analytics-js-integrations/__tests__/integrations/BingAds/utils.test.js +138 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Braze/browser.test.js +1077 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Clevertap/browser.test.js +43 -0
- package/packages/analytics-js-integrations/__tests__/integrations/CommandBar/browser.test.js +115 -0
- package/packages/analytics-js-integrations/__tests__/integrations/FacebookPixel/browser.test.js +410 -0
- package/packages/analytics-js-integrations/__tests__/integrations/FacebookPixel/utils.test.js +775 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Fullstory/browser.test.js +173 -0
- package/packages/analytics-js-integrations/__tests__/integrations/GA/browser.test.js +179 -0
- package/packages/analytics-js-integrations/__tests__/integrations/GA4/__mocks__/data.js +1563 -0
- package/packages/analytics-js-integrations/__tests__/integrations/GA4/browser.test.js +212 -0
- package/packages/analytics-js-integrations/__tests__/integrations/GA4/utils.test.js +380 -0
- package/packages/analytics-js-integrations/__tests__/integrations/GoogleAds/__fixtures__/data.js +256 -0
- package/packages/analytics-js-integrations/__tests__/integrations/GoogleAds/browser.test.js +372 -0
- package/packages/analytics-js-integrations/__tests__/integrations/GoogleAds/utils.test.js +121 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Hotjar/browser.test.js +108 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Intercom/browser.test.js +135 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Intercom/util.test.js +69 -0
- package/packages/analytics-js-integrations/__tests__/integrations/LaunchDarkly/__fixtures__/data.js +61 -0
- package/packages/analytics-js-integrations/__tests__/integrations/LaunchDarkly/browser.test.js +151 -0
- package/packages/analytics-js-integrations/__tests__/integrations/LaunchDarkly/utils.test.js +36 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Lemnisk/browser.test.js +172 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Matomo/browser.test.js +208 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js +117 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/util.test.js +504 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Ninetailed/browser.test.js +148 -0
- package/packages/analytics-js-integrations/__tests__/integrations/PinterestTag/__fixtures__/data.js +24 -0
- package/packages/analytics-js-integrations/__tests__/integrations/PinterestTag/utils.test.js +19 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Podsights/utils.test.js +394 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Posthog/browser.test.js +420 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Posthog/utils.test.js +111 -0
- package/packages/analytics-js-integrations/__tests__/integrations/SpotifyPixel/browser.test.js +630 -0
- package/packages/analytics-js-integrations/__tests__/integrations/Sprig/browser.test.js +85 -0
- package/packages/analytics-js-integrations/__tests__/integrations/TikTokAds/browser.test.js +421 -0
- package/packages/analytics-js-integrations/__tests__/integrations/VWO/browser.test.js +143 -0
- package/packages/analytics-js-integrations/__tests__/integrations/VWO/utils.test.js +36 -0
- package/packages/analytics-js-integrations/__tests__/utils/camelcase.test.js +29 -0
- package/packages/analytics-js-integrations/__tests__/utils/commonUtils.test.js +347 -0
- package/packages/analytics-js-integrations/__tests__/utils/utils.test.js +337 -0
- package/packages/analytics-js-integrations/babel.config.json +14 -0
- package/packages/analytics-js-integrations/jest.config.mjs +21 -0
- package/packages/analytics-js-integrations/package.json +143 -0
- package/packages/analytics-js-integrations/project.json +106 -0
- package/packages/analytics-js-integrations/public/list_integration_sdks.html +408 -0
- package/packages/analytics-js-integrations/rollup.config.mjs +151 -0
- package/packages/analytics-js-integrations/scripts/integrationBuildScript.js +79 -0
- package/packages/analytics-js-integrations/src/integrations/ActiveCampaign/browser.js +53 -0
- package/packages/analytics-js-integrations/src/integrations/ActiveCampaign/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/ActiveCampaign/nativeSdkLoader.js +24 -0
- package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/browser.js +279 -0
- package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/eCommHandle.js +56 -0
- package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/heartbeatHandle.js +268 -0
- package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/AdobeAnalytics/util.js +681 -0
- package/packages/analytics-js-integrations/src/integrations/Adroll/browser.js +123 -0
- package/packages/analytics-js-integrations/src/integrations/Adroll/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Adroll/util.js +48 -0
- package/packages/analytics-js-integrations/src/integrations/Amplitude/browser.js +374 -0
- package/packages/analytics-js-integrations/src/integrations/Amplitude/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Amplitude/nativeSdkLoader.js +114 -0
- package/packages/analytics-js-integrations/src/integrations/Amplitude/test/test_amplitude.html +157 -0
- package/packages/analytics-js-integrations/src/integrations/Amplitude/utils.js +67 -0
- package/packages/analytics-js-integrations/src/integrations/Appcues/browser.js +89 -0
- package/packages/analytics-js-integrations/src/integrations/Appcues/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Axeptio/browser.js +61 -0
- package/packages/analytics-js-integrations/src/integrations/Axeptio/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Axeptio/nativeSdkLoader.js +14 -0
- package/packages/analytics-js-integrations/src/integrations/Axeptio/utils.js +16 -0
- package/packages/analytics-js-integrations/src/integrations/BingAds/browser.js +81 -0
- package/packages/analytics-js-integrations/src/integrations/BingAds/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/BingAds/nativeSdkLoader.js +30 -0
- package/packages/analytics-js-integrations/src/integrations/BingAds/utils.js +100 -0
- package/packages/analytics-js-integrations/src/integrations/Braze/browser.js +297 -0
- package/packages/analytics-js-integrations/src/integrations/Braze/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Braze/nativeSdkLoader.js +35 -0
- package/packages/analytics-js-integrations/src/integrations/Braze/utils.js +51 -0
- package/packages/analytics-js-integrations/src/integrations/Bugsnag/browser.js +62 -0
- package/packages/analytics-js-integrations/src/integrations/Bugsnag/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Chartbeat/browser.js +143 -0
- package/packages/analytics-js-integrations/src/integrations/Chartbeat/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Chartbeat/nativeSdkLoader.js +7 -0
- package/packages/analytics-js-integrations/src/integrations/Clevertap/browser.js +202 -0
- package/packages/analytics-js-integrations/src/integrations/Clevertap/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Clevertap/utils.js +17 -0
- package/packages/analytics-js-integrations/src/integrations/CommandBar/browser.js +78 -0
- package/packages/analytics-js-integrations/src/integrations/CommandBar/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/CommandBar/nativeSdkLoader.js +85 -0
- package/packages/analytics-js-integrations/src/integrations/Comscore/browser.js +126 -0
- package/packages/analytics-js-integrations/src/integrations/Comscore/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Comscore/nativeSdkLoader.js +10 -0
- package/packages/analytics-js-integrations/src/integrations/ConvertFlow/browser.js +60 -0
- package/packages/analytics-js-integrations/src/integrations/ConvertFlow/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/ConvertFlow/utils.js +107 -0
- package/packages/analytics-js-integrations/src/integrations/Criteo/browser.js +144 -0
- package/packages/analytics-js-integrations/src/integrations/Criteo/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Criteo/utils.js +346 -0
- package/packages/analytics-js-integrations/src/integrations/CustomerIO/browser.js +85 -0
- package/packages/analytics-js-integrations/src/integrations/CustomerIO/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/CustomerIO/nativeSdkLoader.js +33 -0
- package/packages/analytics-js-integrations/src/integrations/DCMFloodlight/browser.js +228 -0
- package/packages/analytics-js-integrations/src/integrations/DCMFloodlight/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/DCMFloodlight/utils.js +353 -0
- package/packages/analytics-js-integrations/src/integrations/Drip/browser.js +165 -0
- package/packages/analytics-js-integrations/src/integrations/Drip/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Drip/nativeSdkLoader.js +10 -0
- package/packages/analytics-js-integrations/src/integrations/Drip/utils.js +29 -0
- package/packages/analytics-js-integrations/src/integrations/Engage/browser.js +119 -0
- package/packages/analytics-js-integrations/src/integrations/Engage/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Engage/nativeSdkLoader.js +25 -0
- package/packages/analytics-js-integrations/src/integrations/Engage/utils.js +69 -0
- package/packages/analytics-js-integrations/src/integrations/FacebookPixel/browser.js +326 -0
- package/packages/analytics-js-integrations/src/integrations/FacebookPixel/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/FacebookPixel/utils.js +332 -0
- package/packages/analytics-js-integrations/src/integrations/Fullstory/browser.js +175 -0
- package/packages/analytics-js-integrations/src/integrations/Fullstory/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Fullstory/nativeSdkLoader.js +69 -0
- package/packages/analytics-js-integrations/src/integrations/Fullstory/utils.js +17 -0
- package/packages/analytics-js-integrations/src/integrations/GA/browser.js +817 -0
- package/packages/analytics-js-integrations/src/integrations/GA/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/GA360/browser.js +58 -0
- package/packages/analytics-js-integrations/src/integrations/GA360/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/GA4/browser.js +264 -0
- package/packages/analytics-js-integrations/src/integrations/GA4/config.js +296 -0
- package/packages/analytics-js-integrations/src/integrations/GA4/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/GA4/utils.js +374 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleAds/browser.js +219 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleAds/browser.test.js +16 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleAds/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleAds/nativeSdkLoader.js +28 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleAds/utils.js +135 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleOptimize/browser.js +81 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleOptimize/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleTagManager/browser.js +96 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleTagManager/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/GoogleTagManager/nativeSdkLoader.js +21 -0
- package/packages/analytics-js-integrations/src/integrations/Heap/browser.js +64 -0
- package/packages/analytics-js-integrations/src/integrations/Heap/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Heap/nativeSdkLoader.js +40 -0
- package/packages/analytics-js-integrations/src/integrations/Heap/util.js +23 -0
- package/packages/analytics-js-integrations/src/integrations/Hotjar/browser.js +79 -0
- package/packages/analytics-js-integrations/src/integrations/Hotjar/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Hotjar/nativeSdkLoader.js +21 -0
- package/packages/analytics-js-integrations/src/integrations/HubSpot/browser.js +91 -0
- package/packages/analytics-js-integrations/src/integrations/HubSpot/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/INTERCOM/browser.js +112 -0
- package/packages/analytics-js-integrations/src/integrations/INTERCOM/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/INTERCOM/nativeSdkLoader.js +46 -0
- package/packages/analytics-js-integrations/src/integrations/INTERCOM/utils.js +68 -0
- package/packages/analytics-js-integrations/src/integrations/Iterable/browser.js +179 -0
- package/packages/analytics-js-integrations/src/integrations/Iterable/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Iterable/utils.js +127 -0
- package/packages/analytics-js-integrations/src/integrations/June/browser.js +96 -0
- package/packages/analytics-js-integrations/src/integrations/June/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Keen/browser.js +150 -0
- package/packages/analytics-js-integrations/src/integrations/Keen/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Kissmetrics/browser.js +245 -0
- package/packages/analytics-js-integrations/src/integrations/Kissmetrics/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Kissmetrics/nativeSdkLoader.js +23 -0
- package/packages/analytics-js-integrations/src/integrations/Klaviyo/browser.js +197 -0
- package/packages/analytics-js-integrations/src/integrations/Klaviyo/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Klaviyo/util.js +91 -0
- package/packages/analytics-js-integrations/src/integrations/LaunchDarkly/browser.js +75 -0
- package/packages/analytics-js-integrations/src/integrations/LaunchDarkly/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/LaunchDarkly/utils.js +40 -0
- package/packages/analytics-js-integrations/src/integrations/Lemnisk/browser.js +81 -0
- package/packages/analytics-js-integrations/src/integrations/Lemnisk/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Lemnisk/nativeSdkLoader.js +34 -0
- package/packages/analytics-js-integrations/src/integrations/LinkedInInsightTag/browser.js +79 -0
- package/packages/analytics-js-integrations/src/integrations/LinkedInInsightTag/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/LiveChat/browser.js +81 -0
- package/packages/analytics-js-integrations/src/integrations/LiveChat/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/LiveChat/nativeSdkLoader.js +40 -0
- package/packages/analytics-js-integrations/src/integrations/LiveChat/util.js +71 -0
- package/packages/analytics-js-integrations/src/integrations/Lotame/LotameStorage.js +21 -0
- package/packages/analytics-js-integrations/src/integrations/Lotame/browser.js +152 -0
- package/packages/analytics-js-integrations/src/integrations/Lotame/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Lytics/browser.js +103 -0
- package/packages/analytics-js-integrations/src/integrations/Lytics/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Lytics/nativeSdkLoader.js +77 -0
- package/packages/analytics-js-integrations/src/integrations/Lytics/test/script-test-lytics.html +250 -0
- package/packages/analytics-js-integrations/src/integrations/Matomo/browser.js +184 -0
- package/packages/analytics-js-integrations/src/integrations/Matomo/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Matomo/nativeSdkLoader.js +20 -0
- package/packages/analytics-js-integrations/src/integrations/Matomo/util.js +433 -0
- package/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/browser.js +69 -0
- package/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/nativeSdkLoader.js +22 -0
- package/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js +353 -0
- package/packages/analytics-js-integrations/src/integrations/Mixpanel/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Mixpanel/nativeSdkLoader.js +71 -0
- package/packages/analytics-js-integrations/src/integrations/Mixpanel/util.js +288 -0
- package/packages/analytics-js-integrations/src/integrations/MoEngage/browser.js +131 -0
- package/packages/analytics-js-integrations/src/integrations/MoEngage/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/MoEngage/nativeSdkLoader.js +65 -0
- package/packages/analytics-js-integrations/src/integrations/MoEngage/test/script-test-moengage.html +216 -0
- package/packages/analytics-js-integrations/src/integrations/Mouseflow/browser.js +97 -0
- package/packages/analytics-js-integrations/src/integrations/Mouseflow/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Mouseflow/utils.js +41 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/browser.js +65 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/README.md +70 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/package-lock.json +17843 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/package.json +43 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/favicon.ico +0 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/index.html +75 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/logo192.png +0 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/logo512.png +0 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/manifest.json +25 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/public/robots.txt +3 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/App.css +38 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/App.js +108 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/index.css +34 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/index.js +17 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/logo.svg +1 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/reportWebVitals.js +13 -0
- package/packages/analytics-js-integrations/src/integrations/Ninetailed/sample-app/src/setupTests.js +5 -0
- package/packages/analytics-js-integrations/src/integrations/Olark/browser.js +92 -0
- package/packages/analytics-js-integrations/src/integrations/Olark/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Olark/nativeSdkLoader.js +31 -0
- package/packages/analytics-js-integrations/src/integrations/Olark/utils.js +51 -0
- package/packages/analytics-js-integrations/src/integrations/Optimizely/browser.js +244 -0
- package/packages/analytics-js-integrations/src/integrations/Optimizely/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Optimizely/utils.js +23 -0
- package/packages/analytics-js-integrations/src/integrations/Pendo/browser.js +123 -0
- package/packages/analytics-js-integrations/src/integrations/Pendo/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Pendo/nativeSdkLoader.js +32 -0
- package/packages/analytics-js-integrations/src/integrations/PinterestTag/browser.js +240 -0
- package/packages/analytics-js-integrations/src/integrations/PinterestTag/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/PinterestTag/nativeSdkLoader.js +19 -0
- package/packages/analytics-js-integrations/src/integrations/PinterestTag/propertyMappingConfig.js +57 -0
- package/packages/analytics-js-integrations/src/integrations/PinterestTag/test/input.js +180 -0
- package/packages/analytics-js-integrations/src/integrations/PinterestTag/test/output.js +129 -0
- package/packages/analytics-js-integrations/src/integrations/PinterestTag/utils.js +50 -0
- package/packages/analytics-js-integrations/src/integrations/Podsights/browser.js +179 -0
- package/packages/analytics-js-integrations/src/integrations/Podsights/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Podsights/utils.js +64 -0
- package/packages/analytics-js-integrations/src/integrations/PostAffiliatePro/browser.js +132 -0
- package/packages/analytics-js-integrations/src/integrations/PostAffiliatePro/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/PostAffiliatePro/utils.js +40 -0
- package/packages/analytics-js-integrations/src/integrations/Posthog/browser.js +147 -0
- package/packages/analytics-js-integrations/src/integrations/Posthog/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Posthog/nativeSdkLoader.js +48 -0
- package/packages/analytics-js-integrations/src/integrations/Posthog/test/test_posthog.html +77 -0
- package/packages/analytics-js-integrations/src/integrations/Posthog/utils.js +52 -0
- package/packages/analytics-js-integrations/src/integrations/ProfitWell/browser.js +71 -0
- package/packages/analytics-js-integrations/src/integrations/ProfitWell/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/ProfitWell/nativeSdkLoader.js +25 -0
- package/packages/analytics-js-integrations/src/integrations/Qualaroo/browser.js +116 -0
- package/packages/analytics-js-integrations/src/integrations/Qualaroo/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Qualaroo/utils.js +83 -0
- package/packages/analytics-js-integrations/src/integrations/Qualtrics/browser.js +92 -0
- package/packages/analytics-js-integrations/src/integrations/Qualtrics/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Qualtrics/nativeSdkLoader.js +79 -0
- package/packages/analytics-js-integrations/src/integrations/QuantumMetric/browser.js +54 -0
- package/packages/analytics-js-integrations/src/integrations/QuantumMetric/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/QuoraPixel/browser.js +77 -0
- package/packages/analytics-js-integrations/src/integrations/QuoraPixel/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/QuoraPixel/nativeSdkLoader.js +21 -0
- package/packages/analytics-js-integrations/src/integrations/RedditPixel/browser.js +103 -0
- package/packages/analytics-js-integrations/src/integrations/RedditPixel/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/RedditPixel/nativeSdkLoader.js +21 -0
- package/packages/analytics-js-integrations/src/integrations/Refiner/browser.js +117 -0
- package/packages/analytics-js-integrations/src/integrations/Refiner/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Refiner/nativeSdkLoader.js +20 -0
- package/packages/analytics-js-integrations/src/integrations/Refiner/utils.js +44 -0
- package/packages/analytics-js-integrations/src/integrations/Rockerbox/browser.js +90 -0
- package/packages/analytics-js-integrations/src/integrations/Rockerbox/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Rockerbox/nativeSdkLoader.js +32 -0
- package/packages/analytics-js-integrations/src/integrations/RollBar/browser.js +93 -0
- package/packages/analytics-js-integrations/src/integrations/RollBar/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/RollBar/nativeSdkLoader.js +383 -0
- package/packages/analytics-js-integrations/src/integrations/Satismeter/browser.js +92 -0
- package/packages/analytics-js-integrations/src/integrations/Satismeter/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Satismeter/nativeSdkLoader.js +23 -0
- package/packages/analytics-js-integrations/src/integrations/Satismeter/util.js +54 -0
- package/packages/analytics-js-integrations/src/integrations/Sendinblue/browser.js +111 -0
- package/packages/analytics-js-integrations/src/integrations/Sendinblue/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Sendinblue/nativeSdkLoader.js +36 -0
- package/packages/analytics-js-integrations/src/integrations/Sendinblue/utils.js +129 -0
- package/packages/analytics-js-integrations/src/integrations/Sentry/browser.js +120 -0
- package/packages/analytics-js-integrations/src/integrations/Sentry/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Sentry/utils.js +84 -0
- package/packages/analytics-js-integrations/src/integrations/Shynet/browser.js +99 -0
- package/packages/analytics-js-integrations/src/integrations/Shynet/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/SnapEngage/browser.js +74 -0
- package/packages/analytics-js-integrations/src/integrations/SnapEngage/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/SnapEngage/nativeSdkLoader.js +24 -0
- package/packages/analytics-js-integrations/src/integrations/SnapEngage/util.js +63 -0
- package/packages/analytics-js-integrations/src/integrations/SnapPixel/browser.js +226 -0
- package/packages/analytics-js-integrations/src/integrations/SnapPixel/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/SnapPixel/nativeSdkLoader.js +20 -0
- package/packages/analytics-js-integrations/src/integrations/SnapPixel/util.js +214 -0
- package/packages/analytics-js-integrations/src/integrations/SpotifyPixel/browser.js +180 -0
- package/packages/analytics-js-integrations/src/integrations/SpotifyPixel/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Sprig/browser.js +89 -0
- package/packages/analytics-js-integrations/src/integrations/Sprig/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Sprig/nativeSdkLoader.js +19 -0
- package/packages/analytics-js-integrations/src/integrations/TVSquared/browser.js +99 -0
- package/packages/analytics-js-integrations/src/integrations/TVSquared/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/TVSquared/utils.js +41 -0
- package/packages/analytics-js-integrations/src/integrations/TiktokAds/browser.js +111 -0
- package/packages/analytics-js-integrations/src/integrations/TiktokAds/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/TiktokAds/nativeSdkLoader.js +52 -0
- package/packages/analytics-js-integrations/src/integrations/TiktokAds/util.js +70 -0
- package/packages/analytics-js-integrations/src/integrations/VWO/browser.js +155 -0
- package/packages/analytics-js-integrations/src/integrations/VWO/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/VWO/nativeSdkLoader.js +64 -0
- package/packages/analytics-js-integrations/src/integrations/VWO/utils.js +42 -0
- package/packages/analytics-js-integrations/src/integrations/Vero/browser.js +166 -0
- package/packages/analytics-js-integrations/src/integrations/Vero/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Vero/utils.js +17 -0
- package/packages/analytics-js-integrations/src/integrations/Woopra/browser.js +82 -0
- package/packages/analytics-js-integrations/src/integrations/Woopra/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/Woopra/nativeSdkLoader.js +43 -0
- package/packages/analytics-js-integrations/src/integrations/YandexMetrica/browser.js +139 -0
- package/packages/analytics-js-integrations/src/integrations/YandexMetrica/index.js +1 -0
- package/packages/analytics-js-integrations/src/integrations/YandexMetrica/nativeSdkLoader.js +35 -0
- package/packages/analytics-js-integrations/src/integrations/YandexMetrica/utils.js +140 -0
- package/packages/analytics-js-integrations/src/integrations/index.js +163 -0
- package/packages/analytics-js-integrations/src/utils/camelcase.js +48 -0
- package/packages/analytics-js-integrations/src/utils/commonUtils.js +214 -0
- package/packages/analytics-js-integrations/src/utils/constants.js +4 -0
- package/packages/analytics-js-integrations/src/utils/logger.js +106 -0
- package/packages/analytics-js-integrations/src/utils/utils.js +585 -0
- package/packages/analytics-js-integrations/tsconfig.json +8 -0
- package/packages/analytics-js-integrations/tsconfig.spec.json +26 -0
- package/packages/analytics-js-plugins/.jscpd.json +17 -0
- package/packages/analytics-js-plugins/.size-limit.js +16 -0
- package/packages/analytics-js-plugins/CHANGELOG.md +212 -0
- package/packages/analytics-js-plugins/CHANGELOG_LATEST.md +7 -0
- package/packages/analytics-js-plugins/LICENSE +21 -0
- package/packages/analytics-js-plugins/README.md +57 -0
- package/packages/analytics-js-plugins/__fixtures__/.gitkeep +0 -0
- package/packages/analytics-js-plugins/__fixtures__/fixtures.ts +174 -0
- package/packages/analytics-js-plugins/__fixtures__/msw.handlers.js +45 -0
- package/packages/analytics-js-plugins/__fixtures__/msw.server.js +6 -0
- package/packages/analytics-js-plugins/__mocks__/.gitkeep +0 -0
- package/packages/analytics-js-plugins/__tests__/beaconQueue/.gitkeep +0 -0
- package/packages/analytics-js-plugins/__tests__/bugsnag/index.test.ts +116 -0
- package/packages/analytics-js-plugins/__tests__/bugsnag/utils.test.ts +555 -0
- package/packages/analytics-js-plugins/__tests__/customConsentManager/index.test.ts +264 -0
- package/packages/analytics-js-plugins/__tests__/deviceModeDestinations/utils.test.ts +260 -0
- package/packages/analytics-js-plugins/__tests__/deviceModeTransformation/.gitkeep +0 -0
- package/packages/analytics-js-plugins/__tests__/deviceModeTransformation/index.test.ts +287 -0
- package/packages/analytics-js-plugins/__tests__/deviceModeTransformation/utilities.test.ts +22 -0
- package/packages/analytics-js-plugins/__tests__/errorReporting/index.test.ts +102 -0
- package/packages/analytics-js-plugins/__tests__/externalAnonymousId/.gitkeep +0 -0
- package/packages/analytics-js-plugins/__tests__/googleLinker/.gitkeep +0 -0
- package/packages/analytics-js-plugins/__tests__/ketchConsentManager/index.test.ts +498 -0
- package/packages/analytics-js-plugins/__tests__/ketchConsentManager/utils.test.ts +189 -0
- package/packages/analytics-js-plugins/__tests__/nativeDestinationQueue/utilities.test.ts +98 -0
- package/packages/analytics-js-plugins/__tests__/oneTrustConsentManager/index.test.ts +395 -0
- package/packages/analytics-js-plugins/__tests__/storageEncryption/index.test.ts +37 -0
- package/packages/analytics-js-plugins/__tests__/storageEncryptionLegacy/index.test.ts +41 -0
- package/packages/analytics-js-plugins/__tests__/storageMigrator/.gitkeep +0 -0
- package/packages/analytics-js-plugins/__tests__/storageMigrator/index.test.ts +144 -0
- package/packages/analytics-js-plugins/__tests__/utilities/destination.test.ts +133 -0
- package/packages/analytics-js-plugins/__tests__/utilities/queue.test.ts +327 -0
- package/packages/analytics-js-plugins/__tests__/utilities/retryQueue/RetryQueue.test.ts +1077 -0
- package/packages/analytics-js-plugins/__tests__/utilities/retryQueue/Schedule.test.ts +78 -0
- package/packages/analytics-js-plugins/__tests__/xhrQueue/index.test.ts +320 -0
- package/packages/analytics-js-plugins/__tests__/xhrQueue/utilities.test.ts +388 -0
- package/packages/analytics-js-plugins/babel.config.json +14 -0
- package/packages/analytics-js-plugins/jest.config.mjs +14 -0
- package/packages/analytics-js-plugins/package.json +106 -0
- package/packages/analytics-js-plugins/project.json +131 -0
- package/packages/analytics-js-plugins/public/.gitkeep +0 -0
- package/packages/analytics-js-plugins/rollup.config.mjs +245 -0
- package/packages/analytics-js-plugins/src/beaconQueue/constants.ts +27 -0
- package/packages/analytics-js-plugins/src/beaconQueue/index.ts +146 -0
- package/packages/analytics-js-plugins/src/beaconQueue/logMessages.ts +24 -0
- package/packages/analytics-js-plugins/src/beaconQueue/types.ts +12 -0
- package/packages/analytics-js-plugins/src/beaconQueue/utilities.ts +68 -0
- package/packages/analytics-js-plugins/src/bugsnag/constants.ts +52 -0
- package/packages/analytics-js-plugins/src/bugsnag/index.ts +65 -0
- package/packages/analytics-js-plugins/src/bugsnag/logMessages.ts +19 -0
- package/packages/analytics-js-plugins/src/bugsnag/utils.ts +214 -0
- package/packages/analytics-js-plugins/src/customConsentManager/constants.ts +3 -0
- package/packages/analytics-js-plugins/src/customConsentManager/index.ts +86 -0
- package/packages/analytics-js-plugins/src/customConsentManager/logMessages.ts +3 -0
- package/packages/analytics-js-plugins/src/deviceModeDestinations/constants.ts +6 -0
- package/packages/analytics-js-plugins/src/deviceModeDestinations/index.ts +138 -0
- package/packages/analytics-js-plugins/src/deviceModeDestinations/logMessages.ts +24 -0
- package/packages/analytics-js-plugins/src/deviceModeDestinations/types.ts +28 -0
- package/packages/analytics-js-plugins/src/deviceModeDestinations/utils.ts +249 -0
- package/packages/analytics-js-plugins/src/deviceModeTransformation/constants.ts +12 -0
- package/packages/analytics-js-plugins/src/deviceModeTransformation/index.ts +111 -0
- package/packages/analytics-js-plugins/src/deviceModeTransformation/logMessages.ts +28 -0
- package/packages/analytics-js-plugins/src/deviceModeTransformation/types.ts +38 -0
- package/packages/analytics-js-plugins/src/deviceModeTransformation/utilities.ts +155 -0
- package/packages/analytics-js-plugins/src/errorReporting/index.ts +62 -0
- package/packages/analytics-js-plugins/src/errorReporting/logMessages.ts +3 -0
- package/packages/analytics-js-plugins/src/externalAnonymousId/constants.ts +5 -0
- package/packages/analytics-js-plugins/src/externalAnonymousId/index.ts +47 -0
- package/packages/analytics-js-plugins/src/externalAnonymousId/util.ts +25 -0
- package/packages/analytics-js-plugins/src/googleLinker/base64Decoder.ts +33 -0
- package/packages/analytics-js-plugins/src/googleLinker/constants.ts +1 -0
- package/packages/analytics-js-plugins/src/googleLinker/crc32.ts +44 -0
- package/packages/analytics-js-plugins/src/googleLinker/index.ts +30 -0
- package/packages/analytics-js-plugins/src/googleLinker/userLib.ts +16 -0
- package/packages/analytics-js-plugins/src/googleLinker/utils.ts +156 -0
- package/packages/analytics-js-plugins/src/index.ts +15 -0
- package/packages/analytics-js-plugins/src/ketchConsentManager/constants.ts +4 -0
- package/packages/analytics-js-plugins/src/ketchConsentManager/index.ts +120 -0
- package/packages/analytics-js-plugins/src/ketchConsentManager/logMessages.ts +15 -0
- package/packages/analytics-js-plugins/src/ketchConsentManager/types.ts +11 -0
- package/packages/analytics-js-plugins/src/ketchConsentManager/utils.ts +95 -0
- package/packages/analytics-js-plugins/src/nativeDestinationQueue/constants.ts +9 -0
- package/packages/analytics-js-plugins/src/nativeDestinationQueue/index.ts +159 -0
- package/packages/analytics-js-plugins/src/nativeDestinationQueue/logMessages.ts +14 -0
- package/packages/analytics-js-plugins/src/nativeDestinationQueue/utilities.ts +81 -0
- package/packages/analytics-js-plugins/src/oneTrustConsentManager/constants.ts +3 -0
- package/packages/analytics-js-plugins/src/oneTrustConsentManager/index.ts +131 -0
- package/packages/analytics-js-plugins/src/oneTrustConsentManager/logMessages.ts +8 -0
- package/packages/analytics-js-plugins/src/oneTrustConsentManager/types.ts +4 -0
- package/packages/analytics-js-plugins/src/shared-chunks/common.ts +13 -0
- package/packages/analytics-js-plugins/src/shared-chunks/deviceModeDestinations.ts +3 -0
- package/packages/analytics-js-plugins/src/storageEncryption/constants.ts +1 -0
- package/packages/analytics-js-plugins/src/storageEncryption/encryptionUtils.ts +14 -0
- package/packages/analytics-js-plugins/src/storageEncryption/index.ts +26 -0
- package/packages/analytics-js-plugins/src/storageEncryptionLegacy/constants.ts +2 -0
- package/packages/analytics-js-plugins/src/storageEncryptionLegacy/index.ts +26 -0
- package/packages/analytics-js-plugins/src/storageEncryptionLegacy/legacyEncryptionUtils.ts +18 -0
- package/packages/analytics-js-plugins/src/storageMigrator/constants.ts +3 -0
- package/packages/analytics-js-plugins/src/storageMigrator/index.ts +59 -0
- package/packages/analytics-js-plugins/src/storageMigrator/logMessages.ts +4 -0
- package/packages/analytics-js-plugins/src/types/plugins.ts +69 -0
- package/packages/analytics-js-plugins/src/utilities/constants.ts +3 -0
- package/packages/analytics-js-plugins/src/utilities/destination.ts +40 -0
- package/packages/analytics-js-plugins/src/utilities/eventsDelivery.ts +85 -0
- package/packages/analytics-js-plugins/src/utilities/retryQueue/README.md +135 -0
- package/packages/analytics-js-plugins/src/utilities/retryQueue/RetryQueue.ts +736 -0
- package/packages/analytics-js-plugins/src/utilities/retryQueue/Schedule.ts +101 -0
- package/packages/analytics-js-plugins/src/utilities/retryQueue/constants.ts +32 -0
- package/packages/analytics-js-plugins/src/utilities/retryQueue/logMessages.ts +9 -0
- package/packages/analytics-js-plugins/src/utilities/retryQueue/types.ts +21 -0
- package/packages/analytics-js-plugins/src/xhrQueue/constants.ts +23 -0
- package/packages/analytics-js-plugins/src/xhrQueue/index.ts +158 -0
- package/packages/analytics-js-plugins/src/xhrQueue/logMessages.ts +6 -0
- package/packages/analytics-js-plugins/src/xhrQueue/types.ts +16 -0
- package/packages/analytics-js-plugins/src/xhrQueue/utilities.ts +103 -0
- package/packages/analytics-js-plugins/tsconfig.json +14 -0
- package/packages/analytics-js-plugins/tsconfig.spec.json +24 -0
- package/packages/analytics-js-service-worker/.env.example +8 -0
- package/packages/analytics-js-service-worker/.jscpd.json +17 -0
- package/packages/analytics-js-service-worker/.size-limit.js +11 -0
- package/packages/analytics-js-service-worker/CHANGELOG.md +91 -0
- package/packages/analytics-js-service-worker/CHANGELOG_LATEST.md +7 -0
- package/packages/analytics-js-service-worker/LICENSE +21 -0
- package/packages/analytics-js-service-worker/README.md +74 -0
- package/packages/analytics-js-service-worker/__fixtures__/fixtures.ts +79 -0
- package/packages/analytics-js-service-worker/__fixtures__/msw.server.ts +13 -0
- package/packages/analytics-js-service-worker/__mocks__/.gitkeep +0 -0
- package/packages/analytics-js-service-worker/__tests__/Analytics.test.ts +120 -0
- package/packages/analytics-js-service-worker/__tests__/loosely-validate-event/index.test.ts +140 -0
- package/packages/analytics-js-service-worker/babel.config.json +15 -0
- package/packages/analytics-js-service-worker/jest.config.mjs +14 -0
- package/packages/analytics-js-service-worker/package.json +103 -0
- package/packages/analytics-js-service-worker/project.json +104 -0
- package/packages/analytics-js-service-worker/public/.gitkeep +0 -0
- package/packages/analytics-js-service-worker/rollup.config.mjs +140 -0
- package/packages/analytics-js-service-worker/src/Analytics.ts +564 -0
- package/packages/analytics-js-service-worker/src/IAnalytics.ts +141 -0
- package/packages/analytics-js-service-worker/src/index.ts +9 -0
- package/packages/analytics-js-service-worker/src/loosely-validate-event/index.ts +136 -0
- package/packages/analytics-js-service-worker/src/types.ts +67 -0
- package/packages/analytics-js-service-worker/tsconfig.json +8 -0
- package/packages/analytics-js-service-worker/tsconfig.spec.json +22 -0
- package/packages/analytics-v1.1/.env.example +8 -0
- package/packages/analytics-v1.1/.jscpd.json +17 -0
- package/packages/analytics-v1.1/.size-limit.js +16 -0
- package/packages/analytics-v1.1/.versionrc +12 -0
- package/packages/analytics-v1.1/CHANGELOG.md +3859 -0
- package/packages/analytics-v1.1/CHANGELOG_LATEST.md +5 -0
- package/packages/analytics-v1.1/LICENSE +21 -0
- package/packages/analytics-v1.1/README.md +321 -0
- package/packages/analytics-v1.1/__fixtures__/fixtures.js +130 -0
- package/packages/analytics-v1.1/__fixtures__/msw.handlers.js +51 -0
- package/packages/analytics-v1.1/__fixtures__/msw.server.js +6 -0
- package/packages/analytics-v1.1/__mocks__/.gitkeep +0 -0
- package/packages/analytics-v1.1/__tests__/data-residency.test.js +236 -0
- package/packages/analytics-v1.1/__tests__/features/core/metrics/errorReporting/ErrorReportingService.test.js +80 -0
- package/packages/analytics-v1.1/__tests__/ketchConsent.test.js +49 -0
- package/packages/analytics-v1.1/__tests__/oneTrustCookieConsent.test.js +89 -0
- package/packages/analytics-v1.1/__tests__/script.test.js +167 -0
- package/packages/analytics-v1.1/__tests__/transformationHandler.test.js +179 -0
- package/packages/analytics-v1.1/__tests__/utils/IntegrationsData.test.js +105 -0
- package/packages/analytics-v1.1/__tests__/utils/cdnPaths.test.js +63 -0
- package/packages/analytics-v1.1/__tests__/utils/clientHint.test.js +87 -0
- package/packages/analytics-v1.1/__tests__/utils/eventProcessorUtils.test.js +264 -0
- package/packages/analytics-v1.1/__tests__/utils/navigator.test.js +38 -0
- package/packages/analytics-v1.1/__tests__/utils/preProcessQueue.test.js +78 -0
- package/packages/analytics-v1.1/__tests__/utils/screenDetails.test.js +19 -0
- package/packages/analytics-v1.1/__tests__/utils/utils.test.js +69 -0
- package/packages/analytics-v1.1/babel.config.json +14 -0
- package/packages/analytics-v1.1/jest.config.mjs +14 -0
- package/packages/analytics-v1.1/package.json +115 -0
- package/packages/analytics-v1.1/project.json +119 -0
- package/packages/analytics-v1.1/public/index.html +137 -0
- package/packages/analytics-v1.1/rollup-configs/rollup.sdk.browser.mjs +32 -0
- package/packages/analytics-v1.1/rollup-configs/rollup.sdk.npm.mjs +53 -0
- package/packages/analytics-v1.1/rollup-configs/rollup.utilities.mjs +160 -0
- package/packages/analytics-v1.1/src/core/analytics.js +1669 -0
- package/packages/analytics-v1.1/src/features/core/cookieConsent/CookieConsentFactory.js +32 -0
- package/packages/analytics-v1.1/src/features/core/cookieConsent/OneTrust/browser.js +102 -0
- package/packages/analytics-v1.1/src/features/core/cookieConsent/OneTrust/index.js +1 -0
- package/packages/analytics-v1.1/src/features/core/cookieConsent/ketch/browser.js +114 -0
- package/packages/analytics-v1.1/src/features/core/cookieConsent/ketch/index.js +1 -0
- package/packages/analytics-v1.1/src/features/core/deviceModeTransformation/transformationHandler.js +196 -0
- package/packages/analytics-v1.1/src/features/core/deviceModeTransformation/util.js +23 -0
- package/packages/analytics-v1.1/src/features/core/metrics/errorReporting/ErrorReportingService.js +116 -0
- package/packages/analytics-v1.1/src/features/core/metrics/errorReporting/providers/Bugsnag.js +247 -0
- package/packages/analytics-v1.1/src/features/core/session/index.js +207 -0
- package/packages/analytics-v1.1/src/utils/EventRepository.js +79 -0
- package/packages/analytics-v1.1/src/utils/IntegrationsData.js +56 -0
- package/packages/analytics-v1.1/src/utils/JSFileLoader.js +66 -0
- package/packages/analytics-v1.1/src/utils/PreProcessQueue.js +66 -0
- package/packages/analytics-v1.1/src/utils/RudderApp.js +9 -0
- package/packages/analytics-v1.1/src/utils/RudderContext.js +23 -0
- package/packages/analytics-v1.1/src/utils/RudderElement.js +33 -0
- package/packages/analytics-v1.1/src/utils/RudderElementBuilder.js +29 -0
- package/packages/analytics-v1.1/src/utils/RudderInfo.js +41 -0
- package/packages/analytics-v1.1/src/utils/RudderMessage.js +28 -0
- package/packages/analytics-v1.1/src/utils/beaconQueue.js +140 -0
- package/packages/analytics-v1.1/src/utils/cdnPaths.js +43 -0
- package/packages/analytics-v1.1/src/utils/clientHint.js +28 -0
- package/packages/analytics-v1.1/src/utils/constants.js +70 -0
- package/packages/analytics-v1.1/src/utils/eventProcessorUtils.js +53 -0
- package/packages/analytics-v1.1/src/utils/linker/base64decoder.js +29 -0
- package/packages/analytics-v1.1/src/utils/linker/crc32.js +42 -0
- package/packages/analytics-v1.1/src/utils/linker/index.js +134 -0
- package/packages/analytics-v1.1/src/utils/linker/userLib.js +20 -0
- package/packages/analytics-v1.1/src/utils/navigator.js +32 -0
- package/packages/analytics-v1.1/src/utils/pageProperties.js +74 -0
- package/packages/analytics-v1.1/src/utils/screenDetails.js +23 -0
- package/packages/analytics-v1.1/src/utils/utils.js +423 -0
- package/packages/analytics-v1.1/src/utils/xhrModule.js +117 -0
- package/packages/analytics-v1.1/tsconfig.json +8 -0
- package/packages/analytics-v1.1/tsconfig.spec.json +26 -0
- package/packages/analytics-v1.1/types/index.d.ts +472 -0
- package/packages/analytics-v1.1/types/service-worker/index.d.ts +220 -0
- package/packages/loading-scripts/.env.example +11 -0
- package/packages/loading-scripts/.jscpd.json +17 -0
- package/packages/loading-scripts/CHANGELOG.md +130 -0
- package/packages/loading-scripts/CHANGELOG_LATEST.md +2 -0
- package/packages/loading-scripts/LICENSE +21 -0
- package/packages/loading-scripts/README.md +26 -0
- package/packages/loading-scripts/__fixtures__/.gitkeep +0 -0
- package/packages/loading-scripts/__mocks__/.gitkeep +0 -0
- package/packages/loading-scripts/__tests__/.gitkeep +0 -0
- package/packages/loading-scripts/babel.config.json +14 -0
- package/packages/loading-scripts/jest.config.mjs +14 -0
- package/packages/loading-scripts/package.json +62 -0
- package/packages/loading-scripts/project.json +101 -0
- package/packages/loading-scripts/public/index.html +180 -0
- package/packages/loading-scripts/rollup.config.mjs +112 -0
- package/packages/loading-scripts/src/index.ts +106 -0
- package/packages/loading-scripts/src/types/rudderanalytics.d.ts +16 -0
- package/packages/loading-scripts/tsconfig.json +15 -0
- package/packages/loading-scripts/tsconfig.spec.json +22 -0
- package/packages/sanity-suite/.env.example +39 -0
- package/packages/sanity-suite/.jscpd.json +17 -0
- package/packages/sanity-suite/CHANGELOG.md +154 -0
- package/packages/sanity-suite/LICENSE +21 -0
- package/packages/sanity-suite/README.md +37 -0
- package/packages/sanity-suite/__fixtures__/alias1.json +141 -0
- package/packages/sanity-suite/__fixtures__/alias2.json +101 -0
- package/packages/sanity-suite/__fixtures__/alias3.json +101 -0
- package/packages/sanity-suite/__fixtures__/alias4.json +101 -0
- package/packages/sanity-suite/__fixtures__/alias5.json +107 -0
- package/packages/sanity-suite/__fixtures__/alias6.json +141 -0
- package/packages/sanity-suite/__fixtures__/eventFiltering1.json +69 -0
- package/packages/sanity-suite/__fixtures__/eventFiltering2.json +69 -0
- package/packages/sanity-suite/__fixtures__/eventFiltering3.json +69 -0
- package/packages/sanity-suite/__fixtures__/group1.json +124 -0
- package/packages/sanity-suite/__fixtures__/group2.json +90 -0
- package/packages/sanity-suite/__fixtures__/group3.json +90 -0
- package/packages/sanity-suite/__fixtures__/group4.json +105 -0
- package/packages/sanity-suite/__fixtures__/group5.json +71 -0
- package/packages/sanity-suite/__fixtures__/group6.json +70 -0
- package/packages/sanity-suite/__fixtures__/identify1.json +140 -0
- package/packages/sanity-suite/__fixtures__/identify2.json +106 -0
- package/packages/sanity-suite/__fixtures__/identify3.json +103 -0
- package/packages/sanity-suite/__fixtures__/identify4.json +69 -0
- package/packages/sanity-suite/__fixtures__/identify5.json +106 -0
- package/packages/sanity-suite/__fixtures__/identify6.json +107 -0
- package/packages/sanity-suite/__fixtures__/identify7.json +106 -0
- package/packages/sanity-suite/__fixtures__/identify8.json +107 -0
- package/packages/sanity-suite/__fixtures__/page1.json +123 -0
- package/packages/sanity-suite/__fixtures__/page2.json +90 -0
- package/packages/sanity-suite/__fixtures__/page3.json +90 -0
- package/packages/sanity-suite/__fixtures__/page4.json +116 -0
- package/packages/sanity-suite/__fixtures__/page5.json +83 -0
- package/packages/sanity-suite/__fixtures__/page6.json +81 -0
- package/packages/sanity-suite/__fixtures__/page7.json +81 -0
- package/packages/sanity-suite/__fixtures__/page8.json +79 -0
- package/packages/sanity-suite/__fixtures__/sourceConfig1.json +1536 -0
- package/packages/sanity-suite/__fixtures__/sourceConfigDMT1.json +665 -0
- package/packages/sanity-suite/__fixtures__/sourceConfigDev1.json +892 -0
- package/packages/sanity-suite/__fixtures__/track1.json +154 -0
- package/packages/sanity-suite/__fixtures__/track2.json +122 -0
- package/packages/sanity-suite/__fixtures__/track3.json +122 -0
- package/packages/sanity-suite/__fixtures__/track4.json +138 -0
- package/packages/sanity-suite/__fixtures__/track5.json +106 -0
- package/packages/sanity-suite/__fixtures__/track6.json +85 -0
- package/packages/sanity-suite/__fixtures__/track7.json +85 -0
- package/packages/sanity-suite/babel.config.json +14 -0
- package/packages/sanity-suite/jest.config.mjs +14 -0
- package/packages/sanity-suite/package.json +83 -0
- package/packages/sanity-suite/project.json +55 -0
- package/packages/sanity-suite/public/v1.1/index-cdn.html +135 -0
- package/packages/sanity-suite/public/v1.1/index-local.html +141 -0
- package/packages/sanity-suite/public/v1.1/index-npm.html +107 -0
- package/packages/sanity-suite/public/v1.1/integrations/index-cdn.html +172 -0
- package/packages/sanity-suite/public/v1.1/integrations/index-local.html +171 -0
- package/packages/sanity-suite/public/v1.1/integrations/index-npm.html +140 -0
- package/packages/sanity-suite/public/v1.1/manualLoadCall/index-cdn.html +172 -0
- package/packages/sanity-suite/public/v1.1/manualLoadCall/index-local.html +171 -0
- package/packages/sanity-suite/public/v1.1/manualLoadCall/index-npm.html +140 -0
- package/packages/sanity-suite/public/v3/index-cdn.html +165 -0
- package/packages/sanity-suite/public/v3/index-local.html +169 -0
- package/packages/sanity-suite/public/v3/index-npm.html +99 -0
- package/packages/sanity-suite/public/v3/integrations/index-cdn.html +196 -0
- package/packages/sanity-suite/public/v3/integrations/index-local.html +198 -0
- package/packages/sanity-suite/public/v3/integrations/index-npm.html +138 -0
- package/packages/sanity-suite/public/v3/manualLoadCall/index-cdn.html +196 -0
- package/packages/sanity-suite/public/v3/manualLoadCall/index-local.html +198 -0
- package/packages/sanity-suite/public/v3/manualLoadCall/index-npm.html +138 -0
- package/packages/sanity-suite/rollup.config.mjs +247 -0
- package/packages/sanity-suite/serve.json +4 -0
- package/packages/sanity-suite/src/ignoredProperties/ignoredProperties.js +183 -0
- package/packages/sanity-suite/src/ignoredProperties/sourceConfigIgnoredProperties.js +144 -0
- package/packages/sanity-suite/src/index-npm-v1.1.ts +53 -0
- package/packages/sanity-suite/src/index-npm.ts +57 -0
- package/packages/sanity-suite/src/index.ts +6 -0
- package/packages/sanity-suite/src/testBook/ResultAssertions.js +77 -0
- package/packages/sanity-suite/src/testBook/TestBook.js +360 -0
- package/packages/sanity-suite/src/testBook/index.js +13 -0
- package/packages/sanity-suite/src/testBookSuites/alias.js +289 -0
- package/packages/sanity-suite/src/testBookSuites/eventFiltering.js +77 -0
- package/packages/sanity-suite/src/testBookSuites/group.js +241 -0
- package/packages/sanity-suite/src/testBookSuites/identify.js +455 -0
- package/packages/sanity-suite/src/testBookSuites/index.js +40 -0
- package/packages/sanity-suite/src/testBookSuites/page.js +259 -0
- package/packages/sanity-suite/src/testBookSuites/sourceConfig.js +89 -0
- package/packages/sanity-suite/src/testBookSuites/sourceConfigDev.js +20 -0
- package/packages/sanity-suite/src/testBookSuites/track.js +448 -0
- package/packages/sanity-suite/src/types/global.d.ts +2 -0
- package/packages/sanity-suite/src/types/rudderanalytics.d.ts +16 -0
- package/packages/sanity-suite/tsconfig.json +14 -0
- package/packages/sanity-suite/tsconfig.spec.json +22 -0
- package/patches/@originjs+vite-plugin-federation+1.3.5.patch +170 -0
- package/patches/@segment+localstorage-retry+1.3.0.patch +123 -0
- package/patches/@segment+top-domain+3.0.1.patch +34 -0
- package/patches/@vespaiach+axios-fetch-adapter+0.3.1.patch +43 -0
- package/patches/crypto-es+2.1.0.patch +103 -0
- package/patches/nx+18.0.5.patch +83 -0
- package/patches/rollup-plugin-generate-html-template+1.7.0.patch +46 -0
- package/scripts/commitizen.js +26 -0
- package/scripts/fix-reports-path-in-github-runner.sh +16 -0
- package/scripts/generate-last-release-changelog.sh +32 -0
- package/scripts/sync-tags-in-nx-projects.sh +24 -0
- package/sonar-project.properties +37 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +49 -0
- package/tsconfig.paths.json +27 -0
- package/types/clipboardJs.d.ts +1 -0
- package/types/component-querystring.d.ts +1 -0
- package/types/component-type.d.ts +1 -0
- package/types/global.d.ts +18 -0
- package/types/join-component.d.ts +1 -0
- package/types/localstorage-retry.d.ts +1 -0
- package/types/loosely-validate-event.d.ts +1 -0
- package/types/user-agent-data-types.d.ts +3 -0
package/packages/analytics-js/__tests__/components/userSessionManager/UserSessionManager.test.ts
ADDED
@@ -0,0 +1,1386 @@
|
|
1
|
+
import type { IPluginsManager } from '@rudderstack/analytics-js-common/types/PluginsManager';
|
2
|
+
import { UserSessionManager } from '../../../src/components/userSessionManager';
|
3
|
+
import {
|
4
|
+
DEFAULT_USER_SESSION_VALUES,
|
5
|
+
USER_SESSION_STORAGE_KEYS,
|
6
|
+
} from '../../../src/components/userSessionManager/constants';
|
7
|
+
import { StoreManager } from '../../../src/services/StoreManager';
|
8
|
+
import type { Store } from '../../../src/services/StoreManager/Store';
|
9
|
+
import { state, resetState } from '../../../src/state';
|
10
|
+
import { DEFAULT_SESSION_TIMEOUT_MS } from '../../../src/constants/timeouts';
|
11
|
+
import { defaultLogger } from '../../../src/services/Logger';
|
12
|
+
import { defaultErrorHandler } from '../../../src/services/ErrorHandler';
|
13
|
+
import { PluginsManager } from '../../../src/components/pluginsManager';
|
14
|
+
import { defaultPluginEngine } from '../../../src/services/PluginEngine';
|
15
|
+
import {
|
16
|
+
anonymousIdWithNoStorageEntries,
|
17
|
+
entriesWithMixStorageButWithoutNone,
|
18
|
+
entriesWithOnlyCookieStorage,
|
19
|
+
entriesWithOnlyLocalStorage,
|
20
|
+
entriesWithOnlyNoStorage,
|
21
|
+
entriesWithStorageOnlyForAnonymousId,
|
22
|
+
} from '../../../__fixtures__/fixtures';
|
23
|
+
|
24
|
+
jest.mock('@rudderstack/analytics-js-common/utilities/uuId', () => ({
|
25
|
+
generateUUID: jest.fn().mockReturnValue('test_uuid'),
|
26
|
+
}));
|
27
|
+
|
28
|
+
describe('User session manager', () => {
|
29
|
+
const dummyAnonymousId = 'dummy-anonymousId-12345678';
|
30
|
+
defaultLogger.warn = jest.fn();
|
31
|
+
defaultLogger.error = jest.fn();
|
32
|
+
|
33
|
+
const defaultPluginsManager = new PluginsManager(
|
34
|
+
defaultPluginEngine,
|
35
|
+
defaultErrorHandler,
|
36
|
+
defaultLogger,
|
37
|
+
);
|
38
|
+
const defaultStoreManager = new StoreManager(
|
39
|
+
defaultPluginsManager,
|
40
|
+
defaultErrorHandler,
|
41
|
+
defaultLogger,
|
42
|
+
);
|
43
|
+
|
44
|
+
let userSessionManager: UserSessionManager;
|
45
|
+
|
46
|
+
defaultStoreManager.init();
|
47
|
+
const clientDataStoreCookie = defaultStoreManager.getStore('clientDataInCookie') as Store;
|
48
|
+
const clientDataStoreLS = defaultStoreManager.getStore('clientDataInLocalStorage') as Store;
|
49
|
+
const clientDataStoreSession = defaultStoreManager.getStore(
|
50
|
+
'clientDataInSessionStorage',
|
51
|
+
) as Store;
|
52
|
+
|
53
|
+
const setDataInLocalStorage = (data: any) => {
|
54
|
+
Object.entries(data).forEach(([key, value]) => {
|
55
|
+
clientDataStoreLS.set(key, value);
|
56
|
+
});
|
57
|
+
};
|
58
|
+
|
59
|
+
const setDataInCookieStorage = (data: any) => {
|
60
|
+
Object.entries(data).forEach(([key, value]) => {
|
61
|
+
clientDataStoreCookie.set(key, value);
|
62
|
+
});
|
63
|
+
};
|
64
|
+
|
65
|
+
const setDataInCookieStorageEngine = (data: any) => {
|
66
|
+
Object.entries(data).forEach(([key, value]) => {
|
67
|
+
clientDataStoreCookie.engine.setItem(key, value);
|
68
|
+
});
|
69
|
+
};
|
70
|
+
|
71
|
+
const clearStorage = () => {
|
72
|
+
Object.values(USER_SESSION_STORAGE_KEYS).forEach(key => {
|
73
|
+
clientDataStoreCookie.remove(key);
|
74
|
+
clientDataStoreLS.remove(key);
|
75
|
+
clientDataStoreSession.remove(key);
|
76
|
+
});
|
77
|
+
};
|
78
|
+
|
79
|
+
beforeEach(() => {
|
80
|
+
clearStorage();
|
81
|
+
resetState();
|
82
|
+
userSessionManager = new UserSessionManager(
|
83
|
+
defaultErrorHandler,
|
84
|
+
defaultLogger,
|
85
|
+
defaultPluginsManager,
|
86
|
+
defaultStoreManager,
|
87
|
+
);
|
88
|
+
});
|
89
|
+
|
90
|
+
afterEach(() => {
|
91
|
+
jest.clearAllMocks();
|
92
|
+
});
|
93
|
+
|
94
|
+
describe('syncStorageDataToState', () => {
|
95
|
+
it('should modify the state and storage appropriately once storage options are modified after initialization', () => {
|
96
|
+
const customData = {
|
97
|
+
rl_anonymous_id: 'dummy-anonymousId',
|
98
|
+
};
|
99
|
+
setDataInCookieStorage(customData);
|
100
|
+
|
101
|
+
state.loadOptions.value.sessions = {
|
102
|
+
autoTrack: true,
|
103
|
+
timeout: 10000,
|
104
|
+
};
|
105
|
+
state.storage.entries.value = entriesWithStorageOnlyForAnonymousId;
|
106
|
+
userSessionManager.init();
|
107
|
+
|
108
|
+
// Modify the storage options and re-align state and storage
|
109
|
+
state.storage.entries.value = entriesWithMixStorageButWithoutNone;
|
110
|
+
userSessionManager.syncStorageDataToState();
|
111
|
+
|
112
|
+
expect(state.session.userId.value).toBe(DEFAULT_USER_SESSION_VALUES.userId);
|
113
|
+
expect(state.session.userTraits.value).toStrictEqual(DEFAULT_USER_SESSION_VALUES.userTraits);
|
114
|
+
expect(state.session.groupId.value).toBe(DEFAULT_USER_SESSION_VALUES.groupId);
|
115
|
+
expect(state.session.groupTraits.value).toStrictEqual(
|
116
|
+
DEFAULT_USER_SESSION_VALUES.groupTraits,
|
117
|
+
);
|
118
|
+
expect(state.session.initialReferrer.value).toBe('$direct');
|
119
|
+
expect(state.session.initialReferringDomain.value).toBe('');
|
120
|
+
// Auto-tracking should resume post consent
|
121
|
+
expect(state.session.sessionInfo.value).toStrictEqual({
|
122
|
+
autoTrack: true,
|
123
|
+
expiresAt: expect.any(Number),
|
124
|
+
id: expect.any(Number),
|
125
|
+
sessionStart: undefined,
|
126
|
+
timeout: 10000, // TODO: fix this after this entry is removed from state
|
127
|
+
});
|
128
|
+
// This also covers the data migration from previous storage to current
|
129
|
+
expect(state.session.anonymousId.value).toBe(customData.rl_anonymous_id);
|
130
|
+
expect(state.session.authToken.value).toBe(DEFAULT_USER_SESSION_VALUES.authToken);
|
131
|
+
});
|
132
|
+
it('should set anonymousId from external name if externalAnonymousIdCookieName load option is provided', () => {
|
133
|
+
const customData = {
|
134
|
+
rl_anonymous_id: 'dummy-anonymousId',
|
135
|
+
};
|
136
|
+
setDataInCookieStorage(customData);
|
137
|
+
state.loadOptions.value.externalAnonymousIdCookieName = 'anonId';
|
138
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
139
|
+
const spy = jest.spyOn(userSessionManager, 'getExternalAnonymousIdByCookieName');
|
140
|
+
userSessionManager.syncStorageDataToState();
|
141
|
+
expect(spy).toHaveBeenCalledWith('anonId');
|
142
|
+
});
|
143
|
+
it('should set anonymousId with existing logic if external name is not string', () => {
|
144
|
+
const customData = {
|
145
|
+
rl_anonymous_id: 'dummy-anonymousId',
|
146
|
+
};
|
147
|
+
setDataInCookieStorage(customData);
|
148
|
+
state.loadOptions.value.externalAnonymousIdCookieName = 12345;
|
149
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
150
|
+
const spy = jest.spyOn(userSessionManager, 'getExternalAnonymousIdByCookieName');
|
151
|
+
|
152
|
+
userSessionManager.syncStorageDataToState();
|
153
|
+
|
154
|
+
expect(spy).not.toHaveBeenCalled();
|
155
|
+
expect(state.session.anonymousId.value).toBe('dummy-anonymousId');
|
156
|
+
});
|
157
|
+
it('should set anonymousId with existing logic if external name is null', () => {
|
158
|
+
const customData = {
|
159
|
+
rl_anonymous_id: 'dummy-anonymousId',
|
160
|
+
};
|
161
|
+
setDataInCookieStorage(customData);
|
162
|
+
state.loadOptions.value.externalAnonymousIdCookieName = null;
|
163
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
164
|
+
const spy = jest.spyOn(userSessionManager, 'getExternalAnonymousIdByCookieName');
|
165
|
+
|
166
|
+
userSessionManager.syncStorageDataToState();
|
167
|
+
|
168
|
+
expect(spy).not.toHaveBeenCalled();
|
169
|
+
expect(state.session.anonymousId.value).toBe('dummy-anonymousId');
|
170
|
+
});
|
171
|
+
it('should set anonymousId with existing logic if external name is undefined', () => {
|
172
|
+
const customData = {
|
173
|
+
rl_anonymous_id: 'dummy-anonymousId',
|
174
|
+
};
|
175
|
+
setDataInCookieStorage(customData);
|
176
|
+
state.loadOptions.value.externalAnonymousIdCookieName = undefined;
|
177
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
178
|
+
const spy = jest.spyOn(userSessionManager, 'getExternalAnonymousIdByCookieName');
|
179
|
+
|
180
|
+
userSessionManager.syncStorageDataToState();
|
181
|
+
|
182
|
+
expect(spy).not.toHaveBeenCalled();
|
183
|
+
expect(state.session.anonymousId.value).toBe('dummy-anonymousId');
|
184
|
+
});
|
185
|
+
it('should set anonymousId with existing logic if anonymousId fetch by the external name is null', () => {
|
186
|
+
const customData = {
|
187
|
+
rl_anonymous_id: 'dummy-anonymousId',
|
188
|
+
};
|
189
|
+
setDataInCookieStorage(customData);
|
190
|
+
state.loadOptions.value.externalAnonymousIdCookieName = 'anonId';
|
191
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
192
|
+
userSessionManager.getExternalAnonymousIdByCookieName = jest.fn(() => null);
|
193
|
+
userSessionManager.syncStorageDataToState();
|
194
|
+
expect(state.session.anonymousId.value).toBe('dummy-anonymousId');
|
195
|
+
});
|
196
|
+
});
|
197
|
+
|
198
|
+
describe('init', () => {
|
199
|
+
it('should migrate legacy storage data if migration is enabled', () => {
|
200
|
+
const customData = {
|
201
|
+
rl_user_id:
|
202
|
+
'RudderEncrypt%3AU2FsdGVkX1%2FSIc%2F%2FsRy9t3CPVe54IHncEARgbMhX7xkKDtO%2BVtg%2BW1mjeAF1v%2Fp5', // '"1wefk7M3Y1D6EDX4ZpIE00LpKAE"'
|
203
|
+
rl_trait:
|
204
|
+
'RudderEncrypt%3AU2FsdGVkX19T0ItDzfT%2FZwWZ8wg4za9jcxyhSM4ZvWvkZCGeDekKc1%2B6l6i19bw8xv4YrtR8IBMp0SJBw76cbg%3D%3D', // '{email: 'saibattinoju@rudderstack.com'}'
|
205
|
+
rl_anonymous_id:
|
206
|
+
'RudderEncrypt%3AU2FsdGVkX19GLIcQTLgTdMu3NH14EwwTTK0ih%2BouACRQVDSrmYeVNe3vzF6W9oh0UzjgEf8N%2Fvxy%2BE%2F2BzIHuA%3D%3D', // '"bc9597ae-117e-4857-9d85-f02719b73239"'
|
207
|
+
// V3 encrypted
|
208
|
+
rl_page_init_referrer:
|
209
|
+
'RS_ENC_v3_Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMS9jZG4vbW9kZXJuL2lpZmUvaW5kZXguaHRtbCI%3D', // '"$direct"
|
210
|
+
// empty string
|
211
|
+
rl_group_id: 'RudderEncrypt%3AU2FsdGVkX19AHpnwm%2FJMyd%2Bu1Vq88KBjUYM0AsZnu8Q%3D', // '""'
|
212
|
+
};
|
213
|
+
|
214
|
+
class MockPluginsManager implements IPluginsManager {
|
215
|
+
invokeSingle = jest.fn(() => ''); // always return empty string
|
216
|
+
}
|
217
|
+
|
218
|
+
const mockPluginsManager = new MockPluginsManager();
|
219
|
+
|
220
|
+
const storeManager = new StoreManager(
|
221
|
+
defaultPluginsManager,
|
222
|
+
defaultErrorHandler,
|
223
|
+
defaultLogger,
|
224
|
+
);
|
225
|
+
|
226
|
+
storeManager.init();
|
227
|
+
|
228
|
+
userSessionManager = new UserSessionManager(
|
229
|
+
defaultErrorHandler,
|
230
|
+
defaultLogger,
|
231
|
+
mockPluginsManager,
|
232
|
+
storeManager,
|
233
|
+
);
|
234
|
+
|
235
|
+
setDataInCookieStorageEngine(customData);
|
236
|
+
|
237
|
+
// Enable migration
|
238
|
+
state.storage.migrate.value = true;
|
239
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
240
|
+
|
241
|
+
defaultPluginsManager.init();
|
242
|
+
|
243
|
+
const invokeSpy = mockPluginsManager.invokeSingle;
|
244
|
+
const extensionPoint = 'storage.migrate';
|
245
|
+
|
246
|
+
userSessionManager.init();
|
247
|
+
|
248
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
249
|
+
extensionPoint,
|
250
|
+
'rl_user_id',
|
251
|
+
clientDataStoreCookie.engine,
|
252
|
+
defaultErrorHandler,
|
253
|
+
defaultLogger,
|
254
|
+
);
|
255
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
256
|
+
extensionPoint,
|
257
|
+
'rl_trait',
|
258
|
+
clientDataStoreCookie.engine,
|
259
|
+
defaultErrorHandler,
|
260
|
+
defaultLogger,
|
261
|
+
);
|
262
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
263
|
+
extensionPoint,
|
264
|
+
'rl_anonymous_id',
|
265
|
+
clientDataStoreCookie.engine,
|
266
|
+
defaultErrorHandler,
|
267
|
+
defaultLogger,
|
268
|
+
);
|
269
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
270
|
+
extensionPoint,
|
271
|
+
'rl_group_id',
|
272
|
+
clientDataStoreCookie.engine,
|
273
|
+
defaultErrorHandler,
|
274
|
+
defaultLogger,
|
275
|
+
);
|
276
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
277
|
+
extensionPoint,
|
278
|
+
'rl_group_trait',
|
279
|
+
clientDataStoreCookie.engine,
|
280
|
+
defaultErrorHandler,
|
281
|
+
defaultLogger,
|
282
|
+
);
|
283
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
284
|
+
extensionPoint,
|
285
|
+
'rl_page_init_referrer',
|
286
|
+
clientDataStoreCookie.engine,
|
287
|
+
defaultErrorHandler,
|
288
|
+
defaultLogger,
|
289
|
+
);
|
290
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
291
|
+
extensionPoint,
|
292
|
+
'rl_page_init_referring_domain',
|
293
|
+
clientDataStoreCookie.engine,
|
294
|
+
defaultErrorHandler,
|
295
|
+
defaultLogger,
|
296
|
+
);
|
297
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
298
|
+
extensionPoint,
|
299
|
+
'rl_session',
|
300
|
+
clientDataStoreCookie.engine,
|
301
|
+
defaultErrorHandler,
|
302
|
+
defaultLogger,
|
303
|
+
);
|
304
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
305
|
+
extensionPoint,
|
306
|
+
'rl_user_id',
|
307
|
+
clientDataStoreLS.engine,
|
308
|
+
defaultErrorHandler,
|
309
|
+
defaultLogger,
|
310
|
+
);
|
311
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
312
|
+
extensionPoint,
|
313
|
+
'rl_trait',
|
314
|
+
clientDataStoreLS.engine,
|
315
|
+
defaultErrorHandler,
|
316
|
+
defaultLogger,
|
317
|
+
);
|
318
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
319
|
+
extensionPoint,
|
320
|
+
'rl_anonymous_id',
|
321
|
+
clientDataStoreLS.engine,
|
322
|
+
defaultErrorHandler,
|
323
|
+
defaultLogger,
|
324
|
+
);
|
325
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
326
|
+
extensionPoint,
|
327
|
+
'rl_group_id',
|
328
|
+
clientDataStoreLS.engine,
|
329
|
+
defaultErrorHandler,
|
330
|
+
defaultLogger,
|
331
|
+
);
|
332
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
333
|
+
extensionPoint,
|
334
|
+
'rl_group_trait',
|
335
|
+
clientDataStoreLS.engine,
|
336
|
+
defaultErrorHandler,
|
337
|
+
defaultLogger,
|
338
|
+
);
|
339
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
340
|
+
extensionPoint,
|
341
|
+
'rl_page_init_referrer',
|
342
|
+
clientDataStoreLS.engine,
|
343
|
+
defaultErrorHandler,
|
344
|
+
defaultLogger,
|
345
|
+
);
|
346
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
347
|
+
extensionPoint,
|
348
|
+
'rl_page_init_referring_domain',
|
349
|
+
clientDataStoreLS.engine,
|
350
|
+
defaultErrorHandler,
|
351
|
+
defaultLogger,
|
352
|
+
);
|
353
|
+
expect(invokeSpy).toHaveBeenCalledWith(
|
354
|
+
extensionPoint,
|
355
|
+
'rl_session',
|
356
|
+
clientDataStoreLS.engine,
|
357
|
+
defaultErrorHandler,
|
358
|
+
defaultLogger,
|
359
|
+
);
|
360
|
+
|
361
|
+
// All the values will be deleted from storage as plugin invocation fails
|
362
|
+
// Eventually, default values will be assigned during initialization
|
363
|
+
expect(state.session.userId.value).toBe('');
|
364
|
+
expect(state.session.userTraits.value).toStrictEqual({});
|
365
|
+
expect(state.session.anonymousId.value).toBe('test_uuid');
|
366
|
+
expect(state.session.groupId.value).toBe('');
|
367
|
+
expect(state.session.groupTraits.value).toStrictEqual({});
|
368
|
+
expect(state.session.initialReferrer.value).toBe('$direct');
|
369
|
+
expect(state.session.initialReferringDomain.value).toBe('');
|
370
|
+
expect(state.session.sessionInfo.value).not.toBeUndefined();
|
371
|
+
|
372
|
+
expect(defaultLogger.error).not.toHaveBeenCalled();
|
373
|
+
});
|
374
|
+
|
375
|
+
it('should auto-migrate data from previous storage', () => {
|
376
|
+
const customData = {
|
377
|
+
rl_user_id: 'dummy-userId-12345678',
|
378
|
+
};
|
379
|
+
setDataInCookieStorage(customData);
|
380
|
+
// persisted data with local storage
|
381
|
+
state.storage.entries.value = entriesWithOnlyLocalStorage;
|
382
|
+
|
383
|
+
userSessionManager.init();
|
384
|
+
|
385
|
+
expect(userSessionManager.getUserId()).toBe(customData.rl_user_id);
|
386
|
+
|
387
|
+
// clears entries from cookie storage
|
388
|
+
expect(clientDataStoreCookie.engine.length).toBe(0);
|
389
|
+
});
|
390
|
+
|
391
|
+
it('should not remove entries from previous storage if the data is not migrated', () => {
|
392
|
+
const customData = {
|
393
|
+
rl_anonymous_id: 'myanonymousid',
|
394
|
+
rl_user_id: 'myuserid',
|
395
|
+
};
|
396
|
+
setDataInLocalStorage(customData);
|
397
|
+
// persisted data with local storage
|
398
|
+
state.storage.entries.value = entriesWithStorageOnlyForAnonymousId;
|
399
|
+
|
400
|
+
userSessionManager.init();
|
401
|
+
|
402
|
+
expect(userSessionManager.getAnonymousId()).toBe(customData.rl_anonymous_id);
|
403
|
+
|
404
|
+
// only the anonymous ID entry should have been cleared from the previous storage
|
405
|
+
expect(clientDataStoreLS.engine.length).toBe(1);
|
406
|
+
});
|
407
|
+
|
408
|
+
it('should set default values for all the user session state fields if storage type is set to none for all', () => {
|
409
|
+
state.storage.entries.value = entriesWithOnlyNoStorage;
|
410
|
+
userSessionManager.init();
|
411
|
+
|
412
|
+
expect(state.session.userId.value).toBe(DEFAULT_USER_SESSION_VALUES.userId);
|
413
|
+
expect(state.session.userTraits.value).toStrictEqual(DEFAULT_USER_SESSION_VALUES.userTraits);
|
414
|
+
expect(state.session.anonymousId.value).toBe(DEFAULT_USER_SESSION_VALUES.anonymousId);
|
415
|
+
expect(state.session.groupId.value).toBe(DEFAULT_USER_SESSION_VALUES.groupId);
|
416
|
+
expect(state.session.groupTraits.value).toStrictEqual(
|
417
|
+
DEFAULT_USER_SESSION_VALUES.groupTraits,
|
418
|
+
);
|
419
|
+
expect(state.session.initialReferrer.value).toBe(DEFAULT_USER_SESSION_VALUES.initialReferrer);
|
420
|
+
expect(state.session.initialReferringDomain.value).toBe(
|
421
|
+
DEFAULT_USER_SESSION_VALUES.initialReferringDomain,
|
422
|
+
);
|
423
|
+
expect(state.session.sessionInfo.value).toStrictEqual(
|
424
|
+
DEFAULT_USER_SESSION_VALUES.sessionInfo,
|
425
|
+
);
|
426
|
+
expect(state.session.authToken.value).toBe(DEFAULT_USER_SESSION_VALUES.authToken);
|
427
|
+
});
|
428
|
+
|
429
|
+
it('should initialize user details from storage to state', () => {
|
430
|
+
const customData = {
|
431
|
+
rl_user_id: 'sample-user-id-1234567',
|
432
|
+
rl_trait: { key1: 'value1' },
|
433
|
+
rl_anonymous_id: 'dummy-anonymousId',
|
434
|
+
rl_group_id: 'sample-group-id-7654321',
|
435
|
+
rl_group_trait: { key2: 'value2' },
|
436
|
+
rl_page_init_referrer: 'dummy-url-1',
|
437
|
+
rl_page_init_referring_domain: 'dummy-url-2',
|
438
|
+
rl_session: {
|
439
|
+
autoTrack: false,
|
440
|
+
manualTrack: true,
|
441
|
+
id: 'someId',
|
442
|
+
},
|
443
|
+
rl_auth_token: 'dummy-auth-token',
|
444
|
+
};
|
445
|
+
setDataInCookieStorage(customData);
|
446
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
447
|
+
userSessionManager.init();
|
448
|
+
expect(state.session.userId.value).toBe(customData.rl_user_id);
|
449
|
+
expect(state.session.userTraits.value).toStrictEqual(customData.rl_trait);
|
450
|
+
expect(state.session.anonymousId.value).toBe(customData.rl_anonymous_id);
|
451
|
+
expect(state.session.groupId.value).toBe(customData.rl_group_id);
|
452
|
+
expect(state.session.groupTraits.value).toStrictEqual(customData.rl_group_trait);
|
453
|
+
expect(state.session.initialReferrer.value).toBe(customData.rl_page_init_referrer);
|
454
|
+
expect(state.session.initialReferringDomain.value).toBe(
|
455
|
+
customData.rl_page_init_referring_domain,
|
456
|
+
);
|
457
|
+
expect(state.session.sessionInfo.value).toStrictEqual({
|
458
|
+
...customData.rl_session,
|
459
|
+
timeout: expect.any(Number), // TODO: fix this after this entry is removed from state
|
460
|
+
});
|
461
|
+
expect(state.session.authToken.value).toBe(customData.rl_auth_token);
|
462
|
+
});
|
463
|
+
|
464
|
+
it('should constantly sync state with storage', () => {
|
465
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
466
|
+
userSessionManager.init();
|
467
|
+
|
468
|
+
// Now update the state values
|
469
|
+
state.session.userId.value = 'new-user-id';
|
470
|
+
state.session.userTraits.value = { key3: 'value3' };
|
471
|
+
state.session.anonymousId.value = 'new-anonymous-id';
|
472
|
+
state.session.groupId.value = 'new-group-id';
|
473
|
+
state.session.groupTraits.value = { key4: 'value4' };
|
474
|
+
state.session.initialReferrer.value = 'new-referrer';
|
475
|
+
state.session.initialReferringDomain.value = 'new-referring-domain';
|
476
|
+
state.session.sessionInfo.value = {
|
477
|
+
autoTrack: true,
|
478
|
+
manualTrack: false,
|
479
|
+
id: 'new-session-id',
|
480
|
+
};
|
481
|
+
state.session.authToken.value = 'new-auth-token';
|
482
|
+
|
483
|
+
expect(clientDataStoreCookie.get('rl_user_id')).toBe('new-user-id');
|
484
|
+
expect(clientDataStoreCookie.get('rl_trait')).toStrictEqual({ key3: 'value3' });
|
485
|
+
expect(clientDataStoreCookie.get('rl_anonymous_id')).toBe('new-anonymous-id');
|
486
|
+
expect(clientDataStoreCookie.get('rl_group_id')).toBe('new-group-id');
|
487
|
+
expect(clientDataStoreCookie.get('rl_group_trait')).toStrictEqual({ key4: 'value4' });
|
488
|
+
expect(clientDataStoreCookie.get('rl_page_init_referrer')).toBe('new-referrer');
|
489
|
+
expect(clientDataStoreCookie.get('rl_page_init_referring_domain')).toBe(
|
490
|
+
'new-referring-domain',
|
491
|
+
);
|
492
|
+
expect(clientDataStoreCookie.get('rl_session')).toStrictEqual({
|
493
|
+
autoTrack: true,
|
494
|
+
manualTrack: false,
|
495
|
+
id: 'new-session-id',
|
496
|
+
});
|
497
|
+
expect(clientDataStoreCookie.get('rl_auth_token')).toBe('new-auth-token');
|
498
|
+
});
|
499
|
+
|
500
|
+
it('should initialize user session state fields appropriately when storage is empty', () => {
|
501
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
502
|
+
userSessionManager.init();
|
503
|
+
|
504
|
+
expect(state.session.userId.value).toBe(DEFAULT_USER_SESSION_VALUES.userId);
|
505
|
+
expect(state.session.userTraits.value).toStrictEqual(DEFAULT_USER_SESSION_VALUES.userTraits);
|
506
|
+
expect(state.session.anonymousId.value).toBe('test_uuid'); // a new anonymous ID is generated
|
507
|
+
expect(state.session.groupId.value).toBe(DEFAULT_USER_SESSION_VALUES.groupId);
|
508
|
+
expect(state.session.groupTraits.value).toStrictEqual(
|
509
|
+
DEFAULT_USER_SESSION_VALUES.groupTraits,
|
510
|
+
);
|
511
|
+
expect(state.session.initialReferrer.value).toBe('$direct'); // referrer is recomputed
|
512
|
+
expect(state.session.initialReferringDomain.value).toBe('');
|
513
|
+
expect(state.session.sessionInfo.value).toStrictEqual({
|
514
|
+
autoTrack: true,
|
515
|
+
expiresAt: expect.any(Number),
|
516
|
+
id: expect.any(Number),
|
517
|
+
sessionStart: undefined,
|
518
|
+
timeout: expect.any(Number), // TODO: fix this after this entry is removed from state
|
519
|
+
});
|
520
|
+
expect(state.session.authToken.value).toBe(DEFAULT_USER_SESSION_VALUES.authToken);
|
521
|
+
});
|
522
|
+
|
523
|
+
it('should initialize session tracking with configured parameters in load options', () => {
|
524
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
525
|
+
state.loadOptions.value.sessions = {
|
526
|
+
autoTrack: false,
|
527
|
+
timeout: 10000,
|
528
|
+
};
|
529
|
+
userSessionManager.init();
|
530
|
+
expect(state.session.sessionInfo.value).toStrictEqual({
|
531
|
+
autoTrack: false,
|
532
|
+
timeout: DEFAULT_SESSION_TIMEOUT_MS,
|
533
|
+
});
|
534
|
+
});
|
535
|
+
|
536
|
+
it('should log a warning and use default timeout if provided timeout is not in number format', () => {
|
537
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
538
|
+
state.loadOptions.value.sessions.timeout = '100000';
|
539
|
+
userSessionManager.init();
|
540
|
+
expect(defaultLogger.warn).toHaveBeenCalledWith(
|
541
|
+
'UserSessionManager:: The session timeout value "100000" is not a number. The default timeout of 1800000 ms will be used instead.',
|
542
|
+
);
|
543
|
+
expect(state.session.sessionInfo.value.timeout).toBe(DEFAULT_SESSION_TIMEOUT_MS);
|
544
|
+
});
|
545
|
+
|
546
|
+
it('should log a warning and disable auto tracking if provided timeout is 0', () => {
|
547
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
548
|
+
state.loadOptions.value.sessions.timeout = 0;
|
549
|
+
userSessionManager.init();
|
550
|
+
expect(defaultLogger.warn).toHaveBeenCalledWith(
|
551
|
+
'UserSessionManager:: The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.',
|
552
|
+
);
|
553
|
+
expect(state.session.sessionInfo.value.autoTrack).toBe(false);
|
554
|
+
});
|
555
|
+
|
556
|
+
it('should log a warning if provided timeout is less than 10 seconds', () => {
|
557
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
558
|
+
state.loadOptions.value.sessions.timeout = 5000; // provided timeout as 5 second
|
559
|
+
userSessionManager.init();
|
560
|
+
expect(defaultLogger.warn).toHaveBeenCalledWith(
|
561
|
+
`UserSessionManager:: The session timeout value 5000 ms is less than the recommended minimum of 10000 ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`,
|
562
|
+
);
|
563
|
+
});
|
564
|
+
});
|
565
|
+
|
566
|
+
describe('getAnonymousId', () => {
|
567
|
+
it('should return the persisted anonymous ID', () => {
|
568
|
+
const customData = {
|
569
|
+
rl_anonymous_id: dummyAnonymousId,
|
570
|
+
};
|
571
|
+
setDataInCookieStorage(customData);
|
572
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
573
|
+
|
574
|
+
userSessionManager.init();
|
575
|
+
|
576
|
+
const actualAnonymousId = userSessionManager.getAnonymousId();
|
577
|
+
expect(actualAnonymousId).toBe(customData.rl_anonymous_id);
|
578
|
+
});
|
579
|
+
|
580
|
+
it('should return a fresh anonymous ID if the persisted anonymous ID is not available', () => {
|
581
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
582
|
+
userSessionManager.init();
|
583
|
+
const actualAnonymousId = userSessionManager.getAnonymousId();
|
584
|
+
expect(actualAnonymousId).toBe('test_uuid');
|
585
|
+
});
|
586
|
+
|
587
|
+
it('should return default value if persistence is disabled for anonymous ID', () => {
|
588
|
+
state.storage.entries.value = {
|
589
|
+
...entriesWithOnlyCookieStorage,
|
590
|
+
anonymousId: {
|
591
|
+
type: 'none',
|
592
|
+
key: USER_SESSION_STORAGE_KEYS.anonymousId,
|
593
|
+
},
|
594
|
+
};
|
595
|
+
userSessionManager.init();
|
596
|
+
const actualAnonymousId = userSessionManager.getAnonymousId();
|
597
|
+
expect(actualAnonymousId).toBe(DEFAULT_USER_SESSION_VALUES.anonymousId);
|
598
|
+
});
|
599
|
+
|
600
|
+
it.skip('should return anonymous ID from external source', () => {
|
601
|
+
const customData = {
|
602
|
+
ajs_anonymous_id: 'dummy-anonymousId-12345678',
|
603
|
+
};
|
604
|
+
const option = {
|
605
|
+
autoCapture: {
|
606
|
+
source: 'segment',
|
607
|
+
enabled: true,
|
608
|
+
},
|
609
|
+
};
|
610
|
+
setDataInCookieStorage(customData);
|
611
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
612
|
+
userSessionManager.init();
|
613
|
+
const actualAnonymousId = userSessionManager.getAnonymousId(option);
|
614
|
+
expect(actualAnonymousId).toBe(customData.ajs_anonymous_id);
|
615
|
+
});
|
616
|
+
});
|
617
|
+
|
618
|
+
describe('getUserId', () => {
|
619
|
+
it('should return the persisted user ID', () => {
|
620
|
+
const customData = {
|
621
|
+
rl_user_id: 'dummy-userId-12345678',
|
622
|
+
};
|
623
|
+
setDataInCookieStorage(customData);
|
624
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
625
|
+
userSessionManager.init();
|
626
|
+
const actualUserId = userSessionManager.getUserId();
|
627
|
+
expect(actualUserId).toBe(customData.rl_user_id);
|
628
|
+
});
|
629
|
+
|
630
|
+
it('should return null if the persisted user ID is not available', () => {
|
631
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
632
|
+
userSessionManager.init();
|
633
|
+
const actualUserId = userSessionManager.getUserId();
|
634
|
+
expect(actualUserId).toBe(null);
|
635
|
+
});
|
636
|
+
|
637
|
+
it('should return null if persistence is disabled for user ID', () => {
|
638
|
+
state.storage.entries.value = {
|
639
|
+
...entriesWithOnlyCookieStorage,
|
640
|
+
userId: {
|
641
|
+
type: 'none',
|
642
|
+
key: USER_SESSION_STORAGE_KEYS.userId,
|
643
|
+
},
|
644
|
+
};
|
645
|
+
userSessionManager.init();
|
646
|
+
const actualUserId = userSessionManager.getUserId();
|
647
|
+
expect(actualUserId).toBe(null);
|
648
|
+
});
|
649
|
+
});
|
650
|
+
|
651
|
+
describe('getUserTraits', () => {
|
652
|
+
it('should return persisted user traits', () => {
|
653
|
+
const customData = {
|
654
|
+
rl_trait: { key1: 'value1', random: '123456789' },
|
655
|
+
};
|
656
|
+
setDataInCookieStorage(customData);
|
657
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
658
|
+
userSessionManager.init();
|
659
|
+
const actualUserTraits = userSessionManager.getUserTraits();
|
660
|
+
expect(actualUserTraits).toStrictEqual(customData.rl_trait);
|
661
|
+
});
|
662
|
+
|
663
|
+
it('should return null if persisted user traits are not available', () => {
|
664
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
665
|
+
userSessionManager.init();
|
666
|
+
const actualUserTraits = userSessionManager.getUserTraits();
|
667
|
+
expect(actualUserTraits).toStrictEqual(null);
|
668
|
+
});
|
669
|
+
|
670
|
+
it('should return null if persistence is disabled for user traits', () => {
|
671
|
+
state.storage.entries.value = {
|
672
|
+
...entriesWithOnlyCookieStorage,
|
673
|
+
userTraits: {
|
674
|
+
type: 'none',
|
675
|
+
key: USER_SESSION_STORAGE_KEYS.userTraits,
|
676
|
+
},
|
677
|
+
};
|
678
|
+
userSessionManager.init();
|
679
|
+
const actualUserTraits = userSessionManager.getUserTraits();
|
680
|
+
expect(actualUserTraits).toStrictEqual(null);
|
681
|
+
});
|
682
|
+
});
|
683
|
+
|
684
|
+
describe('getGroupId', () => {
|
685
|
+
it('should return persisted group ID', () => {
|
686
|
+
const customData = {
|
687
|
+
rl_group_id: 'dummy-groupId-12345678',
|
688
|
+
};
|
689
|
+
setDataInCookieStorage(customData);
|
690
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
691
|
+
userSessionManager.init();
|
692
|
+
const actualGroupId = userSessionManager.getGroupId();
|
693
|
+
expect(actualGroupId).toBe(customData.rl_group_id);
|
694
|
+
});
|
695
|
+
|
696
|
+
it('should return null if persisted group ID is not available', () => {
|
697
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
698
|
+
userSessionManager.init();
|
699
|
+
const actualGroupId = userSessionManager.getGroupId();
|
700
|
+
expect(actualGroupId).toBe(null);
|
701
|
+
});
|
702
|
+
|
703
|
+
it('should return null if persistence is disabled for group ID', () => {
|
704
|
+
state.storage.entries.value = {
|
705
|
+
...entriesWithOnlyCookieStorage,
|
706
|
+
groupId: {
|
707
|
+
type: 'none',
|
708
|
+
key: USER_SESSION_STORAGE_KEYS.groupId,
|
709
|
+
},
|
710
|
+
};
|
711
|
+
userSessionManager.init();
|
712
|
+
const actualGroupId = userSessionManager.getGroupId();
|
713
|
+
expect(actualGroupId).toStrictEqual(null);
|
714
|
+
});
|
715
|
+
});
|
716
|
+
|
717
|
+
describe('getGroupTraits', () => {
|
718
|
+
it('should return persisted group traits', () => {
|
719
|
+
const customData = {
|
720
|
+
rl_group_trait: { key1: 'value1', random: '123456789' },
|
721
|
+
};
|
722
|
+
setDataInCookieStorage(customData);
|
723
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
724
|
+
userSessionManager.init();
|
725
|
+
const actualGroupTraits = userSessionManager.getGroupTraits();
|
726
|
+
expect(actualGroupTraits).toStrictEqual(customData.rl_group_trait);
|
727
|
+
});
|
728
|
+
|
729
|
+
it('should return null if persisted group traits are not available', () => {
|
730
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
731
|
+
userSessionManager.init();
|
732
|
+
const actualGroupTraits = userSessionManager.getGroupTraits();
|
733
|
+
expect(actualGroupTraits).toStrictEqual(null);
|
734
|
+
});
|
735
|
+
|
736
|
+
it('should return null if persistence is disabled for group traits', () => {
|
737
|
+
state.storage.entries.value = {
|
738
|
+
...entriesWithOnlyCookieStorage,
|
739
|
+
groupTraits: {
|
740
|
+
type: 'none',
|
741
|
+
key: USER_SESSION_STORAGE_KEYS.groupTraits,
|
742
|
+
},
|
743
|
+
};
|
744
|
+
userSessionManager.init();
|
745
|
+
const actualGroupTraits = userSessionManager.getGroupTraits();
|
746
|
+
expect(actualGroupTraits).toStrictEqual(null);
|
747
|
+
});
|
748
|
+
});
|
749
|
+
|
750
|
+
describe('getInitialReferrer', () => {
|
751
|
+
it('should return persisted initial referrer', () => {
|
752
|
+
const customData = {
|
753
|
+
rl_page_init_referrer: 'dummy-url-1234',
|
754
|
+
};
|
755
|
+
setDataInCookieStorage(customData);
|
756
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
757
|
+
userSessionManager.init();
|
758
|
+
const actualInitialReferrer = userSessionManager.getInitialReferrer();
|
759
|
+
expect(actualInitialReferrer).toBe(customData.rl_page_init_referrer);
|
760
|
+
});
|
761
|
+
|
762
|
+
it('should return null if persisted initial referrer is not available', () => {
|
763
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
764
|
+
userSessionManager.init();
|
765
|
+
|
766
|
+
// We have to clear the storage as
|
767
|
+
// the 'init' method would've set '$direct' as the value when no persisted value is found
|
768
|
+
clearStorage();
|
769
|
+
|
770
|
+
const actualInitialReferrer = userSessionManager.getInitialReferrer();
|
771
|
+
expect(actualInitialReferrer).toBe(null);
|
772
|
+
});
|
773
|
+
|
774
|
+
it('should return null if persistence is disabled for initial referrer', () => {
|
775
|
+
state.storage.entries.value = {
|
776
|
+
...entriesWithOnlyCookieStorage,
|
777
|
+
initialReferrer: {
|
778
|
+
type: 'none',
|
779
|
+
key: USER_SESSION_STORAGE_KEYS.initialReferrer,
|
780
|
+
},
|
781
|
+
};
|
782
|
+
userSessionManager.init();
|
783
|
+
const actualInitialReferrer = userSessionManager.getInitialReferrer();
|
784
|
+
expect(actualInitialReferrer).toStrictEqual(null);
|
785
|
+
});
|
786
|
+
});
|
787
|
+
|
788
|
+
describe('getInitialReferringDomain', () => {
|
789
|
+
it('should return persisted initial referring domain', () => {
|
790
|
+
const customData = {
|
791
|
+
rl_page_init_referrer: 'dummy-url-1234',
|
792
|
+
rl_page_init_referring_domain: 'dummy-url-287654',
|
793
|
+
};
|
794
|
+
setDataInCookieStorage(customData);
|
795
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
796
|
+
userSessionManager.init();
|
797
|
+
const actualInitialReferringDomain = userSessionManager.getInitialReferringDomain();
|
798
|
+
expect(actualInitialReferringDomain).toBe(customData.rl_page_init_referring_domain);
|
799
|
+
});
|
800
|
+
|
801
|
+
it('should return null if persisted initial referring domain is not available', () => {
|
802
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
803
|
+
userSessionManager.init();
|
804
|
+
const actualInitialReferringDomain = userSessionManager.getInitialReferringDomain();
|
805
|
+
expect(actualInitialReferringDomain).toBe(null);
|
806
|
+
});
|
807
|
+
|
808
|
+
it('should return null if persistence is disabled for initial referring domain', () => {
|
809
|
+
state.storage.entries.value = {
|
810
|
+
...entriesWithOnlyCookieStorage,
|
811
|
+
initialReferringDomain: {
|
812
|
+
type: 'none',
|
813
|
+
key: USER_SESSION_STORAGE_KEYS.initialReferringDomain,
|
814
|
+
},
|
815
|
+
};
|
816
|
+
userSessionManager.init();
|
817
|
+
const actualInitialReferringDomain = userSessionManager.getInitialReferringDomain();
|
818
|
+
expect(actualInitialReferringDomain).toStrictEqual(null);
|
819
|
+
});
|
820
|
+
});
|
821
|
+
|
822
|
+
describe('getAuthToken', () => {
|
823
|
+
it('should return persisted auth token', () => {
|
824
|
+
const customData = {
|
825
|
+
rl_auth_token: 'dummy-auth-token-12345678',
|
826
|
+
};
|
827
|
+
setDataInCookieStorage(customData);
|
828
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
829
|
+
userSessionManager.init();
|
830
|
+
const actualAuthToken = userSessionManager.getAuthToken();
|
831
|
+
expect(actualAuthToken).toBe(customData.rl_auth_token);
|
832
|
+
});
|
833
|
+
|
834
|
+
it('should return null if persisted auth token is not available', () => {
|
835
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
836
|
+
userSessionManager.init();
|
837
|
+
const actualAuthToken = userSessionManager.getAuthToken();
|
838
|
+
expect(actualAuthToken).toBe(null);
|
839
|
+
});
|
840
|
+
|
841
|
+
it('should return null if persistence is disabled for auth token', () => {
|
842
|
+
state.storage.entries.value = {
|
843
|
+
...entriesWithOnlyCookieStorage,
|
844
|
+
authToken: {
|
845
|
+
type: 'none',
|
846
|
+
key: USER_SESSION_STORAGE_KEYS.authToken,
|
847
|
+
},
|
848
|
+
};
|
849
|
+
userSessionManager.init();
|
850
|
+
const actualAuthToken = userSessionManager.getAuthToken();
|
851
|
+
expect(actualAuthToken).toStrictEqual(null);
|
852
|
+
});
|
853
|
+
});
|
854
|
+
|
855
|
+
describe('getSessionInfo', () => {
|
856
|
+
it('should return persisted session info', () => {
|
857
|
+
const customData = {
|
858
|
+
rl_session: { key1: 'value1', random: '123456789' },
|
859
|
+
};
|
860
|
+
setDataInCookieStorage(customData);
|
861
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
862
|
+
// Not calling init here
|
863
|
+
const actualSessionInfo = userSessionManager.getSessionInfo();
|
864
|
+
expect(actualSessionInfo).toStrictEqual(customData.rl_session);
|
865
|
+
});
|
866
|
+
|
867
|
+
it('should return null if persisted session info is not available', () => {
|
868
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
869
|
+
userSessionManager.init();
|
870
|
+
|
871
|
+
// We have to clear the storage as
|
872
|
+
// the 'init' method would've set default value when no persisted value is found
|
873
|
+
clearStorage();
|
874
|
+
|
875
|
+
const actualSessionInfo = userSessionManager.getSessionInfo();
|
876
|
+
expect(actualSessionInfo).toStrictEqual(null);
|
877
|
+
});
|
878
|
+
|
879
|
+
it('should return null if persistence is disabled for session info', () => {
|
880
|
+
state.storage.entries.value = {
|
881
|
+
...entriesWithOnlyCookieStorage,
|
882
|
+
sessionInfo: {
|
883
|
+
type: 'none',
|
884
|
+
key: USER_SESSION_STORAGE_KEYS.sessionInfo,
|
885
|
+
},
|
886
|
+
};
|
887
|
+
userSessionManager.init();
|
888
|
+
const actualSessionInfo = userSessionManager.getSessionInfo();
|
889
|
+
expect(actualSessionInfo).toStrictEqual(null);
|
890
|
+
});
|
891
|
+
});
|
892
|
+
|
893
|
+
describe('setAnonymousId', () => {
|
894
|
+
it('should set the provided anonymous ID', () => {
|
895
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
896
|
+
const newAnonymousId = 'new-dummy-anonymous-id';
|
897
|
+
userSessionManager.init();
|
898
|
+
userSessionManager.setAnonymousId(newAnonymousId);
|
899
|
+
expect(state.session.anonymousId.value).toBe(newAnonymousId);
|
900
|
+
});
|
901
|
+
|
902
|
+
it('should reset the value to default value if persistence is not enabled for anonymous ID', () => {
|
903
|
+
state.storage.entries.value = {
|
904
|
+
...entriesWithOnlyCookieStorage,
|
905
|
+
anonymousId: {
|
906
|
+
type: 'none',
|
907
|
+
key: USER_SESSION_STORAGE_KEYS.anonymousId,
|
908
|
+
},
|
909
|
+
};
|
910
|
+
userSessionManager.init();
|
911
|
+
userSessionManager.setAnonymousId(dummyAnonymousId);
|
912
|
+
expect(state.session.anonymousId.value).toBe(DEFAULT_USER_SESSION_VALUES.anonymousId);
|
913
|
+
});
|
914
|
+
|
915
|
+
it('should generate a new anonymous ID if the value is not provided', () => {
|
916
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
917
|
+
userSessionManager.init();
|
918
|
+
userSessionManager.setAnonymousId();
|
919
|
+
expect(state.session.anonymousId.value).toBe('test_uuid');
|
920
|
+
});
|
921
|
+
|
922
|
+
// TODO: Add a new TC for Google Linker parameters
|
923
|
+
});
|
924
|
+
|
925
|
+
describe('setUserId', () => {
|
926
|
+
it('should set the provided user ID', () => {
|
927
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
928
|
+
clientDataStoreCookie.set = jest.fn();
|
929
|
+
const newUserId = 'new-dummy-user-id';
|
930
|
+
userSessionManager.init();
|
931
|
+
userSessionManager.setUserId(newUserId);
|
932
|
+
expect(state.session.userId.value).toBe(newUserId);
|
933
|
+
});
|
934
|
+
|
935
|
+
it('should reset the value to default value if persistence is not enabled for user ID', () => {
|
936
|
+
state.storage.entries.value = {
|
937
|
+
...entriesWithOnlyCookieStorage,
|
938
|
+
userId: {
|
939
|
+
type: 'none',
|
940
|
+
key: USER_SESSION_STORAGE_KEYS.userId,
|
941
|
+
},
|
942
|
+
};
|
943
|
+
userSessionManager.init();
|
944
|
+
userSessionManager.setUserId('dummy-user-id');
|
945
|
+
expect(state.session.userId.value).toBe(DEFAULT_USER_SESSION_VALUES.userId);
|
946
|
+
});
|
947
|
+
|
948
|
+
it('should reset the value to default value if the value is not provided', () => {
|
949
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
950
|
+
userSessionManager.init();
|
951
|
+
userSessionManager.setUserId();
|
952
|
+
expect(state.session.userId.value).toBe(DEFAULT_USER_SESSION_VALUES.userId);
|
953
|
+
});
|
954
|
+
});
|
955
|
+
|
956
|
+
describe('setUserTraits', () => {
|
957
|
+
it('should set the provided user traits', () => {
|
958
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
959
|
+
clientDataStoreCookie.set = jest.fn();
|
960
|
+
const newUserTraits = { key1: 'value1', key2: 'value2' };
|
961
|
+
userSessionManager.init();
|
962
|
+
userSessionManager.setUserTraits(newUserTraits);
|
963
|
+
expect(state.session.userTraits.value).toStrictEqual(newUserTraits);
|
964
|
+
});
|
965
|
+
|
966
|
+
it('should reset the value to default value if persistence is not enabled for user traits', () => {
|
967
|
+
state.storage.entries.value = {
|
968
|
+
...entriesWithOnlyCookieStorage,
|
969
|
+
userTraits: {
|
970
|
+
type: 'none',
|
971
|
+
key: USER_SESSION_STORAGE_KEYS.userTraits,
|
972
|
+
},
|
973
|
+
};
|
974
|
+
userSessionManager.init();
|
975
|
+
userSessionManager.setUserTraits({ key1: 'value1', key2: 'value2' });
|
976
|
+
expect(state.session.userTraits.value).toStrictEqual(DEFAULT_USER_SESSION_VALUES.userTraits);
|
977
|
+
});
|
978
|
+
|
979
|
+
it('should reset the value to default value if the value is not provided', () => {
|
980
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
981
|
+
userSessionManager.init();
|
982
|
+
userSessionManager.setUserTraits();
|
983
|
+
expect(state.session.userTraits.value).toStrictEqual(DEFAULT_USER_SESSION_VALUES.userTraits);
|
984
|
+
});
|
985
|
+
});
|
986
|
+
|
987
|
+
describe('setGroupId', () => {
|
988
|
+
it('should set the provided group id', () => {
|
989
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
990
|
+
clientDataStoreCookie.set = jest.fn();
|
991
|
+
const newGroupId = 'new-dummy-group-id';
|
992
|
+
userSessionManager.init();
|
993
|
+
userSessionManager.setGroupId(newGroupId);
|
994
|
+
expect(state.session.groupId.value).toBe(newGroupId);
|
995
|
+
expect(clientDataStoreCookie.set).toHaveBeenCalled();
|
996
|
+
});
|
997
|
+
|
998
|
+
it('should reset the value to default value if persistence is not enabled for group id', () => {
|
999
|
+
state.storage.entries.value = {
|
1000
|
+
...entriesWithOnlyCookieStorage,
|
1001
|
+
groupId: {
|
1002
|
+
type: 'none',
|
1003
|
+
key: USER_SESSION_STORAGE_KEYS.groupId,
|
1004
|
+
},
|
1005
|
+
};
|
1006
|
+
userSessionManager.init();
|
1007
|
+
userSessionManager.setGroupId('dummy-group-id');
|
1008
|
+
expect(state.session.groupId.value).toBe(DEFAULT_USER_SESSION_VALUES.groupId);
|
1009
|
+
});
|
1010
|
+
|
1011
|
+
it('should reset the value to default value if the value is not provided', () => {
|
1012
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1013
|
+
userSessionManager.init();
|
1014
|
+
userSessionManager.setGroupId();
|
1015
|
+
expect(state.session.groupId.value).toBe(DEFAULT_USER_SESSION_VALUES.groupId);
|
1016
|
+
});
|
1017
|
+
});
|
1018
|
+
|
1019
|
+
describe('setGroupTraits', () => {
|
1020
|
+
it('should set the provided group traits', () => {
|
1021
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1022
|
+
clientDataStoreCookie.set = jest.fn();
|
1023
|
+
const newGroupTraits = { key1: 'value1', key2: 'value2' };
|
1024
|
+
userSessionManager.init();
|
1025
|
+
userSessionManager.setGroupTraits(newGroupTraits);
|
1026
|
+
expect(state.session.groupTraits.value).toStrictEqual(newGroupTraits);
|
1027
|
+
});
|
1028
|
+
|
1029
|
+
it('should reset the value to default value if persistence is not enabled for group traits', () => {
|
1030
|
+
state.storage.entries.value = {
|
1031
|
+
...entriesWithOnlyCookieStorage,
|
1032
|
+
groupTraits: {
|
1033
|
+
type: 'none',
|
1034
|
+
key: USER_SESSION_STORAGE_KEYS.groupTraits,
|
1035
|
+
},
|
1036
|
+
};
|
1037
|
+
userSessionManager.init();
|
1038
|
+
userSessionManager.setGroupTraits({ key1: 'value1', key2: 'value2' });
|
1039
|
+
expect(state.session.groupTraits.value).toStrictEqual(
|
1040
|
+
DEFAULT_USER_SESSION_VALUES.groupTraits,
|
1041
|
+
);
|
1042
|
+
});
|
1043
|
+
|
1044
|
+
it('should reset the value to default value if the value is not provided', () => {
|
1045
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1046
|
+
userSessionManager.init();
|
1047
|
+
userSessionManager.setGroupTraits();
|
1048
|
+
expect(state.session.groupTraits.value).toStrictEqual(
|
1049
|
+
DEFAULT_USER_SESSION_VALUES.groupTraits,
|
1050
|
+
);
|
1051
|
+
});
|
1052
|
+
});
|
1053
|
+
|
1054
|
+
describe('setInitialReferrer', () => {
|
1055
|
+
it('should set the provided initial referrer', () => {
|
1056
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1057
|
+
clientDataStoreCookie.set = jest.fn();
|
1058
|
+
const newReferrer = 'new-dummy-referrer-1';
|
1059
|
+
userSessionManager.init();
|
1060
|
+
userSessionManager.setInitialReferrer(newReferrer);
|
1061
|
+
expect(state.session.initialReferrer.value).toBe(newReferrer);
|
1062
|
+
});
|
1063
|
+
|
1064
|
+
it('should reset the value to default value if persistence is not enabled for initial referrer', () => {
|
1065
|
+
state.storage.entries.value = {
|
1066
|
+
...entriesWithOnlyCookieStorage,
|
1067
|
+
initialReferrer: {
|
1068
|
+
type: 'none',
|
1069
|
+
key: USER_SESSION_STORAGE_KEYS.initialReferrer,
|
1070
|
+
},
|
1071
|
+
};
|
1072
|
+
userSessionManager.init();
|
1073
|
+
userSessionManager.setInitialReferrer('dummy-url');
|
1074
|
+
expect(state.session.initialReferrer.value).toBe(DEFAULT_USER_SESSION_VALUES.initialReferrer);
|
1075
|
+
});
|
1076
|
+
|
1077
|
+
it('should reset the value to default value if the value is not provided', () => {
|
1078
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1079
|
+
userSessionManager.init();
|
1080
|
+
userSessionManager.setInitialReferrer();
|
1081
|
+
expect(state.session.initialReferrer.value).toBe(DEFAULT_USER_SESSION_VALUES.initialReferrer);
|
1082
|
+
});
|
1083
|
+
});
|
1084
|
+
|
1085
|
+
describe('setInitialReferringDomain', () => {
|
1086
|
+
it('should set the provided initial referring domain', () => {
|
1087
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1088
|
+
clientDataStoreCookie.set = jest.fn();
|
1089
|
+
const newReferrer = 'new-dummy-referrer-2';
|
1090
|
+
userSessionManager.init();
|
1091
|
+
userSessionManager.setInitialReferringDomain(newReferrer);
|
1092
|
+
expect(state.session.initialReferringDomain.value).toBe(newReferrer);
|
1093
|
+
expect(clientDataStoreCookie.set).toHaveBeenCalled();
|
1094
|
+
});
|
1095
|
+
|
1096
|
+
it('should reset the value to default value if persistence is not enabled for initial referring domain', () => {
|
1097
|
+
state.storage.entries.value = {
|
1098
|
+
...entriesWithOnlyCookieStorage,
|
1099
|
+
initialReferringDomain: {
|
1100
|
+
type: 'none',
|
1101
|
+
key: USER_SESSION_STORAGE_KEYS.initialReferringDomain,
|
1102
|
+
},
|
1103
|
+
};
|
1104
|
+
userSessionManager.init();
|
1105
|
+
userSessionManager.setInitialReferringDomain('dummy-url');
|
1106
|
+
expect(state.session.initialReferringDomain.value).toBe(
|
1107
|
+
DEFAULT_USER_SESSION_VALUES.initialReferringDomain,
|
1108
|
+
);
|
1109
|
+
});
|
1110
|
+
|
1111
|
+
it('should reset the value to default value if the value is not provided', () => {
|
1112
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1113
|
+
userSessionManager.init();
|
1114
|
+
userSessionManager.setInitialReferringDomain();
|
1115
|
+
expect(state.session.initialReferringDomain.value).toBe(
|
1116
|
+
DEFAULT_USER_SESSION_VALUES.initialReferringDomain,
|
1117
|
+
);
|
1118
|
+
});
|
1119
|
+
});
|
1120
|
+
|
1121
|
+
describe('setAuthToken', () => {
|
1122
|
+
it('should set the provided auth token', () => {
|
1123
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1124
|
+
clientDataStoreCookie.set = jest.fn();
|
1125
|
+
const newAuthToken = 'new-dummy-auth-token';
|
1126
|
+
userSessionManager.init();
|
1127
|
+
userSessionManager.setAuthToken(newAuthToken);
|
1128
|
+
expect(state.session.authToken.value).toBe(newAuthToken);
|
1129
|
+
});
|
1130
|
+
|
1131
|
+
it('should reset the value to default value if persistence is not enabled for auth token', () => {
|
1132
|
+
state.storage.entries.value = {
|
1133
|
+
...entriesWithOnlyCookieStorage,
|
1134
|
+
authToken: {
|
1135
|
+
type: 'none',
|
1136
|
+
key: USER_SESSION_STORAGE_KEYS.authToken,
|
1137
|
+
},
|
1138
|
+
};
|
1139
|
+
userSessionManager.init();
|
1140
|
+
userSessionManager.setAuthToken('dummy-auth-token');
|
1141
|
+
expect(state.session.authToken.value).toBe(DEFAULT_USER_SESSION_VALUES.authToken);
|
1142
|
+
});
|
1143
|
+
|
1144
|
+
it('should reset the value to default value if the value is not provided', () => {
|
1145
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1146
|
+
userSessionManager.init();
|
1147
|
+
userSessionManager.setAuthToken();
|
1148
|
+
expect(state.session.authToken.value).toBe(DEFAULT_USER_SESSION_VALUES.authToken);
|
1149
|
+
});
|
1150
|
+
});
|
1151
|
+
|
1152
|
+
describe('refreshSession', () => {
|
1153
|
+
it('refreshSession: should return empty object if any type of tracking is not enabled', () => {
|
1154
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1155
|
+
userSessionManager.init();
|
1156
|
+
state.session.sessionInfo.value = {};
|
1157
|
+
userSessionManager.refreshSession();
|
1158
|
+
expect(state.session.sessionInfo.value).toStrictEqual({});
|
1159
|
+
});
|
1160
|
+
|
1161
|
+
it('refreshSession: should return session id and sessionStart when auto tracking is enabled', () => {
|
1162
|
+
const futureTimestamp = Date.now() + 5000;
|
1163
|
+
state.session.sessionInfo.value = {
|
1164
|
+
autoTrack: true,
|
1165
|
+
timeout: 10 * 60 * 1000,
|
1166
|
+
expiresAt: futureTimestamp,
|
1167
|
+
id: 1683613729115,
|
1168
|
+
sessionStart: true,
|
1169
|
+
};
|
1170
|
+
userSessionManager.refreshSession();
|
1171
|
+
expect(state.session.sessionInfo.value).toEqual({
|
1172
|
+
autoTrack: true,
|
1173
|
+
timeout: 10 * 60 * 1000,
|
1174
|
+
expiresAt: expect.any(Number),
|
1175
|
+
id: 1683613729115,
|
1176
|
+
sessionStart: false,
|
1177
|
+
});
|
1178
|
+
});
|
1179
|
+
|
1180
|
+
it('refreshSession: should return session id and sessionStart when manual tracking is enabled', () => {
|
1181
|
+
const manualTrackingSessionId = 1029384756;
|
1182
|
+
userSessionManager.init();
|
1183
|
+
userSessionManager.start(manualTrackingSessionId);
|
1184
|
+
userSessionManager.refreshSession();
|
1185
|
+
expect(state.session.sessionInfo.value).toEqual({
|
1186
|
+
id: manualTrackingSessionId,
|
1187
|
+
sessionStart: true,
|
1188
|
+
manualTrack: true,
|
1189
|
+
});
|
1190
|
+
});
|
1191
|
+
|
1192
|
+
it('refreshSession: should generate new session id and sessionStart and return when auto tracking session is expired', () => {
|
1193
|
+
userSessionManager.init();
|
1194
|
+
const pastTimestamp = Date.now() - 5000;
|
1195
|
+
state.session.sessionInfo.value = {
|
1196
|
+
autoTrack: true,
|
1197
|
+
timeout: 10 * 60 * 1000,
|
1198
|
+
expiresAt: pastTimestamp,
|
1199
|
+
id: 1683613729115,
|
1200
|
+
sessionStart: false,
|
1201
|
+
};
|
1202
|
+
userSessionManager.refreshSession();
|
1203
|
+
expect(state.session.sessionInfo.value).toEqual({
|
1204
|
+
autoTrack: true,
|
1205
|
+
timeout: 10 * 60 * 1000,
|
1206
|
+
id: expect.any(Number),
|
1207
|
+
expiresAt: expect.any(Number),
|
1208
|
+
sessionStart: true,
|
1209
|
+
});
|
1210
|
+
});
|
1211
|
+
|
1212
|
+
it('refreshSession: should return only session id from the second event of the auto session tracking', () => {
|
1213
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1214
|
+
userSessionManager.init();
|
1215
|
+
userSessionManager.refreshSession(); // sessionInfo For First Event
|
1216
|
+
userSessionManager.refreshSession();
|
1217
|
+
expect(state.session.sessionInfo.value.sessionStart).toBe(false);
|
1218
|
+
});
|
1219
|
+
|
1220
|
+
it('refreshSession: should return only session id from the second event of the manual session tracking', () => {
|
1221
|
+
const manualTrackingSessionId = 1029384756;
|
1222
|
+
userSessionManager.start(manualTrackingSessionId);
|
1223
|
+
userSessionManager.refreshSession(); // sessionInfo For First Event
|
1224
|
+
userSessionManager.refreshSession();
|
1225
|
+
expect(state.session.sessionInfo.value.sessionStart).toBe(false);
|
1226
|
+
});
|
1227
|
+
});
|
1228
|
+
|
1229
|
+
describe('getSessionId', () => {
|
1230
|
+
it('getSessionId: should return session id for active session', () => {
|
1231
|
+
const futureTimestamp = Date.now() + 10000;
|
1232
|
+
state.session.sessionInfo.value = {
|
1233
|
+
autoTrack: true,
|
1234
|
+
timeout: 10 * 60 * 1000,
|
1235
|
+
expiresAt: futureTimestamp,
|
1236
|
+
id: 1683613729115,
|
1237
|
+
sessionStart: false,
|
1238
|
+
};
|
1239
|
+
const sessionId = userSessionManager.getSessionId();
|
1240
|
+
expect(typeof sessionId).toBe('number');
|
1241
|
+
expect(sessionId.toString().length).toBeGreaterThan(0);
|
1242
|
+
});
|
1243
|
+
|
1244
|
+
it('getSessionId: should return session id for active session', () => {
|
1245
|
+
const pastTimestamp = Date.now() - 5000;
|
1246
|
+
state.session.sessionInfo.value = {
|
1247
|
+
autoTrack: true,
|
1248
|
+
timeout: 10 * 60 * 1000,
|
1249
|
+
expiresAt: pastTimestamp,
|
1250
|
+
id: 1683613729115,
|
1251
|
+
sessionStart: false,
|
1252
|
+
};
|
1253
|
+
const sessionId = userSessionManager.getSessionId();
|
1254
|
+
expect(typeof sessionId).toBe('object');
|
1255
|
+
expect(sessionId).toBe(null);
|
1256
|
+
});
|
1257
|
+
});
|
1258
|
+
|
1259
|
+
describe('auto tracking', () => {
|
1260
|
+
it('startAutoTracking: should create a new session in case of invalid session', () => {
|
1261
|
+
userSessionManager.init();
|
1262
|
+
state.session.sessionInfo.value = {
|
1263
|
+
autoTrack: true,
|
1264
|
+
timeout: 10 * 60 * 1000,
|
1265
|
+
expiresAt: Date.now() - 1000,
|
1266
|
+
id: 1683613729115,
|
1267
|
+
sessionStart: false,
|
1268
|
+
};
|
1269
|
+
userSessionManager.startOrRenewAutoTracking();
|
1270
|
+
expect(state.session.sessionInfo.value).toEqual({
|
1271
|
+
autoTrack: true,
|
1272
|
+
timeout: 10 * 60 * 1000,
|
1273
|
+
expiresAt: expect.any(Number),
|
1274
|
+
id: expect.any(Number),
|
1275
|
+
sessionStart: undefined,
|
1276
|
+
});
|
1277
|
+
});
|
1278
|
+
|
1279
|
+
it('startAutoTracking: should not create a new session in case of valid session', () => {
|
1280
|
+
userSessionManager.init();
|
1281
|
+
state.session.sessionInfo.value = {
|
1282
|
+
autoTrack: true,
|
1283
|
+
timeout: 10 * 60 * 1000,
|
1284
|
+
expiresAt: Date.now() + 30 * 1000,
|
1285
|
+
id: 1683613729115,
|
1286
|
+
sessionStart: false,
|
1287
|
+
};
|
1288
|
+
userSessionManager.startOrRenewAutoTracking();
|
1289
|
+
expect(state.session.sessionInfo.value).toEqual({
|
1290
|
+
autoTrack: true,
|
1291
|
+
timeout: 10 * 60 * 1000,
|
1292
|
+
expiresAt: expect.any(Number),
|
1293
|
+
id: 1683613729115,
|
1294
|
+
sessionStart: false,
|
1295
|
+
});
|
1296
|
+
});
|
1297
|
+
});
|
1298
|
+
|
1299
|
+
describe('manual tracking', () => {
|
1300
|
+
it('startManualTracking: should create a new manual session', () => {
|
1301
|
+
const manualTrackingSessionId = 1029384756;
|
1302
|
+
userSessionManager.init();
|
1303
|
+
userSessionManager.start(manualTrackingSessionId);
|
1304
|
+
expect(state.session.sessionInfo.value).toEqual({
|
1305
|
+
manualTrack: true,
|
1306
|
+
id: manualTrackingSessionId,
|
1307
|
+
sessionStart: undefined,
|
1308
|
+
});
|
1309
|
+
});
|
1310
|
+
|
1311
|
+
it('startManualTracking: should create a new manual session even id session id is not provided', () => {
|
1312
|
+
userSessionManager.init();
|
1313
|
+
userSessionManager.start();
|
1314
|
+
expect(state.session.sessionInfo.value).toEqual({
|
1315
|
+
manualTrack: true,
|
1316
|
+
id: expect.any(Number),
|
1317
|
+
sessionStart: undefined,
|
1318
|
+
});
|
1319
|
+
});
|
1320
|
+
|
1321
|
+
it('endSessionTracking: should clear session info', () => {
|
1322
|
+
userSessionManager.init();
|
1323
|
+
userSessionManager.end();
|
1324
|
+
expect(state.session.sessionInfo.value).toEqual({});
|
1325
|
+
});
|
1326
|
+
});
|
1327
|
+
|
1328
|
+
describe('reset', () => {
|
1329
|
+
it('should reset user session to the initial value except anonymousId', () => {
|
1330
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1331
|
+
userSessionManager.init();
|
1332
|
+
userSessionManager.setAnonymousId(dummyAnonymousId);
|
1333
|
+
const sessionInfoBeforeReset = JSON.parse(JSON.stringify(state.session.sessionInfo.value));
|
1334
|
+
userSessionManager.reset();
|
1335
|
+
expect(state.session.userId.value).toEqual('');
|
1336
|
+
expect(state.session.userTraits.value).toEqual({});
|
1337
|
+
expect(state.session.groupId.value).toEqual('');
|
1338
|
+
expect(state.session.groupTraits.value).toEqual({});
|
1339
|
+
expect(state.session.anonymousId.value).toEqual(dummyAnonymousId);
|
1340
|
+
// new session will be generated
|
1341
|
+
expect(state.session.sessionInfo.value.autoTrack).toBe(sessionInfoBeforeReset.autoTrack);
|
1342
|
+
expect(state.session.sessionInfo.value.timeout).toBe(sessionInfoBeforeReset.timeout);
|
1343
|
+
expect(state.session.sessionInfo.value.expiresAt).not.toBe(sessionInfoBeforeReset.expiresAt);
|
1344
|
+
expect(state.session.sessionInfo.value.id).not.toBe(sessionInfoBeforeReset.id);
|
1345
|
+
expect(state.session.sessionInfo.value.sessionStart).toBe(undefined);
|
1346
|
+
});
|
1347
|
+
|
1348
|
+
it('should clear the existing anonymousId and set a new anonymousId with first parameter set to true', () => {
|
1349
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1350
|
+
userSessionManager.init();
|
1351
|
+
userSessionManager.setAnonymousId(dummyAnonymousId);
|
1352
|
+
userSessionManager.reset(true);
|
1353
|
+
expect(state.session.anonymousId.value).toEqual('test_uuid');
|
1354
|
+
});
|
1355
|
+
|
1356
|
+
it('should clear anonymousId and set default value in case of storage type is no_storage', () => {
|
1357
|
+
state.storage.entries.value = anonymousIdWithNoStorageEntries;
|
1358
|
+
userSessionManager.init();
|
1359
|
+
userSessionManager.setAnonymousId(dummyAnonymousId);
|
1360
|
+
userSessionManager.reset(true);
|
1361
|
+
expect(state.session.anonymousId.value).toEqual('');
|
1362
|
+
});
|
1363
|
+
|
1364
|
+
it('should not start a new session with second parameter set to true', () => {
|
1365
|
+
state.storage.entries.value = entriesWithOnlyCookieStorage;
|
1366
|
+
userSessionManager.init();
|
1367
|
+
const sessionInfoBeforeReset = JSON.parse(JSON.stringify(state.session.sessionInfo.value));
|
1368
|
+
userSessionManager.reset(true, true);
|
1369
|
+
expect(state.session.sessionInfo.value).toEqual(sessionInfoBeforeReset);
|
1370
|
+
});
|
1371
|
+
});
|
1372
|
+
|
1373
|
+
describe('getExternalAnonymousIdByCookieName', () => {
|
1374
|
+
it('Should return null if the cookie value does not exists', () => {
|
1375
|
+
const externalAnonymousId =
|
1376
|
+
userSessionManager.getExternalAnonymousIdByCookieName('anonId_cookie');
|
1377
|
+
expect(externalAnonymousId).toEqual(null);
|
1378
|
+
});
|
1379
|
+
it('Should return the cookie value if exists', () => {
|
1380
|
+
document.cookie = 'anonId_cookie=sampleAnonymousId12345';
|
1381
|
+
const externalAnonymousId =
|
1382
|
+
userSessionManager.getExternalAnonymousIdByCookieName('anonId_cookie');
|
1383
|
+
expect(externalAnonymousId).toEqual('sampleAnonymousId12345');
|
1384
|
+
});
|
1385
|
+
});
|
1386
|
+
});
|